Re: kAudioDevicePropertyHogMode and NSSpeechSynthesizer...
Re: kAudioDevicePropertyHogMode and NSSpeechSynthesizer...
- Subject: Re: kAudioDevicePropertyHogMode and NSSpeechSynthesizer...
- From: Jeff Moore <email@hidden>
- Date: Thu, 03 Jun 2010 20:40:03 -0700
On Jun 3, 2010, at 6:22 PM, charlie wrote:
>
> Thanks for the quick response, Jeff.
>
> This is for a kiosk test-taking app. One of the many lock down responsibilities of the app is to ensure that the test taker cannot have a pre-recorded audio cheat sheet playing in QuickTime Player or iTunes while he's taking the test. But at the same time, some students will need audio assistance from within the app to read questions aloud using text-to-speech.
Your app would need to hog all the devices on the system to do this. As you've seen, the default device will switch to another device when the current one becomes hogged.
> I just noticed something interesting...
>
> NSSpeechSynthesizer's documentation states that it outputs thru the "default output device", which I'm assuming means the selected output device in the Sound pref pane in System Preferences.
>
> If I open the Sound preferences and watch what happens when my app enters and exits exclusive output mode, I see that the selected output device (in the Sound pref pane) changes away from "Built-in Output" to something else when I enter exclusive mode, then switches back to "Built-in Output" after I exit exclusive mode.
>
> Logically, this makes sense I guess, since my app now owns that hardware, no one else should be able to route thru it.
Indeed. One of the requirements of being the default device is to not be hogged.
> But... If NSSpeechSynthesizer is trying to output thru the "default output device", then that might mean that it's picking up whatever happens to be selected in the Sound pref pane at that moment, which, in my case, would be "MacVide Audio Connector" and would result in silence.
Yes. This sounds like what I would expect to happen. If the current default device becomes hogged, a new default device is chosen.
> What I was hoping though, is that NSSpeechSynthesizer would define "default output device" from the app's perspective, not the System Preferences' perspective.
Unfortunately for your case, the default device is a system-wide property.
> Is there another list that would be better for asking questions about NSSpeechSynthesizer?
I don't know if the Speech group has a public API list but you might find some help on one Cocoa-oriented lists.
> On June 3, 2010 09:02:51 P.M. EDT, Jeff Moore <email@hidden> wrote:
>
>> I don't know a whole lot about NSSpeechSynthesizer. If it has a facility to tell it what audio device to use, then you might be able to work around the issue that way.
>> But to turn things on their heads, why do you need hog mode for your app? Hog mode is a really unfriendly thing to assert on the system. As such, it should only be used in circumstances where it is essential like sending non-mixable data (such as AC-3) to the hardware. The vast majority of apps are best off pretending like hog mode doesn't exist.
>> --
>> Jeff Moore
>> Core Audio
>> Apple
>> On Jun 3, 2010, at 5:56 PM, charlie wrote:
>>> To be clear, when I say it's "working perfectly", I mean that other apps stop emitting sound after I gain exclusive control of the output device and then resume emitting sound again after I relinquish exclusive control.
>>> The only sound my app will be generating is NSSpeechSynthesizer text-to-speech.
>>> Do I need to tell NSSpeechSynthesizer that we're in exclusive output mode somehow? Do I need to "select" the output device somehow after entering exclusive mode for that device?
>>> Thanks.
>>> Chuck
>>> On June 3, 2010 08:45:51 P.M. EDT, charlie <email@hidden> wrote:
>>>> I can obtain and relinquish exclusive control of the built-in output device using kAudioDevicePropertyHogMode. This works perfectly.
>>>> But, after obtaining exclusive control of the built-in output device, NSSpeechSynthesizer does not work (from within the same app/pid).
>>>> Anyone know how I can get NSSpeechSynthesizer to work while in exclusive output mode?
>>>> Thanks.
>>>> Chuck
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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