コード例 #1
0
void	CAAudioBufferList::Copy(const AudioBufferList& inSource, UInt32 inStartingSourceChannel, AudioBufferList& outDestination, UInt32 inStartingDestinationChannel)
{
	//  This is a brute force copy method that can handle ABL's that have different buffer layouts
	//  This means that this method is probably not the fastest way to do this for all cases.
	//  This method also assumes that both the source and destination sample formats are Float32

	UInt32 theInputChannel = inStartingSourceChannel;
	UInt32 theNumberInputChannels = GetTotalNumberChannels(inSource);
	UInt32 theOutputChannel = inStartingDestinationChannel;
	UInt32 theNumberOutputChannels = GetTotalNumberChannels(outDestination);
	
	UInt32 theInputBufferIndex = 0;
	UInt32 theInputBufferChannel = 0;
	UInt32 theOutputBufferIndex = 0;
	UInt32 theOutputBufferChannel = 0;
	while((theInputChannel < theNumberInputChannels) && (theOutputChannel < theNumberOutputChannels))
	{
		GetBufferForChannel(inSource, theInputChannel, theInputBufferIndex, theInputBufferChannel);
		
		GetBufferForChannel(inSource, theOutputChannel, theOutputBufferIndex, theOutputBufferChannel);
		
		CopyChannel(inSource.mBuffers[theInputBufferIndex], theInputBufferChannel, outDestination.mBuffers[theOutputBufferIndex], theOutputBufferChannel);
		
		++theInputChannel;
		++theOutputChannel;
	}
}
コード例 #2
0
ファイル: CAHALAudioDevice.cpp プロジェクト: Michael-Lfx/iOS
void	CAHALAudioDevice::SetPreferredStereoChannels(bool inIsInput, AudioChannelLayout& inChannelLayout)
{
	CAPropertyAddress theAddress(kAudioDevicePropertyPreferredChannelLayout, inIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput);
	UInt32 theSize = OffsetOf32(AudioChannelLayout, mChannelDescriptions) + GetTotalNumberChannels(inIsInput) * SizeOf32(AudioChannelDescription);
	SetPropertyData(theAddress, 0, NULL, theSize, &inChannelLayout);
}
コード例 #3
0
void	CAHALAudioDevice::GetPreferredChannelLayout(bool inIsInput, AudioChannelLayout& outChannelLayout) const
{
	CAPropertyAddress theAddress(kAudioDevicePropertyPreferredChannelLayout, inIsInput ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput);
	UInt32 theSize = (SizeOf32(AudioChannelLayout) - SizeOf32(AudioChannelDescription)) + GetTotalNumberChannels(inIsInput) * SizeOf32(AudioChannelDescription);
	GetPropertyData(theAddress, 0, NULL, theSize, &outChannelLayout);
}