aboutsummaryrefslogtreecommitdiff
path: root/pd/portmidi
diff options
context:
space:
mode:
Diffstat (limited to 'pd/portmidi')
-rw-r--r--pd/portmidi/Makefile77
-rw-r--r--pd/portmidi/README.txt62
-rw-r--r--pd/portmidi/portmidi.dsp124
-rw-r--r--pd/portmidi/portmidi.dsw158
4 files changed, 421 insertions, 0 deletions
diff --git a/pd/portmidi/Makefile b/pd/portmidi/Makefile
new file mode 100644
index 00000000..7a87606d
--- /dev/null
+++ b/pd/portmidi/Makefile
@@ -0,0 +1,77 @@
+# MAKEFILE FOR PORTMIDI AND PORTTIME
+
+
+# For debugging, define PM_CHECK_ERRORS
+PMFLAGS = -DPM_CHECK_ERRORS
+# Otherwise do not define PM_CHECK_ERRORS
+# PMFLAGS =
+
+# Use this for linux alsa (0.9x) version
+versions = pm_linux/pmlinuxalsa.o
+ALSALIB = -lasound
+VFLAGS = -DPMALSA
+
+# Use this for null (a dummy implementation for no Midi I/O:
+# versions = pmlinuxnull.o
+# ALSALIB =
+# VFLAGS = -DPMNULL
+
+pmlib = pm_linux/libportmidi.a
+
+ptlib = porttime/libporttime.a
+
+CC = gcc $(VFLAGS) $(PMFLAGS) -g -Ipm_common -Iporttime
+
+pmobjects = pm_common/pmutil.o $(versions) pm_linux/pmlinux.o \
+ pm_common/portmidi.o pm_linux/pmlinuxalsa.o
+
+ptobjects = porttime/porttime.o porttime/ptlinux.o
+
+current: all
+
+all: $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread \
+ pm_test/latency pm_test/midithru
+
+$(pmlib): Makefile $(pmobjects)
+ ar -cr $(pmlib) $(pmobjects)
+
+$(ptlib): Makefile $(ptobjects)
+ ar -cr $(ptlib) $(ptobjects)
+
+pm_linux/pmlinuxalsa.o: Makefile pm_linux/pmlinuxalsa.c pm_linux/pmlinuxalsa.h
+ $(CC) -c pm_linux/pmlinuxalsa.c -o pm_linux/pmlinuxalsa.o
+
+pm_test/test: Makefile pm_test/test.o $(pmlib) $(ptlib)
+ $(CC) pm_test/test.c -o pm_test/test $(pmlib) $(ptlib) $(ALSALIB)
+
+pm_test/sysex: Makefile pm_test/sysex.o $(pmlib) $(ptlib)
+ $(CC) pm_test/sysex.c -o pm_test/sysex $(pmlib) $(ptlib) $(ALSALIB)
+
+pm_test/midithread: Makefile pm_test/midithread.o $(pmlib) $(ptlib)
+ $(CC) pm_test/midithread.c -o pm_test/midithread \
+ $(pmlib) $(ptlib) $(ALSALIB)
+
+pm_test/latency: Makefile $(ptlib) pm_test/latency.o
+ $(CC) pm_test/latency.c -o pm_test/latency $(pmlib) $(ptlib) \
+ $(ALSALIB) -lpthread -lm
+
+pm_test/midithru: Makefile $(ptlib) pm_test/midithru.o
+ $(CC) pm_test/midithru.c -o pm_test/midithru $(pmlib) $(ptlib) \
+ $(ALSALIB) -lpthread -lm
+
+porttime/ptlinux.o: Makefile porttime/ptlinux.c
+ $(CC) -c porttime/ptlinux.c -o porttime/ptlinux.o
+
+clean:
+ rm -f *.o *~ core* */*.o */*~ */core* pm_test/*/pm_dll.dll
+ rm -f *.opt *.ncb *.plg pm_win/Debug/pm_dll.lib pm_win/Release/pm_dll.lib
+ rm -f pm_test/*.opt pm_test/*.ncb
+
+cleaner: clean
+
+cleanest: cleaner
+ rm -f $(pmlib) $(ptlib) pm_test/test pm_test/sysex pm_test/midithread
+ rm -f pm_test/latency pm_test/midithru
+
+backup: cleanest
+ cd ..; zip -r portmidi.zip portmidi
diff --git a/pd/portmidi/README.txt b/pd/portmidi/README.txt
new file mode 100644
index 00000000..76412efd
--- /dev/null
+++ b/pd/portmidi/README.txt
@@ -0,0 +1,62 @@
+README for PortMidi
+Roger Dannenberg
+6 April 2003
+revised May 2004
+
+For Windows, please see also README_WIN.txt and debugging_dlls.txt
+in pm_win.
+
+For Linux, please see also README_LINUX.txt in pm_linux.
+
+POINTERS VS DEVICE NUMBERS
+
+When you open a MIDI port, PortMidi allocates a structure to
+maintain the state of the open device. Since every device is
+also listed in a table, you might think it would be simpler to
+use the table index rather than a pointer to identify a device.
+This would also help with error checking (it's hard to make
+sure a pointer is valid). PortMidi's design parallels that of
+PortAudio.
+
+ERROR HANDLING
+
+Error handling turned out to be much more complicated than expected.
+PortMidi functions return error codes that the caller can check.
+In addition, errors may occur asynchronously due to MIDI input. In
+this case, the error code is transferred to the next call to
+Pm_Read or Pm_Write. Furthermore, an error can arise during a MIDI THRU
+operation that is also invoked as a side effect of polling for input.
+
+Ordinarily, the caller checks for an error code. If the error is
+system-dependent, pmHostError is returned and the caller can
+call Pm_GetHostErrorText to get a text description of the error.
+
+Host errors are recorded in the system-specific data allocated for
+each open MIDI port. However, if an error occurs on open or close,
+we cannot store the error with the device because there will be
+no device data (assuming PortMidi cleans up after devices that
+are not open). For open and close, we will store the host error
+in a global variable. The PortMidi is smart enough to look here
+first when the user asks for ErrorText.
+
+Because output to a MIDI Thru stream can be invoked as a side-effect
+of a MIDI read operation, some errors normally associated with
+writing MIDI can be returned from Pm_Read.
+
+DEBUGGING
+
+If you are building a console application for research, we suggest
+compiling with the option PM_CHECK_ERRORS. This will insert a
+check for error return values at the end of each PortMidi
+function. If an error is encountered, a text message is printed
+using printf(), the user is asked to type ENTER, and then exit(-1)
+is called to clean up and terminate the program.
+
+You should not use PM_CHECK_ERRORS if printf() does not work
+(e.g. this is not a console application under Windows, or there
+is no visible console on some other OS), and you should not use
+PM_CHECK_ERRORS if you intend to recover from errors rather than
+abruptly terminate the program.
+
+The Windows version (and perhaps others) also offers a DEBUG
+compile-time option. See README_WIN.txt.
diff --git a/pd/portmidi/portmidi.dsp b/pd/portmidi/portmidi.dsp
new file mode 100644
index 00000000..699cc120
--- /dev/null
+++ b/pd/portmidi/portmidi.dsp
@@ -0,0 +1,124 @@
+# Microsoft Developer Studio Project File - Name="portmidi" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=portmidi - 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 "portmidi.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 "portmidi.mak" CFG="portmidi - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "portmidi - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "portmidi - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "portmidi - 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 "pm_win\Release"
+# PROP Intermediate_Dir "pm_win\Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "pm_common" /I "porttime" /I "pm_win" /D "WIN32" /D "_MBCS" /D "_LIB" /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
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF "$(CFG)" == "portmidi - 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 "pm_win\Debug"
+# PROP Intermediate_Dir "pm_win\Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "pm_common" /I "porttime" /I "pm_win" /D "_LIB" /D "DEBUG" /D "PM_CHECK_ERRORS" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "USE_DLL_FOR_CLEANUP" /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
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF
+
+# Begin Target
+
+# Name "portmidi - Win32 Release"
+# Name "portmidi - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\pm_common\pmutil.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pm_win\pmwin.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pm_win\pmwinmm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\pm_common\portmidi.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\pm_common\pminternal.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pm_common\pmutil.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pm_win\pmwinmm.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\pm_common\portmidi.h
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/pd/portmidi/portmidi.dsw b/pd/portmidi/portmidi.dsw
new file mode 100644
index 00000000..1ccfb5bf
--- /dev/null
+++ b/pd/portmidi/portmidi.dsw
@@ -0,0 +1,158 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "latency"=.\PM_TEST\latency.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name portmidi
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name porttime
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "midithread"=.\pm_test\midithread.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name pm_dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name portmidi
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name porttime
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "midithru"=.\pm_test\midithru.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name pm_dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name portmidi
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name porttime
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "pm_dll"=.\pm_win\pm_dll.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "portmidi"=.\portmidi.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name porttime
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "porttime"=.\porttime\porttime.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "sysex"=.\pm_test\sysex.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name pm_dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name portmidi
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name porttime
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "test"=.\pm_test\test.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name pm_dll
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name portmidi
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name porttime
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+