Sound Library or Minim? Multiple sound files using keyPress

edited April 2016 in Library Questions

Hey all! I'm making a video game and want different sound files to play depending on different parts of the game. I have a menu song, a game song, and a sound effect to play if you die.

I've been using SoundFile and the sound library from Processing, but have been reading a lot about minim on forum posts. Is one option better than another? Anyways, here's the main code...

import processing.sound.*;
SoundFile wingFlap_;
SoundFile inGame_; 
SoundFile menuMusic_;

ArrayList<Integer> x = new ArrayList<Integer>();

ArrayList<Integer> y = new ArrayList<Integer>();


PImage pigeon_;

King king_;

PImage startScreen_;

PImage instructionScreen_;

PImage img_;

boolean gameOver = false;

ArrayList <Obstacle> obstacle_;

boolean gameStart = false;


void setup() {
  size(800, 800);
  x.add(1);
  y.add(1);
  pigeon_ = loadImage("pigeon.png");
  king_ = new King(bs); 
  startScreen_ = loadImage("StartScreen.jpg");
  instructionScreen_ = loadImage("InstructionScreen.jpg");
  obstacle_ = new ArrayList<Obstacle> ();
  wingFlap_ = new SoundFile(this, "pigeonFlight.aiff");
  inGame_ = new SoundFile(this, "InGame.mp3");
  menuMusic_ = new SoundFile(this, "MenuMusic.mp3"); 
}




void draw() {
  background(25, 114, 21);
  noStroke();
  if (gameOver == true) {
    drawGameOver();
    menuMusic_.stop();
    wingFlap_.play();
    wingFlap_.loop();
  } else if (gameStart == false) {
    drawStart();
    menuMusic_.play();
  } else {
    drawPoints();
    drawGame();
    checkCollisions();
    loadObstacles();
    menuMusic_.stop();
    inGame_.play();
  }
}
Tagged:
Sign In or Register to comment.