de.lessvoid.nifty.sound.minim.SoundDeviceMinim Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of nifty-minim-soundsystem Show documentation
Show all versions of nifty-minim-soundsystem Show documentation
Implementation of Nifty's AudioDevice for the Minim audio library
package de.lessvoid.nifty.sound.minim;
import ddf.minim.Minim;
import de.lessvoid.nifty.sound.SoundSystem;
import de.lessvoid.nifty.spi.sound.SoundDevice;
import de.lessvoid.nifty.spi.sound.SoundHandle;
import de.lessvoid.nifty.tools.resourceloader.NiftyResourceLoader;
/**
* Implementation of Nifty's SoundDevice for the Minim Java audio library.
* Minim is an audio library primarily built for use with Processing.
* @author Xuanming
*/
public class SoundDeviceMinim implements SoundDevice {
Minim minim;
NiftyResourceLoader resourceLoader;
/**
* Create an instance of SoundDeviceMinim.
* @param minim Instance of Minim currently in use by Processing (or Java).
*/
public SoundDeviceMinim(Minim minim){
this.minim = minim;
}
@Override
public void setResourceLoader(NiftyResourceLoader niftyResourceLoader) {
this.resourceLoader = niftyResourceLoader;
}
@Override
public SoundHandle loadSound(SoundSystem soundSystem, String filename) {
return new SoundHandleMinim(minim, resourceLoader.getResource(filename).getPath());
}
@Override
public SoundHandle loadMusic(SoundSystem soundSystem, String filename) {
return new SoundHandleMinim(minim, resourceLoader.getResource(filename).getPath());
}
@Override
public void update(int delta) { // Do nothing.
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy