If you think the Android project OpenSynth listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.indigo_lab.android.opensynth.view;
//fromwww.java2s.comimport org.thebends.synth.SynthJni;
import com.indigo_lab.android.opensynth.R;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.SeekBar;
publicclass FilterEnvelopeView extends EnvelopeView {
public FilterEnvelopeView(Context context) {
this(context, null);
}
public FilterEnvelopeView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public FilterEnvelopeView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle, R.layout.filter_envelope_view);
}
@Override
publicvoid onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
switch (seekBar.getId()) {
case R.id.attack_seekbar:
SynthJni.setAttackToFilterEnvelope(calcSample(progress, 1f));
break;
case R.id.decay_seekbar:
SynthJni.setDecayToFilterEnvelope(calcSample(progress, 1f));
break;
case R.id.sustain_seekbar:
SynthJni.setSustainToFilterEnvelope(progress / 100f);
break;
case R.id.release_seekbar:
SynthJni.setReleaseToFilterEnvelope(calcSample(progress, 4f));
break;
default:
thrownew RuntimeException("unknown seekbar: " + seekBar.getId());
}
}
}