Listen to ofEvent audioIn in custom class

Hi,

How can I listen to the audioIn event in a custom class?

I tried to add the event by:

ofAddListener(ofEvent().audioIn, this, &MyClass::audioIn);

but it seem that audioIn is not a member of ofCoreEvents.

I am working with OF 0.9.4.

Thanks for help,
wun

hi, did you ever figure this out?

The way to listen to audio events is by setting them in the soundstream settings. If you have a class like:

class MyClass{
    void audioIn(ofSoundBuffer & buffer);
    void audioOut(ofSoundBuffer & buffer);
}

In ofApp:

//.h
ofSoundStream soundStream;
MyClass myobj;

//setup
ofSoundStreamSettings settings;
settings.setInListener(&myobj);
settings.setOutListener(&myobj);
// set any other required settings
soundStream.setup(settings);
1 Like