@Override protected void dispatchDraw(Canvas canvas) { final int saveCount = canvas.save(); canvas.concat(mEffectsController.getEffectsMatrix()); canvas.saveLayerAlpha( 0, 0, canvas.getWidth(), canvas.getHeight(), (int) (255 * mEffectsController.getEffectsAlpha()), Canvas.HAS_ALPHA_LAYER_SAVE_FLAG); super.dispatchDraw(canvas); if (mFadeFactor > 0f) { mFadePaint.setColor(Color.argb(mFadeFactor, 0, 0, 0)); canvas.drawRect(0, 0, getWidth(), getHeight(), mFadePaint); } canvas.restoreToCount(saveCount); }
@Override public Animation getEffects() { return mEffectsController.getEffects(); }
@Override public void onScroll(float factor, int fadeFactor) { mFadeFactor = fadeFactor; if (mEffectsController.apply(factor) || mFadeFactor > 0) invalidate(); }
/* (non-Javadoc) * @see v9t9.audio.sound.SoundVoice#setVolume(int) */ @Override public void setVolume(int volume) { super.setVolume(volume); if (volume == 0) effectsController.stopEnvelope(); else effectsController.updateVoice(); }
@Override public void setEffects(Animation effects) { mEffectsController.setEffects(effects); }
/* (non-Javadoc) * @see v9t9.audio.sound.ClockedSoundVoice#setPeriod(int) */ @Override public void setPeriod(int period) { super.setPeriod(period); effectsController.updateFrequency(); }
@Override public boolean isActive() { return super.isActive() || effectsController.isActive(); }
@Override protected void updateEffect() { effectsController.updateEffect(); }
@Override public float getCurrentMagnitude() { return (float) effectsController.getCurrentSample() / 0x007FFFFF; }
@Override protected boolean updateAccumulator() { return effectsController.updateDivisor(); }