diff --git a/src/modules/audio/Audio.cpp b/src/modules/audio/Audio.cpp index b3be99364..eb12a5982 100644 --- a/src/modules/audio/Audio.cpp +++ b/src/modules/audio/Audio.cpp @@ -13,18 +13,34 @@ * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. - * 2. Altered Audio versions must be plainly marked as such, and must not be + * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. - * 3. This notice may not be removed or altered from any Audio distribution. + * 3. This notice may not be removed or altered from any source distribution. **/ #include "Audio.h" +#include "common/config.h" + +#ifdef LOVE_IOS +#include "common/ios.h" +#endif namespace love { namespace audio { +bool Audio::setMixWithSystem(bool mix) +{ +#ifdef LOVE_IOS + love::ios::setAudioMixWithOthers(mix); + return true; +#else + LOVE_UNUSED(mix); + return false; +#endif +} + StringMap::Entry Audio::distanceModelEntries[] = { {"none", Audio::DISTANCE_NONE}, diff --git a/src/modules/audio/Audio.h b/src/modules/audio/Audio.h index 019908ddc..a20406d5f 100644 --- a/src/modules/audio/Audio.h +++ b/src/modules/audio/Audio.h @@ -9,7 +9,7 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented = 0; you must not + * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. @@ -256,6 +256,12 @@ public: */ virtual bool isEFXsupported() const = 0; + /** + * Sets whether audio from other apps mixes with love.audio or is muted, + * on supported platforms. + **/ + bool setMixWithSystem(bool mix); + private: static StringMap::Entry distanceModelEntries[]; diff --git a/src/modules/audio/Effect.cpp b/src/modules/audio/Effect.cpp index 93214e074..420fc19a8 100644 --- a/src/modules/audio/Effect.cpp +++ b/src/modules/audio/Effect.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2016 LOVE Development Team + * Copyright (c) 2006-2017 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/src/modules/audio/Effect.h b/src/modules/audio/Effect.h index 6204d319f..4bc3f5e3a 100644 --- a/src/modules/audio/Effect.h +++ b/src/modules/audio/Effect.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2016 LOVE Development Team + * Copyright (c) 2006-2017 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/src/modules/audio/RecordingDevice.h b/src/modules/audio/RecordingDevice.h index 1cf4ba180..0158c4363 100644 --- a/src/modules/audio/RecordingDevice.h +++ b/src/modules/audio/RecordingDevice.h @@ -9,7 +9,7 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented = 0; you must not + * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. diff --git a/src/modules/audio/null/RecordingDevice.cpp b/src/modules/audio/null/RecordingDevice.cpp index bee6c0cc3..7d86df957 100644 --- a/src/modules/audio/null/RecordingDevice.cpp +++ b/src/modules/audio/null/RecordingDevice.cpp @@ -9,7 +9,7 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented = 0; you must not + * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. diff --git a/src/modules/audio/null/RecordingDevice.h b/src/modules/audio/null/RecordingDevice.h index c138086b6..9ed7759bb 100644 --- a/src/modules/audio/null/RecordingDevice.h +++ b/src/modules/audio/null/RecordingDevice.h @@ -9,7 +9,7 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented = 0; you must not + * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. diff --git a/src/modules/audio/openal/RecordingDevice.cpp b/src/modules/audio/openal/RecordingDevice.cpp index 8482ad320..b68754f6b 100644 --- a/src/modules/audio/openal/RecordingDevice.cpp +++ b/src/modules/audio/openal/RecordingDevice.cpp @@ -9,7 +9,7 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented = 0; you must not + * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. diff --git a/src/modules/audio/openal/RecordingDevice.h b/src/modules/audio/openal/RecordingDevice.h index de9f0e5d5..427fd21ab 100644 --- a/src/modules/audio/openal/RecordingDevice.h +++ b/src/modules/audio/openal/RecordingDevice.h @@ -9,7 +9,7 @@ * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * - * 1. The origin of this software must not be misrepresented = 0; you must not + * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. diff --git a/src/modules/audio/wrap_Audio.cpp b/src/modules/audio/wrap_Audio.cpp index 1fda94516..395b179b1 100644 --- a/src/modules/audio/wrap_Audio.cpp +++ b/src/modules/audio/wrap_Audio.cpp @@ -25,9 +25,6 @@ #include "null/Audio.h" #include "common/runtime.h" -#ifdef LOVE_IOS -#include "common/ios.h" -#endif // C++ #include @@ -521,15 +518,10 @@ int w_isEffectsSupported(lua_State *L) return 1; } -#ifdef LOVE_IOS -int w_setMixMode(lua_State *L) +int w_setMixWithSystem(lua_State *L) { - love::ios::setAudioMixWithOthers(lua_toboolean(L, 1)); -#else -int w_setMixMode(lua_State *) -{ -#endif - return 0; + luax_pushboolean(L, instance()->setMixWithSystem(luax_toboolean(L, 1))); + return 1; } // List of functions to wrap. @@ -562,7 +554,7 @@ static const luaL_Reg functions[] = { "getMaxSceneEffects", w_getMaxSceneEffects }, { "getMaxSourceEffects", w_getMaxSourceEffects }, { "isEffectsSupported", w_isEffectsSupported }, - { "setMixMode", w_setMixMode }, + { "setMixWithSystem", w_setMixWithSystem }, { 0, 0 } }; diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 8025cb129..f6b16cf22 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -496,7 +496,7 @@ function love.init() end if love.audio then - love.audio.setMixMode(c.audio.mixwithsystem) + love.audio.setMixWithSystem(c.audio.mixwithsystem) end -- Our first timestep, because window creation can take some time diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index b474b2156..104879a3b 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -921,8 +921,8 @@ const unsigned char boot_lua[] = 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, 0x77, - 0x69, 0x74, 0x68, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x29, 0x0a, + 0x78, 0x57, 0x69, 0x74, 0x68, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x28, 0x63, 0x2e, 0x61, 0x75, 0x64, 0x69, + 0x6f, 0x2e, 0x6d, 0x69, 0x78, 0x77, 0x69, 0x74, 0x68, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 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,