AudioManager setStreamSolo - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for AudioManager setStreamSolo method.

This code example shows how to use the following methods:getStreamMaxVolume, getStreamVolume, setStreamSolo, setStreamVolume
    prepareAudio(); 
    tts.speak(text, TextToSpeech.QUEUE_FLUSH, params);
  } 
 
  private void prepareAudio() { 
    audioManager.setStreamSolo(READING_AUDIO_STREAM, true);
 
    int desiredVolume = SettingsUtil.getVolume(this);
 
    // -1 means use the system volume. 
    if (desiredVolume != -1) {
      systemVolume = audioManager.getStreamVolume(READING_AUDIO_STREAM);
      int boudedDesiredVolume =
          Math.min(desiredVolume, audioManager.getStreamMaxVolume(READING_AUDIO_STREAM));
      Log.i(LOG_TAG, "Temporarily setting volume to " + boudedDesiredVolume);
      audioManager.setStreamVolume(READING_AUDIO_STREAM, boudedDesiredVolume, 0);
    } else { 
      systemVolume = -1;
    } 
  } 
 
6
CodeRank
This code example shows how to use the following methods:getStreamVolume, setStreamSolo
 
		STREAM = new AnnouncifySettings(context).getStream();
	} 
 
	private boolean isSilent() { 
		return manager.getStreamVolume(STREAM) == 0 ? true : false;
	} 
 
	public void lowerVolume() { 
		if (isSilent()) { 
			return; 
		} 
		previousVolume = manager.getStreamVolume(STREAM);
		manager.setStreamVolume(STREAM, 5, 0);
	} 
 
	public void muteStreams() { 
		if (isSilent()) { 
			return; 
		} 

5
CodeRank

Related AudioManager setStreamSolo Questions & Answers:

setStreamSolo Method Overview
Solo or unsolo a particular stream.
See Code Examples for other Android AudioManager Methods: