Package com.softsynth.jmsl
Class JMSLMixerContainer
java.lang.Object
com.softsynth.jmsl.JMSLMixerContainer
- All Implemented Interfaces:
Mixer
,PanAmpListener
,XMLWritable
public class JMSLMixerContainer extends java.lang.Object implements Mixer, XMLWritable
A heterogenous Mixer which can accept any Instrument whose getMixerClassName() returns a valid
class name. This Mixer can therefore set up faders for MidiInstruments and JSyn Instruments.
It is really a container of Mixer implementations, which are created by asking the Instrument for
its Mixer classname. It maintains a Hashtable of Mixer classname to Mixer instances. All
instruments with the same Mixer classname will all get added to the same Mixer.
The Faders on this mixer container are mapped to the faders of the Mixer implementations it
contains.
- Author:
- Nick Didkovsky, email: nick@didkovsky.com, (c) 2003 Nick Didkovsky, all rights reserved.
-
Constructor Summary
Constructors Constructor Description JMSLMixerContainer()
-
Method Summary
Modifier and Type Method Description int
addInstrument(Instrument ins)
When Instruments are added to this Mixer, they are implicitely associated with an autoincrementing fader index.int
addInstrument(Instrument ins, double pan, double amp)
add Instrument with initial pan and amp values.double
getAmp(int faderIndex)
int[]
getFaderIndexes(Instrument ins)
faders index(es) associated with an instrument, or NULL if not foundboolean
getFaderMute(int faderNumer)
boolean
getFaderSolo(int faderNumer)
java.awt.Component
getGUIComponent()
The GUI component is an extra component a Mixer can make available for a layout.Instrument
getInstrument(int insIndex)
Get instrument associated with fader index (some instruments may have more than one fader, so you cannot assume fader n goes with ins n)Mixer
getMixer(java.lang.String mixerClassName)
int
getNumFaders()
double
getPan(int faderIndex)
java.awt.Component
getPanAmpControlPanel()
java.awt.Component
getPanAmpControlPanel(int rows, int cols)
java.awt.Component
getPanAmpControlPanel(int rows, int cols, int hgap, int vgap)
static void
main(java.lang.String[] args)
void
muteChange(int faderIndex, boolean flag)
void
panAmpChange(int faderIndex, double pan, double amp)
Pass pan/amp change for this faderindex down to the fader's associated mixer and its asociated fader number on that mixervoid
removeInstrument(Instrument ins)
Calls removeInstrument(ins) on mixer which owns ins.void
repatch(Instrument ins)
Enumerate all MixerFaders.void
setFaderMute(int faderNumber, boolean flag)
void
setFaderSolo(int faderNumber, boolean flag)
void
setFromPanAmpPairs(java.util.Vector panAmpPairs)
void
soloChange(int faderIndex, boolean flag)
void
start()
Start all mixers in this mixervoid
stop()
Stop all mixers in this mixervoid
writeXML(java.io.PrintWriter out)
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
JMSLMixerContainer
public JMSLMixerContainer()
-
-
Method Details
-
addInstrument
Description copied from interface:Mixer
When Instruments are added to this Mixer, they are implicitely associated with an autoincrementing fader index.- Specified by:
addInstrument
in interfaceMixer
- Returns:
- number of new faders added to mixer by adding this instrument
-
addInstrument
Description copied from interface:Mixer
add Instrument with initial pan and amp values. Both pan and amp range 0..1- Specified by:
addInstrument
in interfaceMixer
-
removeInstrument
Calls removeInstrument(ins) on mixer which owns ins. Then removes its own MixerFaders associated with ins. It is the the programmer's task to refresh the GUI as a result, calling getPanAmpPanel() for example, to get a new set of valid components.- Specified by:
removeInstrument
in interfaceMixer
-
setFaderMute
public void setFaderMute(int faderNumber, boolean flag)- Specified by:
setFaderMute
in interfaceMixer
-
setFaderSolo
public void setFaderSolo(int faderNumber, boolean flag)- Specified by:
setFaderSolo
in interfaceMixer
-
getFaderMute
public boolean getFaderMute(int faderNumer)- Specified by:
getFaderMute
in interfaceMixer
-
getFaderSolo
public boolean getFaderSolo(int faderNumer)- Specified by:
getFaderSolo
in interfaceMixer
-
repatch
Enumerate all MixerFaders. For each one whose instrument equals argument, call repatch() on its Mixer implementation -
getMixer
- Returns:
- Mixer contained in this class with the specified classname. Could return null
-
getInstrument
Description copied from interface:Mixer
Get instrument associated with fader index (some instruments may have more than one fader, so you cannot assume fader n goes with ins n)- Specified by:
getInstrument
in interfaceMixer
-
getFaderIndexes
Description copied from interface:Mixer
faders index(es) associated with an instrument, or NULL if not found- Specified by:
getFaderIndexes
in interfaceMixer
-
getNumFaders
public int getNumFaders()- Specified by:
getNumFaders
in interfaceMixer
-
getPan
public double getPan(int faderIndex) -
getAmp
public double getAmp(int faderIndex) -
getGUIComponent
public java.awt.Component getGUIComponent()The GUI component is an extra component a Mixer can make available for a layout. This method collects all components returns by getGUIComponent() by its submixers, into one grid layout- Specified by:
getGUIComponent
in interfaceMixer
-
start
public void start()Start all mixers in this mixer -
stop
public void stop()Stop all mixers in this mixer -
panAmpChange
public void panAmpChange(int faderIndex, double pan, double amp)Pass pan/amp change for this faderindex down to the fader's associated mixer and its asociated fader number on that mixer- Specified by:
panAmpChange
in interfacePanAmpListener
-
muteChange
public void muteChange(int faderIndex, boolean flag)- Specified by:
muteChange
in interfacePanAmpListener
-
soloChange
public void soloChange(int faderIndex, boolean flag)- Specified by:
soloChange
in interfacePanAmpListener
-
setFromPanAmpPairs
public void setFromPanAmpPairs(java.util.Vector panAmpPairs) -
writeXML
public void writeXML(java.io.PrintWriter out) throws java.io.IOException- Specified by:
writeXML
in interfaceXMLWritable
- Throws:
java.io.IOException
-
getPanAmpControlPanel
public java.awt.Component getPanAmpControlPanel()- Returns:
- Panel containing PanAmpPanels to control amp and pan for this mixer
-
getPanAmpControlPanel
public java.awt.Component getPanAmpControlPanel(int rows, int cols) -
getPanAmpControlPanel
public java.awt.Component getPanAmpControlPanel(int rows, int cols, int hgap, int vgap)- Returns:
- Panel with GridLayout containing PanAmpPanels which control this mixer. Specify rows, cols for GridLayout. Follows same rules as GridLayout, where rows=0 means rows added as needed with fixed # cols, and vice versa
-
main
public static void main(java.lang.String[] args)
-