• 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
Re: Put Own Data in to AudioBuffer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Put Own Data in to AudioBuffer


  • Subject: Re: Put Own Data in to AudioBuffer
  • From: William Stewart <email@hidden>
  • Date: Tue, 14 Feb 2006 11:37:55 -0800


On 14/02/2006, at 7:23 AM, sam aspin wrote:

Hi Guys, just trying to post this again as it didnt seem to appear last time:

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!)

Nope - an ABL is something you have to allocate to a particular size based on the format - its a variable sized structure.


Have a look in the PublicUtility classes - you can probably use one of these:
-> simplest - AUOutputBL
-> most complete - CABufferList


Bill



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

--
mailto:email@hidden
tel: +1 408 974 4056
________________________________________________________________________ __
"Much human ingenuity has gone into finding the ultimate Before.
The current state of knowledge can be summarized thus:
In the beginning, there was nothing, which exploded" - Terry Pratchett
________________________________________________________________________ __


_______________________________________________
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


References: 
 >Put Own Data in to AudioBuffer (From: "sam aspin" <email@hidden>)

  • Prev by Date: Put Own Data in to AudioBuffer
  • Next by Date: Re: Changing the transfer speed to a USB to MIDI interface
  • Previous by thread: Put Own Data in to AudioBuffer
  • Next by thread: Intel and four char types
  • Index(es):
    • Date
    • Thread