jmslexamples
Class KeyboardInstrumentPlayer

java.lang.Object
  extended by com.softsynth.jmsl.view.PVPanelAdapter
      extended by 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: didkovn@mail.rockefeller.edu, (c) 2004 Nick Didkovsky, all rights reserved.

Constructor Summary
KeyboardInstrumentPlayer(int rows, int cols)
           
 
Method Summary
 DimensionNameSpace getDimensionNameSpace()
          DimensionNameSpaceEditable interface
 double[] getDoubleArray()
          DimensionNameSpaceEditable interface
 void keyPressed(java.awt.event.KeyEvent ev)
           
 void keyReleased(java.awt.event.KeyEvent ev)
          Turn note off
 void keyTyped(java.awt.event.KeyEvent ev)
          Turn note on
static void main(java.lang.String[] args)
           
 void setDimensionNameSpace(DimensionNameSpace d)
          DimensionNameSpaceEditable interface
 void setDoubleArray(double[] dar)
          DimensionNameSpaceEditable interface
 void 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, 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 Detail

KeyboardInstrumentPlayer

public KeyboardInstrumentPlayer(int rows,
                                int cols)
Method Detail

keyPressed

public void keyPressed(java.awt.event.KeyEvent ev)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent ev)
Turn note on

Specified by:
keyTyped in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent ev)
Turn note off

Specified by:
keyReleased in interface java.awt.event.KeyListener

setInstrument

public void setInstrument(Instrument instrument)
Set instrument, store its DimensionNameSpace, build compatible double[], and build a DimensionNameSpaceEditPanel to change the array's contents.


setDimensionNameSpace

public void setDimensionNameSpace(DimensionNameSpace d)
DimensionNameSpaceEditable interface

Specified by:
setDimensionNameSpace in interface DimensionNameSpaceEditable

getDimensionNameSpace

public DimensionNameSpace getDimensionNameSpace()
DimensionNameSpaceEditable interface

Specified by:
getDimensionNameSpace in interface DimensionNameSpaceEditable

getDoubleArray

public double[] getDoubleArray()
DimensionNameSpaceEditable interface

Specified by:
getDoubleArray in interface DimensionNameSpaceEditable

setDoubleArray

public void setDoubleArray(double[] dar)
DimensionNameSpaceEditable interface

Specified by:
setDoubleArray in interface DimensionNameSpaceEditable

main

public static void main(java.lang.String[] args)