Loading...
Logo
Processing Forum
I've tried to follow the minim documentation to control the volume of the track playing, but I can't get it to work. What am I doing wrong? Here's my code:

Copy code
  1. import ddf.minim.*;
  2. import ddf.minim.signals.*;
  3. import ddf.minim.analysis.*;
  4. import ddf.minim.effects.*;

  5. AudioPlayer gameMusic;
  6. Minim songLoader;
  7. AudioOutput out;

  8. float volLevel = 0;

  9. void setup()
  10. {
  11.   songLoader = new Minim(this);
  12.   startTrack("01.mp3");
  13. }

  14. void draw ()
  15. {
  16.    volLevel = (volLevel + 0.1) % 1;

  17.    updateTrackVol(volLevel);
  18. }

  19. void startTrack (String trackName)
  20. {
  21.     gameMusic = songLoader.loadFile(trackName);
  22.     gameMusic.loop();
  23.   
  24. }

  25. void updateTrackVol (float amount)
  26. {
  27.   out = songLoader.getLineOut();
  28.   out.setVolume(amount);
  29. }

Replies(3)

When I tried your code, I had the following error in the console:
=== Minim Error ===
=== Volume is not supported.

I don't know if it is tied to my system (Windows), my audio driver, the file I chose, or the Minim version...
Also you change the volume too fast, I don't know if it can be audible (if it worked).
I keep getting this message:

=== Minim Error ===
=== Likely buffer underrun in AudioOutput.


What does this mean and how do I fix it?
Maybe you need to add a bufferSize to the Minim object on Line 14 ?