com.frinika.synth
Class SynthRack

java.lang.Object
  extended by com.frinika.synth.SynthRack
All Implemented Interfaces:
ChannelListProvider, ListProvider, MidiDeviceIconProvider, MidiListProvider, InstrumentNameListener, javax.sound.midi.MidiDevice, javax.sound.midi.Synthesizer, javax.sound.sampled.Line, javax.sound.sampled.Mixer

public class SynthRack
extends java.lang.Object
implements javax.sound.midi.Synthesizer, InstrumentNameListener, MidiListProvider, ChannelListProvider, MidiDeviceIconProvider, javax.sound.sampled.Mixer

The SynthRack class can hold 16 Frinika soft synths - one for each MidiChannel. Also making it ideal for connecting to your MidiKeyboard for live playing. You can then setup 16 synths and shift between them using the channel switch on your master keyboard.

Author:
Peter Salomonsen

Nested Class Summary
static class SynthRack.SynthRackInfo
           
 
Nested classes/interfaces inherited from interface javax.sound.midi.MidiDevice
javax.sound.midi.MidiDevice.Info
 
Nested classes/interfaces inherited from interface javax.sound.sampled.Mixer
javax.sound.sampled.Mixer.Info
 
Field Summary
static double GAIN
           
 
Constructor Summary
SynthRack(VoiceServer voiceServer)
          Construct a Frinika Synth
 
Method Summary
 void addGlobalInstrumentNameListener(GlobalInstrumentNameListener globalInstrumentNameListener)
           
 void addLineListener(javax.sound.sampled.LineListener listener)
           
 void clearSynths()
           
 void close()
           
 javax.sound.midi.Instrument[] getAvailableInstruments()
           
 javax.sound.midi.MidiChannel[] getChannels()
           
 javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
           
 ControllerListProvider getControllerList()
           
 javax.sound.sampled.Control[] getControls()
           
 javax.sound.midi.Soundbank getDefaultSoundbank()
           
 javax.sound.midi.MidiDevice.Info getDeviceInfo()
           
 javax.swing.Icon getIcon()
           
 long getLatency()
           
 javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line.Info getLineInfo()
           
 java.lang.Object[] getList()
          The position in the returned array must correspond to the channel number.
 javax.sound.midi.Instrument[] getLoadedInstruments()
           
 int getMaxLines(javax.sound.sampled.Line.Info info)
           
 int getMaxPolyphony()
           
 int getMaxReceivers()
           
 int getMaxTransmitters()
           
 long getMicrosecondPosition()
           
 javax.sound.sampled.Mixer.Info getMixerInfo()
           
 int getNumberOfSynths()
           
 javax.sound.midi.Receiver getReceiver()
           
 java.util.List getReceivers()
           
 javax.sound.sampled.Line.Info[] getSourceLineInfo()
           
 javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line[] getSourceLines()
           
 Synth getSynth(int index)
           
 SynthSettings getSynthSetup()
           
 javax.sound.sampled.Line.Info[] getTargetLineInfo()
           
 javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
           
 javax.sound.sampled.Line[] getTargetLines()
           
 float getTempoBPM()
           
 javax.sound.midi.Transmitter getTransmitter()
           
 java.util.List getTransmitters()
           
 VoiceServer getVoiceServer()
           
 javax.sound.midi.VoiceStatus[] getVoiceStatus()
           
 void instrumentNameChange(Synth synth, java.lang.String instrumentName)
           
 boolean isControlSupported(javax.sound.sampled.Control.Type control)
           
 boolean isLineSupported(javax.sound.sampled.Line.Info info)
           
 boolean isOpen()
           
 boolean isSaveReferencedData()
           
 boolean isSoundbankSupported(javax.sound.midi.Soundbank soundbank)
           
 boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines, boolean maintainSync)
           
 void load(java.io.File file)
           
 boolean loadAllInstruments(javax.sound.midi.Soundbank soundbank)
           
 boolean loadInstrument(javax.sound.midi.Instrument instrument)
           
 boolean loadInstruments(javax.sound.midi.Soundbank soundbank, javax.sound.midi.Patch[] patchList)
           
 void loadSynthSetup(SynthSettings setup)
           
 void loadSynthSetupThread(SynthSettings setup)
           
