• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
User-land driver plugin and sample rate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: User-land driver plugin and sample rate
      • From: Jeff Moore <email@hidden>
  • Prev by Date: writing audio from a AUGraph to disk
  • Next by Date: setting mic volume
  • Previous by thread: Re: writing audio from a AUGraph to disk
  • Next by thread: Re: User-land driver plugin and sample rate
  • Index(es):
    • Date
    • Thread