Loading media/java/android/media/AudioTrack.java +12 −12 Original line number Original line Diff line number Diff line Loading @@ -322,7 +322,7 @@ public class AudioTrack audioBuffSizeCheck(bufferSizeInBytes); audioBuffSizeCheck(bufferSizeInBytes); if (sessionId < 0) { if (sessionId < 0) { throw (new IllegalArgumentException("Invalid audio session ID: "+sessionId)); throw new IllegalArgumentException("Invalid audio session ID: "+sessionId); } } int[] session = new int[1]; int[] session = new int[1]; Loading Loading @@ -375,7 +375,7 @@ public class AudioTrack && (streamType != AudioManager.STREAM_NOTIFICATION) && (streamType != AudioManager.STREAM_NOTIFICATION) && (streamType != AudioManager.STREAM_BLUETOOTH_SCO) && (streamType != AudioManager.STREAM_BLUETOOTH_SCO) && (streamType != AudioManager.STREAM_DTMF)) { && (streamType != AudioManager.STREAM_DTMF)) { throw (new IllegalArgumentException("Invalid stream type.")); throw new IllegalArgumentException("Invalid stream type."); } else { } else { mStreamType = streamType; mStreamType = streamType; } } Loading @@ -383,8 +383,8 @@ public class AudioTrack //-------------- //-------------- // sample rate, note these values are subject to change // sample rate, note these values are subject to change if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) { if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) { throw (new IllegalArgumentException(sampleRateInHz throw new IllegalArgumentException(sampleRateInHz + "Hz is not a supported sample rate.")); + "Hz is not a supported sample rate."); } else { } else { mSampleRate = sampleRateInHz; mSampleRate = sampleRateInHz; } } Loading @@ -411,7 +411,7 @@ public class AudioTrack mChannelCount = 0; mChannelCount = 0; mChannels = AudioFormat.CHANNEL_INVALID; mChannels = AudioFormat.CHANNEL_INVALID; mChannelConfiguration = AudioFormat.CHANNEL_INVALID; mChannelConfiguration = AudioFormat.CHANNEL_INVALID; throw(new IllegalArgumentException("Unsupported channel configuration.")); throw new IllegalArgumentException("Unsupported channel configuration."); } else { } else { mChannels = channelConfig; mChannels = channelConfig; mChannelCount = Integer.bitCount(channelConfig); mChannelCount = Integer.bitCount(channelConfig); Loading @@ -430,14 +430,14 @@ public class AudioTrack break; break; default: default: mAudioFormat = AudioFormat.ENCODING_INVALID; mAudioFormat = AudioFormat.ENCODING_INVALID; throw(new IllegalArgumentException("Unsupported sample encoding." throw new IllegalArgumentException("Unsupported sample encoding." + " Should be ENCODING_PCM_8BIT or ENCODING_PCM_16BIT.")); + " Should be ENCODING_PCM_8BIT or ENCODING_PCM_16BIT."); } } //-------------- //-------------- // audio load mode // audio load mode if ( (mode != MODE_STREAM) && (mode != MODE_STATIC) ) { if ( (mode != MODE_STREAM) && (mode != MODE_STATIC) ) { throw(new IllegalArgumentException("Invalid mode.")); throw new IllegalArgumentException("Invalid mode."); } else { } else { mDataLoadMode = mode; mDataLoadMode = mode; } } Loading Loading @@ -487,7 +487,7 @@ public class AudioTrack int frameSizeInBytes = mChannelCount int frameSizeInBytes = mChannelCount * (mAudioFormat == AudioFormat.ENCODING_PCM_8BIT ? 1 : 2); * (mAudioFormat == AudioFormat.ENCODING_PCM_8BIT ? 1 : 2); if ((audioBufferSize % frameSizeInBytes != 0) || (audioBufferSize < 1)) { if ((audioBufferSize % frameSizeInBytes != 0) || (audioBufferSize < 1)) { throw (new IllegalArgumentException("Invalid audio buffer size.")); throw new IllegalArgumentException("Invalid audio buffer size."); } } mNativeBufferSizeInBytes = audioBufferSize; mNativeBufferSizeInBytes = audioBufferSize; Loading Loading @@ -894,7 +894,7 @@ public class AudioTrack public void play() public void play() throws IllegalStateException { throws IllegalStateException { if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) { throw(new IllegalStateException("play() called on uninitialized AudioTrack.")); throw new IllegalStateException("play() called on uninitialized AudioTrack."); } } synchronized(mPlayStateLock) { synchronized(mPlayStateLock) { Loading @@ -914,7 +914,7 @@ public class AudioTrack public void stop() public void stop() throws IllegalStateException { throws IllegalStateException { if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) { throw(new IllegalStateException("stop() called on uninitialized AudioTrack.")); throw new IllegalStateException("stop() called on uninitialized AudioTrack."); } } // stop playing // stop playing Loading @@ -934,7 +934,7 @@ public class AudioTrack public void pause() public void pause() throws IllegalStateException { throws IllegalStateException { if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) { throw(new IllegalStateException("pause() called on uninitialized AudioTrack.")); throw new IllegalStateException("pause() called on uninitialized AudioTrack."); } } //logd("pause()"); //logd("pause()"); Loading Loading
media/java/android/media/AudioTrack.java +12 −12 Original line number Original line Diff line number Diff line Loading @@ -322,7 +322,7 @@ public class AudioTrack audioBuffSizeCheck(bufferSizeInBytes); audioBuffSizeCheck(bufferSizeInBytes); if (sessionId < 0) { if (sessionId < 0) { throw (new IllegalArgumentException("Invalid audio session ID: "+sessionId)); throw new IllegalArgumentException("Invalid audio session ID: "+sessionId); } } int[] session = new int[1]; int[] session = new int[1]; Loading Loading @@ -375,7 +375,7 @@ public class AudioTrack && (streamType != AudioManager.STREAM_NOTIFICATION) && (streamType != AudioManager.STREAM_NOTIFICATION) && (streamType != AudioManager.STREAM_BLUETOOTH_SCO) && (streamType != AudioManager.STREAM_BLUETOOTH_SCO) && (streamType != AudioManager.STREAM_DTMF)) { && (streamType != AudioManager.STREAM_DTMF)) { throw (new IllegalArgumentException("Invalid stream type.")); throw new IllegalArgumentException("Invalid stream type."); } else { } else { mStreamType = streamType; mStreamType = streamType; } } Loading @@ -383,8 +383,8 @@ public class AudioTrack //-------------- //-------------- // sample rate, note these values are subject to change // sample rate, note these values are subject to change if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) { if ( (sampleRateInHz < 4000) || (sampleRateInHz > 48000) ) { throw (new IllegalArgumentException(sampleRateInHz throw new IllegalArgumentException(sampleRateInHz + "Hz is not a supported sample rate.")); + "Hz is not a supported sample rate."); } else { } else { mSampleRate = sampleRateInHz; mSampleRate = sampleRateInHz; } } Loading @@ -411,7 +411,7 @@ public class AudioTrack mChannelCount = 0; mChannelCount = 0; mChannels = AudioFormat.CHANNEL_INVALID; mChannels = AudioFormat.CHANNEL_INVALID; mChannelConfiguration = AudioFormat.CHANNEL_INVALID; mChannelConfiguration = AudioFormat.CHANNEL_INVALID; throw(new IllegalArgumentException("Unsupported channel configuration.")); throw new IllegalArgumentException("Unsupported channel configuration."); } else { } else { mChannels = channelConfig; mChannels = channelConfig; mChannelCount = Integer.bitCount(channelConfig); mChannelCount = Integer.bitCount(channelConfig); Loading @@ -430,14 +430,14 @@ public class AudioTrack break; break; default: default: mAudioFormat = AudioFormat.ENCODING_INVALID; mAudioFormat = AudioFormat.ENCODING_INVALID; throw(new IllegalArgumentException("Unsupported sample encoding." throw new IllegalArgumentException("Unsupported sample encoding." + " Should be ENCODING_PCM_8BIT or ENCODING_PCM_16BIT.")); + " Should be ENCODING_PCM_8BIT or ENCODING_PCM_16BIT."); } } //-------------- //-------------- // audio load mode // audio load mode if ( (mode != MODE_STREAM) && (mode != MODE_STATIC) ) { if ( (mode != MODE_STREAM) && (mode != MODE_STATIC) ) { throw(new IllegalArgumentException("Invalid mode.")); throw new IllegalArgumentException("Invalid mode."); } else { } else { mDataLoadMode = mode; mDataLoadMode = mode; } } Loading Loading @@ -487,7 +487,7 @@ public class AudioTrack int frameSizeInBytes = mChannelCount int frameSizeInBytes = mChannelCount * (mAudioFormat == AudioFormat.ENCODING_PCM_8BIT ? 1 : 2); * (mAudioFormat == AudioFormat.ENCODING_PCM_8BIT ? 1 : 2); if ((audioBufferSize % frameSizeInBytes != 0) || (audioBufferSize < 1)) { if ((audioBufferSize % frameSizeInBytes != 0) || (audioBufferSize < 1)) { throw (new IllegalArgumentException("Invalid audio buffer size.")); throw new IllegalArgumentException("Invalid audio buffer size."); } } mNativeBufferSizeInBytes = audioBufferSize; mNativeBufferSizeInBytes = audioBufferSize; Loading Loading @@ -894,7 +894,7 @@ public class AudioTrack public void play() public void play() throws IllegalStateException { throws IllegalStateException { if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) { throw(new IllegalStateException("play() called on uninitialized AudioTrack.")); throw new IllegalStateException("play() called on uninitialized AudioTrack."); } } synchronized(mPlayStateLock) { synchronized(mPlayStateLock) { Loading @@ -914,7 +914,7 @@ public class AudioTrack public void stop() public void stop() throws IllegalStateException { throws IllegalStateException { if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) { throw(new IllegalStateException("stop() called on uninitialized AudioTrack.")); throw new IllegalStateException("stop() called on uninitialized AudioTrack."); } } // stop playing // stop playing Loading @@ -934,7 +934,7 @@ public class AudioTrack public void pause() public void pause() throws IllegalStateException { throws IllegalStateException { if (mState != STATE_INITIALIZED) { if (mState != STATE_INITIALIZED) { throw(new IllegalStateException("pause() called on uninitialized AudioTrack.")); throw new IllegalStateException("pause() called on uninitialized AudioTrack."); } } //logd("pause()"); //logd("pause()"); Loading