• 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
put own data into AudioBuffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

put own data into AudioBuffer


  • Subject: put own data into AudioBuffer
  • From: "sam aspin" <email@hidden>
  • Date: Mon, 13 Feb 2006 14:21:17 +0000

Hi folks,

Im trying to get audio data i have stored in a byte array into an AudioBuffer so I can play it back using my modified version of the DefaultOutputUnit example.

I declared the following outside of the method...
**********************************************************
AudioBuffer myBuffer, *mb;
AudioBufferList myBufferList, *mbl;
**********************************************************
These hopefully create an AudioBuffer and AudioBufferList with pointers (i think!)


The array is received by a native c++ method from java, and given the reference 'b'
**********************************************************
JNIEXPORT jint JNICALL Java_JNIWrapper_mySDLNativeMethod
(JNIEnv *env, jclass theClass, jstring arg, jbyteArray b){
**********************************************************


i then try to put the data into the AudioBuffer and associate it with the AudioBufferList. I feel I could be going wrong here....
**********************************************************
myBuffer.mNumberChannels = 1;
myBuffer.mDataByteSize = 512;
myBuffer.mData = b;


	myBufferList.mNumberBuffers = 1;
	myBufferList.mBuffers[0] = myBuffer;
**********************************************************


Within the DefaultOutputUnit example I have modified the UsingDefaultNOAC.cpp file so that the original references to AudioBufferList *ioData now refer to AudioBufferList *mbl and ioData to mbl.


e.g. MyRenderer(void 				*inRefCon,
				AudioUnitRenderActionFlags 	*ioActionFlags,
				const AudioTimeStamp 		*inTimeStamp,
				UInt32 						inBusNumber,
				UInt32 						inNumberFrames,
				AudioBufferList 			*mbl)

It's quite likely that i am going about this in completely the wrong way and if anyone can shed light on what i should be doing it would be greatly appreciated.

BTW This code currently runs but results in a signal 11 (SIGSEGV) error during the following loop:

for (UInt32 channel = 1; channel < mbl->mNumberBuffers; channel++){
memcpy (mbl->mBuffers[channel].mData, mbl->mBuffers[0].mData, mbl->mBuffers[0].mDataByteSize);


thanks in advance

Sam Aspin


_______________________________________________ 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
  • Prev by Date: Changing the transfer speed to a USB to MIDI interface
  • Next by Date: Re: Core Audio instruments
  • Previous by thread: Re: Changing the transfer speed to a USB to MIDI interface
  • Next by thread: Re: Coreaudio-api Digest, Vol 3, Issue 54
  • Index(es):
    • Date
    • Thread