User-land driver plugin and sample rate
User-land driver plugin and sample rate
- Subject: User-land driver plugin and sample rate
- From: Stéphane Letz <email@hidden>
- Date: Fri, 31 Oct 2008 10:23:22 +0100
Hi,
Our user-land driver plugin does not behave correctly when used the
RealPlayer: if RealPlayer plays a wav file, everything works
correctly but the sound get pitched down when RealPlayer plays an
mp3 file. Our driver plugin does support a single sample rate, so we
implement a subclass of HP_Stream that does:
void JackRouterStream::Initialize()
{
// initialize the super class
HP_Stream::Initialize();
// add the available physical formats
AddAvailablePhysicalFormats();
// set the initial format, which is 16 bit stereo
AudioStreamBasicDescription thePhysicalFormat;
thePhysicalFormat.mSampleRate = mSampleRate;
thePhysicalFormat.mFormatID = kAudioFormatLinearPCM;
thePhysicalFormat.mFormatFlags = kJackStreamFormat;
thePhysicalFormat.mBytesPerPacket = 4;
thePhysicalFormat.mFramesPerPacket = 1;
thePhysicalFormat.mBytesPerFrame = 4;
thePhysicalFormat.mChannelsPerFrame = 1;
thePhysicalFormat.mBitsPerChannel = 32;
mFormatList->SetCurrentPhysicalFormat(thePhysicalFormat, false);
}
void JackRouterStream::AddAvailablePhysicalFormats()
{
// basically, for this sample device, we're only going add two formats
AudioStreamRangedDescription thePhysicalFormat;
// the first is 32 bit stereo
thePhysicalFormat.mFormat.mSampleRate = mSampleRate;
thePhysicalFormat.mSampleRateRange.mMinimum = mSampleRate;
thePhysicalFormat.mSampleRateRange.mMaximum = mSampleRate;
thePhysicalFormat.mFormat.mFormatID = kAudioFormatLinearPCM;
thePhysicalFormat.mFormat.mFormatFlags = kJackStreamFormat;
thePhysicalFormat.mFormat.mBytesPerPacket = 4;
thePhysicalFormat.mFormat.mFramesPerPacket = 1;
thePhysicalFormat.mFormat.mBytesPerFrame = 4;
thePhysicalFormat.mFormat.mChannelsPerFrame = 1;
thePhysicalFormat.mFormat.mBitsPerChannel = 32;
mFormatList->AddPhysicalFormat(thePhysicalFormat);
}
I see now that HP_Stream class also has a
"TellHardwareToSetPhysicalFormat" method that returns "true" by
default. Should we redefined to return "false" in our plugin? It
there any other important method that should be adapted for a "single
sample rate" supporting plugin?
Thanks
Stephane Letz
_______________________________________________
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