Question: What is the impact of changing .cpp AudioUnitEffect source to .mm
Question: What is the impact of changing .cpp AudioUnitEffect source to .mm
- Subject: Question: What is the impact of changing .cpp AudioUnitEffect source to .mm
- From: Motti Shneor <email@hidden>
- Date: Sun, 20 Jun 2010 05:05:09 -0400
- Acceptlanguage: en-US
- Thread-topic: Question: What is the impact of changing .cpp AudioUnitEffect source to .mm
Hello everyone.
Our AudioUnitMidiEffect is based on the AUMidiEffectBase.cpp and the whole AU SDK.
It has been all C++, and was totally decoupled from Cocoa and Objective-C.
Now we need to introduce a new member to the AudioUnit class, which is an Objective-C object. This object must be owned by the audio-unit (allocated, inited and released), and should serve us as a convenient interface with external frameworks and bundles we have, that are Obj-C and Cocoa based.
Technically, there's nothing to it.
ourAUMidiEffect.h
--------------------------------------------------------
class ourAUMidiEffect: AUMidiEffectBase
{
void *theNewMember;
}
ourAUMidiEffect.mm
--------------------------------------------------------
#import "theNewMember.h"
ourAUMidiEffect:: ourAUMidiEffect {
NSMemoryPool newPool = [NSMemoryPool newPool];
theNewMember = (void *) [[theNewMember alloc] init];
}
ourAUMidiEffect::~ourAUMidiEffect {
[(theNewMember *) theNewMember release];
}
Will do the job.
But class ourAUMidiEffect is a sensitive piece of code, which processes audio data in real-time thread, and should remain highly optimized.
I don't exactly know the impact of changing it from ourAUMidiEffect.cpp to ourAUMidiEffect.mm
When is the Obj-C runtime loaded?
How fast is its initialization?
Is it loaded only once for the host application, or is it part of my own code?
how is it attached to my code?
Is the code compiled for .mm any slower?
what about thread safety?
All in all, I'd be happy to have some hints and ideas, and hopefully some links would be helpful too. This is not a simplification of the problem --- we really need only one Obj-C object, implementing a simple (less than 10 methods) protocol, which is very simple wrapper around another C++ object.
thanks a lot!
Motti Shneor
------------------------------------------
Senior Software Engineer
Waves Audio ltd.
Phone: +972-3-6084155
Mobile: +972-54-4470730
[mailto: email@hidden]
_______________________________________________
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