Re: Default audio output - getting device changed notification?
Re: Default audio output - getting device changed notification?
- Subject: Re: Default audio output - getting device changed notification?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 23 Jun 2010 12:44:04 +0200
This sample show how to listen audio notifications. To demonstrate how notifications work it installs a listener for kAudioHardwarePropertyDevices.
Listening an other property like kAudioHardwarePropertyDefaultInputDevice, kAudioHardwarePropertyDefaultOutputDevice, kAudioHardwarePropertyDefaultSystemOutputDevice is left as an exercise to the reader, as mention in the following comment:
/*
* These are the other types of notifications we might receive, however, they are beyond
* the scope of this sample and we ignore them.
*
case kAudioHardwarePropertyDefaultInputDevice:
fprintf(stderr, "AHPropertyListenerProc: default input device changed\n");
break;
case kAudioHardwarePropertyDefaultOutputDevice:
fprintf(stderr, "AHPropertyListenerProc: default output device changed\n");
break;
case kAudioHardwarePropertyDefaultSystemOutputDevice:
fprintf(stderr, "AHPropertyListenerProc: default system output device changed\n");
break;
*/
Hint:
AudioHardwareAddPropertyListener(kAudioHardwarePropertyDefaultInputDevice, AHPropertyListenerProc, self );
AudioHardwareAddPropertyListener(kAudioHardwarePropertyDefaultOutputDevice, AHPropertyListenerProc, self );
AudioHardwareAddPropertyListener(kAudioHardwarePropertyDefaultSystemOutputDevice, AHPropertyListenerProc, self );
Le 23 juin 2010 à 12:34, tahome izwah a écrit :
> Thank you but that code only works when audio devices are plugged in
> or removed. I need a notification when the default audio output device
> is changed via the system control panel and it doesn't look like the
> AudioDeviceNotify example has that capability.
>
> thanks!
> --th
>
> 2010/6/23 Jean-Daniel Dupas <email@hidden>:
>>
>> Le 23 juin 2010 à 10:34, tahome izwah a écrit :
>>
>>> Hi all,
>>>
>>> is there a way to sign up for notifications when the default audio
>>> output (the one in the system prefs, ie.
>>> kAudioHardwarePropertyDefaultOutputDevice) has been changed? If so,
>>> how? I wasn't able to find anything in the docs.
>>
>>
>> What about the AudioDeviceNotify sample code ?
>>
>> http://developer.apple.com/mac/library/samplecode/AudioDeviceNotify/Introduction/Intro.html
>>
>>
>> -- Jean-Daniel
>>
>>
>>
>>
>>
-- Jean-Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden