mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Move setMixMode to love.audio
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
CEEB36EA1EE21DB90085BD77 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEEB36E91EE21DB90085BD77 /* AVFoundation.framework */; };
|
||||
FA0B791B1A958E3B000E1D17 /* b64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78F71A958E3B000E1D17 /* b64.cpp */; };
|
||||
FA0B791C1A958E3B000E1D17 /* b64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FA0B78F71A958E3B000E1D17 /* b64.cpp */; };
|
||||
FA0B791D1A958E3B000E1D17 /* b64.h in Headers */ = {isa = PBXBuildFile; fileRef = FA0B78F81A958E3B000E1D17 /* b64.h */; };
|
||||
@@ -919,7 +918,6 @@
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
503971A86B7167A91B670FBA /* boot.lua.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = boot.lua.h; sourceTree = "<group>"; };
|
||||
CEEB36E91EE21DB90085BD77 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
|
||||
FA08F5AE16C7525600F007B5 /* liblove-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "liblove-macosx.plist"; path = "macosx/liblove-macosx.plist"; sourceTree = "<group>"; };
|
||||
FA0B78DD1A958B90000E1D17 /* liblove.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblove.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FA0B78F71A958E3B000E1D17 /* b64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = b64.cpp; sourceTree = "<group>"; };
|
||||
@@ -1599,7 +1597,6 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CEEB36EA1EE21DB90085BD77 /* AVFoundation.framework in Frameworks */,
|
||||
FA27B3C91B498623008A9DCE /* Theora.framework in Frameworks */,
|
||||
FA317EBA18F28B6D00B0BCD7 /* libz.dylib in Frameworks */,
|
||||
FAA627CE18E7E1560080752D /* CoreServices.framework in Frameworks */,
|
||||
@@ -2827,7 +2824,6 @@
|
||||
FA577A6616C7199700860150 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CEEB36E91EE21DB90085BD77 /* AVFoundation.framework */,
|
||||
FA0B7EEB1A959125000E1D17 /* macosx */,
|
||||
);
|
||||
name = Frameworks;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
A9D307F2106635D3004FEDF8 /* physfs.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9D307E9106635C3004FEDF8 /* physfs.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F169A6109E824900FC83D1 /* mpg123.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F16926109E7BAD00FC83D1 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
CE73F8001EEB64150052DAB3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */; };
|
||||
FA0797991BF480A200034B7C /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA0797981BF480A200034B7C /* GameController.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
FA08F69616C766E000F007B5 /* love.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; };
|
||||
FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
@@ -110,6 +111,7 @@
|
||||
A9D307E9106635C3004FEDF8 /* physfs.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = physfs.framework; path = /Library/Frameworks/physfs.framework; sourceTree = "<absolute>"; };
|
||||
A9F16926109E7BAD00FC83D1 /* libmodplug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libmodplug.framework; path = /Library/Frameworks/libmodplug.framework; sourceTree = "<absolute>"; };
|
||||
A9F169A6109E824900FC83D1 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = "<absolute>"; };
|
||||
CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
FA0797981BF480A200034B7C /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk/System/Library/Frameworks/GameController.framework; sourceTree = DEVELOPER_DIR; };
|
||||
FA08F69116C765A200F007B5 /* love.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = love.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
FA0B7F061A95AAF3000E1D17 /* love.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = love.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
@@ -149,6 +151,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CE73F8001EEB64150052DAB3 /* AVFoundation.framework in Frameworks */,
|
||||
FA5D24D11A96E73300C6FC8F /* liblove.a in Frameworks */,
|
||||
FA5D24C21A96D78000C6FC8F /* Foundation.framework in Frameworks */,
|
||||
FA5D24961A96CAC200C6FC8F /* CoreMotion.framework in Frameworks */,
|
||||
@@ -169,6 +172,7 @@
|
||||
1058C7A0FEA54F0111CA2CBB /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */,
|
||||
FA5D24801A96C97900C6FC8F /* ios */,
|
||||
FA0B7EEC1A959249000E1D17 /* macosx */,
|
||||
);
|
||||
|
||||
+10
-12
@@ -349,25 +349,23 @@ void setAudioMixWithOthers(bool mixMode, bool playMuted)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
NSError* err;
|
||||
NSString *category = AVAudioSessionCategoryPlayback;
|
||||
AVAudioSessionCategoryOptions options = 0;
|
||||
NSError *err = nil;
|
||||
|
||||
if (mixMode)
|
||||
{
|
||||
if (playMuted)
|
||||
{
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:&err];
|
||||
}
|
||||
options = AVAudioSessionCategoryOptionMixWithOthers;
|
||||
else
|
||||
{
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:&err];
|
||||
}
|
||||
category = AVAudioSessionCategoryAmbient;
|
||||
}
|
||||
else
|
||||
else if (!playMuted)
|
||||
{
|
||||
if (playMuted)
|
||||
{
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&err];
|
||||
}
|
||||
category = AVAudioSessionCategorySoloAmbient;
|
||||
}
|
||||
|
||||
[[AVAudioSession sharedInstance] setCategory:category withOptions:options error:&err];
|
||||
if (err != nil)
|
||||
NSLog(@"Error in AVAudioSession setCategory: %@", [err localizedDescription]);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@
|
||||
#include "null/Audio.h"
|
||||
|
||||
#include "common/runtime.h"
|
||||
#ifdef LOVE_IOS
|
||||
#include "common/ios.h"
|
||||
#endif
|
||||
|
||||
// C++
|
||||
#include <iostream>
|
||||
@@ -294,6 +296,17 @@ int w_getDistanceModel(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef LOVE_IOS
|
||||
int w_setMixMode(lua_State *L)
|
||||
{
|
||||
love::ios::setAudioMixWithOthers(lua_toboolean(L, 1), lua_toboolean(L, 2));
|
||||
#else
|
||||
int w_setMixMode(lua_State *)
|
||||
{
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int w_getShouldBeSilenced(lua_State *L)
|
||||
{
|
||||
#ifdef LOVE_IOS
|
||||
@@ -329,6 +342,7 @@ static const luaL_Reg functions[] =
|
||||
{ "stopRecording", w_stopRecording },*/
|
||||
{ "setDistanceModel", w_setDistanceModel },
|
||||
{ "getDistanceModel", w_getDistanceModel },
|
||||
{ "setMixMode", w_setMixMode },
|
||||
{ "getShouldBeSilenced", w_getShouldBeSilenced },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "common/version.h"
|
||||
#include "common/runtime.h"
|
||||
#include "common/wrap_Data.h"
|
||||
#include "common/ios.h"
|
||||
|
||||
#include "love.h"
|
||||
|
||||
@@ -259,14 +258,6 @@ static int w__setGammaCorrect(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef LOVE_IOS
|
||||
static int w__setAudioMixMode(lua_State *L)
|
||||
{
|
||||
love::ios::setAudioMixWithOthers(lua_toboolean(L, 1), lua_toboolean(L, 2));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int luaopen_love(lua_State *L)
|
||||
{
|
||||
love::luax_insistpinnedthread(L);
|
||||
@@ -300,11 +291,6 @@ int luaopen_love(lua_State *L)
|
||||
lua_pushcfunction(L, w__setGammaCorrect);
|
||||
lua_setfield(L, -2, "_setGammaCorrect");
|
||||
|
||||
#ifdef LOVE_IOS
|
||||
lua_pushcfunction(L, w__setAudioMixMode);
|
||||
lua_setfield(L, -2, "_setAudioMixMode");
|
||||
#endif
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
for (int i = 0; love::VERSION_COMPATIBILITY[i] != nullptr; i++)
|
||||
|
||||
@@ -420,10 +420,6 @@ function love.init()
|
||||
love._setGammaCorrect(c.gammacorrect)
|
||||
end
|
||||
|
||||
if love._setAudioMixMode then
|
||||
love._setAudioMixMode(c.audio.mixmode, c.audio.playmuted)
|
||||
end
|
||||
|
||||
-- Gets desired modules.
|
||||
for k,v in ipairs{
|
||||
"thread",
|
||||
@@ -498,6 +494,10 @@ function love.init()
|
||||
end
|
||||
end
|
||||
|
||||
if love.audio then
|
||||
love.audio.setMixMode(c.audio.mixmode, c.audio.playmuted)
|
||||
end
|
||||
|
||||
-- Our first timestep, because window creation can take some time
|
||||
if love.timer then
|
||||
love.timer.step()
|
||||
|
||||
@@ -781,13 +781,6 @@ const unsigned char boot_lua[] =
|
||||
0x72, 0x72, 0x65, 0x63, 0x74, 0x28, 0x63, 0x2e, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x63, 0x6f, 0x72, 0x72, 0x65,
|
||||
0x63, 0x74, 0x29, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x5f, 0x73, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f,
|
||||
0x4d, 0x69, 0x78, 0x4d, 0x6f, 0x64, 0x65, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x5f, 0x73, 0x65, 0x74, 0x41, 0x75, 0x64, 0x69, 0x6f, 0x4d, 0x69,
|
||||
0x78, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x63, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x6d, 0x69, 0x78, 0x6d,
|
||||
0x6f, 0x64, 0x65, 0x2c, 0x20, 0x63, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x70, 0x6c, 0x61, 0x79, 0x6d,
|
||||
0x75, 0x74, 0x65, 0x64, 0x29, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x2d, 0x2d, 0x20, 0x47, 0x65, 0x74, 0x73, 0x20, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x20, 0x6d,
|
||||
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x2e, 0x0a,
|
||||
0x09, 0x66, 0x6f, 0x72, 0x20, 0x6b, 0x2c, 0x76, 0x20, 0x69, 0x6e, 0x20, 0x69, 0x70, 0x61, 0x69, 0x72, 0x73,
|
||||
@@ -918,6 +911,13 @@ const unsigned char boot_lua[] =
|
||||
0x77, 0x2e, 0x69, 0x63, 0x6f, 0x6e, 0x29, 0x29, 0x0a,
|
||||
0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x20, 0x74, 0x68, 0x65,
|
||||
0x6e, 0x0a,
|
||||
0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x73, 0x65, 0x74, 0x4d, 0x69,
|
||||
0x78, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x63, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x6d, 0x69, 0x78, 0x6d,
|
||||
0x6f, 0x64, 0x65, 0x2c, 0x20, 0x63, 0x2e, 0x61, 0x75, 0x64, 0x69, 0x6f, 0x2e, 0x70, 0x6c, 0x61, 0x79, 0x6d,
|
||||
0x75, 0x74, 0x65, 0x64, 0x29, 0x0a,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x0a,
|
||||
0x09, 0x2d, 0x2d, 0x20, 0x4f, 0x75, 0x72, 0x20, 0x66, 0x69, 0x72, 0x73, 0x74, 0x20, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x74, 0x65, 0x70, 0x2c, 0x20, 0x62, 0x65, 0x63, 0x61, 0x75, 0x73, 0x65, 0x20, 0x77, 0x69, 0x6e, 0x64,
|
||||
0x6f, 0x77, 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x74, 0x61,
|
||||
|
||||
Reference in New Issue
Block a user