• 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: The proper way of finding out if a host is doing offline processing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The proper way of finding out if a host is doing offline processing


  • Subject: Re: The proper way of finding out if a host is doing offline processing
  • From: William Stewart <email@hidden>
  • Date: Fri, 24 Mar 2006 12:15:22 -0800

Bobby,

Sorry, I'm misreading the post. You want to know, as an AU, if the host is doing offline processing. (What confused me, is the calls quoted to AudioUnitGetProperty - as an AU, you don't need to make the API call, as you can tell what the setting of a property is by just calling either your implementation for this method, or an AUBase method).

So, I think the point of confusion is this. We don't provide a default implementation in AUBase for many properties that we don't think will have general application - in this case, the offline processing is one that we didn't think would affect many AUs. So, unless your AU implements this property itself, you will not see it being set on your AU.

To implement the property you have to do 2 or 3 things:

Firstly, implement GetPropertyInfo:
ComponentResult MySynth::GetPropertyInfo( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
UInt32 & outDataSize,
Boolean & outWritable)
{
ComponentResult result = noErr;

switch(inID)
{
...
case kAudioUnitProperty_OfflineRender:
if (inScope != kAudioUnitScope_Global) return kAudioUnitErr_InvalidScope;
outDataSize = sizeof(UInt32);
outWritable = true;
break;
...
// we would have a default case here that would set result to invalid prop err



We're declaring that the property is writable - so we have two more things to do (if the property were read only, we'd just have to implement GetProperty)


First, provide a way for the host to get the property's current value - through GetProperty:


ComponentResult MySynth::GetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
void * outData)
{
ComponentResult result = noErr;


switch(inID)
{
...
case kAudioUnitProperty_OfflineRender:
if (inScope != kAudioUnitScope_Global) return kAudioUnitErr_InvalidScope;
*(UInt32*)outData = (RendersOffline() != 0);
break;
...


// we would have a default case here that would set result to invalid prop err

We're keeping the current state of Offline in a method we're defining ourselves called RendersOffline - how you decide to implement this is up to you, I'm just describing the general plumbing you need to put into place to have your AU implement this property.

Finally, you need to implement the setting of the property: This is how the host's call to AudioUnitSetProperty will end up in your AU to set this property.

ComponentResult MySynth::SetProperty( AudioUnitPropertyID inID,
AudioUnitScope inScope,
AudioUnitElement inElement,
const void * inData,
UInt32 inDataSize)
{
ComponentResult result = noErr;
switch(inID)
{
...
case kAudioUnitProperty_OfflineRender:
{
if(inScope != kAudioUnitScope_Global) return kAudioUnitErr_InvalidScope;
UInt32 propertyValue = (*(UInt32*)inData) != 0;
SetRendersOffline (propertyValue);
break;


// we would have a default case here that would set result to invalid prop err

This would call through to SetRendersOffline with the new value of this property, and here you need to do whatever you need to do to make this work.


HTH

Bill

On 24/03/2006, at 11:49 AM, William Stewart wrote:


On 24/03/2006, at 11:45 AM, William Stewart wrote:

Bobby,

On 24/03/2006, at 7:54 AM, Bobby Zlatkov wrote:

Stefan, thanks much for your reply.

What I am doing is this:


UInt32 offlineProp; Uint32 size = sizeof(offlineProp);

AudioUnitGetProperty( mAudioUnit, kAudioUnitProperty_OfflineRender,
kAudioUnitScope_Global, 0, & offlineProp, &size );

This is incorrect. You don't want to get the property, but rather you need to set it. By default we expect all AUs to have this property disabled - that is, when they are first opened they would be ready for a real time operation.


Then, as the host changes the context, it uses this property to tell the AU about that change, so you use AudioUnitSetProperty (ie SET, not GET), and to go offline, the value you pass in is 1, to go back to real-time, the value you pass in is 0.

Oh, I should also add that we don't expect all AUs to implement this property - for those AUs that don't do anything different, there is no need for them to implement this property.


You should make sure that when you set this property, that you do NOT set this while an AU can render. This property can lead to some significant changes to the AU's render logic of course. We don't require that the AUs make this render/thread-safe, but rather that the host calls this in a render/thread-safe manner.

HTH

Bill


...

Not sure if this is the right way to do it and also I was not sure where
would be the proper place to put this call ( in CreateUI(), Render () or
somewhere else ) since on return offlineProp is always 0.

Sure - that is correct. Once you set it, it will change.

Bill


Regards,

Bobby Zlatkov
Cakewalk


-----Original Message-----
From: Stefan Gretscher [mailto:email@hidden]
Sent: Thursday, March 23, 2006 6:26 PM
To: Bobby Zlatkov
Cc: email@hidden
Subject: Re: The proper way of finding out if a host is doing offline
processing


Hi Bobby,

Am 24.03.2006 um 00:05 schrieb Bobby Zlatkov:
we have a soft synth that is an AU and are trying to figure out how
to ask a host if the host is doing offline processing like freeze
or bounce.

There's kAudioUnitProperty_OfflineRender - the hosts would set it before bouncing/freezing and clear it again when switching back to normal, real-time operation.

Best,
Stefan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden

--
mailto:email@hidden
tel: +1 408 974 4056
_____________________________________________________________________ _____
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
_____________________________________________________________________ _____


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40apple.com


This email sent to email@hidden

--
mailto:email@hidden
tel: +1 408 974 4056
______________________________________________________________________ ____
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
______________________________________________________________________ ____



--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
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


References: 
 >RE: The proper way of finding out if a host is doing offline processing (From: "Bobby Zlatkov" <email@hidden>)
 >Re: The proper way of finding out if a host is doing offline processing (From: William Stewart <email@hidden>)
 >Re: The proper way of finding out if a host is doing offline processing (From: William Stewart <email@hidden>)

  • Prev by Date: Re: The proper way of finding out if a host is doing offline processing
  • Next by Date: Re: crashing in calls to AudioConverter on 10.3.9
  • Previous by thread: Re: The proper way of finding out if a host is doing offline processing
  • Next by thread: Simple Mute controls
  • Index(es):
    • Date
    • Thread