How to change device Volume on iOS – not music volume

To answer brush51’s question: How can i do that? just change the DEVICE volume? As 0x7fffffff suggested: You cannot change device volume programatically, however MPVolumeView (volume slider) is there to change device volume but only through user interaction. So, Apple recommends using MPVolumeView, so I came up with this: Add volumeSlider property: @property (nonatomic, strong) … Read more

Changing master volume level

Okay, here goes: const int MAXPNAMELEN = 32; const int MIXER_SHORT_NAME_CHARS = 16; const int MIXER_LONG_NAME_CHARS = 64; [Flags] enum MIXERLINE_LINEF : uint{ ACTIVE = 0x00000001, DISCONNECTED = 0x00008000, SOURCE = 0x80000000 } [Flags] enum MIXER : uint{ GETLINEINFOF_DESTINATION = 0x00000000, GETLINEINFOF_SOURCE = 0x00000001, GETLINEINFOF_LINEID = 0x00000002, GETLINEINFOF_COMPONENTTYPE = 0x00000003, GETLINEINFOF_TARGETTYPE = 0x00000004, GETLINEINFOF_QUERYMASK = … Read more

Cleanest way of capturing volume up/down button press on iOS 8

For Swift you can use next code in your viewController class: let volumeView = MPVolumeView(frame: CGRectMake(-CGFloat.max, 0.0, 0.0, 0.0)) self.view.addSubview(volumeView) NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(volumeChanged(_:)), name: “AVSystemController_SystemVolumeDidChangeNotification”, object: nil) Then add this function func volumeChanged(notification: NSNotification) { if let userInfo = notification.userInfo { if let volumeChangeType = userInfo[“AVSystemController_AudioVolumeChangeReasonNotificationParameter”] as? String { if volumeChangeType == “ExplicitVolumeChange” { // … 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));

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

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

iOS 7: MPMusicPlayerController volume deprecated. How to change device volume now?

To answer you question exactly: Yes there is other way to change system volume without user interaction. Until recent times I used to think that changing volume using MPVolumeView programmatically is possible only using private API. But I have just verified, that changing the value of volumeSlider and faking slider’s touchUP event works: MPVolumeView* volumeView … 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