I have ofxAlSoundPlayer working fine, and audioReceived working fine, but then I try to use them together there is a problem.
So my testApp has audioReceived, which works. Then at the top of testApp.h if I do
at this stage the audioReceived still works when compiled and run.
then in my class def i add…
Not doing anything else to AL other than including it at this stage.
The audioReceived no longer receives any input, no signal, nothing.
Anyone have any ideas about this?
Not sure without looking at the code but probably because OpenAL is initialised in the constructor of soundTest and therefore claims the audio input - OpenAL can do input as well.
Does anyone know of an example showing how openAL can use the microphone?
Excuse my lack of knowledge about this lib.
Is it part of the iphone sdk from apple? is soundengine.h the interface to this, and ofxAlSoundPlayer the lib that makes it accessible to us OF users?
I’m having exactly the same problem on the iPod.
I suspect that the initialization of the OpenAL player sets
the audio cathegory to playback only.
What you would need is AVAudioSessionCategoryPlayAndRecord.
Where can we set the AVAudioSessionCategoryPlayAndRecord
inside OF like we would in Object-C?
(I want to use the microphone signal just for analysis and trigger
sound buffers as soon as a microphone signal is received - thus I’m
not playing back the mic input)
Any examples are very welcome
Hi! Just stumbled upon this.
I don’t think the problem has to do with the audio category, as in my case I’m setting it to playAndRecord after openAL has been initialized*. That’s as far as I got with this. I’m going to have a look to see what’s happening, but if you guys have solved it let me know.
*@hanstutschku: this is how I do it, btw. after setting up the stream I do
AVAudioSession* avSession = [[AVAudioSession sharedInstance] retain];
[avSession setCategory: AVAudioSessionCategoryPlayAndRecord error: nil];
[avSession setActive:YES error: nil];
// Re-route audio to the speaker (not the receiver)
UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker;
AudioSessionSetProperty (kAudioSessionProperty_OverrideAudioRoute,sizeof (audioRouteOverride),&audioRouteOverride);
So It definitely has to do with ofxALSoundPlayer initialising something that somehow steals the input. I still don’t know the exact cause but found a workaround. If you make soure that the ofSoundStream is setup before any openAL sound is initialised, the microphone works ok.
So in Chris’ case, if instead of doing
you declare the player as a pointer,
ofxALSoundPlayer * soundTest;
and then on setup you new it after having called ofSoundStreamSetup,
soundTest = new ofxALSoundPlayer();
the mic works ok.
Admittedly hacky, but works for the moment. Will try to have a look at the cause when I get some time.