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
void ChannelNameTable::SortIntoTable( int index )
{
	int i;
	ChannelName_t tempName;

	CopyChannel( &tempName, &m_Channels[ m_iNumChannels ] );

	for( i = m_iNumChannels - 1; i >= index; i-- )
	{
		m_lookup[ m_Channels[ i ].channelNum ] = i + 1;
		CopyChannel( &m_Channels[ i + 1 ], &m_Channels[ i ] );
	}

	m_lookup[ tempName.channelNum ] = index;
	CopyChannel( &m_Channels[ index ], &tempName );
}