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 intaddInstrument(Instrument ins)When Instruments are added to this Mixer, they are implicitely associated with an autoincrementing fader index.intaddInstrument(Instrument ins, double pan, double amp)add Instrument with initial pan and amp values.doublegetAmp(int faderIndex)int[]getFaderIndexes(Instrument ins)faders index(es) associated with an instrument, or NULL if not foundbooleangetFaderMute(int faderNumer)booleangetFaderSolo(int faderNumer)java.awt.ComponentgetGUIComponent()The GUI component is an extra component a Mixer can make available for a layout.InstrumentgetInstrument(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)MixergetMixer(java.lang.String mixerClassName)intgetNumFaders()doublegetPan(int faderIndex)java.awt.ComponentgetPanAmpControlPanel()java.awt.ComponentgetPanAmpControlPanel(int rows, int cols)java.awt.ComponentgetPanAmpControlPanel(int rows, int cols, int hgap, int vgap)static voidmain(java.lang.String[] args)voidmuteChange(int faderIndex, boolean flag)voidpanAmpChange(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 mixervoidremoveInstrument(Instrument ins)Calls removeInstrument(ins) on mixer which owns ins.voidrepatch(Instrument ins)Enumerate all MixerFaders.voidsetFaderMute(int faderNumber, boolean flag)voidsetFaderSolo(int faderNumber, boolean flag)voidsetFromPanAmpPairs(java.util.Vector panAmpPairs)voidsoloChange(int faderIndex, boolean flag)voidstart()Start all mixers in this mixervoidstop()Stop all mixers in this mixervoidwriteXML(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:MixerWhen Instruments are added to this Mixer, they are implicitely associated with an autoincrementing fader index.- Specified by:
addInstrumentin interfaceMixer- Returns:
- number of new faders added to mixer by adding this instrument
-
addInstrument
Description copied from interface:Mixeradd Instrument with initial pan and amp values. Both pan and amp range 0..1- Specified by:
addInstrumentin 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:
removeInstrumentin interfaceMixer
-
setFaderMute
public void setFaderMute(int faderNumber, boolean flag)- Specified by:
setFaderMutein interfaceMixer
-
setFaderSolo
public void setFaderSolo(int faderNumber, boolean flag)- Specified by:
setFaderSoloin interfaceMixer
-
getFaderMute
public boolean getFaderMute(int faderNumer)- Specified by:
getFaderMutein interfaceMixer
-
getFaderSolo
public boolean getFaderSolo(int faderNumer)- Specified by:
getFaderSoloin 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:MixerGet 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:
getInstrumentin interfaceMixer
-
getFaderIndexes
Description copied from interface:Mixerfaders index(es) associated with an instrument, or NULL if not found- Specified by:
getFaderIndexesin interfaceMixer
-
getNumFaders
public int getNumFaders()- Specified by:
getNumFadersin 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:
getGUIComponentin 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:
panAmpChangein interfacePanAmpListener
-
muteChange
public void muteChange(int faderIndex, boolean flag)- Specified by:
muteChangein interfacePanAmpListener
-
soloChange
public void soloChange(int faderIndex, boolean flag)- Specified by:
soloChangein interfacePanAmpListener
-
setFromPanAmpPairs
public void setFromPanAmpPairs(java.util.Vector panAmpPairs) -
writeXML
public void writeXML(java.io.PrintWriter out) throws java.io.IOException- Specified by:
writeXMLin 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)
-