コード例 #1
0
 @Override
 public boolean onMenuItemClick(MenuItem item) {
   switch (item.getItemId()) {
     case MNU_ZEROPRESET:
       for (int i = Equalizer.getBandCount() - 1; i >= 0; i--)
         Equalizer.setBandLevel(i, 0, audioSink);
       BassBoost.setStrength(0, audioSink);
       Virtualizer.setStrength(0, audioSink);
       Player.commitAllEffects(audioSink);
       updateEffects();
       break;
     case MNU_LOADPRESET:
       startActivity(
           new ActivityFileSelection(
               getText(R.string.load_preset),
               MNU_LOADPRESET,
               false,
               false,
               getText(R.string.item_preset).toString(),
               "#pset",
               this),
           0,
           null,
           false);
       break;
     case MNU_SAVEPRESET:
       startActivity(
           new ActivityFileSelection(
               getText(R.string.save_preset),
               MNU_SAVEPRESET,
               true,
               false,
               getText(R.string.item_preset).toString(),
               "#pset",
               this),
           0,
           null,
           false);
       break;
   }
   return true;
 }
コード例 #2
0
 @Override
 public void onValueChanged(BgSeekBar seekBar, int value, boolean fromUser, boolean usingKeys) {
   if (!fromUser) return;
   if (seekBar == barBass) {
     BassBoost.setStrength(value, audioSink);
     seekBar.setText(format(BassBoost.getStrength(audioSink)));
   } else if (seekBar == barVirtualizer) {
     Virtualizer.setStrength(value, audioSink);
     seekBar.setText(format(Virtualizer.getStrength(audioSink)));
   } else if (bars != null && frequencies != null) {
     for (int i = bars.length - 1; i >= 0; i--) {
       if (seekBar == bars[i]) {
         int level = (10 * value) + min;
         if (!usingKeys && (level <= LevelThreshold) && (level >= -LevelThreshold)) {
           level = 0;
           seekBar.setValue(-min / 10);
         }
         Equalizer.setBandLevel(i, level, audioSink);
         seekBar.setText(format(frequencies[i], Equalizer.getBandLevel(i, audioSink)));
         return;
       }
     }
   }
 }