diff options
| author | Gary Scavone <gary@music.mcgill.ca> | 2013-10-11 14:49:10 +0200 |
|---|---|---|
| committer | Stephen Sinclair <sinclair@music.mcgill.ca> | 2013-10-11 14:49:10 +0200 |
| commit | eeca35408122b9fc020139a20255f3c1ad8254cd (patch) | |
| tree | 1cd66b9cf28691271c67a3ed1a424d1ccf407065 /tests | |
Version 1.0.0
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/Debug/.placeholder | 0 | ||||
| -rw-r--r-- | tests/Makefile.in | 43 | ||||
| -rw-r--r-- | tests/Release/.placeholder | 0 | ||||
| -rw-r--r-- | tests/RtMidi.dsw | 65 | ||||
| -rw-r--r-- | tests/cmidiin.cpp | 81 | ||||
| -rw-r--r-- | tests/cmidiin.dsp | 114 | ||||
| -rw-r--r-- | tests/cmidiin.plg | 33 | ||||
| -rw-r--r-- | tests/midiinfo.cpp | 70 | ||||
| -rw-r--r-- | tests/midiinfo.dsp | 114 | ||||
| -rw-r--r-- | tests/midiinfo.plg | 25 | ||||
| -rw-r--r-- | tests/midiout.cpp | 106 | ||||
| -rw-r--r-- | tests/midiout.dsp | 114 | ||||
| -rw-r--r-- | tests/midiout.plg | 33 | ||||
| -rw-r--r-- | tests/qmidiin.cpp | 97 | ||||
| -rw-r--r-- | tests/qmidiin.dsp | 114 | ||||
| -rw-r--r-- | tests/qmidiin.plg | 25 |
16 files changed, 1034 insertions, 0 deletions
diff --git a/tests/Debug/.placeholder b/tests/Debug/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/Debug/.placeholder diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..4acc864 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,43 @@ +### RtMidi tests Makefile - for various flavors of unix + +PROGRAMS = midiinfo midiout qmidiin cmidiin +RM = /bin/rm +SRC_PATH = ../ +INCLUDE = ../ +OBJECT_PATH = @object_path@ +vpath %.o $(OBJECT_PATH) + +OBJECTS = RtMidi.o + +CC = @CXX@ +DEFS = @debug@ +DEFS += @midi_api@ +CFLAGS = @cflags@ +CFLAGS += @warn@ -I$(INCLUDE) +LIBRARY = @LIBS@ +LIBRARY += @frameworks@ + +%.o : $(SRC_PATH)/%.cpp + $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $(OBJECT_PATH)/$@ + +all : $(PROGRAMS) + +midiinfo : midiinfo.cpp $(OBJECTS) + $(CC) $(CFLAGS) $(DEFS) -o midiinfo midiinfo.cpp $(OBJECT_PATH)/RtMidi.o $(LIBRARY) + +midiout : midiout.cpp $(OBJECTS) + $(CC) $(CFLAGS) $(DEFS) -o midiout midiout.cpp $(OBJECT_PATH)/RtMidi.o $(LIBRARY) + +qmidiin : qmidiin.cpp $(OBJECTS) + $(CC) $(CFLAGS) $(DEFS) -o qmidiin qmidiin.cpp $(OBJECT_PATH)/RtMidi.o $(LIBRARY) + +cmidiin : cmidiin.cpp $(OBJECTS) + $(CC) $(CFLAGS) $(DEFS) -o cmidiin cmidiin.cpp $(OBJECT_PATH)/RtMidi.o $(LIBRARY) + +clean : + -rm $(OBJECT_PATH)/*.o + -rm $(PROGRAMS) + -rm -f *~ + +strip : + strip $(PROGRAMS) diff --git a/tests/Release/.placeholder b/tests/Release/.placeholder new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/Release/.placeholder diff --git a/tests/RtMidi.dsw b/tests/RtMidi.dsw new file mode 100644 index 0000000..d9673f2 --- /dev/null +++ b/tests/RtMidi.dsw @@ -0,0 +1,65 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "cmidiin"=.\cmidiin.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "midiinfo"=.\midiinfo.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "midiout"=.\midiout.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "qmidiin"=.\qmidiin.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/tests/cmidiin.cpp b/tests/cmidiin.cpp new file mode 100644 index 0000000..bd63a84 --- /dev/null +++ b/tests/cmidiin.cpp @@ -0,0 +1,81 @@ +//*****************************************// +// cmidiin.cpp +// by Gary Scavone, 2003-2004. +// +// Simple program to test MIDI input and +// use of a user callback function. +// +//*****************************************// + +#include <iostream> +#include "RtMidi.h" + +void usage(void) { + // Error function in case of incorrect command-line + // argument specifications. + std::cout << "\nuseage: cmidiin <port>\n"; + std::cout << " where port = the device to use (default = 0).\n\n"; + exit(0); +} + +void mycallback( double deltatime, std::vector< unsigned char > *message, void *userData ) +{ + unsigned int nBytes = message->size(); + for ( unsigned int i=0; i<nBytes; i++ ) + std::cout << "Byte " << i << " = " << (int)message->at(i) << ", "; + if ( nBytes > 0 ) + std::cout << "stamp = " << deltatime << '\n'; +} + +int main(int argc, char *argv[]) +{ + RtMidiIn *midiin = 0; + + // Minimal command-line check. + if ( argc > 2 ) usage(); + + // RtMidiIn constructor + try { + midiin = new RtMidiIn(); + } + catch (RtError &error) { + error.printMessage(); + exit(EXIT_FAILURE); + } + + // Check available ports vs. specified. + unsigned int port = 0; + unsigned int nPorts = midiin->getPortCount(); + if ( argc == 2 ) port = (unsigned int) atoi( argv[1] ); + if ( port >= nPorts ) { + delete midiin; + std::cout << "Invalid port specifier!\n"; + usage(); + } + + try { + midiin->openPort( port ); + } + catch (RtError &error) { + error.printMessage(); + goto cleanup; + } + + // Set our callback function. This should be done immediately after + // opening the port to avoid having incoming messages written to the + // queue instead of sent to the callback function. + midiin->setCallback( &mycallback ); + + // Don't ignore sysex, timing, or active sensing messages. + midiin->ignoreTypes( false, false, false ); + + std::cout << "\nReading MIDI input ... press <enter> to quit.\n"; + char input; + std::cin.get(input); + + // Clean up + cleanup: + delete midiin; + + return 0; +} diff --git a/tests/cmidiin.dsp b/tests/cmidiin.dsp new file mode 100644 index 0000000..cacda20 --- /dev/null +++ b/tests/cmidiin.dsp @@ -0,0 +1,114 @@ +# Microsoft Developer Studio Project File - Name="cmidiin" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=cmidiin - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cmidiin.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cmidiin.mak" CFG="cmidiin - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cmidiin - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "cmidiin - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cmidiin - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "cmidiin___Win32_Release"
+# PROP BASE Intermediate_Dir "cmidiin___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "cmidiin - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "cmidiin___Win32_Debug"
+# PROP BASE Intermediate_Dir "cmidiin___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "cmidiin - Win32 Release"
+# Name "cmidiin - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\cmidiin.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\RtError.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/cmidiin.plg b/tests/cmidiin.plg new file mode 100644 index 0000000..27a0bcf --- /dev/null +++ b/tests/cmidiin.plg @@ -0,0 +1,33 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: cmidiin - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "c:\windows\TEMP\RSP5012.TMP" with contents
+[
+/nologo /ML /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /Fp"Release/cmidiin.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
+"C:\gary\rtmidi\RtMidi.cpp"
+]
+Creating command line "cl.exe @c:\windows\TEMP\RSP5012.TMP"
+Creating temporary file "c:\windows\TEMP\RSP5013.TMP" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /incremental:no /pdb:"cmidiin.pdb" /machine:I386 /out:"cmidiin.exe"
+.\Release\RtMidi.obj
+.\Release\cmidiin.obj
+]
+Creating command line "link.exe @c:\windows\TEMP\RSP5013.TMP"
+<h3>Output Window</h3>
+Compiling...
+RtMidi.cpp
+Linking...
+
+
+
+<h3>Results</h3>
+cmidiin.exe - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/tests/midiinfo.cpp b/tests/midiinfo.cpp new file mode 100644 index 0000000..58a6275 --- /dev/null +++ b/tests/midiinfo.cpp @@ -0,0 +1,70 @@ +// midiinfo.cpp +// +// Simple program to check MIDI inputs and outputs. +// +// by Gary Scavone, 2003-2004. + +#include <iostream> +#include "RtMidi.h" + +int main() +{ + RtMidiIn *midiin = 0; + RtMidiOut *midiout = 0; + + // RtMidiIn constructor + try { + midiin = new RtMidiIn(); + } + catch (RtError &error) { + error.printMessage(); + exit(EXIT_FAILURE); + } + + // Check inputs. + unsigned int nPorts = midiin->getPortCount(); + std::cout << "\nThere are " << nPorts << " MIDI input sources available.\n"; + std::string portName; + unsigned int i; + for ( i=0; i<nPorts; i++ ) { + try { + portName = midiin->getPortName(i); + } + catch (RtError &error) { + error.printMessage(); + goto cleanup; + } + std::cout << " Input Port #" << i+1 << ": " << portName << '\n'; + } + + // RtMidiOut constructor + try { + midiout = new RtMidiOut(); + } + catch (RtError &error) { + error.printMessage(); + exit(EXIT_FAILURE); + } + + // Check outputs. + nPorts = midiout->getPortCount(); + std::cout << "\nThere are " << nPorts << " MIDI output ports available.\n"; + for ( i=0; i<nPorts; i++ ) { + try { + portName = midiout->getPortName(i); + } + catch (RtError &error) { + error.printMessage(); + goto cleanup; + } + std::cout << " Output Port #" << i+1 << ": " << portName << '\n'; + } + std::cout << '\n'; + + // Clean up + cleanup: + delete midiin; + delete midiout; + + return 0; +} diff --git a/tests/midiinfo.dsp b/tests/midiinfo.dsp new file mode 100644 index 0000000..984513e --- /dev/null +++ b/tests/midiinfo.dsp @@ -0,0 +1,114 @@ +# Microsoft Developer Studio Project File - Name="midiinfo" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=midiinfo - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "midiinfo.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "midiinfo.mak" CFG="midiinfo - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "midiinfo - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "midiinfo - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "midiinfo - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "midiinfo - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "midiinfo - Win32 Release"
+# Name "midiinfo - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\midiinfo.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\RtError.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/midiinfo.plg b/tests/midiinfo.plg new file mode 100644 index 0000000..7455bf6 --- /dev/null +++ b/tests/midiinfo.plg @@ -0,0 +1,25 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: midiinfo - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "c:\windows\TEMP\RSP51B0.TMP" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /incremental:no /pdb:"midiinfo.pdb" /machine:I386 /out:"midiinfo.exe"
+.\Release\midiinfo.obj
+.\Release\RtMidi.obj
+]
+Creating command line "link.exe @c:\windows\TEMP\RSP51B0.TMP"
+<h3>Output Window</h3>
+Linking...
+
+
+
+<h3>Results</h3>
+midiinfo.exe - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/tests/midiout.cpp b/tests/midiout.cpp new file mode 100644 index 0000000..32781b9 --- /dev/null +++ b/tests/midiout.cpp @@ -0,0 +1,106 @@ +//*****************************************// +// midiout.cpp +// by Gary Scavone, 2003-2004. +// +// Simple program to test MIDI output. +// +//*****************************************// + +#include <iostream> +#include "RtMidi.h" + +// Platform-dependent sleep routines. +#if defined(__WINDOWS_MM__) + #include <windows.h> + #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) +#else // Unix variants + #include <unistd.h> + #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) ) +#endif + +void usage(void) { + // Error function in case of incorrect command-line + // argument specifications. + std::cout << "\nuseage: midiout <port>\n"; + std::cout << " where port = the device to use (default = 0).\n\n"; + exit(0); +} + +int main(int argc, char *argv[]) +{ + RtMidiOut *midiout = 0; + std::vector<unsigned char> message; + + // Minimal command-line check. + if ( argc > 2 ) usage(); + + // RtMidiOut constructor + try { + midiout = new RtMidiOut(); + } + catch (RtError &error) { + error.printMessage(); + exit(EXIT_FAILURE); + } + + // Check available ports vs. specified. + unsigned int port = 0; + unsigned int nPorts = midiout->getPortCount(); + if ( argc == 2 ) port = (unsigned int) atoi( argv[1] ); + if ( port >= nPorts ) { + delete midiout; + std::cout << "Invalid port specifier!\n"; + usage(); + } + + try { + midiout->openPort( port ); + //midiout->openVirtualPort(); + } + catch (RtError &error) { + error.printMessage(); + goto cleanup; + } + + // Send out a series of MIDI messages. + + // Program change: 192, 5 + message.push_back( 192 ); + message.push_back( 5 ); + midiout->sendMessage( &message ); + + // Control Change: 176, 7, 100 (volume) + message[0] = 176; + message[1] = 7; + message.push_back( 100 ); + midiout->sendMessage( &message ); + + // Note On: 144, 64, 90 + message[0] = 144; + message[1] = 64; + message[2] = 90; + midiout->sendMessage( &message ); + + SLEEP( 500 ); + + // Note Off: 128, 64, 40 + message[0] = 128; + message[1] = 64; + message[2] = 40; + midiout->sendMessage( &message ); + + // Sysex: 240, 67, 16, 4, 3, 2, 247 + message[0] = 240; + message[1] = 67; + message[2] = 4; + message.push_back( 3 ); + message.push_back( 2 ); + message.push_back( 247 ); + midiout->sendMessage( &message ); + + // Clean up + cleanup: + delete midiout; + + return 0; +} diff --git a/tests/midiout.dsp b/tests/midiout.dsp new file mode 100644 index 0000000..3f9480f --- /dev/null +++ b/tests/midiout.dsp @@ -0,0 +1,114 @@ +# Microsoft Developer Studio Project File - Name="midiout" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=midiout - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "midiout.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "midiout.mak" CFG="midiout - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "midiout - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "midiout - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "midiout - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "midiout___Win32_Release"
+# PROP BASE Intermediate_Dir "midiout___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "midiout - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "midiout___Win32_Debug"
+# PROP BASE Intermediate_Dir "midiout___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "midiout - Win32 Release"
+# Name "midiout - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\midiout.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\RtError.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/midiout.plg b/tests/midiout.plg new file mode 100644 index 0000000..ce83de2 --- /dev/null +++ b/tests/midiout.plg @@ -0,0 +1,33 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: midiout - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "c:\windows\TEMP\RSP5250.TMP" with contents
+[
+/nologo /ML /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /Fp"Release/midiout.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c
+"C:\gary\rtmidi\tests\midiout.cpp"
+]
+Creating command line "cl.exe @c:\windows\TEMP\RSP5250.TMP"
+Creating temporary file "c:\windows\TEMP\RSP5251.TMP" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /incremental:no /pdb:"midiout.pdb" /machine:I386 /out:"midiout.exe"
+.\Release\RtMidi.obj
+.\Release\midiout.obj
+]
+Creating command line "link.exe @c:\windows\TEMP\RSP5251.TMP"
+<h3>Output Window</h3>
+Compiling...
+midiout.cpp
+Linking...
+
+
+
+<h3>Results</h3>
+midiout.exe - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
diff --git a/tests/qmidiin.cpp b/tests/qmidiin.cpp new file mode 100644 index 0000000..639820a --- /dev/null +++ b/tests/qmidiin.cpp @@ -0,0 +1,97 @@ +//*****************************************// +// qmidiin.cpp +// by Gary Scavone, 2003-2004. +// +// Simple program to test MIDI input and +// retrieval from the queue. +// +//*****************************************// + +#include <iostream> +#include <signal.h> +#include "RtMidi.h" + +// Platform-dependent sleep routines. +#if defined(__WINDOWS_MM__) + #include <windows.h> + #define SLEEP( milliseconds ) Sleep( (DWORD) milliseconds ) +#else // Unix variants + #include <unistd.h> + #define SLEEP( milliseconds ) usleep( (unsigned long) (milliseconds * 1000.0) ) +#endif + +bool done; +static void finish(int ignore){ done = true; } + +void usage(void) { + // Error function in case of incorrect command-line + // argument specifications. + std::cout << "\nuseage: qmidiin <port>\n"; + std::cout << " where port = the device to use (default = 0).\n\n"; + exit(0); +} + +int main(int argc, char *argv[]) +{ + RtMidiIn *midiin = 0; + std::vector<unsigned char> message; + int nBytes, i; + double stamp; + + // Minimal command-line check. + if ( argc > 2 ) usage(); + + // RtMidiIn constructor + try { + midiin = new RtMidiIn(); + } + catch (RtError &error) { + error.printMessage(); + exit(EXIT_FAILURE); + } + + // Check available ports vs. specified. + unsigned int port = 0; + unsigned int nPorts = midiin->getPortCount(); + if ( argc == 2 ) port = (unsigned int) atoi( argv[1] ); + if ( port >= nPorts ) { + delete midiin; + std::cout << "Invalid port specifier!\n"; + usage(); + } + + try { + midiin->openPort( port ); + } + catch (RtError &error) { + error.printMessage(); + goto cleanup; + } + + // Don't ignore sysex, timing, or active sensing messages. + midiin->ignoreTypes( false, false, false ); + + // Install an interrupt handler function. + done = false; + (void) signal(SIGINT, finish); + + // Periodically check input queue. + std::cout << "Reading MIDI from port ... quit with Ctrl-C.\n"; + while ( !done ) { + stamp = midiin->getMessage( &message ); + nBytes = message.size(); + for ( i=0; i<nBytes; i++ ) + std::cout << "Byte " << i << " = " << (int)message[i] << ", "; + if ( nBytes > 0 ) + std::cout << "stamp = " << stamp << '\n'; + + // Sleep for 10 milliseconds. + SLEEP( 10 ); + } + + // Clean up + cleanup: + delete midiin; + + return 0; +} diff --git a/tests/qmidiin.dsp b/tests/qmidiin.dsp new file mode 100644 index 0000000..9b66f7e --- /dev/null +++ b/tests/qmidiin.dsp @@ -0,0 +1,114 @@ +# Microsoft Developer Studio Project File - Name="qmidiin" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=qmidiin - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "qmidiin.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "qmidiin.mak" CFG="qmidiin - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "qmidiin - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "qmidiin - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "qmidiin - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "qmidiin___Win32_Release"
+# PROP BASE Intermediate_Dir "qmidiin___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "../" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "qmidiin - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "qmidiin___Win32_Debug"
+# PROP BASE Intermediate_Dir "qmidiin___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "__WINDOWS_MM__" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "qmidiin - Win32 Release"
+# Name "qmidiin - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\qmidiin.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\RtError.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\RtMidi.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/tests/qmidiin.plg b/tests/qmidiin.plg new file mode 100644 index 0000000..2f41a5d --- /dev/null +++ b/tests/qmidiin.plg @@ -0,0 +1,25 @@ +<html>
+<body>
+<pre>
+<h1>Build Log</h1>
+<h3>
+--------------------Configuration: qmidiin - Win32 Release--------------------
+</h3>
+<h3>Command Lines</h3>
+Creating temporary file "c:\windows\TEMP\RSP5122.TMP" with contents
+[
+kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib winmm.lib /nologo /subsystem:console /incremental:no /pdb:"qmidiin.pdb" /machine:I386 /out:"qmidiin.exe"
+.\Release\qmidiin.obj
+.\Release\RtMidi.obj
+]
+Creating command line "link.exe @c:\windows\TEMP\RSP5122.TMP"
+<h3>Output Window</h3>
+Linking...
+
+
+
+<h3>Results</h3>
+qmidiin.exe - 0 error(s), 0 warning(s)
+</pre>
+</body>
+</html>
|
