problem writing OS X audio driver
problem writing OS X audio driver
- Subject: problem writing OS X audio driver
- From: Laurent Humbert <email@hidden>
- Date: Thu, 20 Jun 2002 16:18:49 +0200
Hi everybody,
I got close but definitely no cigar with the audio driver I am working on.
For the moment I kept things very simple with 1 single input stream/channel.
Basically, everything works great, except the sound quality is really
bad. The music is recognizable, but it sounds extremely saturated.
The sound input level as displayed by audio recording software is
normal though.
I tried different input sources (iPod, Guitar, Mic...) but they all
sound real bad.
MyAudioEngine::convertInputSamples method looks like this:
IOReturn MyAudioEngine::convertInputSamples( const void *sampleBuf,
void *destBuf,
UInt32 firstSampleFrame,
UInt32 numSampleFrames,
const
IOAudioStreamFormat *streamFormat,
IOAudioStream *audioStream)
{
UInt32 numSamplesLeft;
float *floatDestBuf;
SInt32 *inputBuf;
floatDestBuf = (float *) destBuf;
inputBuf = &(((SInt32 *)sampleBuf)[firstSampleFrame *
streamFormat->fNumChannels]);
numSamplesLeft = numSampleFrames * streamFormat->fNumChannels;
while (numSamplesLeft > 0)
{
// inputBuf points to a signed 24bit sample value coded on 32
bits, like 0x00FFC935
*floatDestBuf = (*inputBuf << 8) / 2147483648.0;
// I have also tried converting the value to a SInt32 whilst
preserving the signed-ess
// and divide by 8388608.0 but the result is the same
++inputBuf;
++floatDestBuf;
--numSamplesLeft;
}
return kIOReturnSuccess;
}
Has anybody got an idea as to what might be going wrong ? I've been
trying to fix this one for days and I've run out of ideas.
Thanks
L
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.