Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getIsPlaying method inside ofxAudioUnitFilePlayer #18

Open
dferrandizmont opened this issue Jun 15, 2014 · 10 comments
Open

getIsPlaying method inside ofxAudioUnitFilePlayer #18

dferrandizmont opened this issue Jun 15, 2014 · 10 comments

Comments

@dferrandizmont
Copy link

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.

@admsyn
Copy link
Owner

admsyn commented Jun 15, 2014

Hey @dferrandizmont , are you talking about the ofxAudioUnitFilePlayer? (EDIT: changed the title)

@dferrandizmont
Copy link
Author

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.

@admsyn admsyn changed the title getIsPlaying method inside ofxAudioUnit getIsPlaying method inside ofxAudioUnitFilePlayer Jun 15, 2014
@admsyn
Copy link
Owner

admsyn commented Jun 15, 2014

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);

@dferrandizmont
Copy link
Author

@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.

@admsyn
Copy link
Owner

admsyn commented Jun 15, 2014

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.

@dferrandizmont
Copy link
Author

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.

@admsyn
Copy link
Owner

admsyn commented Jun 15, 2014

It's probably expecting a number between 0 and 1 (where 1 is 100%)

@dferrandizmont
Copy link
Author

I tried to change the value from 100 to 1 and I have the same problem ..

@admsyn
Copy link
Owner

admsyn commented Jun 15, 2014

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 :)

@dferrandizmont
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants