ofxAudioUnit
ofxAudioUnit copied to clipboard
getIsPlaying method inside ofxAudioUnitFilePlayer
Hi admsyn, I'm wondering if there is any option inside ofxAudioUnit to get if the sound we are playing is playing or not like the method inside ofSoundPlayer.
Thank you so much.
Hey @dferrandizmont , are you talking about the ofxAudioUnitFilePlayer? (EDIT: changed the title)
Yes, i'm talking about ofxAudioUnitFilePlayer. And I have another question, if I would like to use a reverb parameter for iOS how should I do it?.
Thanks admsyn.
For reverb, you'd just put a reverb audio unit after your file player. You can check out the params example to see how to find / change parameters on the fly.
The reverb unit has the description kAudioUnitType_Effect
kAudioUnitSubType_Reverb2
, so:
// in your ofApp class
ofxAudioUnit reverb;
// in your setup()
reverb = ofxAudioUnit(kAudioUnitType_Effect, kAudioUnitSubType_Reverb2);
filePlayer.connectTo(reverb).connectTo(output);
@admsyn thanks! So, now I would like to edit the reverb I have to do something like this:
float newSpeed = ofMap(x, 0, ofGetWidth(), 0.01, 2, true);
AudioUnitSetParameter(reverb.getUnit(),
kVarispeedParam_PlaybackRate,
kAudioUnitScope_Global,
0,
newSpeed,
0);
I have to change the line kVarispeedParam_PlaybackRate
but I don't know what I have to write here, maybe kReverbParam_DryWetMix
?.
Thank you.
Yepp, except the params for the reverb2 unit all start with "kReverb2Param_", so if you type that you'll see the list in your autocomplete.
Ohh thank you so much but now I have another problem, I would like to edit the reverb parameter and now I have this code
float newReverb = ofMap(touch.x, 0, ofGetWidth(), 0, 100, true);
AudioUnitSetParameter(reverb.getUnit(),
kReverb2Param_DryWetMix,
kAudioUnitScope_Global,
0,
newReverb,
0)
and the reverb always sounds like if its fix to 100%. How can I change it? this is not the right way to do it?, and I saw that the reverb starts default at 100% and I would like to start the reverb at 0% and when I move the finger along the screen it change.
It's probably expecting a number between 0 and 1 (where 1 is 100%)
I tried to change the value from 100 to 1 and I have the same problem ..
Is AudioUnitSetParameter
returning an error? Also, can you move this over to the forum or start a new issue for reverb on ios? This is getting a little off topic :)
No, AudioUnitSetParameter
is not returning any error. Okey, i'm going to create a new issue just for that, and about my early question about a method like getIsPlaying?. Thanks adam.