ソースを参照

Rename love.audio.setMixMode to setMixWithSystem. Fix some copyright notice typos.

--HG--
branch : minor
Alex Szpakowski 8 年 前
コミット
02aa7937a1

+ 18 - 2
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<Audio::DistanceModel, Audio::DISTANCE_MAX_ENUM>::Entry Audio::distanceModelEntries[] =
 {
 	{"none", Audio::DISTANCE_NONE},

+ 7 - 1
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<DistanceModel, DISTANCE_MAX_ENUM>::Entry distanceModelEntries[];

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 1 - 1
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.

+ 4 - 12
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 <iostream>
@@ -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 }
 };
 

+ 1 - 1
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

+ 2 - 2
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,