• 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: AUEffectBase::ChangeStreamFormat changes sOld
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUEffectBase::ChangeStreamFormat changes sOld


  • Subject: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • From: kelly jacklin <email@hidden>
  • Date: Wed, 29 Sep 2004 05:07:17 -0700

On Sep 29, 2004, at 4:58 AM, Shai Shasag wrote:

When the sample rate of the session has changed (ie. under Logic) ChangeStreamFormat gets called with the parameters:
const CAStreamBasicDescription& sOld, const CAStreamBasicDescription& sNew
Where sOld.mSampleRate holds the current sample rate and sNew .mSampleRate hold the new.


My code than calls AUEffectBase::ChangeStreamFormat passing sOld and sNew.
When AUEffectBase::ChangeStreamFormat returns, sOld.mSampleRate holds the NEW sample rate!


This happens despite the fact that sOld is defined as const CAStreamBasicDescription&.

Hi Shai,

The format you are passed is a const reference to the actual (live) format data structure in the AUBase code (actually in the AUScopeElement, if memory serves).

It is not const to the owner of the original data structure, only const to you...

Ideally, the SDK should have made a copy of the old format CAStreamBasicDescription, and passed you a const reference to that, but instead, it just passes a const reference to the live data structure, i.e.:
const CAStreamBasicDescription &curDesc = GetStreamFormat(inScope, inElement);
// ...
result = ChangeStreamFormat(inScope, inElement, curDesc, newDesc);


If you require this information to persist across the call to AUEffectBase::ChangeStreamFormat, make a copy of sOld.

Always be aware, whenever you receive a reference to something, that it is just a pointer to a structure, and that the original structure could be changed by any calls you make. Just because your reference (pointer) is const, does not mean that the underlying data is const (it usually is not)...

Hope this helps,

kelly jacklin

_______________________________________________
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


  • Follow-Ups:
    • Re: AUEffectBase::ChangeStreamFormat changes sOld
      • From: Shai Shasag <email@hidden>
References: 
 >AUEffectBase::ChangeStreamFormat changes sOld (From: Shai Shasag <email@hidden>)

  • Prev by Date: AUEffectBase::ChangeStreamFormat changes sOld
  • Next by Date: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Previous by thread: AUEffectBase::ChangeStreamFormat changes sOld
  • Next by thread: Re: AUEffectBase::ChangeStreamFormat changes sOld
  • Index(es):
    • Date
    • Thread