static void main(java.lang.String[] args)
          Local test program for SynthRack with GUI - opens a SynthRack midi device and creates the GUI dialog
 void open()
           
 boolean remapInstrument(javax.sound.midi.Instrument from, javax.sound.midi.Instrument to)
           
 void removeLineListener(javax.sound.sampled.LineListener listener)
           
 void save(java.io.File file)
           
 void setSaveReferencedData(boolean saveReferencedData)
           
 void setSynth(int index, Synth synth)
           
 void setVoiceServer(VoiceServer voiceServer)
           
 void show()
          Frinika specific method to show gui of this synth
 void synchronize(javax.sound.sampled.Line[] lines, boolean maintainSync)
           
 java.lang.String toString()
          over to provide easier GUI manufactoring
 void unloadAllInstruments(javax.sound.midi.Soundbank soundbank)
           
 void unloadInstrument(javax.sound.midi.Instrument instrument)
           
 void unloadInstruments(javax.sound.midi.Soundbank soundbank, javax.sound.midi.Patch[] patchList)
           
 void unsynchronize(javax.sound.sampled.Line[] lines)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GAIN

public static final double GAIN
See Also:
Constant Field Values
Constructor Detail

SynthRack

public SynthRack(VoiceServer voiceServer)
Construct a Frinika Synth

Parameters:
voiceServer -
Throws:
java.lang.Exception
Method Detail

getIcon

public javax.swing.Icon getIcon()
Specified by:
getIcon in interface MidiDeviceIconProvider

setSynth

public void setSynth(int index,
                     Synth synth)

getSynth

public Synth getSynth(int index)

getSynthSetup

public SynthSettings getSynthSetup()

clearSynths

public void clearSynths()

loadSynthSetup

public void loadSynthSetup(SynthSettings setup)

loadSynthSetupThread

public void loadSynthSetupThread(SynthSettings setup)

save

public void save(java.io.File file)

load

public void load(java.io.File file)

getMaxPolyphony

public int getMaxPolyphony()
Specified by:
getMaxPolyphony in interface javax.sound.midi.Synthesizer

getLatency

public long getLatency()
Specified by:
getLatency in interface javax.sound.midi.Synthesizer

getChannels

public javax.sound.midi.MidiChannel[] getChannels()
Specified by:
getChannels in interface javax.sound.midi.Synthesizer

getVoiceStatus

public javax.sound.midi.VoiceStatus[] getVoiceStatus()
Specified by:
getVoiceStatus in interface javax.sound.midi.Synthesizer

isSoundbankSupported

public boolean isSoundbankSupported(javax.sound.midi.Soundbank soundbank)
Specified by:
isSoundbankSupported in interface javax.sound.midi.Synthesizer

loadInstrument

public boolean loadInstrument(javax.sound.midi.Instrument instrument)
Specified by:
loadInstrument in interface javax.sound.midi.Synthesizer

unloadInstrument

public void unloadInstrument(javax.sound.midi.Instrument instrument)
Specified by:
unloadInstrument in interface javax.sound.midi.Synthesizer

remapInstrument

public boolean remapInstrument(javax.sound.midi.Instrument from,
                               javax.sound.midi.Instrument to)
Specified by:
remapInstrument in interface javax.sound.midi.Synthesizer

getDefaultSoundbank

public javax.sound.midi.Soundbank getDefaultSoundbank()
Specified by:
getDefaultSoundbank in interface javax.sound.midi.Synthesizer

getAvailableInstruments

public javax.sound.midi.Instrument[] getAvailableInstruments()
Specified by:
getAvailableInstruments in interface javax.sound.midi.Synthesizer

getLoadedInstruments

public javax.sound.midi.Instrument[] getLoadedInstruments()
Specified by:
getLoadedInstruments in interface javax.sound.midi.Synthesizer

loadAllInstruments

public boolean loadAllInstruments(javax.sound.midi.Soundbank soundbank)
Specified by:
loadAllInstruments in interface javax.sound.midi.Synthesizer

unloadAllInstruments

public void unloadAllInstruments(javax.sound.midi.Soundbank soundbank)
Specified by:
unloadAllInstruments in interface javax.sound.midi.Synthesizer

loadInstruments

public boolean loadInstruments(javax.sound.midi.Soundbank soundbank,
                               javax.sound.midi.Patch[] patchList)
Specified by:
loadInstruments in interface javax.sound.midi.Synthesizer

unloadInstruments

public void unloadInstruments(javax.sound.midi.Soundbank soundbank,
                              javax.sound.midi.Patch[] patchList)
Specified by:
unloadInstruments in interface javax.sound.midi.Synthesizer

getDeviceInfo

public javax.sound.midi.MidiDevice.Info getDeviceInfo()
Specified by:
getDeviceInfo in interface javax.sound.midi.MidiDevice

open

public void open()
Specified by:
open in interface javax.sound.midi.MidiDevice
Specified by:
open in interface javax.sound.sampled.Line

close

public void close()
Specified by:
close in interface javax.sound.midi.MidiDevice
Specified by:
close in interface javax.sound.sampled.Line

isOpen

public boolean isOpen()
Specified by:
isOpen in interface javax.sound.midi.MidiDevice
Specified by:
isOpen in interface javax.sound.sampled.Line

getMicrosecondPosition

public long getMicrosecondPosition()
Specified by:
getMicrosecondPosition in interface javax.sound.midi.MidiDevice

getMaxReceivers

public int getMaxReceivers()
Specified by:
getMaxReceivers in interface javax.sound.midi.MidiDevice

getMaxTransmitters

public int getMaxTransmitters()
Specified by:
getMaxTransmitters in interface javax.sound.midi.MidiDevice

getReceiver

public javax.sound.midi.Receiver getReceiver()
                                      throws javax.sound.midi.MidiUnavailableException
Specified by:
getReceiver in interface javax.sound.midi.MidiDevice
Throws:
javax.sound.midi.MidiUnavailableException

getReceivers

public java.util.List getReceivers()
Specified by:
getReceivers in interface javax.sound.midi.MidiDevice

getTransmitter

public javax.sound.midi.Transmitter getTransmitter()
                                            throws javax.sound.midi.MidiUnavailableException
Specified by:
getTransmitter in interface javax.sound.midi.MidiDevice
Throws:
javax.sound.midi.MidiUnavailableException

getTransmitters

public java.util.List getTransmitters()
Specified by:
getTransmitters in interface javax.sound.midi.MidiDevice

addGlobalInstrumentNameListener

public void addGlobalInstrumentNameListener(GlobalInstrumentNameListener globalInstrumentNameListener)
Parameters:
box -

instrumentNameChange

public void instrumentNameChange(Synth synth,
                                 java.lang.String instrumentName)
Specified by:
instrumentNameChange in interface InstrumentNameListener

getNumberOfSynths

public int getNumberOfSynths()

getVoiceServer

public VoiceServer getVoiceServer()
Returns:
Returns the voiceServer.

toString

public java.lang.String toString()
over to provide easier GUI manufactoring

Overrides:
toString in class java.lang.Object

getList

public java.lang.Object[] getList()
Description copied from interface: ChannelListProvider
The position in the returned array must correspond to the channel number. null entries are allowed.

Specified by:
getList in interface ChannelListProvider
Specified by:
getList in interface ListProvider
Returns:
list of channels provided.

isSaveReferencedData

public boolean isSaveReferencedData()
Returns:
Returns the saveReferencedData.

setSaveReferencedData

