• 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
Play from Audio CD
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Play from Audio CD


  • Subject: Play from Audio CD
  • From: John Johnson <email@hidden>
  • Date: Thu, 10 Jun 2010 10:09:28 -0500

Hey everyone. I'm trying to play audio directly from a CD. I have an audio ripper that's set up to rip the audio; it rips a certain number of sectors and then passes it back to a delegate object to process in the form of an AudioBufferList. Here is where I write the audio data to a file. My question is how would I begin playing that file before the ripping is completely done? It seems the audio file is not playable until I call AudioFileDispose... Maybe it's possible to play the audio data directly without the need for an intermediate file, I don't know. I'm just a little confused on how this process should go. Any help would be appreciated.

Here's the delegate method that process the ripped audio. 

- (void)processRippedAudio:(AudioBufferList *)audioBufferList andSubchannel:(SubchannelBufferList *)subBufferList
{
if (audioBufferList->mNumberBuffers > 0) {
NSUInteger frameCount = audioBufferList->mBuffers[0].mDataByteSize / sizeof(Float32);
OSErr err = ExtAudioFileWrite(_extAudioFile, frameCount, audioBufferList);
NSAssert2(err == noErr, @"The call to ExtAudioFileWrite failed.", UTCreateStringForOSType(err));
}


if (subBufferList->mNumberBuffers > 0) {
[_subchannelData appendBytes:subBufferList->mBuffers[0].mData length:subBufferList->mBuffers[0].mDataByteSize];
}
}


The audio file is set up as follows:

asbd.mSampleRate = 44100.f;
asbd.mFormatID = kAudioFormatLinearPCM;
asbd.mFormatFlags = kAudioFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsBigEndian | kAudioFormatFlagIsPacked;
asbd.mBytesPerPacket = 4;
asbd.mFramesPerPacket = 1;
asbd.mBytesPerFrame = 4;
asbd.mChannelsPerFrame = 2;
asbd.mBitsPerChannel = 16;
 _______________________________________________
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: Play from Audio CD
      • From: Jeff Moore <email@hidden>
    • Re: Play from Audio CD
      • From: Brian Willoughby <email@hidden>
  • Prev by Date: Re: RemoteIO unit at beginning and end of an AUGraph
  • Next by Date: Re: Cocoa UI Size
  • Previous by thread: Re: Building for 10.4 on 10.6
  • Next by thread: Re: Play from Audio CD
  • Index(es):
    • Date
    • Thread