OSDN Git Service

[fixed] issue 690, AudioTrack#setVolume. No stereo support due to OpenALs lack of...
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Thu, 2 Feb 2012 14:27:28 +0000 (14:27 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Thu, 2 Feb 2012 14:27:28 +0000 (14:27 +0000)
backends/gdx-backend-android/src/com/badlogic/gdx/backends/android/AndroidAudioDevice.java
backends/gdx-openal/src/com/badlogic/gdx/backends/openal/OpenALAudioDevice.java
gdx/src/com/badlogic/gdx/audio/AudioDevice.java

index aec6ea0..4e289c7 100644 (file)
@@ -88,4 +88,9 @@ class AndroidAudioDevice implements AudioDevice {
        public int getLatency () {\r
                return latency;\r
        }\r
+\r
+       @Override\r
+       public void setVolume (float volume) {\r
+               track.setStereoVolume(volume, volume);\r
+       }\r
 }\r
index 8c8036e..1b8be69 100644 (file)
@@ -185,7 +185,7 @@ public class OpenALAudioDevice implements AudioDevice {
        }\r
 \r
        public boolean isMono () {\r
-               return false;\r
+               return channels == 1;\r
        }\r
 \r
        public int getLatency () {\r
index b268bde..b495265 100644 (file)
@@ -47,4 +47,7 @@ public interface AudioDevice extends Disposable {
 \r
        /** Frees all resources associated with this AudioDevice. Needs to be called when the device is no longer needed. */\r
        public void dispose ();\r
+       \r
+       /** Sets the volume in the range [0,1]. */\r
+       public void setVolume(float volume);\r
 }\r