• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Sound Manager?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: Animation of window to dock (hotmail is too bad )
  • Next by Date: Re: In-Cell editing
  • Previous by thread: Re: Sound Manager?
  • Next by thread: NSEvent isEqual
  • Index(es):
    • Date
    • Thread