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 DimensionNameSpacegetDimensionNameSpace()DimensionNameSpaceEditable interfacedouble[]getDoubleArray()DimensionNameSpaceEditable interfacevoidkeyPressed(java.awt.event.KeyEvent ev)voidkeyReleased(java.awt.event.KeyEvent ev)Turn note offvoidkeyTyped(java.awt.event.KeyEvent ev)Turn note onstatic voidmain(java.lang.String[] args)voidsetDimensionNameSpace(DimensionNameSpace d)DimensionNameSpaceEditable interfacevoidsetDoubleArray(double[] dar)DimensionNameSpaceEditable interfacevoidsetInstrument(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, validateMethods 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:
keyPressedin interfacejava.awt.event.KeyListener
-
keyTyped
public void keyTyped(java.awt.event.KeyEvent ev)Turn note on- Specified by:
keyTypedin interfacejava.awt.event.KeyListener
-
keyReleased
public void keyReleased(java.awt.event.KeyEvent ev)Turn note off- Specified by:
keyReleasedin 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:
setDimensionNameSpacein interfaceDimensionNameSpaceEditable
-
getDimensionNameSpace
DimensionNameSpaceEditable interface- Specified by:
getDimensionNameSpacein interfaceDimensionNameSpaceEditable
-
getDoubleArray
public double[] getDoubleArray()DimensionNameSpaceEditable interface- Specified by:
getDoubleArrayin interfaceDimensionNameSpaceEditable
-
setDoubleArray
public void setDoubleArray(double[] dar)DimensionNameSpaceEditable interface- Specified by:
setDoubleArrayin interfaceDimensionNameSpaceEditable
-
main
public static void main(java.lang.String[] args)
-