1
package org.herac.tuxguitar.player.impl.midiport.fluidsynth;
5
import org.herac.tuxguitar.player.base.MidiOutputPort;
6
import org.herac.tuxguitar.player.base.MidiReceiver;
8
public class MidiOutputPortImpl extends MidiOutputPort{
10
private MidiSynth synth;
11
private MidiReceiverImpl receiver;
12
private String soundFont;
14
public MidiOutputPortImpl(MidiSynth synth,File soundfont){
15
super(getUniqueKey(soundfont),getUniqueName(soundfont));
16
this.soundFont = soundfont.getAbsolutePath();
17
this.receiver = new MidiReceiverImpl(synth);
22
if(!this.synth.isConnected(this)){
23
this.synth.connect(this);
28
if(this.synth.isConnected(this)){
29
this.synth.disconnect(this);
33
public MidiReceiver getReceiver(){
42
public String getSoundFont() {
43
return this.soundFont;
46
public static String getUniqueKey(File soundfont){
47
return ("tuxguitar-fluidsynth_" + soundfont.getAbsolutePath());
50
private static String getUniqueName(File soundfont){
51
String name = soundfont.getName();
52
int extensionIndex = name.lastIndexOf(".");
53
if( extensionIndex > 0 ){
54
name = name.substring( 0, extensionIndex );
56
return ("TG Fluidsynth " + "[" + name + "]");