1
package org.herac.tuxguitar.player.impl.midiport.fluidsynth;
5
import org.herac.tuxguitar.player.base.MidiOut;
6
import org.herac.tuxguitar.player.base.MidiPort;
7
import org.herac.tuxguitar.player.impl.midiport.fluidsynth.MidiOutImpl;
9
public class MidiPortImpl extends MidiPort{
11
private MidiSynth synth;
12
private MidiOutImpl midiOut;
13
private String soundFont;
15
public MidiPortImpl(MidiSynth synth,File soundfont){
16
super(getUniqueKey(soundfont),getUniqueName(soundfont));
17
this.soundFont = soundfont.getAbsolutePath();
18
this.midiOut = new MidiOutImpl(synth);
23
if(!this.synth.isConnected(this)){
24
this.synth.connect(this);
29
if(this.synth.isConnected(this)){
30
this.synth.disconnect(this);
43
public String getSoundFont() {
44
return this.soundFont;
47
public static String getUniqueKey(File soundfont){
48
return ("tuxguitar-fluidsynth_" + soundfont.getAbsolutePath());
51
private static String getUniqueName(File soundfont){
52
String name = soundfont.getName();
53
int extensionIndex = name.lastIndexOf(".");
54
if( extensionIndex > 0 ){
55
name = name.substring( 0, extensionIndex );
57
return ("TG Fluidsynth " + "[" + name + "]");