List of usage examples for android.media AudioManager STREAM_MUSIC
int STREAM_MUSIC
To view the source code for android.media AudioManager STREAM_MUSIC.
Click Source Link
From source file:Main.java
public static void setVolume(Context context, int volume) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, AudioManager.FLAG_PLAY_SOUND); }
From source file:Main.java
public static void setCurrentVolume(int percent, Context mc) { AudioManager am = (AudioManager) mc.getSystemService(Context.AUDIO_SERVICE); int maxvolume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, (maxvolume * percent) / 100, AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI); am.setMode(AudioManager.MODE_INVALID); }
From source file:Main.java
public static void setMusicMute(Context context, boolean isMute) { AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, isMute); }
From source file:Main.java
public static void adjustVoiceToSystemSame(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_SAME, 0); }
From source file:Main.java
public static int getVolume(Context context) { AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); return manager.getStreamVolume(AudioManager.STREAM_MUSIC); }
From source file:Main.java
public static void setVolume(int volume, Context context) { AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); manager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); }
From source file:Main.java
public static int getMaxVolume(Context context) { AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); int max = manager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); return max;/*from w ww .j av a 2 s . c o m*/ }
From source file:Main.java
public static void setAudioManage(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true); audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true); audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_DTMF, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, 0); }
From source file:Main.java
public static void mute(Context context) { if (audioManager == null) { audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); }//from ww w .java 2 s .c o m audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true); audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true); }
From source file:Main.java
public static int getMaxSpeakerVolume(Context context) { if (context == null) { return -1; }/* w w w. j a va 2s .c o m*/ int level = -1; AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); if (audioManager != null) { level = audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); } return level; }