Re: Sound Manager?
Re: Sound Manager?
- Subject: Re: Sound Manager?
- From: Matt Neuburg <email@hidden>
- Date: Thu, 04 May 2006 05:49:53 -0700
- Thread-topic: Sound Manager?
On Wed, 3 May 2006 15:35:12 -0400, Shon Frazier <email@hidden>
said:
>The Sound Manager APIs are deprecated. What's the replacement under
>Cocoa?
Core Audio. The Sound Manager / QuickTime APIs for dealing with overall
system sound volume are still documented but don't work properly, a fact
that I regard as a massive bug.
>Specifically: I need to know when the system sound volume changes.
>I'd also like to know whether headphones are plugged in.
>
>1) Is there such a thing as a sound volume changed notification? If
>so, how do I register for it?
Here's a simple version. I say "simple" because in fact all I'm doing is
registering for a change in the sound volume of the left channel. If you
need more, do more.
OSStatus myProc( AudioDeviceID inDevice,
UInt32 inChannel,
Boolean isInput,
AudioDevicePropertyID inPropertyID,
void* me) {
// whatever
}
- (void) awakeFromNib {
AudioDeviceID device;
UInt32 size = sizeof device;
OSStatus err = AudioHardwareGetProperty
(kAudioHardwarePropertyDefaultOutputDevice,
&size, &device);
UInt32 channels[2];
size = sizeof channels;
AudioDeviceGetProperty
(device, 0, false,
kAudioDevicePropertyPreferredChannelsForStereo,
&size, &channels);
AudioDeviceAddPropertyListener
(device, channels[0], false,
kAudioDevicePropertyVolumeScalar,
&myProc, self);
}
m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden