Package jmslexamples
Class KeyboardInstrumentPlayer
java.lang.Object
com.softsynth.jmsl.view.PVPanelAdapter
jmslexamples.KeyboardInstrumentPlayer
- All Implemented Interfaces:
PVComponent
,PVPanel
,DimensionNameSpaceEditable
,java.awt.event.KeyListener
,java.util.EventListener
public class KeyboardInstrumentPlayer extends PVPanelAdapter implements java.awt.event.KeyListener, DimensionNameSpaceEditable
Play an Instrument by typing in a TextArea. Edit all dimensions of instrument
with faders.
Demonstrates the use of Instrument.on() and Instrument.off() as well as
DimensionNameSpaceEditPanel
This example uses both JSyn and MIDI Instruments
This JSyn instrument uses 13 tone equal temperament tuning.
Be sure to type in the TextArea so it can capture your key presses.
- Author:
- Nick Didkovsky, email: nick@didkovsky.com, (c) 2004 Nick Didkovsky, all rights reserved.
-
Constructor Summary
Constructors Constructor Description KeyboardInstrumentPlayer(int rows, int cols)
-
Method Summary
Modifier and Type Method Description DimensionNameSpace
getDimensionNameSpace()
DimensionNameSpaceEditable interfacedouble[]
getDoubleArray()
DimensionNameSpaceEditable interfacevoid
keyPressed(java.awt.event.KeyEvent ev)
void
keyReleased(java.awt.event.KeyEvent ev)
Turn note offvoid
keyTyped(java.awt.event.KeyEvent ev)
Turn note onstatic void
main(java.lang.String[] args)
void
setDimensionNameSpace(DimensionNameSpace d)
DimensionNameSpaceEditable interfacevoid
setDoubleArray(double[] dar)
DimensionNameSpaceEditable interfacevoid
setInstrument(Instrument instrument)
Set instrument, store its DimensionNameSpace, build compatible double[], and build a DimensionNameSpaceEditPanel to change the array's contents.Methods inherited from class com.softsynth.jmsl.view.PVPanelAdapter
add, add, addKeyListener, equals, getBackground, getBounds, getComponent, getFont, getLocation, getParent, hashCode, isEnabled, remove, removeAll, removeKeyListener, setBackground, setEnabled, setFont, setLayout, setLocation, setVisible, toString, validate
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
KeyboardInstrumentPlayer
public KeyboardInstrumentPlayer(int rows, int cols)
-
-
Method Details
-
keyPressed
public void keyPressed(java.awt.event.KeyEvent ev)- Specified by:
keyPressed
in interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent ev)Turn note on- Specified by:
keyTyped
in interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent ev)Turn note off- Specified by:
keyReleased
in interfacejava.awt.event.KeyListener
-
setInstrument
Set instrument, store its DimensionNameSpace, build compatible double[], and build a DimensionNameSpaceEditPanel to change the array's contents. -
setDimensionNameSpace
DimensionNameSpaceEditable interface- Specified by:
setDimensionNameSpace
in interfaceDimensionNameSpaceEditable
-
getDimensionNameSpace
DimensionNameSpaceEditable interface- Specified by:
getDimensionNameSpace
in interfaceDimensionNameSpaceEditable
-
getDoubleArray
public double[] getDoubleArray()DimensionNameSpaceEditable interface- Specified by:
getDoubleArray
in interfaceDimensionNameSpaceEditable
-
setDoubleArray
public void setDoubleArray(double[] dar)DimensionNameSpaceEditable interface- Specified by:
setDoubleArray
in interfaceDimensionNameSpaceEditable
-
main
public static void main(java.lang.String[] args)
-