コード例 #1
0
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
 public void setSavedPreset() {
   final int sbOne, sbTwo, sbThree, sbFour, sbFive, skOne, skTwo;
   if ("Custom".equals(presetsSpinner.getSelectedItem())) {
     sbOne = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_ONE, 0);
     sbTwo = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_TWO, 0);
     sbThree = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_THREE, 0);
     sbFour = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_FOUR, 0);
     sbFive = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_CUSTOM_FIVE, 0);
     skOne = prefs.getInt(EQUALIZER_SEEKBAR_CUSTOM_ONE, 0);
     skTwo = prefs.getInt(EQUALIZER_SEEKBAR_CUSTOM_TWO, 0);
   } else {
     sbOne = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_ONE, 0);
     sbTwo = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_TWO, 0);
     sbThree = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_THREE, 0);
     sbFour = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_FOUR, 0);
     sbFive = prefs.getInt(EQUALIZER_VERTICAL_SEEKBAR_FIVE, 0);
     skOne = prefs.getInt(EQUALIZER_SEEKBAR_ONE, 0);
     skTwo = prefs.getInt(EQUALIZER_SEEKBAR_TWO, 0);
   }
   sb1.setProgressAndThumb(sbOne);
   sb2.setProgressAndThumb(sbTwo);
   sb3.setProgressAndThumb(sbThree);
   sb4.setProgressAndThumb(sbFour);
   sb5.setProgressAndThumb(sbFive);
   Utils.changeAtBand(equalizer, band1, sbOne - 15);
   Utils.changeAtBand(equalizer, band2, sbTwo - 15);
   Utils.changeAtBand(equalizer, band2, sbThree - 15);
   Utils.changeAtBand(equalizer, band3, sbFour - 15);
   Utils.changeAtBand(equalizer, band4, sbFive - 15);
   presetsSpinner.setSelection(0);
   Toast.makeText(getApplicationContext(), R.string.user, Toast.LENGTH_SHORT).show();
   sk1.setProgress(skOne);
   sk2.setProgress(skTwo);
   dbChangePg(sbOne, sbTwo, sbThree, sbFour, sbFive, 0, skOne, skTwo);
 }
コード例 #2
0
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
 private void setValues(TextView sbP, VerticalSeekBar sb, short band, int progress) {
   if ("Custom".equals(presetsSpinner.getSelectedItem())) {
     sbP.setText(Integer.toString(progress - 15));
     sb.setProgress(progress);
     Utils.changeAtBand(equalizer, band, progress - 15);
   } else {
     sbP.setText(Integer.toString(progress));
     sb.setProgress(progress + 15);
     Utils.changeAtBand(equalizer, band, progress);
   }
 }
コード例 #3
0
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
  @Override
  public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {

    seekBar.setProgress(progress);

    // ===========================================temporary
    if (seekBar == sk1) {

      BassBoost.Settings settings = bassBoost.getProperties();
      settings.strength = ((short) (progress * 10));
      bassBoost.setProperties(settings);
      if (progress != 0) {
        presetsSpinner.setSelection(0);
      }
      sk1pgs = progress;

    } else if (seekBar == sk2) {

      virtualizer.setStrength((short) (progress * 10));
      if (progress != 0) {
        presetsSpinner.setSelection(0);
      }
      sk2pgs = progress;
    }

    // ===============================================/temporary

    if (progress == 15) progress = 0;
    else progress = progress - 15;

    if (seekBar == sb1) {

      sbP1.setText(Integer.toString(progress));
      presetsSpinner.setSelection(0);
      Utils.changeAtBand(equalizer, band1, progress);

    } else if (seekBar == sb2) {

      sbP2.setText(Integer.toString(progress));
      presetsSpinner.setSelection(0);
      Utils.changeAtBand(equalizer, band2, progress);

    } else if (seekBar == sb3) {

      sbP3.setText(Integer.toString(progress));
      presetsSpinner.setSelection(0);
      Utils.changeAtBand(equalizer, band3, progress);

    } else if (seekBar == sb4) {

      sbP4.setText(Integer.toString(progress));
      presetsSpinner.setSelection(0);
      Utils.changeAtBand(equalizer, band4, progress);

    } else if (seekBar == sb5) {

      sbP5.setText(Integer.toString(progress));
      presetsSpinner.setSelection(0);
      Utils.changeAtBand(equalizer, band5, progress);
    }
    Utils.setEqPrefs(MyEqualizer.this, true);
  }
コード例 #4
-1
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
 public static void setEqualizer(Context context, int audioSessionId) {
   if (Utils.getEqPrefs(context)) {
     Equalizer equalizer = new Equalizer(1, audioSessionId);
     BassBoost bassBoost = new BassBoost(2, audioSessionId);
     Virtualizer virtualizer = new Virtualizer(3, audioSessionId);
     equalizer.setEnabled(true);
     bassBoost.setEnabled(true);
     virtualizer.setEnabled(true);
     ProgressDataSource myProgressDataSource = new ProgressDataSource(context);
     myProgressDataSource.open();
     List<ProgressClass> values = myProgressDataSource.getAllPgs();
     if (values.size() == 0) {
       myProgressDataSource.createProgress(0, 0, 0, 0, 0, 0, 0, 0);
     } else {
       // Set equalizer
       Utils.changeAtBand(equalizer, (short) 0, values.get(0).getProgress(1) - 15);
       Utils.changeAtBand(equalizer, (short) 1, values.get(0).getProgress(2) - 15);
       Utils.changeAtBand(equalizer, (short) 2, values.get(0).getProgress(3) - 15);
       Utils.changeAtBand(equalizer, (short) 3, values.get(0).getProgress(4) - 15);
       Utils.changeAtBand(equalizer, (short) 4, values.get(0).getProgress(5) - 15);
       // Set bassboost
       bassBoost.setStrength((short) (values.get(0).getArc(1) * 10));
       // Set virtualizer
       virtualizer.setStrength((short) (values.get(0).getArc(2) * 10));
     }
   }
 }