Re: Loading arrays into register
Re: Loading arrays into register
- Subject: Re: Loading arrays into register
- From: "Simon" <email@hidden>
- Date: Fri, 28 Dec 2007 05:29:38 -0500 (EST)
The sample code is from a programme called Sinewave by James McCartney (www.audiosynth.com). The controller class is made in Cocoa. The Sinewave header file imports Cocoa and includes CoreAudio/AudioHardware.h. James writes that Sinewave is "a very simple Cocoa CoreAudio application", and that the Sinewave class "implements a sine oscillator with dezippered control of frequency, pan and amplitude".
The reason I wanted to use a simple Objective-C array (double testArray[100][2]) is that the Sinewave class has no autorelease pool, so I can't use NSMutableArray anyway (I tried to add an autorelease pool manually, but this seemed to create a lot of distortion in the sound output).
Is this enough information?
Simon
--- On Fri 12/28, Brian Willoughby < email@hidden > wrote:
From: Brian Willoughby [mailto: email@hidden]
To: email@hidden
Cc: email@hidden
Date: Fri, 28 Dec 2007 01:30:28 -0800
Subject: Re: Loading arrays into register
Before anyone can think about helping you, Simon, you'll have to mention what sample code you have, and which API you're using for this oscillator. You can't send the data any way you want, you have to send it the way the API is expecting, so it helps to mention the API. If the API works with NSArray but not NSMutableArray, then perhaps you need another API. If the sample code source is available, then perhaps you could rewrite it to properly handle NSMutableArray or something else suitable.Brian WilloughbySound Consulting
On Dec 27, 2007, at 16:26, Simon wrote:I've been working on a Cocoa application that uses a simple Core Audio oscillator that I got from some sample code to play sound. I'm sending data to the oscillator in an array to generate sine waves, but I can't work out the syntax for how to do it.Here's some of the code to show what I mean:
sinewavedef* def = defptr; // get access to Sinewave's data int i;
// load instance variables into registers
double phase = def->phase;
double amp = def->amp;
double pan = def->pan;
double freq = def->freq;
NSArray * xArray = def->xArray;
NSArray * xArrayz = def->xArrayz;
double testArray[100][2] = def->testArray[100][2];
I seem to have no problem with NSArrays (though NMutableArray won't work), but I need to change the data in the arrays, so these are no good. I've tried all the variations of the last line I can think of, including the indeces or not including them, etc. And I can't find anything about it on the internet. I'm still pretty new to programming, so there's probably something really obvious I'm missing.Can anyone help?Hopefully, Simon
_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!
_______________________________________________
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