fr.emn.reactiveinput.devices
Class DMidiSynth

java.lang.Object
  extended byfr.emn.reactiveinput.AbstractDevice
      extended byfr.emn.reactiveinput.devices.DMidiSynth
All Implemented Interfaces:
Device, Processor

public class DMidiSynth
extends AbstractDevice

Title: Input Configurator Description: Copyright: Copyright (c) 2001 Company: Ecole des Mines de Nantes

Version:
1.0
Author:
Pierre Dragicevic

Field Summary
 In instrument
           
 In note
           
 In[] notes
           
 In pitch
           
 In play
           
 In pressure
           
 In velocity
           
 In volume
           
 
Fields inherited from class fr.emn.reactiveinput.AbstractDevice
currIndex, ins, outs
 
Fields inherited from interface fr.emn.reactiveinput.Device
AUTO_PROPERTIES
 
Constructor Summary
DMidiSynth()
           
DMidiSynth(java.lang.String name, javax.sound.midi.Synthesizer mididev)
           
 
Method Summary
 void close()
          Add closing code here if needed.
 Device copy()
          Is isCopiable() returns true, copies the device by calling DeviceUtilities.defaultCopy().
 int getChannel()
           
 boolean getMono()
           
 boolean hasExternalOutput()
          Specifies whether this device has external (implicit) output or not.
 Processor open(OpenContext context)
          Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.
protected  void sendInit()
           
protected  void sendNote(boolean on, int note, double velocity)
           
protected  void sendPitch(double value)
           
protected  void sendPressure(int note, double pressure)
           
protected  void sendProgramChange(int program)
           
protected  void sendVolume(double volume)
           
 void setChannel(int channel)
           
 void setMono(boolean value)
           
 void update()
          Updates device's output values.
 
Methods inherited from class fr.emn.reactiveinput.AbstractDevice
addIn, addIn, addOut, doDisable, doEnable, finalize, getError, getIndex, getInfo, getIns, getName, getOuts, getProperties, hasExternalInput, init, insertAt, insertAtEnd, insertBefore, isCopiable, isEnabled, isOpenable, setEnabled, setInfo, setInfo, setLastError, setName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

play

public final In play

note

public final In note

velocity

public final In velocity

pressure

public final In pressure

volume

public final In volume

pitch

public final In pitch

instrument

public final In instrument

notes

public final In[] notes
Constructor Detail

DMidiSynth

public DMidiSynth()

DMidiSynth

public DMidiSynth(java.lang.String name,
                  javax.sound.midi.Synthesizer mididev)
Method Detail

copy

public Device copy()
Description copied from class: AbstractDevice
Is isCopiable() returns true, copies the device by calling DeviceUtilities.defaultCopy(). Returns null if isCopiable() returns false.

Subclass this method if you want to provide another strategy.

Specified by:
copy in interface Device
Overrides:
copy in class AbstractDevice

hasExternalOutput

public boolean hasExternalOutput()
Description copied from class: AbstractDevice
Specifies whether this device has external (implicit) output or not. Returns false by default.

Return false if the device has no border effects. Most of input and processing devices are in this case.

Return true if the device has border effects, such as graphical feedback, or control of some external value. Examples of devices with external output are application-interfacing devices and all user feedback devices.

This method can be used by the editor for the device's graphical representation. However there is at now no clear definition of what is external output.

Specified by:
hasExternalOutput in interface Device
Overrides:
hasExternalOutput in class AbstractDevice

open

public Processor open(OpenContext context)
Description copied from class: AbstractDevice
Subclass this method if you want to specialize data processing, or if you want to perform some initializations before running the device.

By default, open() does nothing and returns the device itself as the Processor (or null if it is not openable): AbstractDevice implements both Device and Processor interfaces, so that you can add processing code directly into the device.

If you want to add specialization features, subclass this method to return a specific processor implementation depending on your device configuration.

Example :

public Processor getProcessor() { if (super.open() == null) return null; // Select the right processor if (in2.isValid()) { return new twoParamProcessor(in1, in2, out); else return new oneParamProcessor(in1, out); }

In this method, you may also perform all necessary pre-running initialization. If initialization fails, return null even if isOpenable() returns true.

In all cases, return null if isOpenable() returns false.

Specified by:
open in interface Device
Overrides:
open in class AbstractDevice
See Also:
Processor, Device.open()

close

public void close()
Description copied from class: AbstractDevice
Add closing code here if needed.

Specified by:
close in interface Device
Overrides:
close in class AbstractDevice

update

public void update()
Description copied from class: AbstractDevice
Updates device's output values.

Subclass init() and update() methods if you want the device to process the data itself. Otherwise, subclass getProcessor() method to use extern processors.

Specified by:
update in interface Processor
Overrides:
update in class AbstractDevice
See Also:
Processor.update()

sendNote

protected void sendNote(boolean on,
                        int note,
                        double velocity)

sendPressure

protected void sendPressure(int note,
                            double pressure)

sendVolume

protected void sendVolume(double volume)

sendProgramChange

protected void sendProgramChange(int program)

sendInit

protected void sendInit()

sendPitch

protected void sendPitch(double value)

getMono

public boolean getMono()

setMono

public void setMono(boolean value)

getChannel

public int getChannel()
Returns:
Returns the channel.

setChannel

public void setChannel(int channel)
Parameters:
channel - The channel to set.