Comparing version 0.8.1 to 0.9.0
# node-midi Changelog | ||
## Version 0.9.0 | ||
* Avoid fatal error closing unopened port. (Andrew Morton) | ||
* Upgraded RtMidi to 2.1.0. (Hugo Hromic) | ||
* Fixed compile warnings on Windows. (Hugo Hromic) | ||
## Version 0.8.1 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "midi", | ||
"version": "v0.8.1", | ||
"version": "v0.9.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "node test/virtual-loopback-test-automated.js" |
145
README.md
@@ -14,7 +14,7 @@ ♪ ♫ ♩ ♬ | ||
* Some version of Xcode (or Command Line Tools) | ||
* Python (for node-gyp) | ||
* Python (for node-gyp) | ||
### Windows | ||
* Microsoft Visual C++(the Express edition works fine) | ||
* Microsoft Visual C++ (the Express edition works fine) | ||
* Python (for node-gyp) | ||
@@ -26,3 +26,3 @@ | ||
* You must have installed and configured ALSA. Without it this module will **NOT** build. | ||
* Install the libasound2-dev package. | ||
* Install the libasound2-dev package. | ||
* Python (for node-gyp) | ||
@@ -48,53 +48,57 @@ | ||
var midi = require('midi'); | ||
```js | ||
var midi = require('midi'); | ||
// Set up a new input. | ||
var input = new midi.input(); | ||
// Set up a new input. | ||
var input = new midi.input(); | ||
// Count the available input ports. | ||
input.getPortCount(); | ||
// Count the available input ports. | ||
input.getPortCount(); | ||
// Get the name of a specified input port. | ||
input.getPortName(0); | ||
// Get the name of a specified input port. | ||
input.getPortName(0); | ||
// Configure a callback. | ||
input.on('message', function(deltaTime, message) { | ||
console.log('m:' + message + ' d:' + deltaTime); | ||
}); | ||
// Configure a callback. | ||
input.on('message', function(deltaTime, message) { | ||
console.log('m:' + message + ' d:' + deltaTime); | ||
}); | ||
// Open the first available input port. | ||
input.openPort(0); | ||
// Open the first available input port. | ||
input.openPort(0); | ||
// Sysex, timing, and active sensing messages are ignored | ||
// by default. To enable these message types, pass false for | ||
// the appropriate type in the function below. | ||
// Order: (Sysex, Timing, Active Sensing) | ||
input.ignoreTypes(false, false, false); | ||
// Sysex, timing, and active sensing messages are ignored | ||
// by default. To enable these message types, pass false for | ||
// the appropriate type in the function below. | ||
// Order: (Sysex, Timing, Active Sensing) | ||
input.ignoreTypes(false, false, false); | ||
// ... receive MIDI messages ... | ||
// ... receive MIDI messages ... | ||
// Close the port when done. | ||
input.closePort(); | ||
// Close the port when done. | ||
input.closePort(); | ||
``` | ||
### Output | ||
var midi = require('midi'); | ||
```js | ||
var midi = require('midi'); | ||
// Set up a new output. | ||
var output = new midi.output(); | ||
// Set up a new output. | ||
var output = new midi.output(); | ||
// Count the available output ports. | ||
output.getPortCount(); | ||
// Count the available output ports. | ||
output.getPortCount(); | ||
// Get the name of a specified output port. | ||
output.getPortName(0); | ||
// Get the name of a specified output port. | ||
output.getPortName(0); | ||
// Open the first available output port. | ||
output.openPort(0); | ||
// Open the first available output port. | ||
output.openPort(0); | ||
// Send a MIDI message. | ||
output.sendMessage([176,22,1]); | ||
// Send a MIDI message. | ||
output.sendMessage([176,22,1]); | ||
// Close the port when done. | ||
output.closePort(); | ||
// Close the port when done. | ||
output.closePort(); | ||
``` | ||
@@ -108,22 +112,24 @@ ### Virtual Ports | ||
var midi = require('midi'); | ||
```js | ||
var midi = require('midi'); | ||
// Set up a new input. | ||
var input = new midi.input(); | ||
// Set up a new input. | ||
var input = new midi.input(); | ||
// Configure a callback. | ||
input.on('message', function(deltaTime, message) { | ||
console.log('m:' + message + ' d:' + deltaTime); | ||
}); | ||
// Configure a callback. | ||
input.on('message', function(deltaTime, message) { | ||
console.log('m:' + message + ' d:' + deltaTime); | ||
}); | ||
// Create a virtual input port. | ||
input.openVirtualPort("Test Input"); | ||
// Create a virtual input port. | ||
input.openVirtualPort("Test Input"); | ||
// A midi device "Test Input" is now available for other | ||
// software to send messages to. | ||
// A midi device "Test Input" is now available for other | ||
// software to send messages to. | ||
// ... receive MIDI messages ... | ||
// ... receive MIDI messages ... | ||
// Close the port when done. | ||
input.closePort(); | ||
// Close the port when done. | ||
input.closePort(); | ||
``` | ||
@@ -138,29 +144,30 @@ The same can be done with output ports. | ||
// create a readable stream | ||
var stream1 = midi.createReadStream(); | ||
```js | ||
// create a readable stream | ||
var stream1 = midi.createReadStream(); | ||
// createReadStream also accepts an optional `input` param | ||
var input = new midi.input(); | ||
input.openVirtualPort('hello world'); | ||
// createReadStream also accepts an optional `input` param | ||
var input = new midi.input(); | ||
input.openVirtualPort('hello world'); | ||
var stream2 = midi.createReadStream(input) | ||
var stream2 = midi.createReadStream(input) | ||
stream2.pipe(require('fs').createWriteStream('something.bin')); | ||
stream2.pipe(require('fs').createWriteStream('something.bin')); | ||
``` | ||
#### Writable Stream | ||
```js | ||
// create a writable stream | ||
var stream1 = midi.createWriteStream(); | ||
// create a writable stream | ||
var stream1 = midi.createWriteStream(); | ||
// createWriteStream also accepts an optional `output` param | ||
var output = new midi.output(); | ||
output.openVirtualPort('hello again'); | ||
// createWriteStream also accepts an optional `output` param | ||
var output = new midi.output(); | ||
output.openVirtualPort('hello again'); | ||
var stream2 = midi.createWriteStream(output); | ||
var stream2 = midi.createWriteStream(output); | ||
require('fs').createReadStream('something.bin').pipe(stream2); | ||
``` | ||
require('fs').createReadStream('something.bin').pipe(stream2); | ||
## References | ||
@@ -178,3 +185,3 @@ | ||
## Contributors | ||
* Luc Deschenaux - [@luxigo](https://github.com/luxigo) | ||
@@ -181,0 +188,0 @@ * Michael Alyn Miller - [@malyn](https://github.com/malyn) |
@@ -7,3 +7,3 @@ /*! \mainpage The RtMidi Tutorial | ||
RtMidi is a set of C++ classes (RtMidiIn, RtMidiOut and API-specific classes) that provides a common API (Application Programming Interface) for realtime MIDI input/output across Linux (ALSA & Jack), Macintosh OS X (CoreMidi & Jack), and Windows (Multimedia Library & Kernel Streaming) operating systems. RtMidi significantly simplifies the process of interacting with computer MIDI hardware and software. It was designed with the following goals: | ||
RtMidi is a set of C++ classes (RtMidiIn, RtMidiOut and API-specific classes) that provides a common API (Application Programming Interface) for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMIDI & JACK), and Windows (Multimedia Library) operating systems. RtMidi significantly simplifies the process of interacting with computer MIDI hardware and software. It was designed with the following goals: | ||
@@ -13,3 +13,3 @@ <UL> | ||
<LI>simple, common API across all supported platforms</LI> | ||
<LI>only two header files and one source file for easy inclusion in programming projects</LI> | ||
<LI>only one header and one source file for easy inclusion in programming projects</LI> | ||
<LI>MIDI device enumeration</LI> | ||
@@ -22,13 +22,13 @@ </UL> | ||
\section whatsnew What's New (Version 2.0) | ||
\section whatsnew What's New (Version 2.1) | ||
No incompatable API changes were made in version 2.0, however, support for multiple compiled APIs (where available) was added (see \ref multi). Other changes include: 1. Added Windows Kernel Streaming support (thanks to Sebastien Alaiwan), though not tested in Visual Studio (and timestamping is not implemented); and 2. Support for the IRIX (SGI) operating system was discontinued. | ||
A minor API change was made. The RtError class was renamed RtMidiError and embedded directly in RtMidi.h. Thus, all references to RtError should be renamed to RtMidiError and the RtError.h file should be deleted. The Windows Kernel Streaming support was removed because it was uncompilable and incomplete. | ||
\section download Download | ||
Latest Release (26 July 2012): <A href="http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-2.0.1.tar.gz">Version 2.0.1</A> | ||
Latest Release (30 March 2014): <A href="http://www.music.mcgill.ca/~gary/rtmidi/release/rtmidi-2.1.0.tar.gz">Version 2.1.0</A> | ||
\section start Getting Started | ||
The first thing that must be done when using RtMidi is to create an instance of the RtMidiIn or RtMidiOut subclasses. RtMidi is an abstract base class, which itself cannot be instantiated. Each default constructor attempts to establish any necessary "connections" with the underlying MIDI system. RtMidi uses C++ exceptions to report errors, necessitating try/catch blocks around many member functions. An RtError can be thrown during instantiation in some circumstances. A warning message may also be reported if no MIDI devices are found during instantiation. The RtMidi classes have been designed to work with "hot pluggable" or virtual (software) MIDI devices, making it possible to connect to MIDI devices that may not have been present when the classes were instantiated. The following code example demonstrates default object construction and destruction: | ||
The first thing that must be done when using RtMidi is to create an instance of the RtMidiIn or RtMidiOut subclasses. RtMidi is an abstract base class, which itself cannot be instantiated. Each default constructor attempts to establish any necessary "connections" with the underlying MIDI system. RtMidi uses C++ exceptions to report errors, necessitating try/catch blocks around many member functions. An RtMidiError can be thrown during instantiation in some circumstances. A warning message may also be reported if no MIDI devices are found during instantiation. The RtMidi classes have been designed to work with "hot pluggable" or virtual (software) MIDI devices, making it possible to connect to MIDI devices that may not have been present when the classes were instantiated. The following code example demonstrates default object construction and destruction: | ||
@@ -47,3 +47,3 @@ \code | ||
} | ||
catch (RtError &error) { | ||
catch (RtMidiError &error) { | ||
// Handle the exception here | ||
@@ -63,15 +63,15 @@ error.printMessage(); | ||
RtMidi uses a C++ exception handler called RtError, which is declared | ||
and defined in RtError.h. The RtError class is quite simple but it | ||
does allow errors to be "caught" by RtError::Type. Many RtMidi | ||
methods can "throw" an RtError, most typically if a driver error | ||
occurs or an invalid function argument is specified. There are a | ||
number of cases within RtMidi where warning messages may be displayed | ||
but an exception is not thrown. There is a protected RtMidi method, | ||
error(), that can be modified to globally control how these messages | ||
are handled and reported. By default, error messages are not | ||
automatically displayed in RtMidi unless the preprocessor definition | ||
__RTMIDI_DEBUG__ is defined during compilation. Messages associated | ||
with caught exceptions can be displayed with, for example, the | ||
RtError::printMessage() function. | ||
RtMidi uses a C++ exception handler called RtMidiError, which is | ||
declared and defined in RtMidi.h. The RtMidiError class is quite | ||
simple but it does allow errors to be "caught" by RtMidiError::Type. | ||
Many RtMidi methods can "throw" an RtMidiError, most typically if a | ||
driver error occurs or an invalid function argument is specified. | ||
There are a number of cases within RtMidi where warning messages may | ||
be displayed but an exception is not thrown. A client error callback | ||
function can be specified (via the RtMidi::setErrorCallback function) | ||
that is invoked when an error occurs. By default, error messages are | ||
not automatically displayed in RtMidi unless the preprocessor | ||
definition __RTMIDI_DEBUG__ is defined during compilation. Messages | ||
associated with caught exceptions can be displayed with, for example, | ||
the RtMidiError::printMessage() function. | ||
@@ -81,3 +81,3 @@ | ||
A programmer may wish to query the available MIDI ports before deciding which to use. The following example outlines how this can be done. | ||
A client generally must query the available MIDI ports before deciding which to use. The following example outlines how this can be done. | ||
@@ -100,3 +100,3 @@ \code | ||
} | ||
catch ( RtError &error ) { | ||
catch ( RtMidiError &error ) { | ||
error.printMessage(); | ||
@@ -114,3 +114,3 @@ exit( EXIT_FAILURE ); | ||
} | ||
catch ( RtError &error ) { | ||
catch ( RtMidiError &error ) { | ||
error.printMessage(); | ||
@@ -126,3 +126,3 @@ goto cleanup; | ||
} | ||
catch ( RtError &error ) { | ||
catch ( RtMidiError &error ) { | ||
error.printMessage(); | ||
@@ -139,3 +139,3 @@ exit( EXIT_FAILURE ); | ||
} | ||
catch (RtError &error) { | ||
catch (RtMidiError &error) { | ||
error.printMessage(); | ||
@@ -225,3 +225,3 @@ goto cleanup; | ||
The RtMidiIn class provides the RtMidiIn::ignoreTypes() function to specify that certain MIDI message types be ignored. By default, sysem exclusive, timing, and active sensing messages are ignored. | ||
The RtMidiIn class provides the RtMidiIn::ignoreTypes() function to specify that certain MIDI message types be ignored. By default, system exclusive, timing, and active sensing messages are ignored. | ||
@@ -346,3 +346,3 @@ \subsection qmidiin Queued MIDI Input | ||
The Linux ALSA and Macintosh CoreMIDI APIs allow for the establishment of virtual input and output MIDI ports to which other software clients can connect. RtMidi incorporates this functionality with the RtMidiIn::openVirtualPort() and RtMidiOut::openVirtualPort() functions. Any messages sent with the RtMidiOut::sendMessage() function will also be transmitted through an open virtual output port. If a virtual input port is open and a user callback function is set, the callback function will be invoked when messages arrive via that port. If a callback function is not set, the user must poll the input queue to check whether messages have arrived. No notification is provided for the establishment of a client connection via a virtual port. | ||
The Linux ALSA, Macintosh CoreMIDI and JACK APIs allow for the establishment of virtual input and output MIDI ports to which other software clients can connect. RtMidi incorporates this functionality with the RtMidiIn::openVirtualPort() and RtMidiOut::openVirtualPort() functions. Any messages sent with the RtMidiOut::sendMessage() function will also be transmitted through an open virtual output port. If a virtual input port is open and a user callback function is set, the callback function will be invoked when messages arrive via that port. If a callback function is not set, the user must poll the input queue to check whether messages have arrived. No notification is provided for the establishment of a client connection via a virtual port. | ||
@@ -371,3 +371,3 @@ \section compiling Compiling | ||
<TD>Linux or Mac</TD> | ||
<TD>Jack MIDI</TD> | ||
<TD>JACK MIDI</TD> | ||
<TD>__UNIX_JACK__</TD> | ||
@@ -379,5 +379,5 @@ <TD><TT>jack</TT></TD> | ||
<TD>Macintosh OS X</TD> | ||
<TD>CoreMidi</TD> | ||
<TD>CoreMIDI</TD> | ||
<TD>__MACOSX_CORE__</TD> | ||
<TD><TT>CoreMidi, CoreAudio, CoreFoundation</TT></TD> | ||
<TD><TT>CoreMIDI, CoreAudio, CoreFoundation</TT></TD> | ||
<TD><TT>g++ -Wall -D__MACOSX_CORE__ -o midiprobe midiprobe.cpp RtMidi.cpp -framework CoreMIDI -framework CoreAudio -framework CoreFoundation</TT></TD> | ||
@@ -392,21 +392,14 @@ </TR> | ||
</TR> | ||
<TR> | ||
<TD>Windows</TD> | ||
<TD>Kernel Streaming</TD> | ||
<TD>__WINDOWS_KS__</TD> | ||
<TD><TT>ks.h, ksmedia.h, setupapi.lib, ksuser.lib, multithreaded</TT></TD> | ||
<TD><I>compiler specific</I></TD> | ||
</TR> | ||
</TABLE> | ||
<P> | ||
The example compiler statements above could be used to compile the <TT>midiprobe.cpp</TT> example file, assuming that <TT>midiprobe.cpp</TT>, <TT>RtMidi.h</TT>, <tt>RtError.h</tt>, and <TT>RtMidi.cpp</TT> all exist in the same directory. | ||
The example compiler statements above could be used to compile the <TT>midiprobe.cpp</TT> example file, assuming that <TT>midiprobe.cpp</TT>, <TT>RtMidi.h</TT> and <TT>RtMidi.cpp</TT> all exist in the same directory. | ||
\section debug Debugging | ||
If you are having problems getting RtMidi to run on your system, try passing the preprocessor definition <TT>__RTMIDI_DEBUG__</TT> to the compiler (or define it in RtMidi.h). A variety of warning messages will be displayed that may help in determining the problem. Also try using the programs included in the <tt>test</tt> directory. The program <tt>midiprobe</tt> displays the queried capabilities of all MIDI ports found. | ||
If you are having problems getting RtMidi to run on your system, try passing the preprocessor definition <TT>__RTMIDI_DEBUG__</TT> to the compiler (or define it in RtMidi.h). A variety of warning messages will be displayed that may help in determining the problem. Also try using the programs included in the <tt>tests</tt> directory. The program <tt>midiprobe</tt> displays the queried capabilities of all MIDI ports found. | ||
\section multi Using Simultaneous Multiple APIs | ||
Support for each MIDI API is encapsulated in specific MidiInApi or MidiOutApi subclasses, making it possible to compile and instantiate multiple API-specific subclasses on a given operating system. For example, one can compile both the CoreMIDI and Jack support on the OS-X operating system by providing the appropriate preprocessor definitions for each. In a run-time situation, one might first attempt to determine whether any Jack ports are available. This can be done by specifying the api argument RtMidi::UNIX_JACK when attempting to create an instance of RtMidiIn or RtMidiOut. If no available ports are found, then an instance of RtMidi with the api argument RtMidi::MACOSX_CORE can be created. Alternately, if no api argument is specified, RtMidi will first look for CoreMIDI ports and if none are found, then Jack ports (in linux, the search order is ALSA and then Jack; in windows, the search order is WinMM and then WinKS). In theory, it should also be possible to have separate instances of RtMidi open at the same time with different underlying API support, though this has not been tested. | ||
Support for each MIDI API is encapsulated in specific MidiInApi or MidiOutApi subclasses, making it possible to compile and instantiate multiple API-specific subclasses on a given operating system. For example, one can compile both CoreMIDI and JACK support on the OS-X operating system by providing the appropriate preprocessor definitions for each. In a run-time situation, one might first attempt to determine whether any JACK ports are available. This can be done by specifying the api argument RtMidi::UNIX_JACK when attempting to create an instance of RtMidiIn or RtMidiOut. If no available ports are found, then an instance of RtMidi with the api argument RtMidi::MACOSX_CORE can be created. Alternately, if no api argument is specified, RtMidi will first look for JACK ports and if none are found, then CoreMIDI ports (in linux, the search order is JACK and then ALSA. In theory, it should also be possible to have separate instances of RtMidi open at the same time with different underlying API support, though this has not been tested. | ||
@@ -421,9 +414,9 @@ The static function RtMidi::getCompiledApi() is provided to determine the available compiled API support. The function RtMidi::getCurrentApi() indicates the API selected for a given RtMidi instance. | ||
RtMidi for Linux was developed using the Fedora distribution. Two different MIDI APIs are supported on Linux platforms: <A href="http://www.alsa-project.org/">ALSA</A> and <A href="http://jackit.sourceforge.net/">Jack</A>. A decision was made to not include support for the OSS API because the OSS API provides such limited functionality and because <A href="http://www.alsa-project.org/">ALSA</A> support is now incorporated in the Linux kernel. The ALSA sequencer and Jack APIs allows for virtual software input and output ports. | ||
RtMidi for Linux was developed using the Fedora distribution. Two different MIDI APIs are supported on Linux platforms: <A href="http://www.alsa-project.org/">ALSA</A> and <A href="http://jackit.sourceforge.net/">JACK</A>. A decision was made to not include support for the OSS API because the OSS API provides very limited functionality and because <A href="http://www.alsa-project.org/">ALSA</A> support is now incorporated in the Linux kernel. The ALSA sequencer and JACK APIs allows for virtual software input and output ports. | ||
\subsection macosx Macintosh OS X (CoreAudio): | ||
The Apple CoreMidi API allows for the establishment of virtual input and output ports to which other software applications can connect. | ||
The Apple CoreMIDI API allows for the establishment of virtual input and output ports to which other software applications can connect. | ||
The RtMidi Jack support can be compiled on Macintosh OS-X systems, as well as in Linux. | ||
The RtMidi JACK support can be compiled on Macintosh OS-X systems, as well as in Linux. | ||
@@ -436,11 +429,13 @@ \subsection windowsds Windows (Multimedia Library): | ||
RtMidi was originally developed with Visual C++ version 6.0. | ||
RtMidi was originally developed with Visual C++ version 6.0 but has been tested with Virtual Studio 2010. | ||
The \c configure script provides support for the MinGW compiler. | ||
\section acknowledge Acknowledgements | ||
\section acknowledge Development & Acknowledgements | ||
Many thanks to the following people for providing bug fixes and improvements: | ||
RtMidi is on github (https://github.com/thestk/rtmidi). Many thanks to the developers that are helping to maintain and improve RtMidi. | ||
In years past, the following people provided bug fixes and improvements: | ||
<UL> | ||
<LI>Sebastien Alaiwan (Jack memory leaks, Windows kernel streaming)</LI> | ||
<LI>Sebastien Alaiwan (JACK memory leaks, Windows kernel streaming)</LI> | ||
<LI>Jean-Baptiste Berruchon (Windows sysex code)</LI> | ||
@@ -458,3 +453,3 @@ <LI>Pedro Lopez-Cabanillas (ALSA sequencer API, client naming)</LI> | ||
<LI>Axel Schmidt (client naming)</LI> | ||
<LI>Alexander Svetalkin (Jack MIDI)</LI> | ||
<LI>Alexander Svetalkin (JACK MIDI)</LI> | ||
<LI>Casey Tucker (OS-X driver information, sysex sending)</LI> | ||
@@ -468,3 +463,3 @@ <LI>Bastiaan Verreijt (Windows sysex multi-buffer code)</LI> | ||
RtMidi: realtime MIDI i/o C++ classes<BR> | ||
Copyright (c) 2003-2012 Gary P. Scavone | ||
Copyright (c) 2003-2014 Gary P. Scavone | ||
@@ -471,0 +466,0 @@ Permission is hereby granted, free of charge, to any person |
@@ -1,7 +0,20 @@ | ||
RtMidi - a set of C++ classes that provides a common API for realtime MIDI input/output across Linux (ALSA & Jack), Macintosh OS X (CoreMidi & Jack), and Windows (Multimedia). | ||
RtMidi - a set of C++ classes that provides a common API for realtime MIDI input/output across Linux (ALSA & JACK), Macintosh OS X (CoreMidi & JACK), and Windows (Multimedia, Kernel Streaming). | ||
By Gary P. Scavone, 2003-2012 | ||
By Gary P. Scavone, 2003-2014 | ||
v2.0.2: (?? 2014) | ||
v2.1.0: (30 March 2014) | ||
- renamed RtError class to RtMidiError and embedded it in RtMidi.h (and deleted RtError.h) | ||
- fix to CoreMidi implementation to support dynamic port changes | ||
- removed global ALSA sequencer objects because they were not thread safe (Martin Koegler) | ||
- fix for ALSA timing ignore flag (Devin Anderson) | ||
- fix for ALSA incorrect use of snd_seq_create_port() function (Tobias Schlemmer) | ||
- fix for international character support in CoreMidi (Martin Finke) | ||
- fix for unicode conversion in WinMM (Dan Wilcox) | ||
- added custom error hook that allows the client to capture an RtMidi error outside of the RtMidi code (Pavel Mogilevskiy) | ||
- added RtMidi::isPortOpen function (Pavel Mogilevskiy) | ||
- updated OS-X sysex sending mechanism to use normal message sending, which fixes a problem where virtual ports didn't receive sysex messages | ||
- Windows update to avoid lockups when shutting down while sending/receiving sysex messages (ptarabbia) | ||
- OS-X fix to avoid empty messages in callbacks when ignoring sysex messages and split sysexes are received (codepainters) | ||
- ALSA openPort fix to better distinguish sender and receiver (Russell Smyth) | ||
- Windows Kernel Streaming support removed because it was uncompilable and incomplete | ||
@@ -17,3 +30,3 @@ v2.0.1: (26 July 2012) | ||
- updated license | ||
- various memory-leak fixes (thanks to Sebastien Alaiwan and Martin Koegler | ||
- various memory-leak fixes (thanks to Sebastien Alaiwan and Martin Koegler) | ||
- fix for continue sysex problem (thanks to Luc Deschenaux) | ||
@@ -20,0 +33,0 @@ - removed SGI (IRIX) support |
@@ -44,2 +44,48 @@ var should = require('should'); | ||
}); | ||
describe('.openPort', function() { | ||
var input = new Midi.input(); | ||
it('requires an argument', function() { | ||
(function() { | ||
input.openPort(); | ||
}).should.throw('First argument must be an integer'); | ||
}); | ||
it('requires an integer', function() { | ||
(function() { | ||
input.openPort('asdf'); | ||
}).should.throw('First argument must be an integer'); | ||
}); | ||
it('requires a valid port', function() { | ||
(function() { | ||
input.openPort(999); | ||
}).should.throw('Invalid MIDI port number'); | ||
}); | ||
}); | ||
describe('.openVirtualPort', function() { | ||
var input = new Midi.input(); | ||
it('requires an argument', function() { | ||
(function() { | ||
input.openVirtualPort(); | ||
}).should.throw('First argument must be a string'); | ||
}); | ||
it('requires a string', function() { | ||
(function() { | ||
input.openVirtualPort(999); | ||
}).should.throw('First argument must be a string'); | ||
}); | ||
}); | ||
describe('.closePort', function() { | ||
var input = new Midi.input(); | ||
it('allows you to close a port that was not opened', function() { | ||
input.closePort(); | ||
}); | ||
}); | ||
}); | ||
@@ -86,2 +132,48 @@ | ||
}); | ||
describe('.openPort', function() { | ||
var output = new Midi.output(); | ||
it('requires an argument', function() { | ||
(function() { | ||
output.openPort(); | ||
}).should.throw('First argument must be an integer'); | ||
}); | ||
it('requires an integer', function() { | ||
(function() { | ||
output.openPort('asdf'); | ||
}).should.throw('First argument must be an integer'); | ||
}); | ||
it('requires a valid port', function() { | ||
(function() { | ||
output.openPort(999); | ||
}).should.throw('Invalid MIDI port number'); | ||
}); | ||
}); | ||
describe('.openVirtualPort', function() { | ||
var output = new Midi.output(); | ||
it('requires an argument', function() { | ||
(function() { | ||
output.openVirtualPort(); | ||
}).should.throw('First argument must be a string'); | ||
}); | ||
it('requires a string', function() { | ||
(function() { | ||
output.openVirtualPort(999); | ||
}).should.throw('First argument must be a string'); | ||
}); | ||
}); | ||
describe('.closePort', function() { | ||
var output = new Midi.output(); | ||
it('allows you to close a port that was not opened', function() { | ||
output.closePort(); | ||
}); | ||
}); | ||
}); |
@@ -23,7 +23,7 @@ var midi = require("../midi.js"); | ||
var input = new midi.input(); | ||
input.on('message', function(deltaTime, message) { | ||
console.log('Input recieved m:' + message + ' d:' + deltaTime); | ||
}); | ||
console.log('Enumerating inputs'); | ||
@@ -37,3 +37,3 @@ for (var i = 0; i < input.getPortCount(); ++i) { | ||
} | ||
console.log('Enumerating outputs'); | ||
@@ -47,3 +47,3 @@ for (var i = 0; i < output.getPortCount(); ++i) { | ||
} | ||
var id = setInterval(function() { | ||
@@ -53,6 +53,6 @@ console.log('Sending message'); | ||
}, 1000); | ||
setTimeout(function() { | ||
clearInterval(id); | ||
setTimeout(function() { | ||
@@ -59,0 +59,0 @@ input.closePort(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
152
1826
210
1068956