예제 #1
0
  @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);
  }
예제 #2
0
 @Override
 public Animation getEffects() {
   return mEffectsController.getEffects();
 }
예제 #3
0
 @Override
 public void onScroll(float factor, int fadeFactor) {
   mFadeFactor = fadeFactor;
   if (mEffectsController.apply(factor) || mFadeFactor > 0) invalidate();
 }
예제 #4
0
 /* (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();
 }
예제 #5
0
 @Override
 public void setEffects(Animation effects) {
   mEffectsController.setEffects(effects);
 }
예제 #6
0
 /* (non-Javadoc)
  * @see v9t9.audio.sound.ClockedSoundVoice#setPeriod(int)
  */
 @Override
 public void setPeriod(int period) {
   super.setPeriod(period);
   effectsController.updateFrequency();
 }
예제 #7
0
 @Override
 public boolean isActive() {
   return super.isActive() || effectsController.isActive();
 }
예제 #8
0
 @Override
 protected void updateEffect() {
   effectsController.updateEffect();
 }
예제 #9
0
 @Override
 public float getCurrentMagnitude() {
   return (float) effectsController.getCurrentSample() / 0x007FFFFF;
 }
예제 #10
0
 @Override
 protected boolean updateAccumulator() {
   return effectsController.updateDivisor();
 }