41 #include "CAAudioChannelLayout.h"
42 #if !defined(__COREAUDIO_USE_FLAT_INCLUDES__)
43 #include <AudioToolbox/AudioFormat.h>
45 #include <AudioFormat.h>
48 CAAudioChannelLayout::CAAudioChannelLayout ()
50 mLayout = RefCountedLayout::CreateWithNumberChannelDescriptions(0);
56 CAAudioChannelLayout::CAAudioChannelLayout (UInt32 inNumberChannels,
bool inChooseSurround)
59 AudioChannelLayoutTag tag;
61 switch (inNumberChannels)
65 mLayout = RefCountedLayout::CreateWithNumberChannelDescriptions(inNumberChannels);
66 SetAllToUnknown(*mLayout->GetLayout(), inNumberChannels);
69 tag = kAudioChannelLayoutTag_Mono;
72 tag = inChooseSurround ? kAudioChannelLayoutTag_Binaural : kAudioChannelLayoutTag_Stereo;
75 tag = inChooseSurround ? kAudioChannelLayoutTag_Ambisonic_B_Format : kAudioChannelLayoutTag_AudioUnit_4;
78 tag = inChooseSurround ? kAudioChannelLayoutTag_AudioUnit_5_0 : kAudioChannelLayoutTag_AudioUnit_5;
81 tag = inChooseSurround ? kAudioChannelLayoutTag_AudioUnit_6_0 : kAudioChannelLayoutTag_AudioUnit_6;
84 tag = kAudioChannelLayoutTag_AudioUnit_7_0;
87 tag = kAudioChannelLayoutTag_AudioUnit_8;
91 mLayout = RefCountedLayout::CreateWithLayoutTag(tag);
97 CAAudioChannelLayout::CAAudioChannelLayout (AudioChannelLayoutTag inLayoutTag)
100 SetWithTag(inLayoutTag);
106 CAAudioChannelLayout::CAAudioChannelLayout (
const CAAudioChannelLayout &c)
116 CAAudioChannelLayout::CAAudioChannelLayout (
const AudioChannelLayout* inChannelLayout)
119 *
this = inChannelLayout;
125 CAAudioChannelLayout::~CAAudioChannelLayout ()
136 CAAudioChannelLayout& CAAudioChannelLayout::operator= (
const CAAudioChannelLayout &c)
138 if (mLayout != c.mLayout) {
142 if ((mLayout = c.mLayout) != NULL)
149 CAAudioChannelLayout& CAAudioChannelLayout::operator= (
const AudioChannelLayout* inChannelLayout)
151 if (mLayout && &mLayout->Layout() == inChannelLayout)
157 if (inChannelLayout == NULL)
159 mLayout = RefCountedLayout::CreateWithNumberChannelDescriptions(0);
163 mLayout = RefCountedLayout::CreateWithLayout(inChannelLayout);
168 void CAAudioChannelLayout::SetWithTag(AudioChannelLayoutTag inTag)
173 mLayout = RefCountedLayout::CreateWithLayoutTag(inTag);
181 if (mLayout == c.mLayout)
183 return Layout() == c.Layout();
189 void CAAudioChannelLayout::Print (FILE* file)
const
191 CAShowAudioChannelLayout (file, &Layout());
bool TTFOUNDATION_EXPORT operator==(const TTObject &anObject, const TTObject &anotherObject)
Compare two objects for equality.