public void setSaveReferencedData(boolean saveReferencedData)
Parameters:
saveReferencedData - The saveReferencedData to set.

getControllerList

public ControllerListProvider getControllerList()
Specified by:
getControllerList in interface MidiListProvider

setVoiceServer

public void setVoiceServer(VoiceServer voiceServer)

getLine

public javax.sound.sampled.Line getLine(javax.sound.sampled.Line.Info info)
                                 throws javax.sound.sampled.LineUnavailableException
Specified by:
getLine in interface javax.sound.sampled.Mixer
Throws:
javax.sound.sampled.LineUnavailableException

getMaxLines

public int getMaxLines(javax.sound.sampled.Line.Info info)
Specified by:
getMaxLines in interface javax.sound.sampled.Mixer

getMixerInfo

public javax.sound.sampled.Mixer.Info getMixerInfo()
Specified by:
getMixerInfo in interface javax.sound.sampled.Mixer

getSourceLineInfo

public javax.sound.sampled.Line.Info[] getSourceLineInfo()
Specified by:
getSourceLineInfo in interface javax.sound.sampled.Mixer

getSourceLineInfo

public javax.sound.sampled.Line.Info[] getSourceLineInfo(javax.sound.sampled.Line.Info info)
Specified by:
getSourceLineInfo in interface javax.sound.sampled.Mixer

getSourceLines

public javax.sound.sampled.Line[] getSourceLines()
Specified by:
getSourceLines in interface javax.sound.sampled.Mixer

getTargetLineInfo

public javax.sound.sampled.Line.Info[] getTargetLineInfo()
Specified by:
getTargetLineInfo in interface javax.sound.sampled.Mixer

getTargetLineInfo

public javax.sound.sampled.Line.Info[] getTargetLineInfo(javax.sound.sampled.Line.Info info)
Specified by:
getTargetLineInfo in interface javax.sound.sampled.Mixer

getTargetLines

public javax.sound.sampled.Line[] getTargetLines()
Specified by:
getTargetLines in interface javax.sound.sampled.Mixer

isLineSupported

public boolean isLineSupported(javax.sound.sampled.Line.Info info)
Specified by:
isLineSupported in interface javax.sound.sampled.Mixer

isSynchronizationSupported

public boolean isSynchronizationSupported(javax.sound.sampled.Line[] lines,
                                          boolean maintainSync)
Specified by:
isSynchronizationSupported in interface javax.sound.sampled.Mixer

synchronize

public void synchronize(javax.sound.sampled.Line[] lines,
                        boolean maintainSync)
Specified by:
synchronize in interface javax.sound.sampled.Mixer

unsynchronize

public void unsynchronize(javax.sound.sampled.Line[] lines)
Specified by:
unsynchronize in interface javax.sound.sampled.Mixer

addLineListener

public void addLineListener(javax.sound.sampled.LineListener listener)
Specified by:
addLineListener in interface javax.sound.sampled.Line

getControl

public javax.sound.sampled.Control getControl(javax.sound.sampled.Control.Type control)
Specified by:
getControl in interface javax.sound.sampled.Line

getControls

public javax.sound.sampled.Control[] getControls()
Specified by:
getControls in interface javax.sound.sampled.Line

getLineInfo

public javax.sound.sampled.Line.Info getLineInfo()
Specified by:
getLineInfo in interface javax.sound.sampled.Line

isControlSupported

public boolean isControlSupported(javax.sound.sampled.Control.Type control)
Specified by:
isControlSupported in interface javax.sound.sampled.Line

removeLineListener

public void removeLineListener(javax.sound.sampled.LineListener listener)
Specified by:
removeLineListener in interface javax.sound.sampled.Line

getTempoBPM

public float getTempoBPM()

show

public void show()
Frinika specific method to show gui of this synth


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Local test program for SynthRack with GUI - opens a SynthRack midi device and creates the GUI dialog

Parameters:
args -
Throws:
java.lang.Exception