How do use my GUI G4P slider to increase the tempo and volume of my audio file?

edited April 2017 in Library Questions

My sliders are as follows:

public void slider1_change1(GSlider source, GEvent event) { //_CODE_:slider1:634065:
//  println("slider1 - GSlider >> GEvent." + event + " @ " + millis());
tempo = slider1.getValueF();
} //_CODE_:slider1:634065:

public void slider2_change1(GSlider source, GEvent event) { //_CODE_:slider2:997515:
//  println("slider2 - GSlider >> GEvent." + event + " @ " + millis());
  gain = slider2.getValueF();
} //_CODE_:slider2:997515:

Here is my button that plays my audio file in repeat:

public void imgButton1_click1(GImageButton source, GEvent event) { //_CODE_:imgButton1:842456:
  println("imgButton1 - GImageButton >> GEvent." + event + " @ " + millis());
  if (myplayer.isPlaying()) {
  myplayer.pause();
  }
  else  {
  myplayer.loop();
  }
} //_CODE_:imgButton1:842456:

When I click the play/pause button my audio file plays out loud, but I want it to be silent and when I increase the gain the volume increases, along with this the beat plays every second but I want it to increase speed with the slider, help would be greatly appreciated!

My slider values are:

  slider1 = new GSlider(this, 736, 342, 60, 30, 10.0);
  slider1.setRotation(PI/2, GControlMode.CORNER);
  slider1.setLimits(1.0, 1.0, 0.0);
  slider1.setNumberFormat(G4P.DECIMAL, 2);

  slider2 = new GSlider(this, 688, 341, 60, 30, 10.0);
  slider2.setRotation(PI/2, GControlMode.CORNER);
  slider2.setLimits(1.0, 1.0, 0.0);
  slider2.setNumberFormat(G4P.DECIMAL, 2);

Answers

Sign In or Register to comment.