• 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
Setting the samplerate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the samplerate


  • Subject: Setting the samplerate
  • From: Fredrik Oja <email@hidden>
  • Date: Mon, 09 Sep 2002 11:04:21 +0200

I want to capture mono 16bit linear PCM from my audio devices. I have one iMIC and one philips vestra pro camera. When I try to set the stream format the call fails. What am I doing wrong? Below is some code


memset(&formatDesc, 0, sizeof(AudioStreamBasicDescription));
formatDesc.mFormatFlags = 0;
formatDesc.mFramesPerPacket = 1;//160;
formatDesc.mBytesPerFrame = 2;
formatDesc.mBytesPerPacket = formatDesc.mFramesPerPacket *
formatDesc.mBytesPerFrame;
formatDesc.mChannelsPerFrame = 1;
formatDesc.mBitsPerChannel = 16;
formatDesc.mSampleRate = (double) 8000.0;
formatDesc.mFormatID = kAudioFormatLinearPCM;

status = AudioDeviceSetProperty( inputDevices[inputDeviceIndex].id, 0, 0,
true, kAudioDevicePropertyStreamFormat,
sizeof(formatDesc), &formatDesc);
if (status != kAudioHardwareNoError) {
printf("Failed setting AudioDevicePropertyStreamFormat\n");
}

I have also tried by only setting the samplerate variable and leaving everything else at zero, but the call fails anyway.

Any suggestions will be greatly appreciated

/ Fredrik Oja
_______________________________________________
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.

  • Follow-Ups:
    • Re: Setting the samplerate
      • From: Jeff Moore <email@hidden>
  • Prev by Date: Re: Strange message: FWADisposeMIDIStream result = 1
  • Next by Date: MusicSequenceSetAUGraph(...)
  • Previous by thread: Re: Strange message: FWADisposeMIDIStream result = 1
  • Next by thread: Re: Setting the samplerate
  • Index(es):
    • Date
    • Thread