Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Using A Game Controller to Play Sound Files

$
0
0

import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.effects.*; import ddf.minim.signals.*; import ddf.minim.spi.*; import ddf.minim.ugens.*; import net.java.games.input.*; import org.gamecontrolplus.*; import org.gamecontrolplus.gui.*; ControlIO control; ControlDevice stick; Minim minim; AudioPlayer player; public void setup() { size (400, 400); control = ControlIO.getInstance(this); stick = control.getMatchedDevice("DrumController"); minim = new Minim(this); player = minim.loadFile("Kick.wav", 500); if (stick == null) { println("No Device Configured"); System.exit(-1); }} void draw(){ if (stick.getButton("Circle").pressed() == true){ player.rewind(); player.play(); }} I am using this code to use a PS3 controller to play a sound when one of the buttons is pressed. I have the sound file in and controller configuration in my project folder. Any help on reasons that it still won't play the sound when the button is pressed???


Viewing all articles
Browse latest Browse all 2896

Trending Articles