Increasing audio volume from Bluetooth SCO device
Increasing audio volume from Bluetooth SCO device
- Subject: Increasing audio volume from Bluetooth SCO device
- From: Peter Sichel <email@hidden>
- Date: Fri, 25 Jun 2010 00:35:54 -0400
I'm using an IOBluetoothSCOAudioDevice along with CAPlayThrough to route audio from/to a Bluetooth cell phone to create a handsfree speaker phone on the Mac. While some cell phones provide ample audio via the SCO connection, the 2G iPhone I'm testing with is too quiet for comfortable listening even with the Built-in Output set to maximum, so I'm looking for a simple way to increase the audio level from an IOBluetoothSCOAudioDevice.
I've tried using AudioDeviceSetProperty to adjust the kAudioDevicePropertyVolumeScalar, but the master volume (channel 0) is already initialized to its maximum level. Values below 1.0 reduce the volume, while values above 1.0 are ignored.
I've tried configuring the audio drivers volume control, but again, it appears to already be set to maximum.
[controlDict setObject: [NSNumber numberWithUnsignedInt: 65535] forKey:[NSString stringWithUTF8String: kIOAudioControlValueKey]];
[controlDict setObject: [NSNumber numberWithUnsignedInt: 0] forKey:[NSString stringWithUTF8String: kIOAudioLevelControlMinValueKey]];
[controlDict setObject: [NSNumber numberWithUnsignedInt: 65535] forKey:[NSString stringWithUTF8String: kIOAudioLevelControlMaxValueKey]];
[controlDict setObject: [NSNumber numberWithUnsignedInt: ((-22 << 16) + (32768))] forKey:[NSString stringWithUTF8String: kIOAudioLevelControlMinDBKey]];
[controlDict setObject: [NSNumber numberWithUnsignedInt: 0] forKey:[NSString stringWithUTF8String: kIOAudioLevelControlMaxDBKey]];
The other solution I can think of is to modify CAPlayThrough::OutputProc to call an "Adjust Audio Level" function that would multiply each sample in each buffer.
float mAudioLevel;
setAudioLevel(float inLevel) { mAudioLevel = inLevel; }
...
inline void AdjustAudioLevel (AudioBufferList * ioData)
{
for(UInt32 i=0; i<ioData->mNumberBuffers;i++) {
UInt32 count = ioData->mBuffers[i].mDataByteSize;
for(UIn32 j=0; j<count; j++) {
ioData->mBuffers[i].mData[j] *= mAudioLevel;
}
}
}
Being new to Core Audio, I'm wondering if there is an easier solution I'm missing?
Thanks!
- Peter Sichel
Sustainable Softworks
Phone Amego: http://www.sustworks.com/pa_guide/index.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden