Java Code Examples for android.media.AudioTrack#setVolume()
The following examples show how to use
android.media.AudioTrack#setVolume() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultAudioSink.java From MediaSDK with Apache License 2.0 | 4 votes |
@TargetApi(21) private static void setVolumeInternalV21(AudioTrack audioTrack, float volume) { audioTrack.setVolume(volume); }
Example 2
Source File: DefaultAudioSink.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@TargetApi(21) private static void setVolumeInternalV21(AudioTrack audioTrack, float volume) { audioTrack.setVolume(volume); }
Example 3
Source File: DefaultAudioSink.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@TargetApi(21) private static void setVolumeInternalV21(AudioTrack audioTrack, float volume) { audioTrack.setVolume(volume); }
Example 4
Source File: EmbeddedAssistant.java From sample-googleassistant with Apache License 2.0 | 4 votes |
@Override public void onCompleted() { // create a new AudioTrack to workaround audio routing issues. AudioTrack audioTrack = new AudioTrack.Builder() .setAudioFormat(mAudioOutputFormat) .setBufferSizeInBytes(mAudioOutputBufferSize) .setTransferMode(AudioTrack.MODE_STREAM) .build(); if (mAudioOutputDevice != null) { audioTrack.setPreferredDevice(mAudioOutputDevice); } audioTrack.setVolume(AudioTrack.getMaxVolume() * mVolume / 100.0f); audioTrack.play(); mConversationHandler.post(new Runnable() { @Override public void run() { mConversationCallback.onResponseStarted(); } }); for (ByteBuffer audioData : mAssistantResponses) { final ByteBuffer buf = audioData; mConversationHandler.post(new Runnable() { @Override public void run() { mConversationCallback.onAudioSample(buf); } }); audioTrack.write(buf, buf.remaining(), AudioTrack.WRITE_BLOCKING); } mAssistantResponses.clear(); audioTrack.stop(); audioTrack.release(); mConversationHandler.post(new Runnable() { @Override public void run() { mConversationCallback.onResponseFinished(); } }); if (mMicrophoneMode == MicrophoneMode.DIALOG_FOLLOW_ON) { // Automatically start a new request startConversation(); } else { // The conversation is done mConversationHandler.post(new Runnable() { @Override public void run() { mConversationCallback.onConversationFinished(); } }); } }
Example 5
Source File: DefaultAudioSink.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@TargetApi(21) private static void setVolumeInternalV21(AudioTrack audioTrack, float volume) { audioTrack.setVolume(volume); }
Example 6
Source File: DefaultAudioSink.java From Telegram with GNU General Public License v2.0 | 4 votes |
@TargetApi(21) private static void setVolumeInternalV21(AudioTrack audioTrack, float volume) { audioTrack.setVolume(volume); }