aboutsummaryrefslogtreecommitdiff
path: root/src/midiio/include
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-11-10 05:52:11 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2005-11-10 05:52:11 +0000
commitceac394c2133d44e81db2eb633ff54a9ad6ce7c5 (patch)
treeadc534407af80a976263c907897907cb13ef1c82 /src/midiio/include
This commit was generated by cvs2svn to compensate for changes in r3865,svn2git-root
which included commits to RCS files with non-trunk default branches. svn path=/trunk/extensions/gripd/; revision=3866
Diffstat (limited to 'src/midiio/include')
-rw-r--r--src/midiio/include/Array.cpp378
-rw-r--r--src/midiio/include/Array.h67
-rw-r--r--src/midiio/include/CircularBuffer.cpp291
-rw-r--r--src/midiio/include/CircularBuffer.h66
-rw-r--r--src/midiio/include/Collection.cpp355
-rw-r--r--src/midiio/include/Collection.h70
-rw-r--r--src/midiio/include/FileIO.h148
-rw-r--r--src/midiio/include/MidiFile.h108
-rw-r--r--src/midiio/include/MidiFileWrite.h61
-rw-r--r--src/midiio/include/MidiIO.h58
-rw-r--r--src/midiio/include/MidiInPort.h98
-rw-r--r--src/midiio/include/MidiInPort_alsa.h107
-rw-r--r--src/midiio/include/MidiInPort_alsa05.h107
-rw-r--r--src/midiio/include/MidiInPort_linux.h94
-rw-r--r--src/midiio/include/MidiInPort_oss.h105
-rw-r--r--src/midiio/include/MidiInPort_unsupported.h89
-rw-r--r--src/midiio/include/MidiInPort_visual.h114
-rw-r--r--src/midiio/include/MidiInput.h53
-rw-r--r--src/midiio/include/MidiMessage.h78
-rw-r--r--src/midiio/include/MidiOutPort.h92
-rw-r--r--src/midiio/include/MidiOutPort_alsa.h79
-rw-r--r--src/midiio/include/MidiOutPort_linux.h80
-rw-r--r--src/midiio/include/MidiOutPort_oss.h75
-rw-r--r--src/midiio/include/MidiOutPort_unsupported.h71
-rw-r--r--src/midiio/include/MidiOutPort_visual.h75
-rw-r--r--src/midiio/include/MidiOutput.h140
-rw-r--r--src/midiio/include/MidiPort.h49
-rw-r--r--src/midiio/include/Options.h106
-rw-r--r--src/midiio/include/Options_private.h73
-rw-r--r--src/midiio/include/Sequencer_alsa.h139
-rw-r--r--src/midiio/include/Sequencer_oss.h92
-rw-r--r--src/midiio/include/SigTimer.h104
-rw-r--r--src/midiio/include/Voice.h70
-rw-r--r--src/midiio/include/gminstruments.h251
-rw-r--r--src/midiio/include/midichannels.h42
-rw-r--r--src/midiio/include/mididefines.h34
-rw-r--r--src/midiio/include/midiiolib.h57
-rw-r--r--src/midiio/include/notenames.h219
-rw-r--r--src/midiio/include/sigConfiguration.h100
39 files changed, 4395 insertions, 0 deletions
diff --git a/src/midiio/include/Array.cpp b/src/midiio/include/Array.cpp
new file mode 100644
index 0000000..044ed2d
--- /dev/null
+++ b/src/midiio/include/Array.cpp
@@ -0,0 +1,378 @@
+//
+// Copyright 1997-1999 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed Feb 5 19:42:53 PST 1997
+// Last Modified: Sun May 11 20:41:28 GMT-0800 1997
+// Last Modified: Wed Jul 7 11:44:50 PDT 1999 (added setAll() function)
+// Filename: ...sig/maint/code/base/Array/Array.cpp
+// Web Address: http://sig.sapp.org/src/sigBase/Array.cpp
+// Syntax: C++
+//
+// Description: An array which can grow dynamically. Array is derived from
+// the Collection class and adds various mathematical operators
+// to the Collection class. The Array template class is used for
+// storing numbers of any type which can be added, multiplied
+// and divided into one another.
+//
+
+#ifndef _ARRAY_CPP_INCLUDED
+#define _ARRAY_CPP_INCLUDED
+
+#include "Array.h"
+#include <iostream>
+#include <stdlib.h>
+
+
+//////////////////////////////
+//
+// Array::Array
+//
+
+template<class type>
+Array<type>::Array(void) : Collection<type>(4) { }
+
+template<class type>
+Array<type>::Array(int arraySize) : Collection<type>(arraySize) { }
+
+template<class type>
+Array<type>::Array(Array<type>& anArray) : Collection<type>(anArray) { }
+
+template<class type>
+Array<type>::Array(int arraySize, type *anArray) :
+ Collection<type>(arraySize, anArray) { }
+
+
+
+
+//////////////////////////////
+//
+// Array::~Array
+//
+
+template<class type>
+Array<type>::~Array() { }
+
+
+
+//////////////////////////////
+//
+// Array::setAll -- sets the contents of each element to the
+// specified value
+//
+
+template<class type>
+void Array<type>::setAll(type aValue) {
+ for (int i=0; i<getSize(); i++) {
+ array[i] = aValue;
+ }
+}
+
+
+
+//////////////////////////////
+//
+// Array::sum
+//
+
+template<class type>
+type Array<type>::sum(void) {
+ type theSum = 0;
+ for (int i=0; i<getSize(); i++) {
+ theSum += array[i];
+ }
+ return theSum;
+}
+
+template<class type>
+type Array<type>::sum(int loIndex, int hiIndex) {
+ type theSum = 0;
+ for (int i=loIndex; i<=hiIndex; i++) {
+ theSum += array[i];
+ }
+ return theSum;
+}
+
+
+
+//////////////////////////////
+//
+// Array::zero(-1, -1)
+//
+
+template<class type>
+void Array<type>::zero(int minIndex, int maxIndex) {
+ if (size == 0) return;
+ if (minIndex == -1) minIndex = 0;
+ if (maxIndex == -1) maxIndex = size-1;
+
+ if (minIndex < 0 || maxIndex < 0 || minIndex > maxIndex ||
+ maxIndex >= size) {
+ cerr << "Error in zero function: min = " << minIndex
+ << " max = " << maxIndex << " size = " << size << endl;
+ exit(1);
+ }
+
+ for (int i=minIndex; i<=maxIndex; i++) {
+ array[i] = 0;
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////
+//
+// operators
+//
+
+
+template<class type>
+int Array<type>::operator==(const Array<type>& aArray) {
+ if (getSize() != aArray.getSize()) {
+ return 0;
+ }
+ Array<type>& t = *this;
+ int i;
+ for (i=0; i<getSize(); i++) {
+ if (t[i] != aArray[i]) {
+ return 0;
+ }
+ }
+ return 1;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator=
+//
+
+template<class type>
+Array<type>& Array<type>::operator=(const Array<type>& anArray) {
+ if (allocSize < anArray.size) {
+ if (allocSize != 0) {
+ delete [] array;
+ }
+ allocSize = anArray.size;
+ size = anArray.size;
+ array = new type[size];
+ allowGrowthQ = anArray.allowGrowthQ;
+ growthAmount = anArray.growthAmount;
+ maxSize = anArray.maxSize;
+ }
+ size = anArray.size;
+ for (int i=0; i<size; i++) {
+ array[i] = anArray.array[i];
+ }
+
+ return *this;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator+=
+//
+
+template<class type>
+Array<type>& Array<type>::operator+=(const Array<type>& anArray) {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ for (int i=0; i<size; i++) {
+ array[i] += anArray.array[i];
+ }
+
+ return *this;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator+
+//
+
+template<class type>
+Array<type> Array<type>::operator+(const Array<type>& anArray) const {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ Array<type> bArray(*this);
+ bArray += anArray;
+ return bArray;
+}
+
+
+template<class type>
+Array<type> Array<type>::operator+(type aNumber) const {
+ Array<type> anArray(*this);
+ for (int i=0; i<size; i++) {
+ anArray[i] += aNumber;
+ }
+ return anArray;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator-=
+//
+
+template<class type>
+Array<type>& Array<type>::operator-=(const Array<type>& anArray) {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ for (int i=0; i<size; i++) {
+ array[i] -= anArray.array[i];
+ }
+
+ return *this;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator-
+//
+
+template<class type>
+Array<type> Array<type>::operator-(const Array<type>& anArray) const {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ Array<type> bArray(*this);
+ bArray -= anArray;
+ return bArray;
+}
+
+
+template<class type>
+Array<type> Array<type>::operator-(void) const {
+ Array<type> anArray(*this);
+ for (int i=0; i<size; i++) {
+ anArray[i] = -anArray[i];
+ }
+ return anArray;
+}
+
+template<class type>
+Array<type> Array<type>::operator-(type aNumber) const {
+ Array<type> anArray(*this);
+ for (int i=0; i<size; i++) {
+ anArray[i] -= aNumber;
+ }
+ return anArray;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator*=
+//
+
+template<class type>
+Array<type>& Array<type>::operator*=(const Array<type>& anArray) {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ for (int i=0; i<size; i++) {
+ array[i] *= anArray.array[i];
+ }
+
+ return *this;
+}
+
+
+
+//////////////////////////////
+//
+// Array::operator*
+//
+
+template<class type>
+Array<type> Array<type>::operator*(const Array<type>& anArray) const {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ Array<type> bArray(*this);
+ bArray *= anArray;
+ return bArray;
+}
+
+
+template<class type>
+Array<type> Array<type>::operator*(type aNumber) const {
+ Array<type> anArray(*this);
+ for (int i=0; i<size; i++) {
+ anArray[i] *= aNumber;
+ }
+ return anArray;
+}
+
+//////////////////////////////
+//
+// Array::operator/=
+//
+
+template<class type>
+Array<type>& Array<type>::operator/=(const Array<type>& anArray) {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ for (int i=0; i<size; i++) {
+ array[i] /= anArray.array[i];
+ }
+
+ return *this;
+}
+
+//////////////////////////////
+//
+// Array::operator/
+//
+
+template<class type>
+Array<type> Array<type>::operator/(const Array<type>& anArray) const {
+ if (size != anArray.size) {
+ cerr << "Error: different size arrays " << size << " and "
+ << anArray.size << endl;
+ exit(1);
+ }
+
+ Array<type> bArray(*this);
+ bArray /= anArray;
+ return bArray;
+}
+
+
+#endif /* _ARRAY_CPP_INCLUDED */
+
+
+
+// md5sum: 8f52a167c93f51702ce316204fd6e722 - Array.cpp =css= 20030102
diff --git a/src/midiio/include/Array.h b/src/midiio/include/Array.h
new file mode 100644
index 0000000..75e08eb
--- /dev/null
+++ b/src/midiio/include/Array.h
@@ -0,0 +1,67 @@
+//
+// Copyright 1997-1999 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed Feb 5 19:42:53 PST 1997
+// Last Modified: Sun May 11 20:33:13 GMT-0800 1997
+// Last Modified: Wed Jul 7 11:44:50 PDT 1999 (added setAll() function)
+// Last Modified: Mon Jul 29 22:08:32 PDT 2002 (added operator==)
+// Filename: ...sig/maint/code/base/Array/Array.h
+// Web Address: http://sig.sapp.org/include/sigBase/Array.h
+// Documentation: http://sig.sapp.org/doc/classes/Array
+// Syntax: C++
+//
+// Description: An array which can grow dynamically. Array is derived from
+// the Collection class and adds various mathematical operators
+// to the Collection class. The Array template class is used for
+// storing numbers of any type which can be added, multiplied
+// and divided into one another.
+//
+
+#ifndef _ARRAY_H_INCLUDED
+#define _ARRAY_H_INCLUDED
+
+#include "Collection.h"
+
+
+template<class type>
+class Array : public Collection<type> {
+ public:
+ Array (void);
+ Array (int arraySize);
+ Array (Array<type>& aArray);
+ Array (int arraySize, type *anArray);
+ ~Array ();
+
+ void setAll (type aValue);
+ type sum (void);
+ type sum (int lowIndex, int hiIndex);
+ void zero (int minIndex = -1, int maxIndex = -1);
+
+ int operator== (const Array<type>& aArray);
+ Array<type>& operator= (const Array<type>& aArray);
+ Array<type>& operator+= (const Array<type>& aArray);
+ Array<type>& operator-= (const Array<type>& aArray);
+ Array<type>& operator*= (const Array<type>& aArray);
+ Array<type>& operator/= (const Array<type>& aArray);
+
+ Array<type> operator+ (const Array<type>& aArray) const;
+ Array<type> operator+ (type aNumber) const;
+ Array<type> operator- (const Array<type>& aArray) const;
+ Array<type> operator- (void) const;
+
+ Array<type> operator- (type aNumber) const;
+ Array<type> operator* (const Array<type>& aArray) const;
+ Array<type> operator* (type aNumber) const;
+ Array<type> operator/ (const Array<type>& aArray) const;
+};
+
+
+#include "Array.cpp" /* necessary for templates */
+
+
+
+#endif /* _ARRAY_H_INCLUDED */
+
+
+
+// md5sum: 09d1b1f8e70ecde53f484548e48f33c3 - Array.h =css= 20030102
diff --git a/src/midiio/include/CircularBuffer.cpp b/src/midiio/include/CircularBuffer.cpp
new file mode 100644
index 0000000..9f4aca6
--- /dev/null
+++ b/src/midiio/include/CircularBuffer.cpp
@@ -0,0 +1,291 @@
+//
+// Copyright 1997-1998 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 19 December 1997
+// Last Modified: Wed Jan 21 23:16:54 GMT-0800 1998
+// Filename: ...sig/maint/code/base/CircularBuffer/CircularBuffer.cpp
+// Web Address: http://sig.sapp.org/src/sigBase/CircularBuffer.cpp
+// Syntax: C++
+//
+// Description: A Circular buffer designed to handle MIDI input,
+// but able to store any type of object. Elements
+// can be read out of the buffer in two ways.
+// (1) from a read pointer which extracts the
+// elements in order by following the write pointer,
+// and (2) from an index operator related to the
+// write pointer's location, for example,
+// object[0] is the last value written into the
+// buffer and object[-1] (or object[1]) is the
+// item written just before that.
+//
+//
+
+#ifndef _CIRCULARBUFFER_CPP_INCLUDED
+#define _CIRCULARBUFFER_CPP_INCLUDED
+
+#include "CircularBuffer.h"
+#include <stdlib.h>
+#include <iostream>
+
+
+//////////////////////////////
+//
+// CircularBuffer::CircularBuffer -- Constructor.
+//
+
+template<class type>
+CircularBuffer<type>::CircularBuffer(void) {
+ size = 0;
+ buffer = NULL;
+ reset();
+}
+
+
+template<class type>
+CircularBuffer<type>::CircularBuffer(int maxElements) {
+ if (maxElements < 0) {
+ std::cerr << "Error: cannot have a negative number of elements: "
+ << maxElements << std::endl;
+ exit(1);
+ }
+ if (maxElements == 0) {
+ size = 0;
+ buffer = NULL;
+ reset();
+ } else {
+ size = maxElements;
+ buffer = new type[maxElements];
+ reset();
+ }
+}
+
+
+template<class type>
+CircularBuffer<type>::CircularBuffer(const CircularBuffer<type>& anotherBuffer) {
+ size = anotherBuffer.size;
+ if (getSize() == 0) {
+ buffer = NULL;
+ reset();
+ } else {
+ buffer = new type[getSize()];
+ writeIndex = anotherBuffer.writeIndex;
+ readIndex = anotherBuffer.readIndex;
+ itemCount = anotherBuffer.itemCount;
+ for (int i=0; i<getSize(); i++) {
+ buffer[i] = anotherBuffer.buffer[i];
+ }
+ }
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::~CircularBuffer -- Destructor.
+// deallocates buffer memory.
+//
+
+template<class type>
+CircularBuffer<type>::~CircularBuffer() {
+ if (buffer != NULL) {
+ delete [] buffer;
+ }
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::capacity -- returns the number of items which
+// can be added to the buffer. Returns a positive number
+// if the buffer has empty locations available. Returns 0 if the
+// buffer is 100% full. Returns a negative number if the
+// buffer has overflowed.
+
+template<class type>
+int CircularBuffer<type>::capacity(void) const {
+ return getSize() - getCount();
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::extract -- reads the next value from the buffer.
+//
+
+template<class type>
+type CircularBuffer<type>::extract(void) {
+ itemCount--;
+ if (itemCount < 0) {
+ std::cerr << "Error: no elements in buffer to extract." << std::endl;
+ exit(1);
+ }
+ increment(readIndex);
+ return buffer[readIndex];
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::getCount -- returns the number of elements
+// between the write index and the read index.
+//
+
+template<class type>
+int CircularBuffer<type>::getCount(void) const {
+ return itemCount;
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::getSize -- returns the allocated size of the buffer.
+//
+
+template<class type>
+int CircularBuffer<type>::getSize(void) const {
+ return size;
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::insert -- add an element to the circular buffer
+//
+
+template<class type>
+void CircularBuffer<type>::insert(const type& anItem) {
+ itemCount++;
+ increment(writeIndex);
+ buffer[writeIndex] = anItem;
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::operator[] -- access an element relative to the
+// currently written element
+//
+
+template<class type>
+type& CircularBuffer<type>::operator[](int index) {
+ if (buffer == NULL) {
+ std::cerr << "Error: buffer has no allocated space" << std::endl;
+ exit(1);
+ }
+ int realIndex = (index < 0) ? -index : index;
+ if (realIndex >= getSize()) {
+ std::cerr << "Error: Invalid access: " << realIndex << ", maximum is "
+ << getSize()-1 << std::endl;
+ exit(1);
+ }
+ realIndex = writeIndex - realIndex;
+
+ // should need to go through this loop a max of one time:
+ while (realIndex < 0) {
+ realIndex += getSize();
+ }
+
+ return buffer[realIndex];
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::read -- an alias for the extract function.
+//
+
+template<class type>
+type CircularBuffer<type>::read(void) {
+ return extract();
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::reset -- throws out all previous data and
+// sets the read/write/count to initial values. The size
+// data variable must be valid before this function is
+// called.
+//
+
+template<class type>
+void CircularBuffer<type>::reset(void) {
+ readIndex = writeIndex = getSize() - 1;
+ itemCount = 0;
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::setSize -- warning: will throw out all previous data
+// stored in buffer.
+//
+
+template<class type>
+void CircularBuffer<type>::setSize(int aSize) {
+ if (aSize < 0) {
+ std::cerr << "Error: cannot have a negative buffer size: " << aSize << std::endl;
+ exit(1);
+ }
+ if (buffer != NULL) {
+ delete [] buffer;
+ }
+
+ if (aSize == 0) {
+ size = aSize;
+ buffer = NULL;
+ reset();
+ } else {
+ size = aSize;
+ buffer = new type[aSize];
+ reset();
+ }
+}
+
+
+
+//////////////////////////////
+//
+// CircularBuffer::write -- an alias for the insert function.
+//
+
+template<class type>
+void CircularBuffer<type>::write(const type& anElement) {
+ write(anElement);
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// private functions
+//
+
+//////////////////////////////
+//
+// CircularBuffer::increment -- adds one to specified index and
+// will automatically wrap the index when it gets too large.
+//
+
+template<class type>
+void CircularBuffer<type>::increment(int& index) {
+ index++;
+ if (index >= getSize()) {
+ index = 0;
+ }
+}
+
+
+#endif /* _CIRCULARBUFFER_CPP_INCLUDED */
+
+
+
+// md5sum: 31b2e8d6efe7398a12ddb0a1b5680ca2 - CircularBuffer.cpp =css= 20030102
diff --git a/src/midiio/include/CircularBuffer.h b/src/midiio/include/CircularBuffer.h
new file mode 100644
index 0000000..6bb3071
--- /dev/null
+++ b/src/midiio/include/CircularBuffer.h
@@ -0,0 +1,66 @@
+//
+// Copyright 1997-1998 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 19 December 1997
+// Last Modified: Wed Jan 21 23:08:13 GMT-0800 1998
+// Filename: ...sig/maint/code/base/CircularBuffer/CircularBuffer.h
+// Web Address: http://sig.sapp.org/include/sigBase/CircularBuffer.cpp
+// Documentation: http://sig.sapp.org/doc/classes/CircularBuffer
+// Syntax: C++
+//
+// Description: A Circular buffer designed to handle MIDI input,
+// but able to store any type of object. Elements
+// can be read out of the buffer in two ways.
+// (1) from a read pointer which extracts the
+// elements in order by following the write pointer,
+// and (2) from an index operator related to the
+// write pointer's location, for example,
+// object[0] is the last value written into the
+// buffer and object[-1] (or object[1]) is the
+// item written just before that.
+//
+
+#ifndef _CIRCULARBUFFER_H_INCLUDED
+#define _CIRCULARBUFFER_H_INCLUDED
+
+
+template<class type>
+class CircularBuffer {
+ public:
+ CircularBuffer (void);
+ CircularBuffer (int maxElements);
+ CircularBuffer (const CircularBuffer<type>&
+ anotherBuffer);
+ ~CircularBuffer ();
+
+ int capacity (void) const;
+ type extract (void);
+ int getCount (void) const;
+ int getSize (void) const;
+ void insert (const type& aMessage);
+ type& operator[] (int index);
+ type read (void);
+ void reset (void);
+ void setSize (int aSize);
+ void write (const type& aMessage);
+
+ protected:
+ type* buffer;
+ int size;
+ int writeIndex;
+ int readIndex;
+ int itemCount;
+
+ void increment (int& index);
+};
+
+
+#include "CircularBuffer.cpp"
+
+
+
+#endif /* _CIRCULARBUFFER_H_INCLUDED */
+
+
+
+// md5sum: 2857693ec37fdcb6df09db479faf110b - CircularBuffer.h =css= 20030102
diff --git a/src/midiio/include/Collection.cpp b/src/midiio/include/Collection.cpp
new file mode 100644
index 0000000..74eef16
--- /dev/null
+++ b/src/midiio/include/Collection.cpp
@@ -0,0 +1,355 @@
+//
+// Copyright 1997 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed Feb 5 19:42:53 PST 1997
+// Last Modified: Wed Apr 23 22:08:34 GMT-0800 1997
+// Last Modified: Fri Sep 14 15:50:52 PDT 2001 (added last() function)
+// Filename: ...sig/maint/code/base/Collection/Collection.cpp
+// Web Address: http://sig.sapp.org/src/sigBase/Collection.cpp
+// Syntax: C++
+//
+// Description: A dynamic array which can grow as necessary.
+// This class can hold any type of item, but the
+// derived Array class is specifically for collections
+// of numbers.
+//
+
+#ifndef _COLLECTION_CPP_INCLUDED
+#define _COLLECTION_CPP_INCLUDED
+
+#include "Collection.h"
+#include <iostream>
+#include <stdlib.h>
+
+
+//////////////////////////////
+//
+// Collection::Collection
+//
+
+template<class type>
+Collection<type>::Collection(void) {
+ allocSize = 0;
+ size = 0;
+ array = NULL;
+ allowGrowthQ = 0;
+ growthAmount = 8;
+ maxSize = 0;
+}
+
+template<class type>
+Collection<type>::Collection(int arraySize) {
+ array = new type[arraySize];
+ size = arraySize;
+ allocSize = arraySize;
+ allowGrowthQ = 0;
+ growthAmount = arraySize;
+ maxSize = 0;
+}
+
+
+template<class type>
+Collection<type>::Collection(int arraySize, type *aCollection) {
+ size = arraySize;
+ allocSize = arraySize;
+ array = new type[size];
+ for (int i=0; i<size; i++) {
+ array[i] = aCollection[i];
+ }
+ growthAmount = arraySize;
+ allowGrowthQ = 0;
+ maxSize = 0;
+}
+
+
+template<class type>
+Collection<type>::Collection(Collection<type>& aCollection) {
+ size = aCollection.size;
+ allocSize = size;
+ array = new type[size];
+ for (int i=0; i<size; i++) {
+ array[i] = aCollection.array[i];
+ }
+ allowGrowthQ = aCollection.allowGrowthQ;
+ growthAmount = aCollection.growthAmount;
+ maxSize = aCollection.maxSize;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::~Collection
+//
+
+template<class type>
+Collection<type>::~Collection() {
+ if (getAllocSize() != 0) {
+ delete [] array;
+ }
+}
+
+
+
+//////////////////////////////
+//
+// Collection::allowGrowth
+// default value: status = 1
+//
+
+template<class type>
+void Collection<type>::allowGrowth(int status) {
+ if (status == 0) {
+ allowGrowthQ = 0;
+ } else {
+ allowGrowthQ = 1;
+ }
+}
+
+
+
+//////////////////////////////
+//
+// Collection::append
+//
+
+template<class type>
+void Collection<type>::append(type& element) {
+ if (size == getAllocSize()) {
+ grow();
+ }
+ array[size] = element;
+ size++;
+}
+
+template<class type>
+void Collection<type>::appendcopy(type element) {
+ if (size == getAllocSize()) {
+ grow();
+ }
+ array[size] = element;
+ size++;
+}
+
+template<class type>
+void Collection<type>::append(type *element) {
+ if (size == getAllocSize()) {
+ grow();
+ }
+ array[size] = *element;
+ size++;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::grow
+// default parameter: growamt = -1
+//
+
+template<class type>
+void Collection<type>::grow(long growamt) {
+ allocSize += growamt > 0 ? growamt : growthAmount;
+ if (maxSize != 0 && getAllocSize() > maxSize) {
+ std::cerr << "Error: Maximum size allowed for array exceeded." << std::endl;
+ exit(1);
+ }
+
+ type *temp = new type[getAllocSize()];
+ for (int i=0; i<size; i++) {
+ temp[i] = array[i];
+ }
+ array = temp;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::pointer
+//
+
+template<class type>
+type* Collection<type>::pointer(void) {
+ return array;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::getBase
+//
+
+template<class type>
+type* Collection<type>::getBase(void) {
+ return array;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::getAllocSize
+//
+
+template<class type>
+long Collection<type>::getAllocSize(void) const {
+ return allocSize;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::getSize --
+//
+
+template<class type>
+long Collection<type>::getSize(void) const {
+ return size;
+}
+
+
+
+//////////////////////////////
+//
+// Collection::last --
+//
+
+template<class type>
+type& Collection<type>::last(void) {
+ return array[getSize()-1];
+}
+
+
+
+//////////////////////////////
+//
+// Collection::setAllocSize
+//
+
+template<class type>
+void Collection<type>::setAllocSize(long aSize) {
+ if (aSize < getSize()) {
+ std::cerr << "Error: cannot set allocated size smaller than actual size."
+ << std::endl;
+ exit(1);
+ }
+
+ if (aSize <= getAllocSize()) {
+ shrinkTo(aSize);
+ } else {
+ grow(aSize-getAllocSize());
+ size = aSize;
+ }
+}
+
+
+
+//////////////////////////////
+//
+// Collection::setGrowth
+// default parameter: growth = -1
+//
+
+template<class type>
+void Collection<type>::setGrowth(long growth) {
+ if (growth > 0) {
+ growthAmount = growth;
+ }
+}
+
+
+
+//////////////////////////////
+//
+// Collection::setSize
+//
+
+template<class type>
+void Collection<type>::setSize(long newSize) {
+ if (newSize <= getAllocSize()) {
+ size = newSize;
+ } else {
+ grow(newSize-getAllocSize());
+ size = newSize;
+ }
+}
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+//
+// Collection operators
+//
+
+//////////////////////////////
+//
+// Collection::operator[]
+//
+
+template<class type>
+type& Collection<type>::operator[](int elementIndex) {
+ if (allowGrowthQ && elementIndex == size) {
+ if (size == getAllocSize()) {
+ grow();
+ }
+ size++;
+ } else if (elementIndex >= size) {
+ std::cerr << "Error: accessing invalid array location "
+ << elementIndex
+ << " Maximum is " << size-1 << std::endl;
+ exit(1);
+ }
+ return array[elementIndex];
+}
+
+
+//////////////////////////////
+//
+// Collection::operator[] const
+//
+
+template<class type>
+type Collection<type>::operator[](int elementIndex) const {
+ if (elementIndex >= size) {
+ std::cerr << "Error: accessing invalid array location "
+ << elementIndex
+ << " Maximum is " << size-1 << std::endl;
+ exit(1);
+ }
+ return array[elementIndex];
+}
+
+//////////////////////////////
+//
+// shrinkTo
+//
+
+template<class type>
+void Collection<type>::shrinkTo(long aSize) {
+ if (aSize < getSize()) {
+ exit(1);
+ }
+
+ type *temp = new type[aSize];
+ for (int i=0; i<size; i++) {
+ temp[i] = array[i];
+ }
+ delete [] array;
+ array = temp;
+
+ allocSize = aSize;
+ if (size > allocSize) {
+ size = allocSize;
+ }
+}
+
+
+#endif /* _COLLECTION_CPP_INCLUDED */
+
+
+
+// md5sum: 9929fee30b1bede4305e1fb46303ddc1 - Collection.cpp =css= 20030102
diff --git a/src/midiio/include/Collection.h b/src/midiio/include/Collection.h
new file mode 100644
index 0000000..6775366
--- /dev/null
+++ b/src/midiio/include/Collection.h
@@ -0,0 +1,70 @@
+//
+// Copyright 1997 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed Feb 5 19:42:53 PST 1997
+// Last Modified: Tue Apr 22 20:28:16 GMT-0800 1997
+// Last Modified: Fri Sep 14 15:50:52 PDT 2001 (added last() function)
+// Filename: ...sig/maint/code/base/Collection/Collection.h
+// Web Address: http://sig.sapp.org/include/sigBase/Collection.h
+// Documentation: http://sig.sapp.org/doc/classes/Collection
+// Syntax: C++
+//
+// Description: A dynamic array which can grow as necessary.
+// This class can hold any type of item, but the
+// derived Array class is specifically for collections
+// of numbers.
+//
+
+#ifndef _COLLECTION_H_INCLUDED
+#define _COLLECTION_H_INCLUDED
+
+
+template<class type>
+class Collection {
+ public:
+ Collection (void);
+ Collection (int arraySize);
+ Collection (int arraySize, type *aCollection);
+ Collection (Collection<type>& aCollection);
+ ~Collection ();
+
+ void allowGrowth (int status = 1);
+ void append (type& element);
+ void appendcopy (type element);
+ void append (type* element);
+ type *getBase (void);
+ long getAllocSize (void) const;
+ long getSize (void) const;
+ type *pointer (void);
+ void setAllocSize (long aSize);
+ void setGrowth (long growth);
+ void setSize (long newSize);
+ type& operator[] (int arrayIndex);
+ type operator[] (int arrayIndex) const;
+ void grow (long growamt = -1);
+ type& last (void);
+
+
+ protected:
+ long size; // actual array size
+ long allocSize; // maximum allowable array size
+ type *array; // where the array data is stored
+ char allowGrowthQ; // allow/disallow growth
+ long growthAmount; // number of elements to grow by if index
+ // element one beyond max size is accessed
+ long maxSize; // the largest size the array is allowed
+ // to grow to, if 0, then ignore max
+
+ void shrinkTo (long aSize);
+};
+
+
+#include "Collection.cpp"
+
+
+
+#endif /* _COLLECTION_H_INCLUDED */
+
+
+
+// md5sum: 01bec04835c0bd117f40c2bfe51c4abd - Collection.h =css= 20030102
diff --git a/src/midiio/include/FileIO.h b/src/midiio/include/FileIO.h
new file mode 100644
index 0000000..fdec5de
--- /dev/null
+++ b/src/midiio/include/FileIO.h
@@ -0,0 +1,148 @@
+//
+// Copyright 1997 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Fri May 9 22:30:32 PDT 1997
+// Last Modified: Sun Dec 14 05:26:16 GMT-0800 1997
+// Filename: ...sig/maint/code/base/FileIO/FileIO.h
+// Web Address: http://sig.sapp.org/include/sigBase/FileIO.h
+// Documentation: http://sig.sapp.org/doc/classes/FileIO
+// Syntax: C++
+//
+// Description: Derived from the fstream class, this class has
+// functions which allow writing binary files in
+// both little and big endian formats. Useful for
+// writing files such as soundfiles and MIDI files
+// which require numbers to be stored in a particular
+// endian format.
+//
+
+#ifndef _FILEIO_H_INCLUDED
+#define _FILEIO_H_INCLUDED
+
+
+#include <fstream>
+
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned long ulong;
+typedef unsigned int uint;
+
+// templates would be nice to use here, but they don't seem
+// to work intuitively...
+
+class FileIO : public std::fstream {
+ public:
+ FileIO (void);
+ FileIO (const char* filename, std::ios::openmode state);
+ ~FileIO ();
+
+ void readBigEndian (char& aNumber);
+ void readBigEndian (uchar& aNumber);
+ void readBigEndian (short& aNumber);
+ void readBigEndian (ushort& aNumber);
+ void readBigEndian (long& aNumber);
+ void readBigEndian (ulong& aNumber);
+ void readBigEndian (int& aNumber);
+ void readBigEndian (uint& aNumber);
+ void readBigEndian (float& aNumber);
+ void readBigEndian (double& aNumber);
+
+ void readLittleEndian (char& aNumber);
+ void readLittleEndian (uchar& aNumber);
+ void readLittleEndian (short& aNumber);
+ void readLittleEndian (ushort& aNumber);
+ void readLittleEndian (long& aNumber);
+ void readLittleEndian (ulong& aNumber);
+ void readLittleEndian (int& aNumber);
+ void readLittleEndian (uint& aNumber);
+ void readLittleEndian (float& aNumber);
+ void readLittleEndian (double& aNumber);
+
+ void readMachineEndian (char& aNumber);
+ void readMachineEndian (uchar& aNumber);
+ void readMachineEndian (short& aNumber);
+ void readMachineEndian (ushort& aNumber);
+ void readMachineEndian (long& aNumber);
+ void readMachineEndian (ulong& aNumber);
+ void readMachineEndian (int& aNumber);
+ void readMachineEndian (uint& aNumber);
+ void readMachineEndian (float& aNumber);
+ void readMachineEndian (double& aNumber);
+
+ void readNotMachineEndian (char& aNumber);
+ void readNotMachineEndian (uchar& aNumber);
+ void readNotMachineEndian (short& aNumber);
+ void readNotMachineEndian (ushort& aNumber);
+ void readNotMachineEndian (long& aNumber);
+ void readNotMachineEndian (ulong& aNumber);
+ void readNotMachineEndian (int& aNumber);
+ void readNotMachineEndian (uint& aNumber);
+ void readNotMachineEndian (float& aNumber);
+ void readNotMachineEndian (double& aNumber);
+
+ void writeBigEndian (char aNumber);
+ void writeBigEndian (uchar aNumber);
+ void writeBigEndian (short aNumber);
+ void writeBigEndian (ushort aNumber);
+ void writeBigEndian (long aNumber);
+ void writeBigEndian (ulong aNumber);
+ void writeBigEndian (int aNumber);
+ void writeBigEndian (uint aNumber);
+ void writeBigEndian (float aNumber);
+ void writeBigEndian (double aNumber);
+
+ void writeLittleEndian (char aNumber);
+ void writeLittleEndian (uchar aNumber);
+ void writeLittleEndian (short aNumber);
+ void writeLittleEndian (ushort aNumber);
+ void writeLittleEndian (long aNumber);
+ void writeLittleEndian (ulong aNumber);
+ void writeLittleEndian (int aNumber);
+ void writeLittleEndian (uint aNumber);
+ void writeLittleEndian (float aNumber);
+ void writeLittleEndian (double aNumber);
+
+ void writeMachineEndian (char aNumber);
+ void writeMachineEndian (uchar aNumber);
+ void writeMachineEndian (short aNumber);
+ void writeMachineEndian (ushort aNumber);
+ void writeMachineEndian (long aNumber);
+ void writeMachineEndian (ulong aNumber);
+ void writeMachineEndian (int aNumber);
+ void writeMachineEndian (uint aNumber);
+ void writeMachineEndian (float aNumber);
+ void writeMachineEndian (double aNumber);
+
+ void writeNotMachineEndian (char aNumber);
+ void writeNotMachineEndian (uchar aNumber);
+ void writeNotMachineEndian (short aNumber);
+ void writeNotMachineEndian (ushort aNumber);
+ void writeNotMachineEndian (long aNumber);
+ void writeNotMachineEndian (ulong aNumber);
+ void writeNotMachineEndian (int aNumber);
+ void writeNotMachineEndian (uint aNumber);
+ void writeNotMachineEndian (float aNumber);
+ void writeNotMachineEndian (double aNumber);
+
+ protected:
+
+ char flipBytes (char aNumber);
+ uchar flipBytes (uchar aNumber);
+ short flipBytes (short aNumber);
+ ushort flipBytes (ushort aNumber);
+ long flipBytes (long aNumber);
+ ulong flipBytes (ulong aNumber);
+ int flipBytes (int aNumber);
+ uint flipBytes (uint aNumber);
+ float flipBytes (float aNumber);
+ double flipBytes (double aNumber);
+
+};
+
+
+
+#endif /* _FILEIO_H_INCLUDED */
+
+
+
+// md5sum: 0a146ebe5c6bd0850be973f612827d20 - FileIO.h =css= 20030102
diff --git a/src/midiio/include/MidiFile.h b/src/midiio/include/MidiFile.h
new file mode 100644
index 0000000..10794d5
--- /dev/null
+++ b/src/midiio/include/MidiFile.h
@@ -0,0 +1,108 @@
+//
+// Copyright 1999-2000 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Fri Nov 26 14:12:01 PST 1999
+// Last Modified: Fri Dec 2 13:26:44 PST 1999
+// Last Modified: Fri Nov 10 12:13:15 PST 2000 (added some more editing cap.)
+// Last Modified: Thu Jan 10 10:03:39 PST 2002 (added allocateEvents())
+// Last Modified: Mon Jun 10 22:43:10 PDT 2002 (added clear())
+// Filename: ...sig/include/sigInfo/MidiFile.h
+// Web Address: http://sig.sapp.org/include/sigInfo/MidiFile.h
+// Syntax: C++
+//
+// Description: A class which can read/write Standard MIDI files.
+// MIDI data is stored by track in an array. This
+// class is used for example in the MidiPerform class.
+//
+
+#ifndef _MIDIfILE_H_INCLUDED
+#define _MIDIfILE_H_INCLUDED
+
+#include "FileIO.h"
+#include "Array.h"
+#include "Collection.h"
+
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned long ulong;
+
+#define TIME_STATE_DELTA 0
+#define TIME_STATE_ABSOLUTE 1
+
+#define TRACK_STATE_SPLIT 0
+#define TRACK_STATE_JOINED 1
+
+
+class _MFEvent {
+ public:
+ _MFEvent (void);
+ _MFEvent (int command);
+ _MFEvent (int command, int param1);
+ _MFEvent (int command, int param1, int param2);
+ _MFEvent (int track, int command, int param1, int param2);
+ _MFEvent (int aTime, int aTrack, int command, int param1, int param2);
+ ~_MFEvent ();
+ int time;
+ int track;
+ Array<uchar> data;
+};
+
+
+
+class MidiFile {
+ public:
+ MidiFile (void);
+ MidiFile (char* aFile);
+ ~MidiFile ();
+
+ void absoluteTime (void);
+ int addEvent (int aTrack, int aTime,
+ Array<uchar>& midiData);
+ int addTrack (void);
+ int addTrack (int count);
+ void allocateEvents (int track, int aSize);
+ void deltaTime (void);
+ void deleteTrack (int aTrack);
+ void erase (void);
+ void clear (void);
+ _MFEvent& getEvent (int aTrack, int anIndex);
+ int getTimeState (void);
+ int getTrackState (void);
+ int getTicksPerQuarterNote (void);
+ int getTrackCount (void);
+ int getNumTracks (void);
+ int getNumEvents (int aTrack);
+ void joinTracks (void);
+ void mergeTracks (int aTrack1, int aTrack2);
+ int read (char* aFile);
+ void setTicksPerQuarterNote (int ticks);
+ void sortTrack (Collection<_MFEvent>& trackData);
+ void sortTracks (void);
+ void splitTracks (void);
+ int write (const char* aFile);
+
+ protected:
+ Collection<Collection<_MFEvent>*> events; // midi file events
+ int ticksPerQuarterNote; // time base of file
+ int trackCount; // # of tracks in file
+ int theTrackState; // joined or split
+ int theTimeState; // absolute or delta
+ char* readFileName; // read file name
+
+ private:
+ void extractMidiData (FileIO& inputfile, Array<uchar>& array,
+ uchar& runningCommand);
+ ulong extractVlvTime (FileIO& inputfile);
+ ulong unpackVLV (uchar a, uchar b, uchar c, uchar d, uchar e);
+ void writeVLValue (long aValue, Array<uchar>& data);
+};
+
+
+int eventcompare(const void* a, const void* b);
+std::ostream& operator<<(std::ostream& out, MidiFile& aMidiFile);
+
+#endif /* _MIDIfILE_H_INCLUDED */
+
+
+
+// md5sum: ff46e64698e2d9e88ebeef3efa9927d0 - MidiFile.h =css= 20030102
diff --git a/src/midiio/include/MidiFileWrite.h b/src/midiio/include/MidiFileWrite.h
new file mode 100644
index 0000000..a213fdf
--- /dev/null
+++ b/src/midiio/include/MidiFileWrite.h
@@ -0,0 +1,61 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Mar 15 10:55:56 GMT-0800 1998
+// Last Modified: Sun Mar 15 10:55:56 GMT-0800 1998
+// Filename: ...sig/code/control/MidiFileWrite/MidiFileWrite.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiFileWrite.h
+// Syntax: C++
+//
+// Description: The MidiFileWrite class will write out a Type 0 MidiFile.
+// Used for recording MIDI data streams into Standard
+// MIDI files.
+//
+
+#ifndef _MIDIFILEWRITE_INCLUDED
+#define _MIDIFILEWRITE_INCLUDED
+
+
+#include "FileIO.h"
+
+
+class MidiFileWrite {
+ public:
+ MidiFileWrite (void);
+ MidiFileWrite (const char* aFilename, int startTime = -1);
+ ~MidiFileWrite ();
+
+ void close (void);
+ void setup (const char* aFilename, int startTime = -1);
+ void start (int startTime = -1);
+ void writeAbsolute (int aTime, int command, int p1, int p2);
+ void writeAbsolute (int aTime, int command, int p1);
+ void writeAbsolute (int aTime, int command);
+ void writeRaw (uchar aByte);
+ void writeRaw (uchar aByte, uchar Byte);
+ void writeRaw (uchar aByte, uchar Byte, uchar cByte);
+ void writeRaw (uchar aByte, uchar Byte, uchar cByte,
+ uchar dByte);
+ void writeRaw (uchar aByte, uchar Byte, uchar cByte,
+ uchar dByte, uchar eByte);
+ void writeRaw (uchar* anArray, int arraySize);
+ void writeRelative (int aTime, int command, int p1, int p2);
+ void writeRelative (int aTime, int command, int p1);
+ void writeRelative (int aTime, int command);
+ void writeVLValue (long aValue);
+
+
+ protected:
+ FileIO *midifile; // file stream for MIDI file
+ long trackSize; // size count for MIDI track
+ int lastPlayTime; // for calculating delta times
+ int openQ; // for checking file status
+
+};
+
+
+
+#endif /* _MIDIFILEWRITE_INCLUDED */
+
+
+
+// md5sum: 44ac572078bff648d096c7e7867d1b3c - MidiFileWrite.h =css= 20030102
diff --git a/src/midiio/include/MidiIO.h b/src/midiio/include/MidiIO.h
new file mode 100644
index 0000000..80c9168
--- /dev/null
+++ b/src/midiio/include/MidiIO.h
@@ -0,0 +1,58 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 21 December 1997
+// Last Modified: Sun Jan 25 15:44:35 GMT-0800 1998
+// Filename: ...sig/code/control/MidiIO/MidiIO.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiIO.h
+// Syntax: C++
+//
+// Description: A unified class for MidiInput and MidiOutput that handles
+// MIDI input and output connections. The Synthesizer
+// and RadioBaton classes are derived from this class.
+//
+
+#ifndef _MIDIIO_H_INCLUDED
+#define _MIDIIO_H_INCLUDED
+
+
+#include "MidiInput.h"
+#include "MidiOutput.h"
+
+
+class MidiIO : public MidiOutput, public MidiInput {
+ public:
+ MidiIO (void);
+ MidiIO (int outPort, int inPort);
+ ~MidiIO ();
+
+ void close (void);
+ void closeInput (void);
+ void closeOutput (void);
+ int getChannelInOffset (void) const;
+ int getChannelOutOffset (void) const;
+ int getInputPort (void);
+ int getInputTrace (void);
+ int getNumInputPorts (void);
+ int getNumOutputPorts (void);
+ int getOutputPort (void);
+ int getOutputTrace (void);
+ int open (void);
+ int openInput (void);
+ int openOutput (void);
+ void setChannelOffset (int anOffset);
+ void setInputPort (int aPort);
+ void setInputTrace (int aState);
+ void setOutputPort (int aPort);
+ void setOutputTrace (int aState);
+ void toggleInputTrace (void);
+ void toggleOutputTrace (void);
+
+};
+
+
+
+#endif /* _MIDIIO_H_INCLUDED */
+
+
+
+// md5sum: 9f6122405c4d9e83994457210217ff22 - MidiIO.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort.h b/src/midiio/include/MidiInPort.h
new file mode 100644
index 0000000..ac225c4
--- /dev/null
+++ b/src/midiio/include/MidiInPort.h
@@ -0,0 +1,98 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed Jan 21 22:35:31 GMT-0800 1998
+// Last Modified: Thu Jan 22 23:13:54 GMT-0800 1998
+// Last Modified: Sat Nov 7 16:09:18 PST 1998
+// Last Modified: Tue Jun 29 16:14:50 PDT 1999 (added Sysex input)
+// Last Modified: Tue May 23 23:08:44 PDT 2000 (oss/alsa selection added)
+// Filename: ...sig/maint/code/control/MidiInPort/MidiInPort.h
+// Web Address: http://sig.sapp.org/include/sig/MidiInPort.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of an
+// operating-system specific MIDI input method.
+// Provides control of all low-level MIDI input
+// functionality such that it will work on all
+// computers in the same manner.
+//
+
+#ifndef _MIDIINPORT_H_INCLUDED
+#define _MIDIINPORT_H_INCLUDED
+
+
+#include "MidiMessage.h"
+
+#ifdef VISUAL
+ #define MIDIINPORT MidiInPort_visual
+ #include "MidiInPort_visual.h"
+#elif defined(LINUX) && defined(ALSA) && defined(OSS)
+ #define MIDIINPORT MidiInPort_linux
+ #include "MidiInPort_linux.h"
+#elif defined(LINUX) && defined(ALSA) && !defined(OSS)
+ #define MIDIINPORT MidiInPort_alsa
+ #include "MidiInPort_alsa.h"
+#elif defined (LINUX) && defined(OSS) && !defined(ALSA)
+ #define MIDIINPORT MidiInPort_oss
+ #include "MidiInPort_oss.h"
+#elif defined(LINUX)
+ #define MIDIINPORT MidiInPort_oss
+ #include "MidiInPort_oss.h"
+#else
+ #define MIDIINPORT MidiInPort_unsupported
+ #include "MidiInPort_unsupported.h"
+#endif
+
+
+class MidiInPort : protected MIDIINPORT {
+ public:
+ MidiInPort (void) : MIDIINPORT() {}
+ MidiInPort (int aPort, int autoOpen = 1) :
+ MIDIINPORT(aPort, autoOpen) {}
+ ~MidiInPort() { }
+
+ void clearSysex(void) { MIDIINPORT::clearSysex(); }
+ void clearSysex(int buffer) { MIDIINPORT::clearSysex(buffer); }
+ void close(void) { MIDIINPORT::close(); }
+ void closeAll(void) { MIDIINPORT::closeAll(); }
+ MidiMessage extract(void) { return MIDIINPORT::extract(); }
+ int getBufferSize(void) { return MIDIINPORT::getBufferSize(); }
+ int getChannelOffset(void) const {
+ return MIDIINPORT::getChannelOffset(); }
+ int getCount(void) { return MIDIINPORT::getCount(); }
+ const char* getName(void) { return MIDIINPORT::getName(); }
+ static const char* getName(int i) { return MIDIINPORT::getName(i); }
+ static int getNumPorts(void) {
+ return MIDIINPORT::getNumPorts(); }
+ int getPort(void) { return MIDIINPORT::getPort(); }
+ int getPortStatus(void){
+ return MIDIINPORT::getPortStatus(); }
+ uchar* getSysex(int buffer) { return MIDIINPORT::getSysex(buffer); }
+ int getSysexSize(int buffer) { return MIDIINPORT::getSysexSize(buffer); }
+ int getTrace(void) { return MIDIINPORT::getTrace(); }
+ void insert(const MidiMessage& aMessage) {
+ MIDIINPORT::insert(aMessage); }
+ int installSysex(uchar* anArray, int aSize) {
+ return MIDIINPORT::installSysex(anArray, aSize); }
+ int open(void) { return MIDIINPORT::open(); }
+ MidiMessage& operator[](int index) {
+ return MIDIINPORT::message(index); }
+ void pause(void) { MIDIINPORT::pause(); }
+ void setBufferSize(int aSize) {
+ MIDIINPORT::setBufferSize(aSize); }
+ void setChannelOffset(int anOffset) {
+ MIDIINPORT::setChannelOffset(anOffset); }
+ void setAndOpenPort(int aPort) { setPort(aPort); open(); }
+ void setPort(int aPort) { MIDIINPORT::setPort(aPort); }
+ int setTrace(int aState) {
+ return MIDIINPORT::setTrace(aState); }
+ void toggleTrace(void) { MIDIINPORT::toggleTrace(); }
+ void unpause(void) { MIDIINPORT::unpause(); }
+};
+
+
+
+#endif /* _MIDIINPORT_H_INCLUDED */
+
+
+
+// md5sum: 96f8a2b4411a356d1b73cd96421b8931 - MidiInPort.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort_alsa.h b/src/midiio/include/MidiInPort_alsa.h
new file mode 100644
index 0000000..b321600
--- /dev/null
+++ b/src/midiio/include/MidiInPort_alsa.h
@@ -0,0 +1,107 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun May 14 22:05:27 PDT 2000
+// Last Modified: Sat Oct 13 16:11:24 PDT 2001 (updated for ALSA 0.9)
+// Last Modified: Sat Nov 2 20:35:50 PST 2002 (added #ifdef ALSA)
+// Filename: ...sig/maint/code/control/MidiInPort/linux/MidiInPort_alsa.h
+// Web Address: http://sig.sapp.org/include/sig/MidiInPort_alsa.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of
+// linux ALSA sound driver's specific MIDI input methods.
+// This class is inherited privately by the MidiInPort class.
+//
+
+#ifndef _MIDIINPORT_ALSA_H_INCLUDED
+#define _MIDIINPORT_ALSA_H_INCLUDED
+
+#ifdef LINUX
+#ifdef ALSA
+
+#include "MidiMessage.h"
+#include "CircularBuffer.h"
+#include "Array.h"
+#include "Sequencer_alsa.h"
+#include "SigTimer.h"
+#include <pthread.h>
+
+typedef unsigned char uchar;
+typedef void (*MIDI_Callback_function)(int arrivalPort);
+
+
+class MidiInPort_alsa : public Sequencer_alsa {
+ public:
+ MidiInPort_alsa (void);
+ MidiInPort_alsa (int aPort, int autoOpen = 1);
+ ~MidiInPort_alsa ();
+
+ void clearSysex (int buffer);
+ void clearSysex (void);
+ void close (void);
+ void closeAll (void);
+ MidiMessage extract (void);
+ int getBufferSize (void);
+ int getChannelOffset (void) const;
+ int getCount (void);
+ const char* getName (void);
+ static const char* getName (int i);
+ static int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ uchar* getSysex (int buffer);
+ int getSysexSize (int buffer);
+ int getTrace (void);
+ void insert (const MidiMessage& aMessage);
+ int installSysex (uchar* anArray, int aSize);
+ MidiMessage& message (int index);
+ int open (void);
+ void pause (void);
+ void setBufferSize (int aSize);
+ void setChannelOffset (int anOffset);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ void toggleTrace (void);
+ void unpause (void);
+
+ static Array<int> threadinitport;
+
+ protected:
+ int port; // the port to which this object belongs
+
+ static MIDI_Callback_function callbackFunction;
+
+ static int installSysexPrivate (int port,
+ uchar* anArray, int aSize);
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* trace; // for verifying input
+ static std::ostream* tracedisplay; // stream for displaying trace
+ static int numDevices; // number of input ports
+ static CircularBuffer<MidiMessage>** midiBuffer; // MIDI storage frm ports
+ static int channelOffset; // channel offset, either 0 or 1
+ // not being used right now.
+ static int* pauseQ; // for adding items to Buffer or not
+ static SigTimer midiTimer; // for timing MIDI input
+ static Array<pthread_t> midiInThread; // for MIDI input thread function
+ static int* sysexWriteBuffer; // for MIDI sysex write location
+ static Array<uchar>** sysexBuffers; // for MIDI sysex storage
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+
+
+ friend void *interpretMidiInputStreamPrivateALSA(void * x);
+
+};
+
+
+#endif /* ALSA */
+#endif /* LINUX */
+
+#endif /* _MIDIINPORT_ALSA_H_INCLUDED */
+
+
+
+// md5sum: 260a0accd6b08b638a00904c382293bc - MidiInPort_alsa.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort_alsa05.h b/src/midiio/include/MidiInPort_alsa05.h
new file mode 100644
index 0000000..27af569
--- /dev/null
+++ b/src/midiio/include/MidiInPort_alsa05.h
@@ -0,0 +1,107 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun May 14 22:05:27 PDT 2000
+// Last Modified: Wed Oct 3 22:28:20 PDT 2001 (frozen for ALSA 0.5)
+// Last Modified: Thu Jan 2 18:55:12 PST 2003 (added #ifdef ALSA05)
+// Filename: ...sig/maint/code/control/MidiInPort/linux/MidiInPort_alsa05.h
+// Web Address: http://sig.sapp.org/include/sig/MidiInPort_alsa05.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of
+// linux ALSA sound driver's specific MIDI input methods.
+// This class is inherited privately by the MidiInPort class.
+//
+
+#ifndef _MIDIINPORT_ALSA05_H_INCLUDED
+#define _MIDIINPORT_ALSA05_H_INCLUDED
+
+#ifdef LINUX
+#ifdef ALSA05
+
+#include "MidiMessage.h"
+#include "CircularBuffer.h"
+#include "Array.h"
+#include "Sequencer_alsa05.h"
+#include "SigTimer.h"
+#include <pthread.h>
+
+typedef unsigned char uchar;
+typedef void (*MIDI_Callback_function)(int arrivalPort);
+
+
+class MidiInPort_alsa05 : public Sequencer_alsa05 {
+ public:
+ MidiInPort_alsa05 (void);
+ MidiInPort_alsa05 (int aPort, int autoOpen = 1);
+ ~MidiInPort_alsa05 ();
+
+ void clearSysex (int buffer);
+ void clearSysex (void);
+ void close (void);
+ void closeAll (void);
+ MidiMessage extract (void);
+ int getBufferSize (void);
+ int getChannelOffset (void) const;
+ int getCount (void);
+ const char* getName (void);
+ static const char* getName (int i);
+ static int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ uchar* getSysex (int buffer);
+ int getSysexSize (int buffer);
+ int getTrace (void);
+ void insert (const MidiMessage& aMessage);
+ int installSysex (uchar* anArray, int aSize);
+ MidiMessage& message (int index);
+ int open (void);
+ void pause (void);
+ void setBufferSize (int aSize);
+ void setChannelOffset (int anOffset);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ void toggleTrace (void);
+ void unpause (void);
+
+ static Array<int> threadinitport;
+
+ protected:
+ int port; // the port to which this object belongs
+
+ static MIDI_Callback_function callbackFunction;
+
+ static int installSysexPrivate (int port,
+ uchar* anArray, int aSize);
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* trace; // for verifying input
+ static ostream* tracedisplay; // stream for displaying trace
+ static int numDevices; // number of input ports
+ static CircularBuffer<MidiMessage>** midiBuffer; // MIDI storage frm ports
+ static int channelOffset; // channel offset, either 0 or 1
+ // not being used right now.
+ static int* pauseQ; // for adding items to Buffer or not
+ static SigTimer midiTimer; // for timing MIDI input
+ static Array<pthread_t> midiInThread; // for MIDI input thread function
+ static int* sysexWriteBuffer; // for MIDI sysex write location
+ static Array<uchar>** sysexBuffers; // for MIDI sysex storage
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+
+
+ friend void *interpretMidiInputStreamPrivateALSA05(void * x);
+
+};
+
+
+#endif /* ALSA05 */
+#endif /* LINUX */
+
+#endif /* _MIDIINPORT_ALSA05_H_INCLUDED */
+
+
+
+// md5sum: 7b85b4a658c6f1d45dc1da7752f25cae - MidiInPort_alsa05.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort_linux.h b/src/midiio/include/MidiInPort_linux.h
new file mode 100644
index 0000000..589d27a
--- /dev/null
+++ b/src/midiio/include/MidiInPort_linux.h
@@ -0,0 +1,94 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun May 14 22:30:04 PDT 2000
+// Last Modified: Thu May 18 23:36:07 PDT 2000 (added ifdef LINUX lines)
+// Last Modified: Sat Nov 2 20:37:49 PST 2002 (added ifdef ALSA OSS)
+// Filename: ...sig/maint/code/control/MidiInPort/MidiInPort_linux.h
+// Web Address: http://sig.sapp.org/include/sig/MidiInPort_linux.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of an
+// operating-system specific MIDI input method.
+// Provides control of all low-level MIDI input
+// functionality such that it will work on all
+// computers in the same manner.
+//
+
+#ifndef _MIDIINPORT_LINUX_H_INCLUDED
+#define _MIDIINPORT_LINUX_H_INCLUDED
+
+#ifdef LINUX
+#if defined(ALSA) && defined(OSS)
+
+#define MIDI_IN_UNKNOWN_SELECT 0
+#define MIDI_IN_OSS_SELECT 1
+#define MIDI_IN_ALSA_SELECT 2
+
+#include "MidiInPort_oss.h"
+#include "MidiInPort_alsa.h"
+#include "MidiInPort_unsupported.h"
+#include "MidiMessage.h"
+
+
+class MidiInPort_linux {
+ public:
+ MidiInPort_linux(void);
+ MidiInPort_linux(int aPort, int autoOpen = 1);
+ ~MidiInPort_linux();
+
+ void clearSysex (void);
+ void clearSysex (int buffer);
+ void close (void);
+ void closeAll (void);
+ MidiMessage extract (void);
+ int getBufferSize (void);
+ int getChannelOffset (void) const;
+ int getCount (void);
+ const char* getName (void);
+ static const char* getName (int i);
+ static int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ uchar* getSysex (int buffer);
+ int getSysexSize (int buffer);
+ int getTrace (void);
+ void insert (const MidiMessage& aMessage);
+ int installSysex (uchar* anArray, int aSize);
+ MidiMessage& message (int index);
+ int open (void);
+ MidiMessage& operator[] (int index);
+ void pause (void);
+ void setBufferSize (int aSize);
+ void setChannelOffset (int anOffset);
+ void setAndOpenPort (int aPort);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ void toggleTrace (void);
+ void unpause (void);
+
+ static int getSelect (void);
+ static int selectOSS (void);
+ static int selectALSA (void);
+ static int selectUnknown (void);
+
+ private:
+
+ static int current; // the type of MIDI out selected
+ static int alsaQ; // boolean for if ALSA is present
+ static int ossQ; // boolean for if OSS is present
+ static int objectCount; // keeps track of static variables
+
+ static MidiInPort_oss *oss_input;
+ static MidiInPort_alsa *alsa_input;
+ static MidiInPort_unsupported *unknown_input;
+
+ void determineDrivers (void);
+};
+
+#endif /* ALSA and OSS def */
+#endif /* LINUX def */
+
+#endif /* _MIDIINPORT_LINUX_H_INCLUDED */
+
+
+// md5sum: cc3608fb63ccf222f018efc89a4275f0 - MidiInPort_linux.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort_oss.h b/src/midiio/include/MidiInPort_oss.h
new file mode 100644
index 0000000..ffa5666
--- /dev/null
+++ b/src/midiio/include/MidiInPort_oss.h
@@ -0,0 +1,105 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Fri Jan 8 08:33:57 PST 1999
+// Last Modified: Fri Jan 8 08:34:01 PST 1999
+// Last Modified: Tue Jun 29 16:18:02 PDT 1999 (added sysex capability)
+// Last Modified: Wed May 10 17:10:05 PDT 2000 (name change from _linux to _oss)
+// Filename: ...sig/maint/code/control/MidiInPort/linux/MidiInPort_oss.h
+// Web Address: http://sig.sapp.org/include/sig/MidiInPort_oss.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of
+// linux OSS sound driver's specific MIDI input methods.
+// This class is inherited privately by the MidiInPort class.
+//
+
+#ifndef _MIDIINPORT_OSS_H_INCLUDED
+#define _MIDIINPORT_OSS_H_INCLUDED
+
+#ifdef LINUX
+
+#include "MidiMessage.h"
+#include "CircularBuffer.h"
+#include "Array.h"
+#include "Sequencer_oss.h"
+#include "SigTimer.h"
+#include <pthread.h>
+
+typedef unsigned char uchar;
+typedef void (*MIDI_Callback_function)(int arrivalPort);
+
+
+class MidiInPort_oss : public Sequencer_oss {
+ public:
+ MidiInPort_oss (void);
+ MidiInPort_oss (int aPort, int autoOpen = 1);
+ ~MidiInPort_oss ();
+
+ void clearSysex (int buffer);
+ void clearSysex (void);
+ void close (void);
+ void close (int i) { close(); }
+ void closeAll (void);
+ MidiMessage extract (void);
+ int getBufferSize (void);
+ int getChannelOffset (void) const;
+ int getCount (void);
+ const char* getName (void);
+ static const char* getName (int i);
+ static int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ uchar* getSysex (int buffer);
+ int getSysexSize (int buffer);
+ int getTrace (void);
+ void insert (const MidiMessage& aMessage);
+ int installSysex (uchar* anArray, int aSize);
+ MidiMessage& message (int index);
+ int open (void);
+ void pause (void);
+ void setBufferSize (int aSize);
+ void setChannelOffset (int anOffset);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ void toggleTrace (void);
+ void unpause (void);
+
+ protected:
+ int port; // the port to which this object belongs
+
+ static MIDI_Callback_function callbackFunction;
+
+ static int installSysexPrivate (int port,
+ uchar* anArray, int aSize);
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* trace; // for verifying input
+ static std::ostream* tracedisplay; // stream for displaying trace
+ static int numDevices; // number of input ports
+ static CircularBuffer<MidiMessage>** midiBuffer; // MIDI storage frm ports
+ static int channelOffset; // channel offset, either 0 or 1
+ // not being used right now.
+ static int* pauseQ; // for adding items to Buffer or not
+ static SigTimer midiTimer; // for timing MIDI input
+ static pthread_t midiInThread; // for MIDI input thread function
+ static int* sysexWriteBuffer; // for MIDI sysex write location
+ static Array<uchar>** sysexBuffers; // for MIDI sysex storage
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+
+
+ friend void *interpretMidiInputStreamPrivate(void * x);
+
+};
+
+
+#endif /* LINUX */
+
+#endif /* _MIDIINPORT_OSS_H_INCLUDED */
+
+
+
+// md5sum: 05331ff5c3806fc753ebebaeffa3c377 - MidiInPort_oss.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort_unsupported.h b/src/midiio/include/MidiInPort_unsupported.h
new file mode 100644
index 0000000..1f3bcf0
--- /dev/null
+++ b/src/midiio/include/MidiInPort_unsupported.h
@@ -0,0 +1,89 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Fri Jan 23 00:04:51 GMT-0800 1998
+// Last Modified: Fri Jan 23 00:04:58 GMT-0800 1998
+// Last Modified: Wed Jun 30 11:42:59 PDT 1999 (added sysex capability)
+// Filename: ...sig/code/control/MidiInPort/unsupported/MidiInPort_unsupported.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiInPort_unsupported.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of
+// an unknown sound driver's specific MIDI input methods.
+// This class is inherited privately by the MidiInPort class.
+// This class is used when there is no MIDI input, so
+// that MIDI programs can otherwise be compiled and run.
+// This file can also serve as a template for creating
+// an OS specific class for MIDI input.
+//
+
+#ifndef _MIDIINPUT_UNSUPPORTED_H_INCLUDED
+#define _MIDIINPUT_UNSUPPORTED_H_INCLUDED
+
+#include "MidiMessage.h"
+#include "CircularBuffer.h"
+#include "Array.h"
+
+class MidiInPort_unsupported {
+ public:
+ MidiInPort_unsupported (void);
+ MidiInPort_unsupported (int aPort, int autoOpen = 1);
+ ~MidiInPort_unsupported ();
+
+ void clearSysex (int index) { }
+ void clearSysex (void) { }
+ int getSysexSize (int index) { return 0; }
+ uchar* getSysex (int buffer) { return NULL; }
+ int installSysex (unsigned char *&, int &) { return 0; }
+ int getBufferSize (void) { return 0; }
+ void close (void);
+ void close (int i) { close(); }
+ void closeAll (void);
+ MidiMessage extract (void);
+ int getChannelOffset (void) const;
+ int getCount (void);
+ const char* getName (void);
+ static const char* getName (int i);
+ int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ int getTrace (void);
+ void insert (const MidiMessage& aMessage);
+ MidiMessage& message (int index);
+ int open (void);
+ void pause (void);
+ void setBufferSize (int aSize);
+ void setChannelOffset (int anOffset);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ void toggleTrace (void);
+ void unpause (void);
+
+ protected:
+ int port; // the port to which this object belongs
+ int trace;
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* openQ; // for open/close status of port
+ static int numDevices; // number of input ports
+ static CircularBuffer<MidiMessage>* midiBuffer; // MIDI storage from ports
+ static int channelOffset; // channel offset, either 0 or 1
+ // not being used right now.
+ static int* sysexWriteBuffer; // for MIDI sysex write location
+ static Array<uchar>** sysexBuffers; // for MIDI sysex storage
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+ void setPortStatus (int aStatus);
+
+
+};
+
+
+
+#endif /* _MIDIINPUT_UNSUPPORTED_H_INCLUDED */
+
+
+
+// md5sum: ff5492fbd59a47e48e2c0ce06705add1 - MidiInPort_unsupported.h =css= 20030102
diff --git a/src/midiio/include/MidiInPort_visual.h b/src/midiio/include/MidiInPort_visual.h
new file mode 100644
index 0000000..398a187
--- /dev/null
+++ b/src/midiio/include/MidiInPort_visual.h
@@ -0,0 +1,114 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Dec 28 15:18:46 GMT-0800 1997
+// Last Modified: Mon Jan 12 20:05:27 GMT-0800 1998
+// Last Modified: Wed Jun 30 11:29:51 PDT 1999 (added sysex capability)
+// Filename: ...sig/code/control/MidiInPort/visual/MidiInPort_visual.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiInPort_visual.h
+// Syntax: C++
+//
+// Description: An interface for MIDI input capabilities of
+// Windows 95/NT/98 specific MIDI input methods.
+// as defined in winmm.lib. This class is inherited
+// privately by the MidiInPort class.
+//
+
+#ifndef _MIDIINPUT_VISUAL_H_INCLUDED
+#define _MIDIINPUT_VISUAL_H_INCLUDED
+
+
+#ifdef VISUAL
+
+#define DEFAULT_INPUT_BUFFER_SIZE (1024)
+
+#include <windows.h>
+#include <mmsystem.h>
+
+#include "MidiMessage.h"
+#include "CircularBuffer.h"
+#include "Array.h"
+
+class MidiInPort_visual {
+ public:
+ MidiInPort_visual (void);
+ MidiInPort_visual (int aPort, int autoOpen = 1);
+ ~MidiInPort_visual ();
+
+ void clearSysex (void);
+ void clearSysex (int buffer);
+ void close (void);
+ void closeAll (void);
+ MidiMessage extract (void);
+ int getBufferSize (void);
+ int getChannelOffset (void) const;
+ int getCount (void);
+ const char* getName (void);
+ static const char* getName (int i);
+ static int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ uchar* getSysex (int buffer);
+ int getSysexSize (int buffer);
+ int getTrace (void);
+ void insert (const MidiMessage& aMessage);
+ int installSysex (uchar* anArray, int aSize);
+ MidiMessage& message (int index);
+ int open (void);
+ void pause (void);
+ void setBufferSize (int aSize);
+ void setChannelOffset (int anOffset);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ void toggleTrace (void);
+ void unpause (void);
+
+ protected:
+ int port; // the port to which this object belongs
+ int trace;
+
+ int installSysexPrivate (int port, uchar* anArray, int aSize);
+ void installSysexStuff (HMIDIIN dev, int port);
+ void uninstallSysexStuff (HMIDIIN dev, int port);
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* openQ; // for open/close status of port
+ static int* inrunningQ; // for running open input port
+ static int numDevices; // number of input ports
+ static HMIDIIN* device; // Windoze MIDI-in device structure
+ static MIDIHDR** sysexDriverBuffer1; // for Windoze driver sysex buffers
+ static MIDIHDR** sysexDriverBuffer2; // for Windoze driver sysex buffers
+ static int* sysexDBnumber; // for Windoze driver sysex buffers
+ static HANDLE* hMutex; // mutual exclusive
+ static CircularBuffer<MidiMessage>* midiBuffer; // MIDI storage from ports
+ static int channelOffset; // channel offset from either 0 or 1.
+ // not being used right now.
+ static int* sysexWriteBuffer; // for MIDI sysex write location
+ static Array<uchar>** sysexBuffers;// for MIDI sysex storage
+ static int* sysexStatus; // tracing multiple MIM_LONGDATA messgs
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+ void releaseMutex (void);
+ void setPortStatus (int aStatus);
+ void waitForMutex (void);
+
+
+ friend void CALLBACK midiInputCallback(HMIDIIN hMidiIn, UINT inputStatus,
+ DWORD instancePtr, DWORD midiMessage, DWORD timestamp);
+};
+
+
+// This is the command which is called by the driver when there is
+// MIDI data being received from the MIDI input port:
+ void CALLBACK midiInputCallback(HMIDIIN hMidiIn, UINT inputStatus,
+ DWORD instancePtr, DWORD midiMessage, DWORD timestamp);
+
+
+#endif /* VISUAL */
+#endif /* _MIDIINPUT_VISUAL_H_INCLUDED */
+
+
+
+// md5sum: d5aee7a88c4a054b3e2d4d40622fdc42 - MidiInPort_visual.h =css= 20030102
diff --git a/src/midiio/include/MidiInput.h b/src/midiio/include/MidiInput.h
new file mode 100644
index 0000000..4425f75
--- /dev/null
+++ b/src/midiio/include/MidiInput.h
@@ -0,0 +1,53 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 18 December 1997
+// Last Modified: Sun Jan 25 15:27:02 GMT-0800 1998
+// Last Modified: Thu Apr 20 16:23:24 PDT 2000 (added scale function)
+// Filename: ...sig/code/control/MidiInput/MidiInput.h
+// Web Address: http://sig.sapp.org/include/sig/MidiInput.h
+// Syntax: C++
+//
+// Description: A higher-level MIDI input interface than the
+// MidiInPort class. Can be used to allow multiple
+// objects to share a single MIDI input stream, or
+// to fake a MIDI input connection.
+//
+
+#ifndef _MIDIINPUT_H_INCLUDED
+#define _MIDIINPUT_H_INCLUDED
+
+
+#include "MidiInPort.h"
+
+
+class MidiInput : public MidiInPort {
+ public:
+ MidiInput (void);
+ MidiInput (int aPort, int autoOpen = 1);
+ ~MidiInput ();
+
+ int getBufferSize (void);
+ int getCount (void);
+ MidiMessage extract (void);
+ void insert (const MidiMessage& aMessage);
+ int isOrphan (void) const;
+ void makeOrphanBuffer (int aSize = 1024);
+ void removeOrphanBuffer(void);
+ void setBufferSize (int aSize);
+
+ int scale (int value, int min, int max);
+ double fscale (int value, double min, double max);
+ int scale14 (int value, int min, int max);
+ double fscale14 (int value, double min, double max);
+
+ protected:
+ CircularBuffer<MidiMessage>* orphanBuffer;
+
+};
+
+
+#endif /* _MIDIINPUT_H_INCLUDED */
+
+
+
+// md5sum: 73972cc29d7bcf0fba136b098c0419a0 - MidiInput.h =css= 20030102
diff --git a/src/midiio/include/MidiMessage.h b/src/midiio/include/MidiMessage.h
new file mode 100644
index 0000000..e4b59ba
--- /dev/null
+++ b/src/midiio/include/MidiMessage.h
@@ -0,0 +1,78 @@
+//
+// Copyright 1997 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 19 December 1997
+// Last Modified: Fri Jan 23 00:21:24 GMT-0800 1998
+// Last Modified: Sun Sep 20 20:30:53 PDT 1998
+// Last Modified: Mon Oct 15 14:29:12 PDT 2001 (added is_note functions)
+// Filename: ...sig/include/sigInfo/MidiMessage.h
+// Web Address: http://sig.sapp.org/include/sigInfo/MidiMessage.h
+// Syntax: C++
+//
+// Description: A structure for handling MIDI input messages.
+// This class stores a time stamp plus up to
+// four MIDI message bytes. System Exclusive messages
+// are stored in a separate array in the MidiInPort
+// class, and their storage index is passed to the
+// user through a MIDI message for later extraction
+// of the full sysex message.
+//
+
+#ifndef _MIDIMESSAGE_H_INCLUDED
+#define _MIDIMESSAGE_H_INCLUDED
+
+#include <iostream>
+
+typedef unsigned char uchar;
+typedef unsigned long ulong;
+
+class MidiMessage {
+ public:
+ ulong time; // timestamp
+ ulong data; // MIDI command and parameters
+
+ MidiMessage (void);
+ MidiMessage (int aCommand, int aP1, int aP2,
+ int aTime = 0);
+ MidiMessage (const MidiMessage& aMessage);
+ ~MidiMessage ();
+
+ uchar& command (void);
+ MidiMessage& operator= (const MidiMessage& aMessage);
+ uchar& operator[] (int index);
+ uchar& p0 (void);
+ uchar& p1 (void);
+ uchar& p2 (void);
+ uchar& p3 (void);
+ int getArgCount (void) const;
+ int getParameterCount (void) const;
+
+ uchar getCommand (void) const;
+ uchar getP0 (void) const;
+ uchar getP1 (void) const;
+ uchar getP2 (void) const;
+ uchar getP3 (void) const;
+
+ void setCommand (uchar aCommand);
+ void setData (uchar aCommand, uchar aP1 = 0,
+ uchar aP2 = 0, uchar aP3 = 0);
+ void setP0 (uchar aP0);
+ void setP1 (uchar aP1);
+ void setP2 (uchar aP2);
+ void setP3 (uchar aP3);
+
+ int is_note (void);
+ int is_note_on (void);
+ int is_note_off (void);
+
+};
+
+
+std::ostream& operator<<(std::ostream& out, MidiMessage& aMessage);
+
+
+#endif /* _MIDIMESSAGE_H_INCLUDED */
+
+
+
+// md5sum: 4738e957fb8a233f6dbaeebda490e6a4 - MidiMessage.h =css= 20030102
diff --git a/src/midiio/include/MidiOutPort.h b/src/midiio/include/MidiOutPort.h
new file mode 100644
index 0000000..0287dfd
--- /dev/null
+++ b/src/midiio/include/MidiOutPort.h
@@ -0,0 +1,92 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Dec 28 15:04:24 GMT-0800 1997
+// Last Modified: Fri Jan 23 10:56:18 GMT-0800 1998
+// Last Modified: Sat Nov 7 16:15:54 PST 1998
+// Last Modified: Tue May 23 23:08:44 PDT 2000 (oss/alsa selection added)
+// Last Modified: Mon Jun 19 10:32:11 PDT 2000 (oss/alsa define fix)
+// Filename: ...sig/code/control/MidiOutPort/MidiOutPort.h
+// Web Address: http://sig.sapp.org/include/sig/MidiOutPort.h
+// Syntax: C++
+//
+// Description: Operating-System independent interface for
+// basic MIDI output capabilities. Privately
+// inherits the operating-system specific class
+// for MIDI output.
+//
+
+#ifndef _MIDIOUTPORT_H_INCLUDED
+#define _MIDIOUTPORT_H_INCLUDED
+
+
+#ifdef VISUAL
+ #define MIDIOUTPORT MidiOutPort_visual
+ #include "MidiOutPort_visual.h"
+#elif defined(LINUX) && defined(ALSA) && defined(OSS)
+ #define MIDIOUTPORT MidiOutPort_linux
+ #include "MidiOutPort_linux.h"
+#elif defined(LINUX) && defined(ALSA) && !defined(OSS)
+ #define MIDIOUTPORT MidiOutPort_alsa
+ #include "MidiOutPort_alsa.h"
+#elif defined (LINUX) && defined(OSS) && !defined(ALSA)
+ #define MIDIOUTPORT MidiOutPort_oss
+ #include "MidiOutPort_oss.h"
+#elif defined(LINUX)
+ #define MIDIOUTPORT MidiOutPort_oss
+ #include "MidiOutPort_oss.h"
+#else
+ #define MIDIOUTPORT MidiOutPort_unsupported
+ #include "MidiOutPort_unsupported.h"
+#endif
+
+
+class MidiOutPort : protected MIDIOUTPORT {
+ public:
+ MidiOutPort (void) : MIDIOUTPORT() {}
+ MidiOutPort (int aPort, int autoOpen = 1) :
+ MIDIOUTPORT(aPort, autoOpen) {}
+ ~MidiOutPort() { }
+
+ void close(void) { MIDIOUTPORT::close(); }
+ void closeAll(void) { MIDIOUTPORT::closeAll(); }
+ int getChannelOffset(void) const {
+ return MIDIOUTPORT::getChannelOffset(); }
+ const char* getName(void) { return MIDIOUTPORT::getName(); }
+ static const char* getName(int i) { return MIDIOUTPORT::getName(i); }
+ static int getNumPorts(void) { return MIDIOUTPORT::getNumPorts(); }
+ int getPort(void) { return MIDIOUTPORT::getPort(); }
+ int getPortStatus(void) {
+ return MIDIOUTPORT::getPortStatus(); }
+ int getTrace(void) {
+ return MIDIOUTPORT::getTrace(); }
+ int open(void) { return MIDIOUTPORT::open(); }
+ int rawsend(int command, int p1, int p2) {
+ return MIDIOUTPORT::rawsend(command, p1, p2); }
+ int rawsend(int command, int p1) {
+ return MIDIOUTPORT::rawsend(command, p1); }
+ int rawsend(int command) {
+ return MIDIOUTPORT::rawsend(command); }
+ int rawsend(uchar* array, int size) {
+ return MIDIOUTPORT::rawsend(array, size); }
+ void setAndOpenPort(int aPort) { setPort(aPort); open(); }
+// void setChannelOffset(int aChannel) {
+// MIDIOUTPORT::setChannelOffset(aChannel); }
+ void setPort(int aPort) { MIDIOUTPORT::setPort(aPort); }
+ int setTrace(int aState) {
+ return MIDIOUTPORT::setTrace(aState); }
+ int sysex(uchar* array, int size) {
+ return MIDIOUTPORT::sysex(array, size); }
+ void toggleTrace(void) { MIDIOUTPORT::toggleTrace(); }
+ MidiOutPort& operator=(MidiOutPort& other) {
+ setPort(other.getPort());
+ if (other.getPortStatus()) { open(); }
+ return *this; }
+};
+
+
+
+
+#endif /* _MIDIOUTPORT_H_INCLUDED */
+
+
+// md5sum: 2f7b8aa8ef705eab57179b626ce1d62d - MidiOutPort.h =css= 20030102
diff --git a/src/midiio/include/MidiOutPort_alsa.h b/src/midiio/include/MidiOutPort_alsa.h
new file mode 100644
index 0000000..34139a3
--- /dev/null
+++ b/src/midiio/include/MidiOutPort_alsa.h
@@ -0,0 +1,79 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed May 10 16:22:00 PDT 2000
+// Last Modified: Sun May 14 20:43:44 PDT 2000
+// Last Modified: Sat Nov 2 20:39:01 PST 2002 (added ALSA def)
+// Filename: ...sig/maint/code/control/MidiOutPort/linux/MidiOutPort_alsa.h
+// Web Address: http://sig.sapp.org/include/sig/MidiOutPort_alsa.h
+// Syntax: C++
+//
+// Description: Operating-System specific interface for
+// basic MIDI output capabilities in Linux using
+// OSS sound drivers. Privately inherited by the
+// MidiOutPort class.
+//
+
+#ifndef _MIDIOUTPORT_ALSA_H_INCLUDED
+#define _MIDIOUTPORT_ALSA_H_INCLUDED
+
+#ifdef LINUX
+#ifdef ALSA
+
+#include "Sequencer_alsa.h"
+#include <iostream>
+
+typedef unsigned char uchar;
+
+
+class MidiOutPort_alsa : public Sequencer_alsa {
+ public:
+ MidiOutPort_alsa (void);
+ MidiOutPort_alsa (int aPort, int autoOpen = 1);
+ ~MidiOutPort_alsa ();
+
+ void close (void);
+ void closeAll (void);
+ int getChannelOffset (void) const;
+ const char* getName (void);
+ static const char* getName (int i);
+ int getPort (void);
+ static int getNumPorts (void);
+ int getPortStatus (void);
+ int getTrace (void);
+ int rawsend (int command, int p1, int p2);
+ int rawsend (int command, int p1);
+ int rawsend (int command);
+ int rawsend (uchar* array, int size);
+ int open (void);
+ void setChannelOffset (int aChannel);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ int sysex (uchar* array, int size);
+ void toggleTrace (void);
+
+ protected:
+ int port; // the port to which this object belongs
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int numDevices; // number of output ports
+ static int* trace; // for printing messages to output
+ static std::ostream* tracedisplay; // for printing trace messages
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+ void setPortStatus (int aStatus);
+
+ static int channelOffset; // channel offset, either 0 or 1.
+ // not being used right now.
+};
+
+
+
+#endif /* ALSA */
+#endif /* LINUX */
+#endif /* _MIDIOUTPUT_ALSA_H_INCLUDED */
+
+
+// md5sum: 5b7648c7b493df7cb0d1fae3bbb8be24 - MidiOutPort_alsa.h =css= 20030102
diff --git a/src/midiio/include/MidiOutPort_linux.h b/src/midiio/include/MidiOutPort_linux.h
new file mode 100644
index 0000000..a02dc22
--- /dev/null
+++ b/src/midiio/include/MidiOutPort_linux.h
@@ -0,0 +1,80 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Wed May 10 16:03:52 PDT 2000
+// Last Modified: Thu May 18 23:37:17 PDT 2000
+// Last Modified: Sat Nov 2 20:40:01 PST 2002 (added ALSA OSS def)
+// Filename: ...sig/code/control/MidiOutPort_linux/MidiOutPort_linux.h
+// Web Address: http://sig.sapp.org/include/sig/MidiOutPort_linux.h
+// Syntax: C++
+//
+// Description: Linux MIDI output class which detects which
+// type of MIDI drivers are available: either
+// ALSA or OSS.
+//
+
+#ifndef _MIDIOUTPORT_LINUX_H_INCLUDED
+#define _MIDIOUTPORT_LINUX_H_INCLUDED
+
+#ifdef LINUX
+#if defined(ALSA) && defined(OSS)
+
+#include "MidiOutPort_oss.h"
+#include "MidiOutPort_alsa.h"
+#include "MidiOutPort_unsupported.h"
+
+#define UNKNOWN_MIDI_SELECT 0 /* use dummy MIDI output */
+#define OSS_MIDI_SELECT 1 /* use OSS MIDI output */
+#define ALSA_MIDI_SELECT 2 /* use ALSA MIDI output */
+
+class MidiOutPort_linux {
+ public:
+ MidiOutPort_linux (void);
+ MidiOutPort_linux (int aPort, int autoOpen = 1);
+ ~MidiOutPort_linux ();
+
+ void close (void);
+ void closeAll (void);
+ int getChannelOffset (void) const;
+ const char* getName (void);
+ static const char* getName (int i);
+ static int getNumPorts (void);
+ int getPort (void);
+ int getPortStatus (void);
+ int getTrace (void);
+ int open (void);
+ int rawsend (int command, int p1, int p2);
+ int rawsend (int command, int p1);
+ int rawsend (int command);
+ int rawsend (uchar* array, int size);
+ void setAndOpenPort (int aPort);
+ void setChannelOffset (int aChannel);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ int sysex (uchar* array, int size);
+ void toggleTrace (void);
+
+ static int getSelect (void);
+ static int selectOSS (void);
+ static int selectALSA (void);
+ static int selectUnknown (void);
+
+ private:
+ static int current; // the type of MIDI out selected
+ static int alsaQ; // boolean for if ALSA is present
+ static int ossQ; // boolean for if OSS is present
+
+ static int objectCount;
+ static MidiOutPort_oss *oss_output;
+ static MidiOutPort_alsa *alsa_output;
+ static MidiOutPort_unsupported *unknown_output;
+
+ void determineDrivers (void);
+};
+
+#endif /* ALSA and OSS */
+#endif /* LINUX */
+
+#endif /* _MIDIOUTPORT_LINUX_H_INCLUDED */
+
+
+// md5sum: c80f9f47c45a6d4a20b6549743cae9fb - MidiOutPort_linux.h =css= 20030102
diff --git a/src/midiio/include/MidiOutPort_oss.h b/src/midiio/include/MidiOutPort_oss.h
new file mode 100644
index 0000000..22cf32d
--- /dev/null
+++ b/src/midiio/include/MidiOutPort_oss.h
@@ -0,0 +1,75 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Fri Dec 18 19:15:00 PST 1998
+// Last Modified: Wed May 10 17:00:11 PDT 2000 (name change from _linux to _oss)
+// Filename: ...sig/maint/code/control/MidiOutPort/linux/MidiOutPort_oss.h
+// Web Address: http://sig.sapp.org/include/sig/MidiOutPort_oss.h
+// Syntax: C++
+//
+// Description: Operating-System specific interface for
+// basic MIDI output capabilities in Linux using
+// OSS sound drivers. Privately inherited by the
+// MidiOutPort class.
+//
+
+#ifndef _MIDIOUTPORT_OSS_H_INCLUDED
+#define _MIDIOUTPORT_OSS_H_INCLUDED
+
+#ifdef LINUX
+
+#include "Sequencer_oss.h"
+
+typedef unsigned char uchar;
+
+
+class MidiOutPort_oss : public Sequencer_oss {
+ public:
+ MidiOutPort_oss (void);
+ MidiOutPort_oss (int aPort, int autoOpen = 1);
+ ~MidiOutPort_oss ();
+
+ void close (void);
+ void closeAll (void);
+ int getChannelOffset (void) const;
+ const char* getName (void);
+ static const char* getName (int i);
+ int getPort (void);
+ static int getNumPorts (void);
+ int getPortStatus (void);
+ int getTrace (void);
+ int rawsend (int command, int p1, int p2);
+ int rawsend (int command, int p1);
+ int rawsend (int command);
+ int rawsend (uchar* array, int size);
+ int open (void);
+ void setChannelOffset (int aChannel);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ int sysex (uchar* array, int size);
+ void toggleTrace (void);
+
+ protected:
+ int port; // the port to which this object belongs
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int numDevices; // number of output ports
+ static int* trace; // for printing messages to output
+ static std::ostream* tracedisplay; // for printing trace messages
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+ void setPortStatus (int aStatus);
+
+ static int channelOffset; // channel offset, either 0 or 1.
+ // not being used right now.
+};
+
+
+
+#endif /* LINUX */
+#endif /* _MIDIOUTPUT_OSS_H_INCLUDED */
+
+
+// md5sum: f60183e23c49741e93d9b965bbe9a6d8 - MidiOutPort_oss.h =css= 20030102
diff --git a/src/midiio/include/MidiOutPort_unsupported.h b/src/midiio/include/MidiOutPort_unsupported.h
new file mode 100644
index 0000000..a5e8c35
--- /dev/null
+++ b/src/midiio/include/MidiOutPort_unsupported.h
@@ -0,0 +1,71 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Mon Jan 12 21:36:26 GMT-0800 1998
+// Last Modified: Mon Jan 12 21:36:31 GMT-0800 1998
+// Filename: ...sig/code/control/MidiOutPort/unsupported/MidiOutPort_unsupported.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiOutPort_unsupported.h
+// Syntax: C++
+//
+// Description: Operating-System specific interface for basic MIDI output
+// capabilities in an unknown operating system. Privately
+// inherited by the MidiOutPort class. Used for compiling
+// and running MIDI programs on a computer with no
+// MIDI output.
+//
+
+#ifndef _MIDIOUTPUT_UNSUPPORTED_H_INCLUDED
+#define _MIDIOUTPUT_UNSUPPORTED_H_INCLUDED
+
+typedef unsigned char uchar;
+
+class MidiOutPort_unsupported {
+ public:
+ MidiOutPort_unsupported (void);
+ MidiOutPort_unsupported (int aPort, int autoOpen = 1);
+ ~MidiOutPort_unsupported ();
+
+ void close (void);
+ void closeAll (void);
+ int getChannelOffset (void) const;
+ const char* getName (void) const;
+ const char* getName (int i) const;
+ int getPort (void) const;
+ int getNumPorts (void) const;
+ int getPortStatus (void) const;
+ int getTrace (void) const;
+ int rawsend (int command, int p1, int p2);
+ int rawsend (int command, int p1);
+ int rawsend (int command);
+ int rawsend (uchar* array, int size);
+ int open (void);
+ void setChannelOffset (int aChannel);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ int sysex (uchar* array, int size);
+ void toggleTrace (void);
+
+ protected:
+ int port; // the port to which this object belongs
+ int trace; // for printing out midi messages to standard output
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* openQ; // for open/close status of port
+ static int numDevices; // number of output ports
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+ void setPortStatus (int aStatus);
+
+ static int channelOffset; // channel offset, either 0 or 1
+ // not being used right now.
+};
+
+
+
+#endif /* _MIDIOUTPUT_UNSUPPORTED_H_INCLUDED */
+
+
+
+// md5sum: e244688a99d220addc7b1c6f6f6a8022 - MidiOutPort_unsupported.h =css= 20030102
diff --git a/src/midiio/include/MidiOutPort_visual.h b/src/midiio/include/MidiOutPort_visual.h
new file mode 100644
index 0000000..d6a3984
--- /dev/null
+++ b/src/midiio/include/MidiOutPort_visual.h
@@ -0,0 +1,75 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Dec 28 15:18:46 GMT-0800 1997
+// Last Modified: Mon Jan 12 20:05:27 GMT-0800 1998
+// Filename: ...sig/code/control/MidiOutPort/visual/MidiOutPort_visual.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiOutPort_visual.h
+// Syntax: C++
+//
+// Description: Operating-System specific interface for
+// basic MIDI output capabilities in Windows 95/NT/98
+// using winmm.lib. Privately inherited by the
+// MidiOutPort class.
+//
+
+#ifndef _MIDIOUTPUT_VISUAL_H_INCLUDED
+#define _MIDIOUTPUT_VISUAL_H_INCLUDED
+
+#ifdef VISUAL
+
+typedef unsigned char uchar;
+
+#include <windows.h>
+#include <mmsystem.h>
+
+class MidiOutPort_visual {
+ public:
+ MidiOutPort_visual (void);
+ MidiOutPort_visual (int aPort, int autoOpen = 1);
+ ~MidiOutPort_visual ();
+
+ void close (void);
+ void closeAll (void);
+ int getChannelOffset (void) const;
+ const char* getName (void);
+ static const char* getName (int i);
+ int getPort (void);
+ static int getNumPorts (void);
+ int getPortStatus (void);
+ int getTrace (void);
+ int rawsend (int command, int p1, int p2);
+ int rawsend (int command, int p1);
+ int rawsend (int command);
+ int rawsend (uchar* array, int size);
+ int open (void);
+ void setChannelOffset (int aChannel);
+ void setPort (int aPort);
+ int setTrace (int aState);
+ int sysex (uchar* array, int size);
+ void toggleTrace (void);
+
+ protected:
+ int port; // the port to which this object belongs
+ int trace; // for printing out Midi messages to standard output
+
+ static int objectCount; // num of similar objects in existence
+ static int* portObjectCount; // objects connected to particular port
+ static int* openQ; // for open/close status of port
+ static int numDevices; // number of output ports
+ static HMIDIOUT* device; // Windoze midi out device structure
+
+ private:
+ void deinitialize (void);
+ void initialize (void);
+ void setPortStatus (int aStatus);
+
+ static int channelOffset; // channel offset, either 0 or 1.
+ // not being used right now.
+};
+
+
+#endif /* VISUAL */
+#endif /* _MIDIOUTPUT_VISUAL_H_INCLUDED */
+
+
+// md5sum: 47799e340effa57676be8a3943cabb70 - MidiOutPort_visual.h =css= 20030102
diff --git a/src/midiio/include/MidiOutput.h b/src/midiio/include/MidiOutput.h
new file mode 100644
index 0000000..d424816
--- /dev/null
+++ b/src/midiio/include/MidiOutput.h
@@ -0,0 +1,140 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 18 December 1997
+// Last Modified: Mon Jan 26 23:53:05 GMT-0800 1998
+// Last Modified: Sat Jan 30 14:00:29 PST 1999
+// Last Modified: Sun Jul 18 18:52:42 PDT 1999 (added RPN functions)
+// Filename: ...sig/maint/code/control/MidiOutput/MidiOutput.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiOutput.h
+// Syntax: C++
+//
+// Description: The MIDI output interface for MIDI synthesizers/equipment
+// which has many convienience functions defined for
+// various types of MIDI output.
+//
+
+#ifndef _MIDIOUTPUT_H_INCLUDED
+#define _MIDIOUTPUT_H_INCLUDED
+
+#include "MidiOutPort.h"
+#include "FileIO.h"
+#include "SigTimer.h"
+#include "Array.h"
+
+
+class MidiOutput : public MidiOutPort {
+ public:
+ MidiOutput (void);
+ MidiOutput (int aPort, int autoOpen = 1);
+ ~MidiOutput ();
+
+ // Basic user MIDI output commands:
+ int cont (int channel, int controller, int data);
+ int off (int channel, int keynum, int releaseVelocity);
+ int pc (int channel, int timbre);
+ int play (int channel, int keynum, int velocity);
+ int pw (int channel, int mostByte, int leastByte);
+ int pw (int channel, int tuningData);
+ int pw (int channel, double tuningData);
+ void recordStart (char *filename, int format);
+ void recordStop (void);
+ void reset (void);
+ int send (int command, int p1, int p2);
+ int send (int command, int p1);
+ int send (int command);
+ void silence (int aChannel = -1);
+ void sustain (int channel, int status);
+ int sysex (char* data, int length);
+ int sysex (uchar* data, int length);
+
+ protected:
+ int outputRecordQ; // boolean for recording
+ int outputRecordType; // what form to record MIDI data in
+ int lastFlushTime; // for recording midi data
+ FileIO outputRecordFile; // file for recording midi data
+ static SigTimer timer; // for recording midi data
+ static Array<int>* rpn_lsb_status; // for RPN messages
+ static Array<int>* rpn_msb_status; // for RPN messages
+ static int objectCount; // for RPN messages
+
+ void deinitializeRPN (void);
+ void initializeRPN (void);
+ void writeOutputAscii (int channel, int p1, int p2);
+ void writeOutputBinary (int channel, int p1, int p2);
+ void writeOutputMidifile(int channel, int p1, int p2);
+
+ public: // RPN controller functions
+ int NRPN (int channel, int nrpn_msb, int nrpn_lsb,
+ int data_msb, int data_lsb);
+ int NRPN (int channel, int nrpn_msb, int nrpn_lsb,
+ int data_msb);
+ int NRPN (int channel, int nrpn_msb, int nrpn_lsb,
+ double data);
+ int NRPN_null (int channel);
+ int NRPN_attack (int channel, double value);
+ int NRPN_attack (int channel, int value);
+ int NRPN_decay (int channel, double value);
+ int NRPN_decay (int channel, int value);
+ int NRPN_drumAttack (int drum, double value);
+ int NRPN_drumAttack (int drum, int value);
+ int NRPN_drumChorus (int drum, double value);
+ int NRPN_drumChorus (int drum, int value);
+ int NRPN_drumDecay (int drum, double value);
+ int NRPN_drumDecay (int drum, int value);
+ int NRPN_drumLevel (int drum, double value);
+ int NRPN_drumLevel (int drum, int value);
+ int NRPN_drumPan (int drum, double value);
+ int NRPN_drumPan (int drum, int value);
+ int NRPN_drumPitch (int drum, double value);
+ int NRPN_drumPitch (int drum, int value);
+ int NRPN_drumFilterCutoff (int drum, double value);
+ int NRPN_drumFilterCutoff (int drum, int value);
+ int NRPN_drumFilterResonance(int drum, double value);
+ int NRPN_drumFilterResonance(int drum, int value);
+ int NRPN_drumReverb (int drum, double value);
+ int NRPN_drumReverb (int drum, int value);
+ int NRPN_drumVariation (int drum, double value);
+ int NRPN_drumVariation (int drum, int value);
+ int NRPN_filterCutoff (int channel, double value);
+ int NRPN_filterCutoff (int channel, int value);
+ int NRPN_release (int channel, double value);
+ int NRPN_release (int channel, int value);
+ int NRPN_vibratoDelay (int channel, double value);
+ int NRPN_vibratoDelay (int channel, int value);
+ int NRPN_vibratoDepth (int channel, double value);
+ int NRPN_vibratoDepth (int channel, int value);
+ int NRPN_vibratoRate (int channel, double value);
+ int NRPN_vibratoRate (int channel, int value);
+
+ int RPN (int channel, int rpn_msb, int rpn_lsb,
+ int data_msb, int data_lsb);
+ int RPN (int channel, int rpn_msb, int rpn_lsb,
+ int data_msb);
+ int RPN (int channel, int rpn_msb, int rpn_lsb,
+ double data);
+ int RPN_null (void);
+ int RPN_null (int channel);
+ int pbRange (int channel, int steps);
+ int tuneFine (int channel, int cents);
+ int fineTune (int channel, int cents);
+ int tuneCoarse (int channel, int steps);
+ int coarseTune (int channel, int steps);
+ int tuningProgram (int channel, int program);
+ int tuningBank (int channel, int bank);
+
+};
+
+
+#endif /* _MIDIOUTPUT_H_INCLUDED */
+
+// Brief description of MidiOutput public member functions:
+//
+// send: sends a MIDI command to the MIDI output with up to two parameters
+// play: sends a playnote command to the MIDI output
+// pc: Patch Change. changes the timbre (instrument) on the given channel
+// cont: sends a CONTinuous CONTroller MIDI command
+// sysex: sends a system exclusive command to the MIDI output
+//
+
+
+// md5sum: 12ee02c32563ae219aaa8c7599de55db - MidiOutput.h =css= 20030102
diff --git a/src/midiio/include/MidiPort.h b/src/midiio/include/MidiPort.h
new file mode 100644
index 0000000..834877e
--- /dev/null
+++ b/src/midiio/include/MidiPort.h
@@ -0,0 +1,49 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 21 December 1997
+// Last Modified: Fri Jan 23 10:21:25 GMT-0800 1998
+// Filename: .../sig/code/control/MidiPort/MidiPort.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/MidiPort.h
+// Syntax: C++
+//
+// Description: A unified object that handles basic MIDI input and output.
+// Derived from the MidiInPort and MidiOutPort classes.
+//
+
+#ifndef _MIDIPORT_H_INCLUDED
+#define _MIDIPORT_H_INCLUDED
+
+
+#include "MidiInPort.h"
+#include "MidiOutPort.h"
+
+
+class MidiPort : public MidiOutPort, public MidiInPort {
+ public:
+ MidiPort (void);
+ MidiPort (int outputPort, int inputPort);
+ ~MidiPort ();
+
+ int getChannelInOffset (void) const;
+ int getChannelOutOffset (void) const;
+ int getInputPort (void);
+ int getInputTrace (void);
+ int getOutputPort (void);
+ int getOutputTrace (void);
+ void setChannelOffset (int anOffset);
+ void setInputPort (int aPort);
+ int setInputTrace (int aState);
+ void setOutputPort (int aPort);
+ int setOutputTrace (int aState);
+ void toggleInputTrace (void);
+ void toggleOutputTrace (void);
+
+};
+
+
+
+#endif /* _MIDIPORT_H_INCLUDED */
+
+
+
+// md5sum: 84d8155528b06c9aa902e8f06649385f - MidiPort.h =css= 20030102
diff --git a/src/midiio/include/Options.h b/src/midiio/include/Options.h
new file mode 100644
index 0000000..71754fb
--- /dev/null
+++ b/src/midiio/include/Options.h
@@ -0,0 +1,106 @@
+//
+// Copyright 1998-2000 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Apr 5 13:07:18 PDT 1998
+// Last Modified: Fri Jan 15 07:24:00 PST 1999
+// Last Modified: Sat Mar 27 18:17:59 PST 1999
+// Last Modified: Thu Apr 13 14:02:52 PDT 2000 (added 2nd define function)
+// Last Modified: Fri May 5 17:57:50 PDT 2000 (added --options suppression)
+// Filename: ...sig/maint/code/base/Options/Options.h
+// Web Address: http://sig.sapp.org/include/sigBase/Options.h
+// Documentation: http://sig.sapp.org/doc/classes/Options
+// Syntax: C++
+//
+// Description: Handles command-line options in a graceful manner.
+//
+
+#ifndef _OPTIONS_H_INCLUDED
+#define _OPTIONS_H_INCLUDED
+
+#include "Array.h"
+
+class option_list;
+class option_register;
+
+
+class Options {
+ public:
+ Options (void);
+ Options (int argc, char** argv);
+ ~Options ();
+
+ int argc (void) const;
+ char** argv (void) const;
+ void define (const char* aDefinition);
+ void define (const char* aDefinition,
+ const char* description);
+ char* getArg (int index);
+ char* getArgument (int index);
+ int getArgCount (void);
+ int getArgumentCount (void);
+ int getBoolean (const char* optionName);
+ const char* getCommand (void);
+ const char* getCommandLine (void);
+ const char* getString (void);
+ const char* getDefinition (const char* optionName);
+ double getDouble (const char* optionName);
+ char getFlag (void);
+ float getFloat (const char* optionName);
+ int getInt (const char* optionName);
+ int getInteger (const char* optionName);
+ const char* getString (const char* optionName);
+ char getType (const char* optionName);
+ int optionsArg (void);
+ void print (void);
+ void process (int error_check = 1, int suppress = 0);
+ void process (int argc, char** argv,
+ int error_check = 1,
+ int suppress = 0);
+ void reset (void);
+ void verify (int argc, char** argv,
+ int error_check = 1,
+ int suppress = 0);
+ void verify (int error_check = 1,
+ int suppress = 0);
+ void setFlag (char aFlag);
+ void setModified (const char* optionName,
+ const char* optionValue);
+ void setOptions (int argc, char** argv);
+
+ protected:
+ int options_error_check; // for verify command
+ int gargc;
+ char** gargv;
+ char* commandString;
+ char optionFlag;
+ Array<char*> argument;
+ Array<option_register*> optionRegister;
+ Array<option_list*> optionList;
+ int processedQ;
+ int sortedQ;
+ int suppressQ; // prevent the --options option
+ int optionsArgument; // indicates --options present
+
+ int getRegIndex (const char* optionName);
+ int optionQ (const char* aString, int& argp);
+ void sortOptionNames (void);
+ int storeOption (int gargp, int& position,
+ int& running);
+
+};
+
+#define OPTION_BOOLEAN_TYPE 'b'
+#define OPTION_CHAR_TYPE 'c'
+#define OPTION_DOUBLE_TYPE 'd'
+#define OPTION_FLOAT_TYPE 'f'
+#define OPTION_INT_TYPE 'i'
+#define OPTION_STRING_TYPE 's'
+#define OPTION_UNKNOWN_TYPE 'x'
+
+
+
+#endif /* _OPTIONS_H_INCLUDED */
+
+
+
+// md5sum: c59d297a8081cb48f61b534484819f48 - Options.h =css= 20030102
diff --git a/src/midiio/include/Options_private.h b/src/midiio/include/Options_private.h
new file mode 100644
index 0000000..8349d55
--- /dev/null
+++ b/src/midiio/include/Options_private.h
@@ -0,0 +1,73 @@
+//
+// Copyright 1998-1999 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Apr 5 13:07:18 PDT 1998
+// Last Modified: Sun Jan 10 05:44:48 PST 1999
+// Filename: ...sig/maint/code/base/Options/Options_private.h
+// Web Address: http://sig.sapp.org/include/sigBase/Options_private.h
+// Syntax: C++
+//
+// Description: A private function for use in the Options class.
+//
+
+#ifndef _OPTIONS_PRIVATE_H_INCLUDED
+#define _OPTIONS_PRIVATE_H_INCLUDED
+
+
+class option_register {
+ public:
+ option_register (void);
+ option_register (const char* aDefinition, char aType,
+ const char* aDefaultOption,
+ const char* aModifiedOption);
+ ~option_register ();
+ void clearModified (void);
+ const char* getDefinition (void);
+ const char* getDefault (void);
+ const char* getOption (void);
+ const char* getModified (void);
+ int getModifiedQ (void);
+ char getType (void);
+ void reset (void);
+ void setDefault (const char* aString);
+ void setDefinition (const char* aString);
+ void setModified (const char* aString);
+ void setType (char aType);
+
+ protected:
+ char* definition;
+ char* defaultOption;
+ char* modifiedOption;
+ char type;
+
+};
+
+
+/////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////
+
+
+class option_list {
+ public:
+ option_list (void);
+ option_list (const char* optionName, int anIndex);
+ ~option_list ();
+
+ int getIndex (void);
+ const char* getName (void);
+ void setName (const char* aString);
+ void setIndex (int anIndex);
+
+ protected:
+ char* name;
+ int index;
+
+};
+
+
+
+#endif /* _OPTIONS_PRIVATE_H_INCLUDED */
+
+
+
+// md5sum: b440ad2158e9921d0e31463a8c3e1ae0 - Options_private.h =css= 20030102
diff --git a/src/midiio/include/Sequencer_alsa.h b/src/midiio/include/Sequencer_alsa.h
new file mode 100644
index 0000000..3227f5e
--- /dev/null
+++ b/src/midiio/include/Sequencer_alsa.h
@@ -0,0 +1,139 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Thu May 11 21:06:21 PDT 2000
+// Last Modified: Sat Oct 13 14:50:04 PDT 2001 (updated for ALSA 0.9 interface)
+// Filename: ...sig/maint/code/control/MidiOutPort/Sequencer_alsa.h
+// Web Address: http://sig.sapp.org/include/sig/Sequencer_alsa.h
+// Syntax: C++
+//
+// Description: Basic MIDI input/output functionality for the
+// Linux ALSA midi device /dev/snd/midiXX. This class
+// is inherited by the classes MidiInPort_alsa and
+// MidiOutPort_alsa.
+//
+// to get information of status a alsa hardware & software
+// cat /proc/asound/version
+// cat /proc/asound/devices
+// cat /proc/asound/card0/midi0
+//
+
+#ifndef _SEQUENCER_ALSA_H_INCLUDED
+#define _SEQUENCER_ALSA_H_INCLUDED
+
+#include <iostream>
+
+#ifdef ALSA
+
+#include <alsa/asoundlib.h>
+#include "Collection.h"
+
+#define MIDI_EXTERNAL (1)
+#define MIDI_INTERNAL (2)
+
+typedef unsigned char uchar;
+
+
+class Sequencer_alsa {
+ public:
+ Sequencer_alsa (int autoOpen = 1);
+ ~Sequencer_alsa ();
+
+ void close (void);
+ void closeInput (int index);
+ void closeOutput (int index);
+ void displayInputs (std::ostream& out = std::cout,
+ char* initial = "\t");
+ void displayOutputs (std::ostream& out = std::cout,
+ char* initial = "\t");
+ static const char* getInputName (int aDevice);
+ static const char* getOutputName (int aDevice);
+ static int getNumInputs (void);
+ static int getNumOutputs (void);
+ int is_open (int mode, int index);
+ int is_open_in (int index);
+ int is_open_out (int index);
+ int open (int direction, int index);
+ int openInput (int index);
+ int openOutput (int index);
+ void read (int dev, uchar* buf, int count);
+ void rebuildInfoDatabase (void);
+ int write (int aDevice, int aByte);
+ int write (int aDevice, uchar* bytes, int count);
+ int write (int aDevice, char* bytes, int count);
+ int write (int aDevice, int* bytes, int count);
+
+ int getInCardValue (int aDevice) const;
+ int getOutCardValue (int aDevice) const;
+ protected:
+ static int class_count; // number of existing classes using
+ static int indevcount; // number of MIDI input devices
+ static int outdevcount; // number of MIDI output devices
+ static int initialized; // for starting buileinfodatabase
+
+ static Collection<snd_rawmidi_t*> Sequencer_alsa::rawmidi_in;
+ static Collection<snd_rawmidi_t*> Sequencer_alsa::rawmidi_out;
+ static Collection<int> Sequencer_alsa::midiincard;
+ static Collection<int> Sequencer_alsa::midioutcard;
+ static Collection<int> Sequencer_alsa::midiindevice;
+ static Collection<int> Sequencer_alsa::midioutdevice;
+ static Collection<char*> Sequencer_alsa::midiinname;
+ static Collection<char*> Sequencer_alsa::midioutname;
+
+ private:
+ static void buildInfoDatabase (void);
+ static void getPossibleMidiStreams(Collection<int>& cards,
+ Collection<int>& devices);
+ int getInDeviceValue (int aDevice) const;
+ int getInputType (int aDevice) const;
+ int getOutDeviceValue (int aDevice) const;
+ int getOutputType (int aDevice) const;
+ void removeInfoDatabase (void);
+
+
+ friend void *interpretMidiInputStreamPrivateALSA(void * x);
+
+};
+
+#else /* ALSA is not defined */
+
+typedef unsigned char uchar;
+
+class Sequencer_alsa {
+ public:
+ Sequencer_alsa (int autoOpen = 1) { }
+ ~Sequencer_alsa () { }
+
+ void close (void) { };
+ void displayInputs (std::ostream& out = std::cout,
+ char* initial = "\t")
+ { out << initial << "NONE\n"; }
+ void displayOutputs (std::ostream& out = std::cout,
+ char* initial = "\t")
+ { out << initial << "NONE\n"; }
+ static const char* getInputName (int aDevice) { return ""; }
+ static const char* getOutputName (int aDevice) { return ""; }
+ static int getNumInputs (void) { return 0; }
+ static int getNumOutputs (void) { return 0; }
+ int is_open (int mode, int index) { return 0; }
+ int is_open_in (int index) { return 0; }
+ int is_open_out (int index) { return 0; }
+ int open (void) { return 0; }
+ void read (int dev, uchar* buf, int count) { }
+ void rebuildInfoDatabase (void) { }
+ int write (int aDevice, int aByte) { return 0; }
+ int write (int aDevice, uchar* bytes, int count) { return 0; }
+ int write (int aDevice, char* bytes, int count) { return 0; }
+ int write (int aDevice, int* bytes, int count) { return 0; }
+ int getInCardValue (int aDevice) const { return 0; }
+ int getOutCardValue (int aDevice) const { return 0; }
+
+};
+
+
+#endif /* ALSA */
+
+
+#endif /* _SEQUENCER_ALSA_H_INCLUDED */
+
+
+// md5sum: 6147020b0646fca8245f653505308949 - Sequencer_alsa.h =css= 20030102
diff --git a/src/midiio/include/Sequencer_oss.h b/src/midiio/include/Sequencer_oss.h
new file mode 100644
index 0000000..5f269a7
--- /dev/null
+++ b/src/midiio/include/Sequencer_oss.h
@@ -0,0 +1,92 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Jan 3 21:02:02 PST 1999
+// Last Modified: Sat Jan 30 14:11:18 PST 1999
+// Last Modified: Wed May 10 17:00:11 PDT 2000 (name change from _oss to _oss)
+// Filename: ...sig/maint/code/control/MidiOutPort/Sequencer_oss.h
+// Web Address: http://sig.sapp.org/include/sig/Sequencer_oss.h
+// Syntax: C++
+//
+// Description: Basic MIDI input/output functionality for the
+// Linux OSS midi device /dev/sequencer. This class
+// is inherited by the classes MidiInPort_oss and
+// MidiOutPort_oss.
+//
+
+#ifndef _SEQUENCER_OSS_H_INCLUDED
+#define _SEQUENCER_OSS_H_INCLUDED
+
+#include <iostream>
+
+#define MIDI_EXTERNAL (1)
+#define MIDI_INTERNAL (2)
+
+typedef unsigned char uchar;
+
+
+class Sequencer_oss {
+ public:
+ Sequencer_oss (int autoOpen = 1);
+ ~Sequencer_oss ();
+
+ void close (void);
+ void displayInputs (std::ostream& out = std::cout,
+ char* initial = "\t");
+ void displayOutputs (std::ostream& out = std::cout,
+ char* initial = "\t");
+ static int getNumInputs (void);
+ static int getNumOutputs (void);
+ static const char* getInputName (int aDevice);
+ static const char* getOutputName (int aDevice);
+ int is_open (void);
+ int open (void);
+ void read (uchar* buf, uchar* dev, int count);
+ void rawread (uchar* buf, int packetCount);
+ void rebuildInfoDatabase (void);
+ int write (int aDevice, int aByte);
+ int write (int aDevice, uchar* bytes, int count);
+ int write (int aDevice, char* bytes, int count);
+ int write (int aDevice, int* bytes, int count);
+
+ protected:
+ static const char* sequencer; // name of sequencer device
+ static int sequencer_fd; // sequencer file descriptor
+ static int class_count; // number of existing classes using
+ static uchar midi_write_packet[4]; // for writing MIDI bytes out
+ static uchar midi_read_packet[4]; // for reading MIDI bytes out
+ static uchar synth_write_message[8]; // for writing to internal seq
+ static int indevcount; // number of MIDI input devices
+ static int outdevcount; // number of MIDI output devices
+ static char** indevnames; // MIDI input device names
+ static char** outdevnames; // MIDI output device names
+ static int* indevnum; // total number of MIDI inputs
+ static int* outdevnum; // total number of MIDI outputs
+ static int* indevtype; // 1 = External, 2 = Internal
+ static int* outdevtype; // 1 = External, 2 = Internal
+ static uchar synth_message_buffer[1024]; // hold bytes for synth dev
+ static int synth_message_buffer_count; // count of synth buffer
+ static int synth_message_bytes_expected; // expected count of synth
+ static int synth_message_curr_device; // for keeping track of dev
+ static int initialized; // for starting buileinfodatabase
+
+ private:
+ static void buildInfoDatabase (void);
+ static int getFd (void);
+ int getInDeviceValue (int aDevice) const;
+ int getInputType (int aDevice) const;
+ int getOutDeviceValue (int aDevice) const;
+ int getOutputType (int aDevice) const;
+ void removeInfoDatabase (void);
+ void setFd (int anFd);
+
+ int writeInternal(int aDevice, int aByte);
+ int transmitMessageToInternalSynth(void);
+ int transmitVoiceMessage(void);
+ int transmitCommonMessage(void);
+};
+
+
+#endif /* _SEQUENCER_OSS_H_INCLUDED */
+
+
+// md5sum: 1df08cd946c609b9b42aadbc96b7a296 - Sequencer_oss.h =css= 20030102
diff --git a/src/midiio/include/SigTimer.h b/src/midiio/include/SigTimer.h
new file mode 100644
index 0000000..e93345c
--- /dev/null
+++ b/src/midiio/include/SigTimer.h
@@ -0,0 +1,104 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Thanks to: Erik Neuenschwander <erikn@leland.stanford.edu>
+// for Windows 95 assembly code for Pentium clock cycles.
+// Ozgur Izmirli <ozgur@ccrma.stanford.edu>
+// for concept of periodic timer.
+// Creation Date: Mon Oct 13 11:34:57 GMT-0800 1997
+// Last Modified: Tue Feb 10 21:05:19 GMT-0800 1998
+// Last Modified: Sat Sep 19 15:56:48 PDT 1998
+// Last Modified: Mon Feb 22 04:44:25 PST 1999
+// Last Modified: Sun Nov 28 12:39:39 PST 1999 (added adjustPeriod())
+// Filename: .../sig/code/control/SigTimer/SigTimer.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/SigTimer.h
+// Syntax: C++
+//
+// Description: This class can only be used on Motorola Pentinum 75 Mhz
+// chips or better because the timing information is
+// extracted from the clock cycle count from a register
+// on the CPU itself. This class will estimate the
+// speed of the computer, but it would be better if there
+// was a way of finding out the speed from some function.
+// This class is used primarily for timing of MIDI input
+// and output at a millisecond resolution.
+//
+// Interesting: http://www.datasilicon.nl/I786/timer_1.htm
+//
+
+#ifndef _SIGTIMER_H_INCLUDED
+#define _SIGTIMER_H_INCLUDED
+
+
+#ifdef VISUAL
+ #include <wtypes.h>
+ typedef LONGLONG int64bits;
+#else
+ typedef long long int int64bits;
+ #include <unistd.h> /* for millisleep function */
+#endif
+
+
+class SigTimer {
+ public:
+ SigTimer (void);
+ SigTimer (int aSpeed);
+ SigTimer (SigTimer& aTimer);
+ ~SigTimer ();
+
+ void adjustPeriod (double periodDelta);
+ int expired (void) const;
+ double getPeriod (void) const;
+ double getPeriodCount (void) const;
+ double getTempo (void) const;
+ int getTicksPerSecond (void) const;
+ int getTime (void) const;
+ double getTimeInSeconds (void) const;
+ int getTimeInTicks (void) const;
+ void reset (void);
+ void setPeriod (double aPeriod);
+ void setTempo (double beatsPerMinute);
+ void setPeriodCount (double aCount);
+ void setTicksPerSecond (int aTickRate);
+ void start (void);
+ void sync (SigTimer& aTimer);
+ void update (void);
+ void update (int periodCount);
+
+ // The following functions are semi-private. They do not have
+ // anything to do with timing themselves, but are a by-product
+ // of the timer implementation. They are useful, so they have
+ // been left public; however, they should be used judiciously.
+ static int getCpuSpeed (void);
+ static int measureCpuSpeed (int quantize = 0);
+ static void setCpuSpeed (int aSpeed);
+
+ // the following function is hardware specific to Intel Pentium
+ // computers with a processor speed of at least 75 MHz.
+ // This function is the only non-portable function in this
+ // class, but everything else is based on it.
+ static int64bits clockCycles (void);
+
+ protected:
+ static int64bits globalOffset;
+ static int cpuSpeed;
+
+ int64bits offset;
+ int ticksPerSecond;
+ double period;
+
+ // protected functions
+ double getFactor (void) const;
+
+};
+
+
+// The following function is mostly for Linux:
+void millisleep(int milliseconds);
+void millisleep(float milliseconds);
+
+
+#endif /* _SIGTIMER_H_INCLUDED */
+
+
+
+// md5sum: 601fa3caae4e3bacc4e6fb87f545c86b - SigTimer.h =css= 20030102
diff --git a/src/midiio/include/Voice.h b/src/midiio/include/Voice.h
new file mode 100644
index 0000000..3cddf9f
--- /dev/null
+++ b/src/midiio/include/Voice.h
@@ -0,0 +1,70 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sun Oct 11 18:21:46 PDT 1998
+// Last Modified: Sun Oct 11 18:33:04 PDT 1998
+// Filename: ...sig/maint/code/control/Voice/Voice.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/Voice.h
+// Syntax: C++
+//
+// Description: The Voice class is a MIDI output class which keeps
+// track of the last note played in to it. If the last
+// note was not turned off when a new note is played,
+// then the old note will be turned off before the
+// new note is played.
+//
+
+#ifndef _VOICE_H_INCLUDED
+#define _VOICE_H_INCLUDED
+
+#include "MidiOutput.h"
+
+class Voice : public MidiOutput {
+ public:
+ Voice (int aChannel);
+ Voice (const Voice& aVoice);
+ Voice (void);
+ ~Voice ();
+
+ void cont (int controler, int data);
+ int getChan (void) const;
+ int getChannel (void) const;
+ int getKey (void) const;
+ int getKeynum (void) const;
+ int getOffTime (void) const;
+ int getOnTime (void) const;
+ int getVel (void) const;
+ int getVelocity (void) const;
+ void off (void);
+ void pc (int aTimbre);
+ void play (int aChannel, int aKeyno, int aVelocity);
+ void play (int aKeyno, int aVelocity);
+ void play (void);
+ void setChan (int aChannel);
+ void setChannel (int aChannel);
+ void setKey (int aKeyno);
+ void setKeynum (int aKeyno);
+ void setVel (int aVelocity);
+ void setVelocity (int aVelocity);
+ int status (void) const;
+ void sustain (int aStatus);
+
+ protected:
+ int chan; // the current channel number
+ int key; // the current key number
+ int vel; // the current velocity value
+
+ int onTime; // last note on message sent
+ int offTime; // last note off message sent
+
+ int oldChan; // last channel played on
+ int oldKey; // last key to be played
+ int oldVel; // last velocity of last key
+
+ static SigTimer timer; // for recording on/off times
+};
+
+
+#endif /* _VOICE_H_INCLUDED */
+
+
+// md5sum: 8a5495ecc10d42be6b1832492e107723 - Voice.h =css= 20030102
diff --git a/src/midiio/include/gminstruments.h b/src/midiio/include/gminstruments.h
new file mode 100644
index 0000000..0e567da
--- /dev/null
+++ b/src/midiio/include/gminstruments.h
@@ -0,0 +1,251 @@
+//
+// Copyright 1997-2000 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu> (from 18Dec1997)
+// Creation Date: 26 December 1997
+// Last Modified: Tue Apr 18 11:38:28 PDT 2000 (put CH_X defines here)
+// Filename: ...sig/include/sigInfo/gminstruments.h
+// Web Address: http://sig.sapp.org/include/sigInfo/gminstruments.h
+// Syntax: C
+//
+// Description: Defines names for instruments as arranged in General MIDI.
+//
+
+#ifndef _GMINSTRUMENTS_H_INCLUDED
+#define _GMINSTRUMENTS_H_INCLUDED
+
+#define CH_1 0
+#define CH_2 1
+#define CH_3 2
+#define CH_4 3
+#define CH_5 4
+#define CH_6 5
+#define CH_7 6
+#define CH_8 7
+#define CH_9 8
+#define CH_10 9
+#define CH_11 10
+#define CH_12 11
+#define CH_13 12
+#define CH_14 13
+#define CH_15 14
+#define CH_16 15
+
+#define GM_PIANO(X) (0+(X))
+#define GM_ACOUSTIC_GRAND_PIANO (0)
+#define GM_BRIGHT_ACOUSTIC_PIANO (1)
+#define GM_ELECTRIC_GRAND_PIANO (1)
+#define GM_HONKYTONK_PIANO (2)
+#define GM_HONKY_TONK_PIANO (3)
+#define GM_ELECTRIC_PIANO_1 (4)
+#define GM_ELECTRIC_PIANO_2 (5)
+#define GM_HARPSICHORD (6)
+#define GM_CLAVI (7)
+
+#define GM_CHROMATIC(X) (8+(X))
+#define GM_CELESTA (8)
+#define GM_GLOCKENSPIEL (9)
+#define GM_MUSIC_BOX (10)
+#define GM_VIBRAPHONE (11)
+#define GM_MARIMBA (12)
+#define GM_XYLOPHONE (13)
+#define GM_TUBULAR_BELLS (14)
+#define GM_DULCIMER (15)
+
+#define GM_ORGAN(X) (16+(X))
+#define GM_DRAWBAR_ORGAN (16)
+#define GM_PERCUSSIVE_ORGAN (17)
+#define GM_ROCK_ORGAN (18)
+#define GM_CHURCH_ORGAN (19)
+#define GM_REED_ORGAN (20)
+#define GM_ACCORDION (21)
+#define GM_HARMONICA (22)
+#define GM_TANGO_ACCORDION (23)
+
+#define GM_GUITAR(X) (24+(X))
+#define GM_ACOUSTIC_GUITAR_NYLON (24)
+#define GM_ACOUSTIC_GUITAR_STEEL (25)
+#define GM_ELECTRIC_GUITAR_JAZZ (26)
+#define GM_ELECTRIC_GUITAR_CLEAN (27)
+#define GM_ELECTRIC_GUITAR_MUTED (28)
+#define GM_OVERDRIVEN_GUITAR (29)
+#define GM_DISTORTION_GUITAR (30)
+#define GM_GUITAR_HARMONICS (31)
+
+#define GM_BASS(X) (32+(X))
+#define GM_ACOUSTIC_BASS (32)
+#define GM_ELECTRIC_BASS_FINGER (33)
+#define GM_ELECTRIC_BASS_PICK (34)
+#define GM_FRETLESS_BASS (35)
+#define GM_SLAP_BASS_1 (36)
+#define GM_SLAP_BASS_2 (37)
+#define GM_SYNTH_BASS_1 (38)
+#define GM_SYNTH_BASS_2 (39)
+
+#define GM_STRINGS(X) (40+(X))
+#define GM_VIOLIN (40)
+#define GM_VIOLA (41)
+#define GM_CELLO (42)
+#define GM_CONTRABASS (43)
+#define GM_TREMOLO_STRINGS (44)
+#define GM_PIZZACATO_STRINGS (45)
+#define GM_ORCHESTRAL_HARP (46)
+#define GM_TIMPANI (47)
+
+#define GM_ENSEMBLE(X) (48+(X))
+#define GM_STRING_ENSEMBLE_1 (48)
+#define GM_STRING_ENSEMBLE_2 (49)
+#define GM_SYNTHSTRINGS_1 (50)
+#define GM_SYNTHSTRINGS_2 (51)
+#define GM_CHOIR_AAHS (52)
+#define GM_VOICE_OOHS (53)
+#define GM_SYNTH_VOICE (54)
+#define GM_ORCHESTRA_HIT (55)
+
+#define GM_BRASS(X) (56+(X))
+#define GM_TRUMPET (56)
+#define GM_TROMBONE (57)
+#define GM_TUBA (58)
+#define GM_MUTED_TRUMPED (59)
+#define GM_FRENCH_HORN (60)
+#define GM_BRASS_SECTION (61)
+#define GM_SYNTHBRASS_1 (62)
+#define GM_SYNTHBRASS_2 (63)
+
+#define GM_REED(X) (64+(X))
+#define GM_SOPRANO_SAX (64)
+#define GM_ALTO_SAX (65)
+#define GM_TENOR_SAX (66)
+#define GM_BARITONE_SAX (67)
+#define GM_OBOE (68)
+#define GM_ENGLISH_HORN (69)
+#define GM_BASSOON (70)
+#define GM_CLARINET (71)
+
+#define GM_PIPE(X) (72+(X))
+#define GM_PICCOLO (72)
+#define GM_FLUTE (73)
+#define GM_RECORDER (74)
+#define GM_PAN_FLUTE (75)
+#define GM_BLOWN_BOTTLE (76)
+#define GM_SHAKUHACHI (77)
+#define GM_WHISTLE (78)
+#define GM_OCARINA (79)
+
+#define GM_LEAD(X) (80+(X))
+#define GM_LEAD_SQUARE (80)
+#define GM_LEAD_SAWTOOTH (81)
+#define GM_LEAD_CALLIOPE (82)
+#define GM_LEAD_CHIFF (83)
+#define GM_LEAD_CHARANG (84)
+#define GM_LEAD_VOICE (85)
+#define GM_LEAD_FIFTHS (86)
+#define GM_LEAD_BASS (87)
+
+#define GM_PAD(X) (88+(X))
+#define GM_PAD_NEW_AGE (88)
+#define GM_PAD_WARM (89)
+#define GM_PAD_POLYSYNTH (90)
+#define GM_PAD_CHOIR (91)
+#define GM_PAD_BOWED (92)
+#define GM_PAD_METALLIC (93)
+#define GM_PAD_HALO (94)
+#define GM_PAD_SWEEP (95)
+
+#define GM_FX(X) (96+(X))
+#define GM_FX_TRAIN (96)
+#define GM_FX_SOUNDTRACK (97)
+#define GM_FX_CRYSTAL (98)
+#define GM_FX_ATMOSPHERE (99)
+#define GM_FX_BRIGHTNESS (100)
+#define GM_FX_GOBLINS (101)
+#define GM_FX_ECHOES (102)
+#define GM_FX_SCI_FI (103)
+
+#define GM_ETHNIC(X) (104+(X))
+#define GM_SITAR (104)
+#define GM_BANJO (105)
+#define GM_SHAMISEN (106)
+#define GM_KOTO (107)
+#define GM_KALIMBA (108)
+#define GM_BAGPIPE (109)
+#define GM_FIDDLE (110)
+#define GM_SHANAI (111)
+
+#define GM_PERCUSSION(X) (112+(X))
+#define GM_TINKLE_BELL (112)
+#define GM_AGOGO (113)
+#define GM_STEEL_DRUMS (114)
+#define GM_WOODBLOCKS (115)
+#define GM_TAIKO_DRUM (116)
+#define GM_MELODIC_DRUM (117)
+#define GM_SYNTH_DRUM (118)
+#define GM_REVERSE_CYMBAL (119)
+
+#define GM_SOUNDEFFECT(X) (120+(X))
+#define GM_GUITAR_FRET_NOISE (120)
+#define GM_BREATH_NOISE (121)
+#define GM_SEASHORE (122)
+#define GM_BIRD_TWEET (123)
+#define GM_TELEPHONE_RING (124)
+#define GM_HELICOPTER (125)
+#define GM_APPLAUSE (126)
+#define GM_GUNSHOT (127)
+
+//
+// Percussion instruments on channel 10
+//
+
+#define GM_ACOUSTIC_BASS_DRUM (35)
+#define GM_BASS_DRUM_1 (36)
+#define GM_SIDE_STICK (37)
+#define GM_ACOUSTIC_SNARE (38)
+#define GM_HAND_CLAP (39)
+#define GM_ELECTRIC_SNARE (40)
+#define GM_LOW_FLOOR_TOM (41)
+#define GM_CLOSED_HI_HAT (42)
+#define GM_HIGH_FLOOR_TOM (43)
+#define GM_PEDAL_HI_HAT (44)
+#define GM_LOW_TOM (45)
+#define GM_OPEN_HI_HAT (46)
+#define GM_LOW_MID_TOM (47)
+#define GM_HIGH_MID_TOM (48)
+#define GM_CRASH_CYMBAL_1 (49)
+#define GM_HIGH_TOM (50)
+#define GM_RIDE_CYMBAL_1 (51)
+#define GM_CHINESE_CYMBAL (52)
+#define GM_RIDE_BELL (53)
+#define GM_TAMBOURINE (54)
+#define GM_SPLASH_CYMBAL (55)
+#define GM_COWBELL (56)
+#define GM_CRASH_CYMBAL_2 (57)
+#define GM_VIBRASLAP (58)
+#define GM_RIDE_CYMBAL_2 (59)
+#define GM_HI_BONGO (60)
+#define GM_LOW_BONGO (61)
+#define GM_MUTE_HI_CONGA (62)
+#define GM_OPEN_HI_CONGA (63)
+#define GM_LOW_CONGA (64)
+#define GM_HIGH_TIMBALE (65)
+#define GM_LOW_TIMBALE (66)
+#define GM_HIGH_AGOGO (67)
+#define GM_LOW_AGOGO (68)
+#define GM_CABASA (69)
+#define GM_MARACAS (70)
+#define GM_SHORT_WHISTLE (71)
+#define GM_LONG_WHISTLE (72)
+#define GM_SHORT_GUIRO (73)
+#define GM_LONG_GUIRO (74)
+#define GM_CLAVES (75)
+#define GM_HI_WOOD_BLOCK (76)
+#define GM_LOW_WOOD_BLOCK (77)
+#define GM_MUTE_CUICA (78)
+#define GM_OPEN_CUICA (79)
+#define GM_MUTE_TRIANGLE (80)
+#define GM_OPEN_TRIANGLE (81)
+
+
+#endif /* _GMINSTRUMENTS_H_INCLUDED */
+
+
+
+// md5sum: 6299d04892a6899533b9164aa9e1a874 - gminstruments.h =css= 20030102
diff --git a/src/midiio/include/midichannels.h b/src/midiio/include/midichannels.h
new file mode 100644
index 0000000..4526813
--- /dev/null
+++ b/src/midiio/include/midichannels.h
@@ -0,0 +1,42 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 21 December 1997
+// Last Modified: Wed Feb 11 22:49:59 GMT-0800 1998
+// Filename: ...sig/code/control/misc/midichannels.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/midichannels.h
+// Syntax: C++
+//
+// Description: Offset by 1 MIDI channel names.
+//
+
+#ifndef _MIDICHANNELS_H_INCLUDED
+#define _MIDICHANNELS_H_INCLUDED
+
+/* temporarily changed :
+
+// channel defines: offset from 0
+#define CH_1 (0x00)
+#define CH_2 (0x01)
+#define CH_3 (0x02)
+#define CH_4 (0x03)
+#define CH_5 (0x04)
+#define CH_6 (0x05)
+#define CH_7 (0x06)
+#define CH_8 (0x07)
+#define CH_9 (0x08)
+#define CH_10 (0x09)
+#define CH_11 (0x0a)
+#define CH_12 (0x0b)
+#define CH_13 (0x0c)
+#define CH_14 (0x0d)
+#define CH_15 (0x0e)
+#define CH_16 (0x0f)
+
+*/
+
+#endif /* _MIDICHANNELS_H_INCLUDED */
+
+
+
+
+// md5sum: 5267399f7ff90a6ea3ad2dc132afae3e - midichannels.h =css= 20030102
diff --git a/src/midiio/include/mididefines.h b/src/midiio/include/mididefines.h
new file mode 100644
index 0000000..4161c2f
--- /dev/null
+++ b/src/midiio/include/mididefines.h
@@ -0,0 +1,34 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: 21 December 1997
+// Last Modified: Wed Feb 11 22:49:59 GMT-0800 1998
+// Filename: ...sig/code/control/misc/mididefines.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/mididefines.h
+// Syntax: C++
+//
+// Description: Collection of all of the MIDI convienience defines.
+//
+
+#ifndef _MIDIDEFINES_H_INCLUDED
+#define _MIDIDEFINES_H_INCLUDED
+
+
+// include channel defines
+#include "midichannels.h"
+
+
+// include note name defines
+#include "notenames.h"
+
+
+// include General MIDI instrument names
+#include "gminstruments.h"
+
+
+
+#endif /* _MIDIDEFINES_H_INCLUDED */
+
+
+
+
+// md5sum: 0f081c8e0b386a11e448b6088bfcd489 - mididefines.h =css= 20030102
diff --git a/src/midiio/include/midiiolib.h b/src/midiio/include/midiiolib.h
new file mode 100644
index 0000000..17d0430
--- /dev/null
+++ b/src/midiio/include/midiiolib.h
@@ -0,0 +1,57 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Sat Nov 2 20:20:24 PST 2002
+// Last Modified: Thu Jan 2 18:51:20 PST 2003 (changed name from midio.h)
+// Filename: ...sig/code/misc/midiiolib.h
+// Web Address: http://sig.sapp.org/include/sig/midiiolib.h
+// Syntax: C++
+//
+// Description: Includes all of the header files for using the midiio
+// Library.
+//
+
+#ifndef _MIDIIOLIB_H_INCLUDED
+#define _MIDIIOLIB_H_INCLUDED
+
+#include "Array.h"
+#include "CircularBuffer.h"
+#include "Collection.h"
+#include "FileIO.h"
+#include "gminstruments.h"
+#include "midichannels.h"
+#include "mididefines.h"
+#include "MidiFile.h"
+#include "MidiFileWrite.h"
+#include "MidiInPort_alsa05.h"
+#include "MidiInPort_alsa.h"
+#include "MidiInPort.h"
+#include "MidiInPort_linux.h"
+#include "MidiInPort_oss.h"
+#include "MidiInPort_unsupported.h"
+#include "MidiInPort_visual.h"
+#include "MidiInput.h"
+#include "MidiIO.h"
+#include "MidiMessage.h"
+#include "MidiOutPort_alsa.h"
+#include "MidiOutPort.h"
+#include "MidiOutPort_linux.h"
+#include "MidiOutPort_oss.h"
+#include "MidiOutPort_unsupported.h"
+#include "MidiOutPort_visual.h"
+#include "MidiOutput.h"
+#include "MidiPort.h"
+#include "notenames.h"
+#include "Options.h"
+#include "Options_private.h"
+#include "Sequencer_alsa.h"
+#include "Sequencer_oss.h"
+#include "sigConfiguration.h"
+#include "SigTimer.h"
+#include "Voice.h"
+
+
+#endif /* _MIDIIO_H_INCLUDED */
+
+
+
+// md5sum: b389c20c620865344d827a88a0fb048d - midiiolib.h =css= 20030102
diff --git a/src/midiio/include/notenames.h b/src/midiio/include/notenames.h
new file mode 100644
index 0000000..ce9d505
--- /dev/null
+++ b/src/midiio/include/notenames.h
@@ -0,0 +1,219 @@
+//
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu> (from 18Dec1997)
+// Creation Date: 26 December 1997
+// Last Modified: 26 December 1997
+// Filename: ...sig/code/control/misc/notenames.h
+// Web Address: http://www-ccrma.stanford.edu/~craig/improv/include/notenames.h
+// Syntax: C
+//
+// Description: Defines for pitch names of midi key numbers
+//
+
+#ifndef _NOTENAMES_H_INCLUDED
+#define _NOTENAMES_H_INCLUDED
+
+#define C00 (0)
+#define Cs00 (1)
+#define Db00 (1)
+#define D00 (2)
+#define Ds00 (3)
+#define Eb00 (3)
+#define E00 (4)
+#define F00 (5)
+#define Fs00 (6)
+#define Gb00 (6)
+#define G00 (7)
+#define Gs00 (8)
+#define Ab00 (8)
+#define A00 (9)
+#define As00 (10)
+#define Bb00 (10)
+#define B00 (11)
+
+#define C0 (12)
+#define Cs0 (13)
+#define Db0 (13)
+#define D0 (14)
+#define Ds0 (15)
+#define Eb0 (15)
+#define E0 (16)
+#define F0 (17)
+#define Fs0 (18)
+#define Gb0 (18)
+#define G0 (19)
+#define Gs0 (20)
+#define Ab0 (20)
+#define A0 (21)
+#define As0 (22)
+#define Bb0 (22)
+
+/*
+ * Note that the following symbol B0 is used in
+ * unix in the file /usr/include/termios.h also as
+ * a symbol, so It is disabled for now in this file.
+ * termios.h is need in Unix for the KeyboardInput.h file
+ */
+
+// #define B0 (23)
+
+#define C1 (24)
+#define Cs1 (25)
+#define Db1 (25)
+#define D1 (26)
+#define Ds1 (27)
+#define Eb1 (27)
+#define E1 (28)
+#define F1 (29)
+#define Fs1 (30)
+#define Gb1 (30)
+#define G1 (31)
+#define Gs1 (32)
+#define Ab1 (32)
+#define A1 (33)
+#define As1 (34)
+#define Bb1 (34)
+#define B1 (35)
+
+#define C2 (36)
+#define Cs2 (37)
+#define Db2 (37)
+#define D2 (38)
+#define Ds2 (39)
+#define Eb2 (39)
+#define E2 (40)
+#define F2 (41)
+#define Fs2 (42)
+#define Gb2 (42)
+#define G2 (43)
+#define Gs2 (44)
+#define Ab2 (44)
+#define A2 (45)
+#define As2 (46)
+#define Bb2 (46)
+#define B2 (47)
+
+#define C3 (48)
+#define Cs3 (49)
+#define Db3 (49)
+#define D3 (50)
+#define Ds3 (51)
+#define Eb3 (51)
+#define E3 (52)
+#define F3 (53)
+#define Fs3 (54)
+#define Gb3 (54)
+#define G3 (55)
+#define Gs3 (56)
+#define Ab3 (56)
+#define A3 (57)
+#define As3 (58)
+#define Bb3 (58)
+#define B3 (59)
+
+#define C4 (60)
+#define Cs4 (61)
+#define Db4 (61)
+#define D4 (62)
+#define Ds4 (63)
+#define Eb4 (63)
+#define E4 (64)
+#define F4 (65)
+#define Fs4 (66)
+#define Gb4 (66)
+#define G4 (67)
+#define Gs4 (68)
+#define Ab4 (68)
+#define A4 (69)
+#define As4 (70)
+#define Bb4 (70)
+#define B4 (71)
+
+#define C5 (72)
+#define Cs5 (73)
+#define Db5 (73)
+#define D5 (74)
+#define Ds5 (75)
+#define Eb5 (75)
+#define E5 (76)
+#define F5 (77)
+#define Fs5 (78)
+#define Gb5 (78)
+#define G5 (79)
+#define Gs5 (80)
+#define Ab5 (81)
+#define A5 (81)
+#define As5 (82)
+#define Bb5 (82)
+#define B5 (83)
+
+#define C6 (84)
+#define Cs6 (85)
+#define Db6 (85)
+#define D6 (86)
+#define Ds6 (87)
+#define Eb6 (87)
+#define E6 (88)
+#define F6 (89)
+#define Fs6 (90)
+#define Gb6 (90)
+#define G6 (91)
+#define Gs6 (92)
+#define Ab6 (92)
+#define A6 (93)
+#define As6 (94)
+#define Bb6 (94)
+#define B6 (95)
+
+#define C7 (96)
+#define Cs7 (97)
+#define Db7 (97)
+#define D7 (98)
+#define Ds7 (99)
+#define Eb7 (99)
+#define E7 (100)
+#define F7 (101)
+#define Fs7 (102)
+#define Gb7 (102)
+#define G7 (103)
+#define Gs7 (104)
+#define Ab7 (104)
+#define A7 (105)
+#define As7 (106)
+#define Bb7 (106)
+#define B7 (107)
+
+#define C8 (108)
+#define Cs8 (109)
+#define Db8 (109)
+#define D8 (110)
+#define Ds8 (111)
+#define Eb8 (111)
+#define E8 (112)
+#define F8 (113)
+#define Fs8 (114)
+#define Gb8 (114)
+#define G8 (115)
+#define Gs8 (116)
+#define Ab8 (116)
+#define A8 (117)
+#define As8 (118)
+#define Bb8 (118)
+#define B8 (119)
+
+#define C9 (120)
+#define Cs9 (121)
+#define Db9 (121)
+#define D9 (122)
+#define Ds9 (123)
+#define Eb9 (123)
+#define E9 (124)
+#define F9 (125)
+#define Fs9 (126)
+#define Gb9 (126)
+#define G9 (127)
+
+
+#endif /* _NOTENAMES_H_INCLUDED */
+
+
+// md5sum: c0f727163d32e04212a0ce5c8b6c4a6f - notenames.h =css= 20030102
diff --git a/src/midiio/include/sigConfiguration.h b/src/midiio/include/sigConfiguration.h
new file mode 100644
index 0000000..b1e5f17
--- /dev/null
+++ b/src/midiio/include/sigConfiguration.h
@@ -0,0 +1,100 @@
+//
+// Copyright 1997 by Craig Stuart Sapp, All Rights Reserved.
+// Programmer: Craig Stuart Sapp <craig@ccrma.stanford.edu>
+// Creation Date: Mon Dec 1 18:16:57 GMT-0800 1997
+// Last Modified: Mon Dec 1 18:16:57 GMT-0800 1997
+// Filename: ...sig/maint/code/misc/sigConfiguration.h
+// Web Address: http://sig.sapp.org/include/sig/sigConfiguration.h
+// Syntax: C
+//
+// Description: This file defines flags for different code setups:
+// You specify the OS in a compiler flag and this file takes care
+// of the rest of the defines for that OS. This file should
+// automatically be included in any file which uses any of the
+// define flags below.
+//
+// OS setup defines to use in compiling files:
+//
+// -DLINUX: Linux running on intel computers
+// -DNEXTI: NeXT OS on Intel Hardware
+// -DNEXTM: NeXT OS on Motorola Hardware
+// -DSUN: Sun SPARCstations
+// -DVISUAL: Windows 95/NT using Microsoft Visual C++ 5.0
+// -DHPUX: Hewlett-Packard Unix Workstations.
+// -DIRIX: SGI computers with IRIX OS.
+//
+//
+// Various options that can be defined for each OS. These
+// defines may be mixed and matched in different OSes:
+//
+// -DOTHEREND: If the computer is little-endian, then this
+// define switches the byte ordering behavior for writing/reading
+// soundfiles. Intel computers need this define, most others
+// will not.need this define.
+//
+// -DSHORTRAND: Indicates that the rand() function generates
+// numbers between 0 and 0x7fff. The default without this
+// option is a range between 0 and 0x7fffffff.
+//
+// -DINTEL: Indicates that the computer hardware uses an
+// intel x86 CPU. Not used for anything right now except to
+// define the endian flag (OTHEREND).
+//
+// -DMOTOROLA: Indicates that the computer hardware uses a
+// Motorola 68k CPU. Not used for anything right now.
+//
+//
+
+#ifndef _SIGCONFIGURATION_H_INCLUDED
+#define _SIGCONFIGURATION_H_INCLUDED
+
+
+#ifdef LINUX
+ #define INTEL
+#endif
+
+
+#ifdef NEXTI
+ #define INTEL
+#endif
+
+
+#ifdef NEXT
+ #define MOTOROLA
+#endif
+
+
+#ifdef VISUAL
+ #define INTEL
+#endif
+
+
+#ifdef SUN
+ #define SHORTRAND
+#endif
+
+
+#ifdef HPUX
+ #define SHORTRAND
+#endif
+
+
+#ifdef IRIX
+ #define SHORTRAND
+#endif
+
+
+// These defines must come after the previous defines:
+
+
+#ifdef INTEL
+ #define OTHEREND
+#endif
+
+
+
+#endif /* _SIGCONFIGURATION_H_INCLUDED */
+
+
+
+// md5sum: 32f74a7c264b158b83ff38db1ea885f8 - sigConfiguration.h =css= 20030102