-(void) SetupEQUnit:(UInt32)nEqLevel
{
// Open the output unit
int result = 0;
AudioComponentDescription desc;
desc.componentType = kAudioUnitType_Effect; // I've also tried kAudioUnitType_Output with no success
desc.componentSubType = kAudioUnitSubType_AUiPodEQ;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
result = AudioUnitUninitialize(m_EQUnit); // Incase we were already loaded...
printf("AudioUnitUninitialize result is %d\n", result);
AudioComponent comp = AudioComponentFindNext(NULL, &desc);
result = AudioComponentInstanceNew(comp, &m_EQUnit);
printf("AudioComponentInstanceNew result is %d\n", result);
result = AudioUnitSetProperty(m_EQUnit, nEqLevel, 0, 0, (const void *)nEqLevel, sizeof(UInt32));
printf("AudioUnitSetProperty result is %d\n", result);
result = AudioUnitInitialize(m_EQUnit);
printf("AudioUnitInitialize result is %d\n", result);
}
The GDB output is below:
AudioUnitUninitialize result is -50
AudioComponentInstanceNew result is 0
AudioUnitSetProperty result is -10851
AudioUnitInitialize result is 0
While the audio is playing, I'd like to call this function to set the EQ setting.
Any help with figuring out how to set this will be greatly appreciated.
Thanks in advance,
KappA