• 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
Playing AudioBuffers from Memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Playing AudioBuffers from Memory


  • Subject: Playing AudioBuffers from Memory
  • From: Craig Bakalian <email@hidden>
  • Date: Sun, 8 Feb 2004 09:41:28 -0500

Hi,
I am still working on recording audio. It is a challenge for me. The
following code is recording data, and I am able to save it to disk!
Horray, yet now the challenge is to play the captureStorage.
captureStorage is a Ptr, and captureCurrentPtr is a Ptr and
captureTotalBytesCaptured is a UInt32. I am having a brain freeze on
how to unwrap the Ptr.

OSStatus recordCallback(AudioDeviceID device, const AudioTimeStamp *now,
const AudioBufferList *inputdata,
const AudioTimeStamp *input_time,
AudioBufferList *outputdata,
const AudioTimeStamp *output_time,
void *refCon)
{
MyWindowController *con = (MyWindowController *)refCon;

if((inputdata != NULL) && (inputdata->mNumberBuffers > 0))
{
if(inputdata->mBuffers[0].mData)
{
if (con->captureCurrentPtr + inputdata->mBuffers[0].mDataByteSize <
con->captureStorage + kSizeOfCaptureBuffer)
{
BlockMove(inputdata->mBuffers[0].mData, con->captureCurrentPtr,
inputdata->mBuffers[0].mDataByteSize);
con->captureCurrentPtr += inputdata->mBuffers[0].mDataByteSize;
con->captureTotalBytesCaptured +=
inputdata->mBuffers[0].mDataByteSize;
}
}
}
return(kAudioHardwareNoError);
}

This is my inputCallback that is called on an reverbUnit in a graph, it
works, I get junk sizzling through when I hit a play button, yet I do
not have a clue as to how to fill in the AudioBufferList into *ioData.

OSStatus myInputCallback(void *inRefCon,
AudioUnitRenderActionFlags *inActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumFrames,
AudioBufferList *ioData)
{
MyWindowController *con = (MyWindowController *)inRefCon;
//how do I fill in the *ioData,
// I can't event do ioData->mBuffers[0].mData = NULL;
ioData->mBuffers[0].mDataByteSize = 0;
return 0;
}

All of the examples for how to do this stop at this point, and say,
"add buffers here". Is there and example of how to "add buffers
here". It's gotta be a memset of some kind or I gotta do some offset
thing. I'll take any help!


Craig Bakalian
www.eThinkingCap.com
_______________________________________________
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: Playing AudioBuffers from Memory
      • From: Jens Bauer <email@hidden>
    • Re: Playing AudioBuffers from Memory
      • From: john <email@hidden>
  • Prev by Date: On Memory Management & MusicSequence
  • Next by Date: Re: AudioUnitRender returning -1
  • Previous by thread: Re: On Memory Management & MusicSequence
  • Next by thread: Re: Playing AudioBuffers from Memory
  • Index(es):
    • Date
    • Thread