Home

  User Manual

  Tool Design

  Project Status

  Downloads

 

Tool Design

Design of Soundwave

Sreeram Sreedharan

Capturing MIDI Events

The first stage in the implementation of Soundwave involved the capturing of MIDI input signals. This was done using the JAVA MIDI API which provides classes and interfaces which simplify this process. We created a class which implements the Receiver interface that provided by the JAVA MIDI API and connected it to a Transmitter object generated by the JAVA API which connects with the MIDI device at a low level.

This custom receiver then decodes this MIDI input, again using some of the defined constants available in the JAVA API. For example, the constant 0x90 (which indicates that the message is a 'NOTE_ON' signal) is available in the ShortMessage class as an integer constant NOTE_ON.

Translation into Keystrokes

The receiver then passes this information onto the KeyboardDriver class. This class then acquires an instance of the MappingEngine class which contains the mappings from MIDI events to Virtual key presses.

Sending Keystrokes to the Operating System

The keyboard driver then uses the Robot class found in the JAVA API to make system calls to the underlying operating system. Since this class is a part of the JAVA API, it can make these operating system calls across all the operating systems that JAVA supports.

Interfacing with other Software

As a bonus, the KeyboardDriver class implements the KeyListener interface, meaning that other programs can set it as an observer to generated KeyEvents.

Testing Framework

Frederick Hallett-Hook

The testing of Soundwave was done using a series of jUnit test cases. The output of the test would be a key press from the robot class. To capture this a JFrame was created with Key Listeners attached when the robot pressed or released keys this JFrame would be the active window and record what key the event was for and if it was pressed or released.

The first tests were to check if Soundwave could handle midi input; this was done by creating ShortCodes (one step down from a MIDI event) which could be easily created for testing. These were created to test pressing of a key, releasing of a key and if the key pressed was the same key produced. Two more tests were created for the pressing and releasing of a pedal device which would act as a shift key.

Two tests were created for the KeyEvent passing method of getting press and release events from another program and 1 final test if the input key was the same as the output for this type of input.











Template from: steves-templates.com