some more cleanup
This commit is contained in:
parent
0e624d3b99
commit
106cec35d9
1 changed files with 17 additions and 121 deletions
110
mac/sound.cpp
110
mac/sound.cpp
|
@ -25,24 +25,6 @@
|
|||
#include "sound.h"
|
||||
|
||||
|
||||
|
||||
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// TODO remove the following code as soon as the Coreaudio is working!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// TEST Debug functions
|
||||
#include <string.h>
|
||||
void StoreInOutStreamProps ( ComponentInstance in );
|
||||
void StoreAudioStreamBasicDescription ( AudioStreamBasicDescription in, std::string text );
|
||||
static FILE* pFile = fopen ( "test.dat", "w" );
|
||||
|
||||
|
||||
|
||||
|
||||
/* Implementation *************************************************************/
|
||||
void CSound::OpenCoreAudio()
|
||||
{
|
||||
|
@ -227,12 +209,9 @@ void CSound::OpenCoreAudio()
|
|||
static_cast<int> ( outputSampleRate ) ).arg ( SYSTEM_SAMPLE_RATE ) );
|
||||
}
|
||||
|
||||
|
||||
// TEST
|
||||
StoreInOutStreamProps ( audioInputUnit );
|
||||
StoreInOutStreamProps ( audioOutputUnit );
|
||||
|
||||
|
||||
// allocate memory for buffer struct
|
||||
pBufferList = (AudioBufferList*) malloc ( offsetof ( AudioBufferList,
|
||||
mBuffers[0] ) + sizeof ( AudioBuffer ) );
|
||||
}
|
||||
|
||||
void CSound::CloseCoreAudio()
|
||||
|
@ -298,15 +277,7 @@ int CSound::Init ( const int iNewPrefMonoBufferSize )
|
|||
// create memory for intermediate audio buffer
|
||||
vecsTmpAudioSndCrdStereo.Init ( iCoreAudioBufferSizeStero );
|
||||
|
||||
|
||||
// TODO
|
||||
// fill audio unit buffer struct
|
||||
pBufferList = (AudioBufferList*) malloc ( offsetof ( AudioBufferList,
|
||||
mBuffers[0] ) + sizeof(AudioBuffer) );
|
||||
|
||||
//(sizeof(AudioBufferList) + (numChannels-1)) * sizeof(AudioBuffer)
|
||||
|
||||
|
||||
pBufferList->mNumberBuffers = 1;
|
||||
pBufferList->mBuffers[0].mNumberChannels = 2; // stereo
|
||||
pBufferList->mBuffers[0].mDataByteSize = iCoreAudioBufferSizeMono * 4; // 2 bytes, 2 channels
|
||||
|
@ -395,78 +366,3 @@ OSStatus CSound::processOutput ( void* inRefCon,
|
|||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// TODO remove the following code as soon as the Coreaudio is working!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// TEST Debug functions
|
||||
void StoreAudioStreamBasicDescription ( AudioStreamBasicDescription in,
|
||||
std::string text )
|
||||
{
|
||||
fprintf ( pFile, "*** AudioStreamBasicDescription: %s***\n", text.c_str() );
|
||||
fprintf ( pFile, "mSampleRate: %e\n", in.mSampleRate );
|
||||
fprintf ( pFile, "mFormatID: %d\n", (int) in.mFormatID );
|
||||
fprintf ( pFile, "mFormatFlags: %d\n", (int) in.mFormatFlags );
|
||||
fprintf ( pFile, "mFramesPerPacket: %d\n", (int) in.mFramesPerPacket );
|
||||
fprintf ( pFile, "mBytesPerFrame: %d\n", (int) in.mBytesPerFrame );
|
||||
fprintf ( pFile, "mBytesPerPacket: %d\n", (int) in.mBytesPerPacket );
|
||||
fprintf ( pFile, "mChannelsPerFrame: %d\n", (int) in.mChannelsPerFrame );
|
||||
fprintf ( pFile, "mBitsPerChannel: %d\n", (int) in.mBitsPerChannel );
|
||||
// fprintf ( pFile, "mReserved %d\n", in.mReserved );
|
||||
fflush ( pFile );
|
||||
}
|
||||
|
||||
void StoreInOutStreamProps ( ComponentInstance in )
|
||||
{
|
||||
// input bus 1
|
||||
AudioStreamBasicDescription DeviceFormatin1;
|
||||
UInt32 size = sizeof ( AudioStreamBasicDescription );
|
||||
AudioUnitGetProperty ( in,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input,
|
||||
1,
|
||||
&DeviceFormatin1,
|
||||
&size );
|
||||
StoreAudioStreamBasicDescription ( DeviceFormatin1, "Input Bus 1" );
|
||||
|
||||
// output bus 1
|
||||
AudioStreamBasicDescription DeviceFormatout1;
|
||||
size = sizeof ( AudioStreamBasicDescription );
|
||||
AudioUnitGetProperty ( in,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Output,
|
||||
1,
|
||||
&DeviceFormatout1,
|
||||
&size );
|
||||
StoreAudioStreamBasicDescription ( DeviceFormatout1, "Output Bus 1" );
|
||||
|
||||
// input bus 0
|
||||
AudioStreamBasicDescription DeviceFormatin0;
|
||||
size = sizeof ( AudioStreamBasicDescription );
|
||||
AudioUnitGetProperty ( in,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Input,
|
||||
0,
|
||||
&DeviceFormatin0,
|
||||
&size );
|
||||
StoreAudioStreamBasicDescription ( DeviceFormatin0, "Input Bus 0" );
|
||||
|
||||
// output bus 0
|
||||
AudioStreamBasicDescription DeviceFormatout0;
|
||||
size = sizeof ( AudioStreamBasicDescription );
|
||||
AudioUnitGetProperty ( in,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
kAudioUnitScope_Output,
|
||||
0,
|
||||
&DeviceFormatout0,
|
||||
&size );
|
||||
StoreAudioStreamBasicDescription ( DeviceFormatout0, "Output Bus 0" );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue