Using SeekBar to Control Volume in android?

Please look at below code . It solves your problem. import android.app.Activity; import android.content.Context; import android.media.AudioManager; import android.os.Bundle; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; public class TestExample extends Activity { /** Called when the activity is first created. */ private SeekBar volumeSeekbar = null; private AudioManager audioManager = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setVolumeControlStream(AudioManager.STREAM_MUSIC); … Read more

Get System Volume iOS

Update for Swift let vol = AVAudioSession.sharedInstance().outputVolume The audio session can provide output volume (iOS >= 6.0). float vol = [[AVAudioSession sharedInstance] outputVolume]; NSLog(@”output volume: %1.2f dB”, 20.f*log10f(vol+FLT_MIN));

Listen to volume buttons in background service?

It is possible. Use code below (for newer Android versions, especially Marshmallow, see bottom of the answer): public class SettingsContentObserver extends ContentObserver { int previousVolume; Context context; public SettingsContentObserver(Context c, Handler handler) { super(handler); context=c; AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); previousVolume = audio.getStreamVolume(AudioManager.STREAM_MUSIC); } @Override public boolean deliverSelfNotifications() { return super.deliverSelfNotifications(); } @Override public void … Read more

AVAudioPlayer fade volume out

Here’s how I’m doing it: -(void)doVolumeFade { if (self.player.volume > 0.1) { self.player.volume = self.player.volume – 0.1; [self performSelector:@selector(doVolumeFade) withObject:nil afterDelay:0.1]; } else { // Stop and get the sound ready for playing again [self.player stop]; self.player.currentTime = 0; [self.player prepareToPlay]; self.player.volume = 1.0; } } . 11 years later: do note that setVolume#fadeDuration now … Read more

How do you get/set media volume (not ringtone volume) in Android?

private AudioManager audio; Inside onCreate: audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE); Override onKeyDown: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_UP: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI); return true; case KeyEvent.KEYCODE_VOLUME_DOWN: audio.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI); return true; default: return false; } }

How to display a 3D plot of a 3D array isosurface in matplotlib mplot3D or similar?

Just to elaborate on my comment above, matplotlib’s 3D plotting really isn’t intended for something as complex as isosurfaces. It’s meant to produce nice, publication-quality vector output for really simple 3D plots. It can’t handle complex 3D polygons, so even if implemented marching cubes yourself to create the isosurface, it wouldn’t render it properly. However, … Read more

Is there a broadcast action for volume changes?

There is no broadcast action, but I did find you can hook up a content observer to get notified when the settings change, volume of streams being some of those settings. Register for the android.provider.Settings.System.CONTENT_URI to be notified of all settings changes: mSettingsContentObserver = new SettingsContentObserver( new Handler() ); this.getApplicationContext().getContentResolver().registerContentObserver( android.provider.Settings.System.CONTENT_URI, true, mSettingsContentObserver ); The … Read more

How to get audio volume level, and volume changed notifications on iOS?

Any chance you did your signature wrong for the volumeChanged: method? This worked for me, dumped in my appdelegate: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(volumeChanged:) name:@”AVSystemController_SystemVolumeDidChangeNotification” object:nil]; } – (void)volumeChanged:(NSNotification *)notification { float volume = [[[notification userInfo] objectForKey:@”AVSystemController_AudioVolumeNotificationParameter”] floatValue]; // Do stuff with volume } My volumeChanged: method gets hit every … Read more

Android: MediaPlayer setVolume function

This function is actualy wonderful. Thanks to it you can create a volume scale with any number of steps! Let’s assume you want 50 steps: int maxVolume = 50; Then to set setVolume to any value in this range (0-49) you do this: float log1=(float)(Math.log(maxVolume-currVolume)/Math.log(maxVolume)); yourMediaPlayer.setVolume(log1,log1); //set volume takes two paramater Nice and easy! And … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)