コード例 #1
0
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
 public void initVirtualizer() {
   try {
     virtualizer = getVirtualizer();
     if (null != virtualizer) {
       virtualizer.setEnabled(true);
       virtualizer.setStrength((short) 0);
     }
   } catch (Exception localException) {
     localException.printStackTrace();
   }
 }
コード例 #2
0
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setContentView(R.layout.equalizer_main);
    if (null == getEqualizer() || null == getVirtualizer() || null == getBassBoost()) finish();
    startService(new Intent(this, MyService.class));
    prefs = getPreferences(MODE_PRIVATE);

    initApp();

    initEqualizer();

    if (Utils.isOn) {
      enableAll();
    } else {
      disableAll();

      onOffBtn.setImageResource(R.drawable.off_btn);
      Utils.isOn = false;

      Log.e("eqActive", Boolean.toString(equalizer.getEnabled()));
      dontTouch.setVisibility(View.VISIBLE);
      equalizer.setEnabled(false);

      equalizer.release();
      bassBoost.release();
      virtualizer.release();
      disableAll();
    }
    super.onCreate(savedInstanceState);
  }
コード例 #3
0
ファイル: MyEqualizer.java プロジェクト: kairon007/UpMobile
  private void initDB() {

    final int DEF = 15;
    myProgressDataSource = new ProgressDataSource(this);
    myProgressDataSource.open();

    values = myProgressDataSource.getAllPgs();

    Log.e("valSize", Integer.toString(values.size()));

    if (values.size() == 0) {
      myProgressDataSource.createProgress(DEF, DEF, DEF, DEF, DEF, 0, 0, 0);
    } else {
      Log.e("valuesPgs", Integer.toString(values.get(0).getProgress(1)));
      int progress;
      presetsSpinner.setSelection(values.get(0).getUser());

      ProgressClass value = values.get(0);
      setValues(sbP1, sb1, band1, value.getProgress(1));
      setValues(sbP2, sb2, band2, value.getProgress(2));
      setValues(sbP3, sb3, band3, value.getProgress(3));
      setValues(sbP4, sb4, band4, value.getProgress(4));
      setValues(sbP5, sb5, band5, value.getProgress(5));
      progress = values.get(0).getArc(1);
      Log.e("dbSK1", Integer.toString(progress));
      sk1.setProgress(progress);
      sk1pgs = progress;
      bassBoost.setStrength((short) (progress * 10));
      progress = values.get(0).getArc(2);
      Log.e("dbSK2", Integer.toString(progress));
      sk2.setProgress(progress);
      sk2pgs = progress;
      virtualizer.setStrength((short) (progress * 10));
    }
    myProgressDataSource.close();
  }
コード例 #4
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);
  }
コード例 #5
-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));
     }
   }
 }