Re: Making an Aiff file from an Midi file
Re: Making an Aiff file from an Midi file
- Subject: Re: Making an Aiff file from an Midi file
- From: Luke Bellandi <email@hidden>
- Date: Tue, 2 Dec 2003 14:48:05 -0800
Hi Craig,
I assume you're trying to shoehorn this code into a Cocoa app, given
that you're using Obj-C++?
If so, you should be relinquishing processing to the main run loop
rather than calling usleep().
The equivalent would be (assuming you're calling from the app's main
run loop)
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:0.250]];
instead of usleep(250 * 1000);
We haven't seen any bugs in our testing of this code. What are the
specific problems you're seeing?
Thanks,
Luke
On Dec 2, 2003, at 10:17 AM, Craig Bakalian wrote:
Shesh!
Man -o man! Debugging the threads of DiskWriterAUGraph is killing me!
All is well with the code that I have transformed for my apps needs,
yet my app is in objective c. Something is going wrong at the point of
a objective-c++ bridge file (with a .mm on the end) in the below code
where the while(PAUG->IsRunning()) is called. This code is unreliable,
or sometimes it actually writes the aiff with sound data in it with a
big EX_BAD_COMMAND error, or sometimes it writes a file with no sound
data in it with a big EX_BAD_COMMAND error.
-(void)startAiffProcessingWithAudioUnit: (AudioUnit)outputUnit
withAUGraph: (AUGraph)graph withSequence: (MusicSequence)sequence
directoryName: (NSString *)directory andFileName: (NSString *)fileName
{
const char* baseDir = new char[1024];
const char* baseFilename = new char[1024];
baseDir = [directory cString];
baseFilename = [fileName cString];
ProducerAUGraph *PAUG = new ProducerAUGraph (outputUnit, graph,
sequence, baseDir, baseFilename);
Float32 monitorValue = 0.10f;
while (PAUG->IsRunning())
{
usleep ( 250 * 1000 );
if (PAUG->GetPercentComplete() > monitorValue)
{
monitorValue += 0.10f;
}
}
delete PAUG;
}
To continue, if I get deeper into the ProducerAUGraph, it is indeed the
IsRunning() function that is causing all the errors. One more thing,
The example code calls for the below code to have if
(mIsRunningCallCount == 1) to start the thread, which I am unable to
do? It will only work if I set it to if (mIsRunningCallCount == 2).
Why? Please, there has got to be an engineer out there at apple that
is the author of this code? Please, Help! Or, is there an easier way,
in an objective- c project to push data out of output unit, and stuff
it in an aiff file.
void ProducerAUGraph::IsRunningPropertyListener (AudioUnit inAU,
AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement
inElement)
{
mIsRunningCallCount++;
if (mIsRunningCallCount == 2) {
mProcessorThread->Start();
}
}
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.
_______________________________________________
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.