fluidsynth/bindings/fluidsynth_jni/java/fluidsynth/Sample.java
derselbst aac2354f5c remove fop-level "fluidsynth" directory node
cd fluidsynth && git mv * ../
2017-09-03 13:30:26 +02:00

39 lines
899 B
Java

package fluidsynth;
public class Sample
{
protected int sampleNum = -1;
protected int rootkey;
protected String filename;
public Sample(String filename, int rootkey) throws FluidException {
sampleNum = newSample(filename, rootkey);
if (sampleNum < 0) {
throw new FluidException("Failed to load the sample (err=" + sampleNum + ")");
}
this.filename = filename;
this.rootkey = rootkey;
}
protected void finalize() {
if (sampleNum >= 0) {
deleteSample(sampleNum);
sampleNum = -1;
}
}
public int getRootKey() {
return rootkey;
}
public String getFileName() {
return filename;
}
int getSampleNum() {
return sampleNum;
}
protected native int newSample(String filename, int rootkey);
protected native void deleteSample(int sampleNum);
}