Commits

marcus  committed 9a6a112

Added pygame2.midi, a portmidi wrapper for MIDI in- and output (from trunk).
Added package and module descriptions, where missing.
Fixed freetype library installation on Win32 platforms, if no SDL_ttf is chosen.

  • Participants
  • Parent commits c9ff7a6
  • Branches pgreloaded

Comments (0)

Files changed (34)

 	$(top_srcdir)/test/util \
 	$(top_srcdir)/lib \
 	$(top_srcdir)/lib/freetype \
+	$(top_srcdir)/lib/midi \
 	$(top_srcdir)/lib/sdl \
 	$(top_srcdir)/lib/sdlext \
 	$(top_srcdir)/lib/sdlgfx \
 	$(top_srcdir)/src/base \
 	$(top_srcdir)/src/freetype \
 	$(top_srcdir)/src/mask \
+	$(top_srcdir)/src/midi \
 	$(top_srcdir)/src/sdl \
 	$(top_srcdir)/src/sdlext \
 	$(top_srcdir)/src/sdlgfx \
 	rm -rf /usr/local/lib/python2.5/site-packages/pygame2*
 	rm -rf /usr/local/lib/python2.6/site-packages/pygame2*
 	rm -rf /usr/local/lib/python3.1/site-packages/pygame2*
-
     Build and install the pygame2.freetype module. This wraps the
     FreeType2 library.
 
+WITH_PORTMIDI=[yes|no|1|True]   Example: make -WITH_PORTMIDI=False
+    
+    Build and install the pygame2.midi module. This wraps the
+    portmidi library and gives access to the pygame2.midi module.
+
 1.1 Dependencies
 ----------------
 Pygame2 is designed to run in as many environments as possible. As such,
 * libpng >= 1.2.24          (http://www.libpng.org)
 * libjpeg >= 6b             (http://www.ijg.org/)
 * freetype >= 2.3.5         (http://www.freetype.org)
+* portmidi >= 199           (http://portmedia.sourceforge.net/)
 
 1.2 Notes on SVN usage
 ----------------------
 * (re)add tests
 * add examples
 * reorganise and add camera module
-* add portmidi wrapper
 * add math module
 * add movie module
 * subsurfaces via surface[x:y,a:b]? Brought up by ctgPi via IRC
 * SDL_gfx has to set the correct errors (SDL_SetError()). Fix that and
   merge it back to the SDL_gfx upstream
 * Speed up blits using fast lookup tables for 8bpp to 8bpp.
+* Brush up documentation for pygame2.midi.
 
 Things to WRAP:
 ===============
 
 # freetype (module) support
 build['FREETYPE'] = istrue (os.getenv ("WITH_FREETYPE", True))
+
+# midi (module) support
+build['PORTMIDI'] = istrue (os.getenv ("WITH_PORTMIDI", True))

File config/config_modules.py

             ['freetype.h', 'ft2build.h'], 'freetype',
             pkgconfig_name='freetype2',
             config_program='freetype-config'),
+        
+        'portmidi' : dep(['portmidi.h'], 'portmidi'),
     }
 
     OS_MODULES[buildsystem].update_sys_deps (DEPENDENCIES)

File config/config_msys.py

         libraries.update (_hunt_libs ("png", dirs))
     if cfg.build['JPEG']:
         libraries.update (_hunt_libs ("jpeg", dirs))
+    if cfg.build['FREETYPE']:
+        libraries.update (_hunt_libs ("freetype", dirs))
+    if cfg.build['PORTMIDI']:
+        libraries.update (_hunt_libs ("portmidi", dirs))
 
     return [ k.replace ("/", os.sep) for k in libraries.keys() ]
 

File config/config_win.py

         libraries.update (_hunt_libs ("png", dirs))
     if cfg.build['JPEG']:
         libraries.update (_hunt_libs ("jpeg", dirs))
+    if cfg.build['FREETYPE']:
+        libraries.update (_hunt_libs ("freetype", dirs))
+    if cfg.build['PORTMIDI']:
+        libraries.update (_hunt_libs ("portmidi", dirs))
 
     return libraries.keys ()
 

File config/dll.py

     ('jpeg', r'(lib){0,1}jpeg\.dll$', []),
     ('png', r'(lib){0,1}png(1[23])(-0){0,1}\.dll$', ['z']),
     ('z', r'zlib1\.dll$', []),
+    ('portmidi', r'portmidi\.dll$', []),
 ]
 
 # regexs: Maps name to DLL file name regex.

File doc/BuildDarwin.txt

 * SDL >= 1.2.10              (http://www.libsdl.org)
 * SDL_mixer >= 1.2.11        (http://www.libsdl.org/projects/SDL_mixer/)
 * SDL_ttf >= 2.0.9           (http://www.libsdl.org/projects/SDL_ttf/)
-* SDL_image >= 1.2.10         (http://www.libsdl.org/projects/SDL_image/)
+* SDL_image >= 1.2.10        (http://www.libsdl.org/projects/SDL_image/)
 * SDL_gfx >= 2.0.18          (http://www.ferzkopp.net/Software/SDL_gfx-2.0/)
 * libpng >= 1.2.24           (http://www.libpng.org)
 * libjpeg >= 6b              (http://www.ijg.org/)
 * freetype >= 2.3.5          (http://www.freetype.org)
+* portmidi >= 199            (http://portmedia.sourceforge.net/)
 
 And you will need the dependency packages for the packages above:
 

File doc/BuildMinGW.txt

 * libpng >= 1.2.24           (http://www.libpng.org)
 * libjpeg >= 6b              (http://www.ijg.org/)
 * freetype >= 2.3.5          (http://www.freetype.org)
+* portmidi >= 199            (http://portmedia.sourceforge.net/)
 
 And you will need the dependency packages for the packages above:
 

File doc/BuildUnix.txt

 * SDL >= 1.2.10              (http://www.libsdl.org)
 * SDL_mixer >= 1.2.11        (http://www.libsdl.org/projects/SDL_mixer/)
 * SDL_ttf >= 2.0.9           (http://www.libsdl.org/projects/SDL_ttf/)
-* SDL_image >= 1.2.10         (http://www.libsdl.org/projects/SDL_image/)
+* SDL_image >= 1.2.10        (http://www.libsdl.org/projects/SDL_image/)
 * SDL_gfx >= 2.0.18          (http://www.ferzkopp.net/Software/SDL_gfx-2.0/)
 * libpng >= 1.2.24           (http://www.libpng.org)
 * libjpeg >= 6b              (http://www.ijg.org/)
 * freetype >= 2.3.5          (http://www.freetype.org)
+* portmidi >= 199            (http://portmedia.sourceforge.net/)
 
 And you will need the dependency packages for the packages above:
 

File doc/BuildVC.txt

 * libpng >= 1.2.24           (http://www.libpng.org)
 * libjpeg >= 6b              (http://www.ijg.org/)
 * freetype >= 2.3.5          (http://www.freetype.org)
+* portmidi >= 199            (http://portmedia.sourceforge.net/)
 
 The Win32 build chain for Pygame2 does not support building all
 dependencies from scratch. Instead it relies on already built libraries,

File doc/building.rst

 
 Build and install the :mod:`pygame2.freetype` module. This wraps the
 FreeType2 library.
+
+  WITH_PORTMIDI=[yes|no|1|True]           Example: make -DWITH_PORTMIDI=False
+
+Build and install the :mod:`pygame2.pypm` and :mod:`pygame2.midi` modules. This
+wraps the portmidi library and gives access to the :mod:`pygame2.midi` module.

File doc/create_doc.py

             continue # Skip invalid ones
         if isgetsetdescriptor (obj) or ismemberdescriptor (obj):
             document_attr (obj, buf, 4)
-        elif ismethod (obj) or ismethoddescriptor (obj):
+        elif ismethod (obj) or ismethoddescriptor (obj) or isfunction (obj):
             document_method (obj, buf, 4)
         else:
             pass

File doc/src/midibase.xml

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE module SYSTEM "api.dtd">
+
+<module name="pygame2.midi.base">
+  <show>0</show>
+  <alias>pygame2.midi</alias>
+  <short>MIDI input and output interaction module.</short>
+  <desc>
+    MIDI input and output interaction module.
+
+    The midi module can send output to midi devices, and get input from midi
+    devices. It can also list midi devices on the system, including real and
+    virtual ones.
+
+    It uses the portmidi library (using PyPortMidi) and is portable to all
+    platforms portmidi supports (currently windows, OSX, and linux).
+  </desc>
+  
+  <class name="Input">
+    <constructor>Input (id, bufsize=4096) -> Input</constructor>
+    <desc>Creates a new Input instance for a specific device.
+      
+      The Input class gives read access to a specific midi device, which allows
+      input, with buffering support.
+    
+      Raises a ValueError, if the *id* is not within the range of available
+      devices.
+      Raises a pygame2.Error, if the midi module is not initialized.
+    </desc>
+    <method name="close">
+      <call>close () -> None</call>
+      <desc>Closes the Input device.
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="poll">
+      <call>poll () -> bool</call>
+      <desc>Gets, whether data is available on the buffer or not.
+
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="read">
+      <call>read (amount) -> list</call>
+      <desc>Reads a certain *amount* of midi events from the buffer.
+
+        Reads from the Input buffer and gives back midi events in the form
+
+            [ [[status,data1,data2,data3],timestamp],
+              [[status,data1,data2,data3],timestamp], ...]
+
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+  </class>
+
+  <class name="Output">
+    <constructor>Output (id, latency=0, bufsize=4096) -> Output</constructor>
+    <desc>Creates a new Output instance for a specific device.
+    
+      The Output class gives write access to a specific midi device, which
+      allows output.
+
+      *latency* is the delay in milliseconds applied to timestamps to determine
+      when the output should actually occur. (If *latency* is &lt; 0, 0 is 
+      assumed.)
+
+      If *latency* is zero, timestamps are ignored and all output is delivered
+      immediately. If *latency* is greater than zero, output is delayed until
+      the message timestamp plus the latency. (NOTE: time is measured 
+      relative to the time source indicated by time_proc. Timestamps are 
+      absolute, not relative delays or offsets.) In some cases, PortMidi 
+      can obtain better timing than your application by passing timestamps 
+      along to the device driver or hardware. Latency may also help you 
+      to synchronize midi data to audio data by matching midi latency to 
+      the audio buffer latency.
+    
+      Raises a ValueError, if the *id* is not within the range of available
+      devices.
+      Raises a pygame2.Error, if the midi module is not initialized.
+    </desc>
+    
+    <method name="abort">
+      <call>abort () -> None</call>
+      <desc>Aborts outgoing messages immediately.
+
+        The caller should immediately close the output port;
+        this call may result in transmission of a partial midi message.
+
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="close">
+      <call>close () -> None</call>
+      <desc>Closes the Output device.
+
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="note_off">
+      <call>note_off (note, velocity=None, channel = 0) -> None</call>
+      <desc>Turn a note off in the output stream.
+
+        Turn a note off in the output stream. The note must already
+        be on for this to work correctly.
+
+        Raises a ValueError, if *channel* is not in the range [0, 15].
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="note_on">
+      <call>note_on (note, velocity=None, channel=0) -> None</call>
+      <desc>Turn a note on in the output stream.
+
+        Turn a note on in the output stream. The note must already be off for
+        this to work correctly.
+
+        Raises a ValueError, if *channel* is not in the range [0, 15].
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="set_instrument">
+      <call>set_instrument (id, channel=0) -> None</call>
+      <desc>Select an instrument, with a value between 0 and 127.
+
+        Selects an instrument, where the *id* is in a range of [0, 127].
+
+        Raises a ValueError, if *id* is not in the range [0, 127].
+        Raises a ValueError, if *channel* is not in the range [0, 15].
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="write">
+      <call>write (data) -> None</call>
+      <desc>Writes midi data to the output device.
+
+        Writes series of MIDI information in the form of a list:
+
+        write([[[status &lt;,data1&gt;&lt;,data2&gt;&lt;,data3&gt;],timestamp],
+               [[status &lt;,data1&gt;&lt;,data2&gt;&lt;,data3&gt;],timestamp],...])
+
+        &lt;data&gt; fields are optional.
+
+        Example: choose program change 1 at time 20000 and
+        send note 65 with velocity 100 500 ms later.
+
+            write([[[0xc0,0,0],20000],[[0x90,60,100],20500]])
+
+        Notes:
+            1. timestamps will be ignored if latency = 0.
+            2. To get a note to play immediately, send MIDI info with
+               timestamp read from function time().
+            3. understanding optional data fields:
+
+                 write([[[0xc0,0,0],20000]])
+
+               is equivalent to
+
+                 write([[[0xc0],20000]])
+
+        This can send up to 1024 elements in your data list, otherwise an
+        IndexError is raised.
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="write_short">
+      <call>write_short (status, data1=None, data2=None) -> None</call>
+      <desc>Writes MIDI information of 3 bytes or less.
+
+        Writes a short MIDI information to the device. The data fields are
+        optional and assumed 0, if omitted. The *status* byte could be:
+
+            0xc0 = program change
+            0x90 = note on
+            ...
+
+        Example: note 65 on with velocity 100
+
+            write_short(0x90,65,100)
+
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+    <method name="write_sys_ex">
+      <call>write_sys_ex (timestamp, msg) -> None</call>
+      <desc>Writes a timestamped, system-exclusive message.
+
+        Writes a system-exclusive message *msg*, which can be either a byte
+        buffer or string - or - list of bytes.
+
+        Example:
+
+            write_sys_ex (0, '\xF0\x7D\x10\x11\x12\x13\xF7')
+
+        is equivalent to
+
+            write_sys_ex (pygame2.midi.time (),
+                          [0xF0,0x7D,0x10,0x11,0x12,0x13,0xF7])
+
+        Raises a pygame2.Error, if the midi module is not initialized.
+      </desc>
+    </method>
+  </class>
+
+  <func name="get_count">
+    <call>get_count () -> int</call>
+    <desc>Gets the number of available midi devices.
+
+      Raises a pygame2.Error, if the midi module is not initialized..
+    </desc>
+  </func>
+  
+  <func name="get_default_input_id">
+    <call>get_default_input_id () -> int</call>
+    <desc>Returns the default device ID or -1 if there are no devices.
+
+      The result can be passed to the Input()/Ouput() class.
+      
+      On the PC, the user can specify a default device by
+      setting an environment variable. For example, to use device #1.
+
+        set PM_RECOMMENDED_INPUT_DEVICE=1
+
+      The user should first determine the available device ID by using
+      the supplied application "testin" or "testout".
+
+      In general, the registry is a better place for this kind of info,
+      and with USB devices that can come and go, using integers is not
+      very reliable for device identification. Under Windows, if
+      PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is
+      *NOT* found in the environment, then the default device is obtained
+      by looking for a string in the registry under:
+
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device
+      
+      and
+
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device
+
+      for a string. The number of the first device with a substring that
+      matches the string exactly is returned. For example, if the string
+      in the registry is "USB", and device 1 is named
+      "In USB MidiSport 1x1", then that will be the default
+      input because it contains the string "USB".
+
+      In addition to the name, get_device_info() returns "interf", which
+      is the interface name. (The "interface" is the underlying software
+      system or API used by PortMidi to access devices. Examples are
+      MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.)
+      At present, the only Win32 interface is "MMSystem", the only Linux
+      interface is "ALSA", and the only Max OS X interface is "CoreMIDI".
+      To specify both the interface and the device name in the registry,
+      separate the two with a comma and a space, e.g.:
+      MMSystem, In USB MidiSport 1x1
+      In this case, the string before the comma must be a substring of
+      the "interf" string, and the string after the space must be a
+      substring of the "name" name string in order to match the device.
+
+      Note: in the current release, the default is simply the first device
+      (the input or output device with the lowest PmDeviceID).
+
+      Raises a pygame2.Error, if the midi module is not initialized.
+    </desc>
+  </func>
+  
+  <func name="get_default_output_id">
+    <call>get_default_output_id () -> int</call>
+    <desc>Return the default device ID or -1 if there are no devices.
+
+      The result can be passed to the Input()/Ouput() class.
+
+      On the PC, the user can specify a default device by
+      setting an environment variable. For example, to use device #1.
+
+        set PM_RECOMMENDED_OUTPUT_DEVICE=1
+
+      The user should first determine the available device ID by using
+      the supplied application "testin" or "testout".
+
+      In general, the registry is a better place for this kind of info,
+      and with USB devices that can come and go, using integers is not
+      very reliable for device identification. Under Windows, if
+      PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is
+      *NOT* found in the environment, then the default device is obtained
+      by looking for a string in the registry under:
+
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device
+      and
+        
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device
+
+      for a string. The number of the first device with a substring that
+      matches the string exactly is returned. For example, if the string
+      in the registry is "USB", and device 1 is named
+      "In USB MidiSport 1x1", then that will be the default
+      input because it contains the string "USB".
+
+      In addition to the name, get_device_info() returns "interf", which
+      is the interface name. (The "interface" is the underlying software
+      system or API used by PortMidi to access devices. Examples are
+      MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.)
+      At present, the only Win32 interface is "MMSystem", the only Linux
+      interface is "ALSA", and the only Max OS X interface is "CoreMIDI".
+      To specify both the interface and the device name in the registry,
+      separate the two with a comma and a space, e.g.:
+      MMSystem, In USB MidiSport 1x1
+      In this case, the string before the comma must be a substring of
+      the "interf" string, and the string after the space must be a
+      substring of the "name" name string in order to match the device.
+
+      Note: in the current release, the default is simply the first device
+      (the input or output device with the lowest PmDeviceID).
+
+      Raises a pygame2.Error, if the midi module is not initialized.
+    </desc>
+  </func>
+  
+  <func name="get_device_info">
+    <call>get_device_info (id) -> string, string, bool, bool, bool</call>
+    <desc>Gets information about a midi device.
+
+      Gets enhanced information about a midi device. The return values are
+
+      * the name of the device, e.g. 'ALSA'
+      * the enhanced description of the device, e.g. 'Midi Through Port-0'
+      * a boolean indicating, whether the device is an input device
+      * a boolean indicating, whether the device is an output device
+      * a boolean indicating, whether the device is opened
+
+      in this order.
+
+      Raises a TypeError, if the *id* is not a integer value.
+      Raises a ValueError, if the *id* is not within the range of available
+      devices.
+      Raises a pygame2.Error, if the midi module is not initialized.
+    </desc>
+  </func>
+  
+  <func name="init">
+    <call>init () -> None</call>
+    <desc>Initializes the midi module.
+
+    Raises a pygame2.Error on failure.
+    </desc>
+  </func>
+  
+  <func name="quit">
+    <call>quit () -> None</call>
+    <desc>Uninitializes the midi module and releases all hold resources.</desc>
+  </func>
+  
+  <func name="time">
+    <call>time () -> int</call>
+    <desc>Gets the time in milliseconds since the midi module was
+    initialized.</desc>
+  </func>
+
+  <func name="was_init">
+    <call>was_init () -> bool</call>
+    <desc>Gets, whether the midi module was already initialized.</desc>
+  </func>
+</module>

File doc/src/modules.rst

    pygame2_font.rst
    pygame2_freetype_base.rst
    pygame2_mask.rst
+   pygame2_midi.rst
    pygame2_sdl.rst
    pygame2_sdl_audio.rst
    pygame2_sdl_cdrom.rst

File doc/src/pygame2midi.xml

+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE module SYSTEM "api.dtd">
+
+<module name="pygame2.midi">
+  <alias>pygame2.midi</alias>
+  <short>MIDI input and output interaction module</short>
+  <desc>
+    MIDI input and output interaction module.
+
+    The midi module can send output to midi devices, and get input from midi
+    devices. It can also list midi devices on the system, including real and
+    virtual ones.
+
+    It uses the portmidi library (using PyPortMidi) and is portable to all
+    platforms portmidi supports (currently windows, OSX, and linux).
+  </desc>
+  <include>pygame2_midi_base.rst</include>
+</module>

File lib/colordict.py

 ##    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ##
 
+"""
+Named colors.
+"""
+
 THECOLORS = {
     'gray17' : (43, 43, 43, 255) ,
     'gold' : (255, 215, 0, 255) ,

File lib/dll/__init__.py

 # DO NOT REMOVE
 # This is a placeholder to make packaging systems happy
+"""
+DLL inclusion package for Win32 platforms.
+"""
 ##    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ##
 
+"""
+System font detection methods.
+"""
+
 import glob, os, sys, subprocess
 
 #

File lib/freetype/__init__.py

+"""
+FreeType2 wrapper for high-quality font and text operations.
+"""
 from pygame2.freetype.base import *

File lib/midi/__init__.py

+"""
+MIDI input and output interaction module.
+
+The midi module can send output to midi devices, and get input from midi
+devices. It can also list midi devices on the system, including real and
+virtual ones.
+
+It uses the portmidi library (using PyPortMidi) and is portable to all
+platforms portmidi supports (currently windows, OSX, and linux).
+"""
+from pygame2.midi.base import *

File lib/midi/base.py

+##    pygame - Python Game Library
+##    Copyright (C) 2008  Rene Dudfield
+##
+##    This library is free software; you can redistribute it and/or
+##    modify it under the terms of the GNU Library General Public
+##    License as published by the Free Software Foundation; either
+##    version 2 of the License, or (at your option) any later version.
+##
+##    This library is distributed in the hope that it will be useful,
+##    but WITHOUT ANY WARRANTY; without even the implied warranty of
+##    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+##    Library General Public License for more details.
+##
+##    You should have received a copy of the GNU Library General Public
+##    License along with this library; if not, write to the Free
+##    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+##
+
+"""
+PyPortMidi interface methods to ease interaction with MIDI devices.
+"""
+
+import pygame2
+import atexit
+
+# Necessary globals
+_pypm = None    # The PyPortMidi module binding
+_init = False   # Initialization flag.
+
+def _check_init ():
+    if not _init:
+        raise pygame2.Error ("pygame2.midi is not initialized")
+
+def init ():
+    """init () -> None
+    
+    Initializes the midi module.
+
+    Raises a pygame2.Error on failure.
+    """
+    global _pypm, _init
+    if not _init:
+        try:
+            import pygame2.midi.pypm
+            _pypm = pygame2.midi.pypm
+        except ImportError:
+            raise pygame2.Error ("pygame2.midi.pypm not usable")
+        _pypm.Initialize ()
+        _init = True
+        atexit.register (quit)
+
+def quit ():
+    """quit () -> None
+    
+    Uninitializes the midi module and releases all hold resources.
+    """
+    global _pypm, _init
+    if _pypm:
+        _pypm.Terminate ()
+        _pypm = None
+        _init = False
+
+def was_init ():
+    """was_init () -> bool
+    
+    Gets, whether the midi module was already initialized.
+    """
+    return _init
+
+def time ():
+    """time () -> int
+    
+    Gets the time in milliseconds since the midi module was initialized.
+    """
+    return _pypm.Time ()
+
+def get_count ():
+    """get_count () -> int
+    
+    Gets the number of available midi devices.
+    
+    Raises a pygame2.Error, if the midi module is not initialized..
+    """
+    _check_init ()
+    return _pypm.CountDevices ()
+
+
+def get_default_input_id ():
+    """get_default_input_id () -> int
+    
+    Returns the default device ID or -1 if there are no devices.
+    The result can be passed to the Input()/Ouput() class.
+    
+    On the PC, the user can specify a default device by
+    setting an environment variable. For example, to use device #1.
+    
+        set PM_RECOMMENDED_INPUT_DEVICE=1
+    
+    The user should first determine the available device ID by using
+    the supplied application "testin" or "testout".
+    
+    In general, the registry is a better place for this kind of info,
+    and with USB devices that can come and go, using integers is not
+    very reliable for device identification. Under Windows, if
+    PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is
+    *NOT* found in the environment, then the default device is obtained
+    by looking for a string in the registry under:
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device
+    and HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device
+    for a string. The number of the first device with a substring that
+    matches the string exactly is returned. For example, if the string
+    in the registry is "USB", and device 1 is named
+    "In USB MidiSport 1x1", then that will be the default
+    input because it contains the string "USB".
+    
+    In addition to the name, get_device_info() returns "interf", which
+    is the interface name. (The "interface" is the underlying software
+    system or API used by PortMidi to access devices. Examples are
+    MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.)
+    At present, the only Win32 interface is "MMSystem", the only Linux
+    interface is "ALSA", and the only Max OS X interface is "CoreMIDI".
+    To specify both the interface and the device name in the registry,
+    separate the two with a comma and a space, e.g.:
+        MMSystem, In USB MidiSport 1x1
+    In this case, the string before the comma must be a substring of
+    the "interf" string, and the string after the space must be a
+    substring of the "name" name string in order to match the device.
+    
+    Note: in the current release, the default is simply the first device
+    (the input or output device with the lowest PmDeviceID).
+
+    Raises a pygame2.Error, if the midi module is not initialized.
+    """
+    _check_init ()
+    return _pypm.GetDefaultInputDeviceID ()
+
+def get_default_output_id ():
+    """get_default_output_id () -> int
+    
+    Return the default device ID or -1 if there are no devices.
+    The result can be passed to the Input()/Ouput() class.
+    
+    On the PC, the user can specify a default device by
+    setting an environment variable. For example, to use device #1.
+    
+        set PM_RECOMMENDED_OUTPUT_DEVICE=1
+    
+    The user should first determine the available device ID by using
+    the supplied application "testin" or "testout".
+    
+    In general, the registry is a better place for this kind of info,
+    and with USB devices that can come and go, using integers is not
+    very reliable for device identification. Under Windows, if
+    PM_RECOMMENDED_OUTPUT_DEVICE (or PM_RECOMMENDED_INPUT_DEVICE) is
+    *NOT* found in the environment, then the default device is obtained
+    by looking for a string in the registry under:
+        HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Input_Device
+    and HKEY_LOCAL_MACHINE/SOFTWARE/PortMidi/Recommended_Output_Device
+    for a string. The number of the first device with a substring that
+    matches the string exactly is returned. For example, if the string
+    in the registry is "USB", and device 1 is named
+    "In USB MidiSport 1x1", then that will be the default
+    input because it contains the string "USB".
+    
+    In addition to the name, get_device_info() returns "interf", which
+    is the interface name. (The "interface" is the underlying software
+    system or API used by PortMidi to access devices. Examples are
+    MMSystem, DirectX (not implemented), ALSA, OSS (not implemented), etc.)
+    At present, the only Win32 interface is "MMSystem", the only Linux
+    interface is "ALSA", and the only Max OS X interface is "CoreMIDI".
+    To specify both the interface and the device name in the registry,
+    separate the two with a comma and a space, e.g.:
+        MMSystem, In USB MidiSport 1x1
+    In this case, the string before the comma must be a substring of
+    the "interf" string, and the string after the space must be a
+    substring of the "name" name string in order to match the device.
+    
+    Note: in the current release, the default is simply the first device
+    (the input or output device with the lowest PmDeviceID).
+
+    Raises a pygame2.Error, if the midi module is not initialized.
+    """
+    _check_init ()
+    return _pypm.GetDefaultOutputDeviceID()
+
+def get_device_info (id):
+    """get_device_info (id) -> string, string, bool, bool, bool
+    
+    Gets information about a midi device.
+    
+    Gets enhanced information about a midi device. The return values are
+    
+    * the name of the device, e.g. 'ALSA'
+    * the enhanced description of the device, e.g. 'Midi Through Port-0'
+    * a boolean indicating, whether the device is an input device
+    * a boolean indicating, whether the device is an output device
+    * a boolean indicating, whether the device is opened
+    
+    in this order.
+    
+    Raises a TypeError, if the *id* is not a integer value.
+    Raises a ValueError, if the *id* is not within the range of available
+    devices.
+    Raises a pygame2.Error, if the midi module is not initialized.
+    """
+    _check_init ()
+    _id = int (id)
+    if _id < 0 or _id >= get_count ():
+        raise ValueError ("id must be in the range of available devices")
+    name, desc, input, output, opened = _pypm.GetDeviceInfo (_id)
+    return name, desc, input == 1, output == 1, opened == 1
+
+class Input (object):
+    """Input (id, bufsize=4096) -> Input
+    
+    Creates a new Input instance for a specific device.
+    
+    The Input class gives read access to a specific midi device, which allows
+    input, with buffering support.
+    
+    Raises a ValueError, if the *id* is not within the range of available
+    devices.
+    Raises a pygame2.Error, if the midi module is not initialized.
+    """
+    def __init__ (self, id, bufsize=4096):
+        _check_init ()
+        interf, name, input, output, opened = get_device_info (id)
+        if not input:
+            raise pygame2.Error ("device is not an input device")
+        
+        self._input = _pypm.Input(device_id, buffer_size)
+        self._id = id
+
+    def close (self):
+        """I.close () -> None
+        
+        Closes the Input device.
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if self._input:
+            self._input.Close ()
+        self._input = None
+    
+    def read (self, amount):
+        """I.read (amount) -> list
+
+        Reads a certain *amount* of midi events from the buffer.
+        
+        Reads from the Input buffer and gives back midi events in the form
+        
+        [ [[status,data1,data2,data3],timestamp],
+          [[status,data1,data2,data3],timestamp], ...]
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if not self._input:
+            raise pygame2.Error ("device is not opened")
+        return self._input.Read (amount)
+    
+    def poll (self):
+        """I.poll () -> bool
+
+        Gets, whether data is available on the buffer or not.
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if not self._input:
+            raise pygame2.Error ("device is not opened")
+
+        r = self._input.Poll ()
+        if r == _pypm.TRUE:
+            return True
+        elif r == _pypm.FALSE:
+            return False
+        else:
+            err_text = _pypm.GetErrorText (r)
+            raise pygame2.Error (err_text)
+
+class Output (object):
+    """Output (id, latency=0, bufsize=4096) -> Output
+    
+    Creates a new Output instance for a specific device.
+    
+    The Output class gives write access to a specific midi device, which allows
+    output.
+
+    *latency* is the delay in milliseconds applied to timestamps to determine
+    when the output should actually occur. (If *latency* is < 0, 0 is 
+    assumed.)
+
+    If *latency* is zero, timestamps are ignored and all output is delivered
+    immediately. If *latency* is greater than zero, output is delayed until
+    the message timestamp plus the latency. (NOTE: time is measured 
+    relative to the time source indicated by time_proc. Timestamps are 
+    absolute, not relative delays or offsets.) In some cases, PortMidi 
+    can obtain better timing than your application by passing timestamps 
+    along to the device driver or hardware. Latency may also help you 
+    to synchronize midi data to audio data by matching midi latency to 
+    the audio buffer latency.
+    
+    Raises a ValueError, if the *id* is not within the range of available
+    devices.
+    Raises a pygame2.Error, if the midi module is not initialized.
+    """
+    def __init__ (self, id, latency=0):
+        _check_init ()
+        interf, name, input, output, opened = get_device_info (id)
+        if not output:
+            raise pygame2.Error ("device is not an output device")
+        
+        self.output = _pypm.Output (id, latency)
+        self._id = id
+    
+    def close (self):
+        """O.close () -> None
+        
+        Closes the Output device.
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if self._input:
+            self._input.Close ()
+        self._input = None
+    
+    def abort (self):
+        """O.abort () -> None
+        
+        Aborts outgoing messages immediately.
+        
+        The caller should immediately close the output port;
+        this call may result in transmission of a partial midi message.
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init()
+        if self._output:
+            self._output.Abort ()
+    
+    def write (self, data):
+        """O.write (data) -> None
+        
+        Writes midi data to the output device.
+        
+        Writes series of MIDI information in the form of a list:
+        
+             write([[[status <,data1><,data2><,data3>],timestamp],
+                    [[status <,data1><,data2><,data3>],timestamp],...])
+        
+        <data> fields are optional.
+        
+        Example: choose program change 1 at time 20000 and
+        send note 65 with velocity 100 500 ms later.
+             
+             write([[[0xc0,0,0],20000],[[0x90,60,100],20500]])
+        
+        Notes:
+          1. timestamps will be ignored if latency = 0.
+          2. To get a note to play immediately, send MIDI info with
+             timestamp read from function time().
+          3. understanding optional data fields:
+               
+               write([[[0xc0,0,0],20000]])
+             
+             is equivalent to
+               
+               write([[[0xc0],20000]])
+
+        This can send up to 1024 elements in your data list, otherwise an 
+        IndexError is raised.
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if not self._output:
+            raise pygame2.Error ("device is not opened")
+        self._output.Write (data)
+    
+    def write_short (self, status, data1=0, data2=0):
+        """O.write_short (status <, data1><, data2>) -> None
+
+        Writes MIDI information of 3 bytes or less.
+
+        Writes a short MIDI information to the device. The data fields are
+        optional and assumed 0, if omitted. The *status* byte could be:
+
+            0xc0 = program change
+            0x90 = note on
+            ...
+            
+        Example: note 65 on with velocity 100
+            
+            write_short(0x90,65,100)
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if not self._output:
+            raise pygame2.Error ("device is not opened")
+        self._output.WriteShort (status, data1, data2)
+
+    def write_sys_ex (self, timestamp, msg):
+        """O.write_sys_ex (timestamp, msg) -> None
+        
+        Writes a timestamped, system-exclusive message.
+        
+        Writes a system-exclusive message *msg*, which can be either a byte
+        buffer or string  - or - list of bytes.
+        
+        Example:
+        
+            write_sys_ex (0, '\\xF0\\x7D\\x10\\x11\\x12\\x13\\xF7')
+        
+        is equivalent to
+        
+            write_sys_ex (pygame2.midi.time (),
+                          [0xF0,0x7D,0x10,0x11,0x12,0x13,0xF7])
+        
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        _check_init ()
+        if not self._output:
+            raise pygame2.Error ("device is not opened")
+        self._output.WriteSysExc (timestamp, msg)
+
+    def note_on (self, note, velocity=None, channel=0):
+        """O.note_on (note, velocity=None, channel=0) -> None
+        
+        Turn a note on in the output stream.
+
+        Turn a note on in the output stream. The note must already be off for
+        this to work correctly.
+        
+        Raises a ValueError, if *channel* is not in the range [0, 15].
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        if velocity is None:
+            velocity = 0
+
+        if not (0 <= channel <= 15):
+            raise ValueError ("Channel not between 0 and 15")
+
+        self.write_short (0x90 + channel, note, velocity)
+    
+    def note_off (self, note, velocity=None, channel=0):
+        """O.note_off (note, velocity=None, channel = 0) -> None
+
+        Turn a note off in the output stream.
+
+        Turn a note off in the output stream. The note must already
+        be on for this to work correctly.
+        
+        Raises a ValueError, if *channel* is not in the range [0, 15].
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        if velocity is None:
+            velocity = 0
+
+        if not (0 <= channel <= 15):
+            raise ValueError ("Channel not between 0 and 15")
+
+        self.write_short (0x80 + channel, note, velocity)
+
+    def set_instrument (self, id, channel=0):
+        """O.set_instrument (id, channel=0) -> None
+        
+        Select an instrument, with a value between 0 and 127.
+
+        Selects an instrument, where the *id* is in a range of [0, 127].
+        
+        Raises a ValueError, if *id* is not in the range [0, 127].
+        Raises a ValueError, if *channel* is not in the range [0, 15].
+        Raises a pygame2.Error, if the midi module is not initialized.
+        """
+        if not (0 <= id <= 127):
+            raise ValueError ("instrument id not between 0 and 127")
+        if not (0 <= channel <= 15):
+            raise ValueError ("Channel not between 0 and 15")
+        self.write_short (0xc0 + channel, id)

File lib/sdlext/__init__.py

+"""
+Extensions to the SDL wrapper.
+"""
 from pygame2.sdlext.base import *

File lib/sdlgfx/__init__.py

+"""
+SDL_gfx wrapper package for Pygame2.
+"""
 from pygame2.sdlgfx.base import *

File lib/sdlimage/__init__.py

+"""
+SDL_image wrapper package for Pygame2.
+"""
 from pygame2.sdlimage.base import *

File lib/sdlmixer/__init__.py

+"""
+SDL_mixer wrapper package for Pygame2.
+"""
 from pygame2.sdlmixer.base import *
 from pygame2.sdlmixer.base import Chunk as Sound

File lib/sdlttf/__init__.py

+"""
+SDL_ttf wrapper package for Pygame2.
+"""
 from pygame2.sdlttf.base import *
 from pygame2.sdlttf.sysfont import get_sys_font

File lib/sprite/__init__.py

 ##    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ##
 
-"""pygame module with basic game object classes
+"""
+Basic game object classes.
 
 This module contains several simple classes to be used within games. There
 is the main Sprite class and several Group classes that contain Sprites.

File lib/threads/__init__.py

 """
-* Experimental *
+Experimental threaded map function
 
 Like the map function, but can use a pool of threads.
-
 Really easy to use threads.  eg.  tmap(f, alist)
-
-If you know how to use the map function, you can use threads.
+If you know how to use the map function, you now can use threads.
 """
 
 __author__ = "Rene Dudfield"
         depends = ['freetype'],
         optional_dep = ['SDL']),
 
+    Module ("midi.pypm",
+        sources = [ "src/midi/pypm.c" ],
+        depends = ['portmidi']),
+
     ]
 
 if helpers.getversion() < (3, 0, 0):
         if os.path.isdir(pkg_dir):
             packages.append(pkg_name)
             package_dir[pkg_name] = pkg_dir
-

File msys_build_deps.py

 jpeg 7
 zlib 1.2.3
 smpeg rev. 384
+portmidi 199
 
 The build environment used:
 
   make clean
 fi
 """),
-##     Dependency('PORTMIDI', ['portmidi', 'portmidi-[1-9].*'], ['portmidi.dll'], """
-
-## set -e
-## cd $BDWD
-
-## if [ x$BDCONF == x1 ]; then
-##   cat > GNUmakefile << 'THE_END'
-## # Makefile for portmidi, generated for Pygame by msys_build_deps.py.
-
-## target = /usr/local
-
-## pmcom = pm_common
-## pmwin = pm_win
-## pt = porttime
-
-## pmdll = portmidi.dll
-## pmlib = libportmidi.a
-## pmimplib = libportmidi.dll.a
-## pmcomsrc = $(pmcom)/portmidi.c $(pmcom)/pmutil.c
-## pmwinsrc = $(pmwin)/pmwin.c $(pmwin)/pmwinmm.c
-## pmobj = portmidi.o pmutil.o pmwin.o pmwinmm.o
-## pmsrc = $(pmcomsrc) $(pmwinsrc)
-## pmreqhdr = $(pmcom)/portmidi.h $(pmcom)/pmutil.h
-## pmhdr = $(pmreqhdr) $(pmcom)/pminternal.h $(pmwin)/pmwinmm.h
-
-## ptsrc = $(pt)/porttime.c porttime/ptwinmm.c
-## ptobj = porttime.o ptwinmm.o
-## ptreqhdr = $(pt)/porttime.h
-## pthdr = $(ptreqhdr)
-
-## src = $(pmsrc) $(ptsrc)
-## reqhdr = $(pmreqhdr) $(ptreqhdr)
-## hdr = $(pmhdr) $(pthdr)
-## obj = $(pmobj) $(ptobj)
-## def = portmidi.def
-
-## IHDR := -I$(pmcom) -I$(pmwin) -I$(pt)
-## LIBS := $(LOADLIBES) $(LDLIBS) -lwinmm
-
-## all : $(pmdll)
-## .PHONY : all
-
-## $(pmlib) : $(src) $(hdr)
-## \t$(CC) $(CPPFLAGS) $(IHDR) -c $(CFLAGS) $(src)
-## \tar rc $(pmlib) $(obj)
-## \tranlib $(pmlib)
-
-## $(pmdll) : $(pmlib) $(def)
-## \t$(CC) -shared $(LDFLAGS) -def $(def) $(pmlib) $(LIBS) -o $@
-## \tdlltool -D $(pmdll) -d $(def) -l $(pmimplib)
-## \tranlib $(pmimplib)
-
-## .PHONY : install
-
-## install : $(pmdll)
-## \tcp -f --target-directory=$(target)/bin $<
-## \tcp -f --target-directory=$(target)/lib $(pmlib)
-## \tcp -f --target-directory=$(target)/lib $(pmimplib)
-## \tcp -f --target-directory=$(target)/include $(reqhdr)
-
-## .PHONY : clean
-
-## clean :
-## \trm -f $(obj) $(pmdll) $(pmimplib) $(pmlib)
-## THE_END
-
-##   cat > portmidi.def << 'THE_END'
-## LIBRARY portmidi.dll
-## EXPORTS
-## Pm_Abort
-## Pm_Close
-## Pm_CountDevices
-## Pm_Dequeue
-## Pm_Enqueue
-## Pm_GetDefaultInputDeviceID
-## Pm_GetDefaultOutputDeviceID
-## Pm_GetDeviceInfo
-## Pm_GetErrorText
-## Pm_GetHostErrorText
-## Pm_HasHostError
-## Pm_Initialize
-## Pm_OpenInput
-## Pm_OpenOutput
-## Pm_Poll
-## Pm_QueueCreate
-## Pm_QueueDestroy
-## Pm_QueueEmpty
-## Pm_QueueFull
-## Pm_QueuePeek
-## Pm_Read
-## Pm_SetChannelMask
-## Pm_SetFilter
-## Pm_SetOverflow
-## Pm_Terminate
-## Pm_Write
-## Pm_WriteShort
-## Pm_WriteSysEx
-## Pt_Sleep
-## Pt_Start
-## Pt_Started
-## Pt_Stop
-## Pt_Time
-## pm_add_device
-## pm_alloc
-## pm_descriptor_index DATA
-## pm_descriptor_max DATA
-## pm_fail_fn
-## pm_fail_timestamp_fn
-## pm_free
-## pm_hosterror DATA
-## pm_hosterror_text DATA
-## pm_init
-## pm_none_dictionary DATA
-## pm_read_bytes
-## pm_read_short
-## pm_success_fn
-## pm_term
-## pm_winmm_in_dictionary DATA
-## pm_winmm_init
-## pm_winmm_out_dictionary DATA
-## pm_winmm_term
-## THE_END
-
-## fi
-
-## if [ x$BDCOMP == x1 ]; then
-##   make
-## fi
-
-## if [ x$BDINST == x1 ]; then
-##   make install
-## fi
-
-## if [ x$BDSTRIP == x1 ]; then
-##   strip --strip-all /usr/local/bin/portmidi.dll
-## fi
-
-## if [ x$BDCLEAN == x1 ]; then
-##   set +e
-##   make clean
-##   rm -f GNUmakefile portmidi.def
-## fi
-## """),
     Dependency('GFX', ['SDL_gfx-[2-9].*'], ['SDL_gfx.dll'], """
 
 set -e
   rm -f SDL_gfx.dll
 fi
 """),
+    Dependency('PORTMIDI', ['portmidi', 'portmidi-[1-9].*'], ['portmidi.dll'], """
+
+set -e
+cd $BDWD
+
+if [ x$BDCONF == x1 ]; then
+  cat > GNUmakefile << 'THE_END'
+# Makefile for portmidi, generated for Pygame by msys_build_deps.py.
+
+target = /usr/local
+CC = gcc
+
+pmcom = pm_common
+pmwin = pm_win
+pt = porttime
+
+pmdll = portmidi.dll
+pmlib = libportmidi.a
+pmimplib = libportmidi.dll.a
+pmcomsrc = $(pmcom)/portmidi.c $(pmcom)/pmutil.c
+pmwinsrc = $(pmwin)/pmwin.c $(pmwin)/pmwinmm_.c
+pmobj = portmidi.o pmutil.o pmwin.o pmwinmm_.o
+pmsrc = $(pmcomsrc) $(pmwinsrc)
+pmreqhdr = $(pmcom)/portmidi.h $(pmcom)/pmutil.h
+pmhdr = $(pmreqhdr) $(pmcom)/pminternal.h $(pmwin)/pmwinmm.h
+
+ptsrc = $(pt)/porttime.c porttime/ptwinmm.c
+ptobj = porttime.o ptwinmm.o
+ptreqhdr = $(pt)/porttime.h
+pthdr = $(ptreqhdr)
+
+src = $(pmsrc) $(ptsrc)
+reqhdr = $(pmreqhdr) $(ptreqhdr)
+hdr = $(pmhdr) $(pthdr)
+obj = $(pmobj) $(ptobj)
+def = portmidi.def
+
+IHDR := -I$(pmcom) -I$(pmwin) -I$(pt)
+LIBS := $(LOADLIBES) $(LDLIBS) -lwinmm
+
+
+
+all : $(pmdll)
+.PHONY : all
+
+$(pmwin)/pmwinmm_.c : $(pmwin)/pmwinmm.c
+\tsed 's_#define DEBUG.*$$_/*&*/_' < "$<" > "$@"
+
+$(pmlib) : $(src) $(hdr)
+\t$(CC) $(CFLAGS) $(IHDR) -c $(CFLAGS) $(src)
+\tar rc $(pmlib) $(obj)
+\tranlib $(pmlib)
+
+$(pmdll) : $(pmlib) $(def)
+\tc++ -shared $(LDFLAGS) -def $(def) $(pmlib) $(LIBS) -o $@
+\tdlltool -D $(pmdll) -d $(def) -l $(pmimplib)
+\tranlib $(pmimplib)
+
+.PHONY : install
+
+install : $(pmdll)
+\tcp -f --target-directory=$(target)/bin $<
+\tcp -f --target-directory=$(target)/lib $(pmlib)
+\tcp -f --target-directory=$(target)/lib $(pmimplib)
+\tcp -f --target-directory=$(target)/include $(reqhdr)
+
+.PHONY : clean
+
+clean :
+\trm -f $(obj) $(pmdll) $(pmimplib) $(pmlib) $(pmwin)/pmwinmm_.c
+THE_END
+
+  cat > portmidi.def << 'THE_END'
+LIBRARY portmidi.dll
+EXPORTS
+Pm_Abort
+Pm_Close
+Pm_CountDevices
+Pm_Dequeue
+Pm_Enqueue
+Pm_GetDefaultInputDeviceID
+Pm_GetDefaultOutputDeviceID
+Pm_GetDeviceInfo
+Pm_GetErrorText
+Pm_GetHostErrorText
+Pm_HasHostError
+Pm_Initialize
+Pm_OpenInput
+Pm_OpenOutput
+Pm_Poll
+Pm_QueueCreate
+Pm_QueueDestroy
+Pm_QueueEmpty
+Pm_QueueFull
+Pm_QueuePeek
+Pm_Read
+Pm_SetChannelMask
+Pm_SetFilter
+Pm_SetOverflow
+Pm_Terminate
+Pm_Write
+Pm_WriteShort
+Pm_WriteSysEx
+Pt_Sleep
+Pt_Start
+Pt_Started
+Pt_Stop
+Pt_Time
+pm_add_device
+pm_alloc
+pm_descriptor_index DATA
+pm_descriptor_max DATA
+pm_fail_fn
+pm_fail_timestamp_fn
+pm_free
+pm_hosterror DATA
+pm_hosterror_text DATA
+pm_init
+pm_none_dictionary DATA
+pm_read_bytes
+pm_read_short
+pm_success_fn
+pm_term
+pm_winmm_in_dictionary DATA
+pm_winmm_init
+pm_winmm_out_dictionary DATA
+pm_winmm_term
+THE_END
+
+fi
+
+if [ x$BDCOMP == x1 ]; then
+  make
+fi
+
+if [ x$BDINST == x1 ]; then
+  make install
+fi
+
+if [ x$BDSTRIP == x1 ]; then
+  strip --strip-all /usr/local/bin/portmidi.dll
+fi
+
+if [ x$BDCLEAN == x1 ]; then
+  set +e
+  make clean
+  rm -f GNUmakefile portmidi.def
+fi
+"""),
+
     ]  # End dependencies = [.
 
 

File src/midi/pypm.c

+/* Generated by Cython 0.11.2 on Mon Jun  1 16:21:31 2009 */
+
+#define PY_SSIZE_T_CLEAN
+#include "Python.h"
+#include "structmember.h"
+#ifndef Py_PYTHON_H
+    #error Python headers needed to compile C extensions, please install development version of Python.
+#endif
+#ifndef PY_LONG_LONG
+  #define PY_LONG_LONG LONG_LONG
+#endif
+#ifndef DL_EXPORT
+  #define DL_EXPORT(t) t
+#endif
+#if PY_VERSION_HEX < 0x02040000
+  #define METH_COEXIST 0
+  #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
+#endif
+#if PY_VERSION_HEX < 0x02050000
+  typedef int Py_ssize_t;
+  #define PY_SSIZE_T_MAX INT_MAX
+  #define PY_SSIZE_T_MIN INT_MIN
+  #define PY_FORMAT_SIZE_T ""
+  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
+  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
+  #define PyNumber_Index(o)    PyNumber_Int(o)
+  #define PyIndex_Check(o)     PyNumber_Check(o)
+#endif
+#if PY_VERSION_HEX < 0x02060000
+  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
+  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
+  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
+  #define PyVarObject_HEAD_INIT(type, size) \
+          PyObject_HEAD_INIT(type) size,
+  #define PyType_Modified(t)
+
+  typedef struct {
+       void *buf;
+       PyObject *obj;
+       Py_ssize_t len;
+       Py_ssize_t itemsize;
+       int readonly;
+       int ndim;
+       char *format;
+       Py_ssize_t *shape;
+       Py_ssize_t *strides;
+       Py_ssize_t *suboffsets;
+       void *internal;
+  } Py_buffer;
+
+  #define PyBUF_SIMPLE 0
+  #define PyBUF_WRITABLE 0x0001
+  #define PyBUF_FORMAT 0x0004
+  #define PyBUF_ND 0x0008
+  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
+  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
+  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
+  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
+  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
+
+#endif
+#if PY_MAJOR_VERSION < 3
+  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
+#else
+  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
+#endif
+#if PY_MAJOR_VERSION >= 3
+  #define Py_TPFLAGS_CHECKTYPES 0
+  #define Py_TPFLAGS_HAVE_INDEX 0
+#endif
+#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
+  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
+#endif
+#if PY_MAJOR_VERSION >= 3
+  #define PyBaseString_Type            PyUnicode_Type
+  #define PyString_Type                PyBytes_Type
+  #define PyString_CheckExact          PyBytes_CheckExact
+  #define PyInt_Type                   PyLong_Type
+  #define PyInt_Check(op)              PyLong_Check(op)
+  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
+  #define PyInt_FromString             PyLong_FromString
+  #define PyInt_FromUnicode            PyLong_FromUnicode
+  #define PyInt_FromLong               PyLong_FromLong
+  #define PyInt_FromSize_t             PyLong_FromSize_t
+  #define PyInt_FromSsize_t            PyLong_FromSsize_t
+  #define PyInt_AsLong                 PyLong_AsLong
+  #define PyInt_AS_LONG                PyLong_AS_LONG
+  #define PyInt_AsSsize_t              PyLong_AsSsize_t
+  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
+  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
+#else
+  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
+  #define PyBytes_Type                 PyString_Type
+#endif
+#if PY_MAJOR_VERSION >= 3
+  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
+#endif
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+  #ifndef __stdcall
+    #define __stdcall
+  #endif
+  #ifndef __cdecl
+    #define __cdecl
+  #endif
+  #ifndef __fastcall
+    #define __fastcall
+  #endif
+#else
+  #define _USE_MATH_DEFINES
+#endif
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
+#else
+  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
+  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
+  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
+#endif
+#if PY_VERSION_HEX < 0x02050000
+  #define __Pyx_NAMESTR(n) ((char *)(n))
+  #define __Pyx_DOCSTR(n)  ((char *)(n))
+#else
+  #define __Pyx_NAMESTR(n) (n)
+  #define __Pyx_DOCSTR(n)  (n)
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+#include <math.h>
+#define __PYX_HAVE_API__pypm
+#include "portmidi.h"
+#include "porttime.h"
+#define __PYX_USE_C99_COMPLEX defined(_Complex_I)
+
+
+#ifdef __GNUC__
+#define INLINE __inline__
+#elif _WIN32
+#define INLINE __inline
+#else
+#define INLINE 
+#endif
+
+typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/
+
+
+
+static int __pyx_skip_dispatch = 0;
+
+
+/* Type Conversion Predeclarations */
+
+#if PY_MAJOR_VERSION < 3
+#define __Pyx_PyBytes_FromString          PyString_FromString
+#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
+#define __Pyx_PyBytes_AsString            PyString_AsString
+#else
+#define __Pyx_PyBytes_FromString          PyBytes_FromString
+#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
+#define __Pyx_PyBytes_AsString            PyBytes_AsString
+#endif
+
+#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
+static INLINE int __Pyx_PyObject_IsTrue(PyObject*);
+static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
+
+#if !defined(T_PYSSIZET)
+#if PY_VERSION_HEX < 0x02050000
+#define T_PYSSIZET T_INT
+#elif !defined(T_LONGLONG)
+#define T_PYSSIZET \
+        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
+        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
+#else
+#define T_PYSSIZET \
+        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
+        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
+        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
+#endif
+#endif
+
+#if !defined(T_SIZET)
+#if !defined(T_ULONGLONG)
+#define T_SIZET \
+        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
+        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
+#else
+#define T_SIZET \
+        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
+        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
+        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
+#endif
+#endif
+
+static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
+static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
+static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
+
+#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
+
+
+#ifdef __GNUC__
+/* Test for GCC > 2.95 */
+#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
+#define likely(x)   __builtin_expect(!!(x), 1)
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#else /* __GNUC__ > 2 ... */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ > 2 ... */
+#else /* __GNUC__ */
+#define likely(x)   (x)
+#define unlikely(x) (x)
+#endif /* __GNUC__ */
+    
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static PyObject *__pyx_empty_tuple;
+static int __pyx_lineno;
+static int __pyx_clineno = 0;
+static const char * __pyx_cfilenm= __FILE__;
+static const char *__pyx_filename;
+static const char **__pyx_f;
+
+
+#ifdef CYTHON_REFNANNY
+typedef struct {
+  void (*INCREF)(void*, PyObject*, int);
+  void (*DECREF)(void*, PyObject*, int);
+  void (*GOTREF)(void*, PyObject*, int);
+  void (*GIVEREF)(void*, PyObject*, int);
+  void* (*NewContext)(const char*, int, const char*);
+  void (*FinishContext)(void**);
+} __Pyx_RefnannyAPIStruct;
+static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL;
+#define __Pyx_ImportRefcountAPI(name)   (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI")
+#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__)
+#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r)
+#define __Pyx_SetupRefcountContext(name)   void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__)
+#define __Pyx_FinishRefcountContext()   __Pyx_Refnanny->FinishContext(&__pyx_refchk)
+#else
+#define __Pyx_INCREF(r) Py_INCREF(r)
+#define __Pyx_DECREF(r) Py_DECREF(r)
+#define __Pyx_GOTREF(r)
+#define __Pyx_GIVEREF(r)
+#define __Pyx_XDECREF(r) Py_XDECREF(r)
+#define __Pyx_SetupRefcountContext(name)
+#define __Pyx_FinishRefcountContext()
+#endif /* CYTHON_REFNANNY */
+#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r)
+#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r)
+
+static void __Pyx_RaiseDoubleKeywordsError(
+    const char* func_name, PyObject* kw_name); /*proto*/
+
+static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
+    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
+
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+
+
+static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
+    PyObject *r;
+    if (!j) return NULL;
+    r = PyObject_GetItem(o, j);
+    Py_DECREF(j);
+    return r;
+}
+
+
+#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+            PyObject *r = PyList_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+}
+
+#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+    if (likely(o != Py_None)) {
+        if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+            PyObject *r = PyTuple_GET_ITEM(o, i);
+            Py_INCREF(r);
+            return r;
+        }
+        else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) {
+            PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i);
+            Py_INCREF(r);
+            return r;
+        }
+    }
+    return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+}
+
+
+#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \
+                                                    __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \
+                                                    __Pyx_GetItemInt_Generic(o, to_py_func(i)))
+
+static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) {
+    PyObject *r;
+    if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) {
+        r = PyList_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
+        r = PyTuple_GET_ITEM(o, i);
+        Py_INCREF(r);
+    }
+    else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) {
+        r = PySequence_GetItem(o, i);
+    }
+    else {
+        r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i));
+    }
+    return r;
+}
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+static int __Pyx_Print(PyObject *, int); /*proto*/
+#if PY_MAJOR_VERSION >= 3
+static PyObject* __pyx_print = 0;
+static PyObject* __pyx_print_kwargs = 0;
+#endif
+
+static int __Pyx_PrintOne(PyObject *o); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
+    if (likely(PyList_CheckExact(L))) {
+        if (PyList_Append(L, x) < 0) return NULL;
+        Py_INCREF(Py_None);
+        return Py_None; /* this is just to have an accurate signature */
+    }
+    else {
+        PyObject *r, *m;
+        m = __Pyx_GetAttrString(L, "append");
+        if (!m) return NULL;
+        r = PyObject_CallFunctionObjArgs(m, x, NULL);
+        Py_DECREF(m);
+        return r;
+    }
+}
+
+static INLINE int __Pyx_StrEq(const char *, const char *); /*proto*/
+
+static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
+
+static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);
+
+static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);
+
+static INLINE char __Pyx_PyInt_AsChar(PyObject *);
+
+static INLINE short __Pyx_PyInt_AsShort(PyObject *);
+
+static INLINE int __Pyx_PyInt_AsInt(PyObject *);
+
+static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);
+
+static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);
+
+static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
+
+static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
+
+static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
+
+static INLINE long __Pyx_PyInt_AsLong(PyObject *);
+
+static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);
+
+static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);
+
+static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
+
+static void __Pyx_AddTraceback(const char *funcname); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+
+/* Type declarations */
+
+/* "/home/rene/dev/pygame/pygame/trunk/src/pypm.pyx":201
+ *     return Pm_Channel(chan-1)
+ * 
+ * cdef class Output:             # <<<<<<<<<<<<<<
+ *     """
+ * class Output:
+ */
+
+struct __pyx_obj_4pypm_Output {
+  PyObject_HEAD
+  int i;
+  PmStream *midi;
+  int debug;
+  int _aborted;
+};
+
+/* "/home/rene/dev/pygame/pygame/trunk/src/pypm.pyx":394
+ * 
+ * 
+ * cdef class Input:             # <<<<<<<<<<<<<<
+ *     """
+ * class Input:
+ */
+
+struct __pyx_obj_4pypm_Input {
+  PyObject_HEAD
+  PmStream *midi;
+  int debug;
+  int i;
+};
+/* Module declarations from pypm */
+
+static PyTypeObject *__pyx_ptype_4pypm_Output = 0;
+static PyTypeObject *__pyx_ptype_4pypm_Input = 0;
+#define __Pyx_MODULE_NAME "pypm"
+int __pyx_module_is_main_pypm = 0;
+
+/* Implementation of pypm */
+static char __pyx_k_3[] = "0.05";
+static PyObject *__pyx_int_0x1;
+static PyObject *__pyx_int_0x2;
+static PyObject *__pyx_int_0x4;
+static PyObject *__pyx_int_0x8;
+static PyObject *__pyx_int_0x10;
+static PyObject *__pyx_int_0x20;
+static PyObject *__pyx_int_0x30;
+static PyObject *__pyx_int_0x40;
+static PyObject *__pyx_int_0x7F;
+static PyObject *__pyx_int_0x80;
+static PyObject *__pyx_int_0x100;
+static PyObject *__pyx_int_0x200;
+static PyObject *__pyx_int_0x300;
+static PyObject *__pyx_int_0x400;
+static PyObject *__pyx_int_0x800;
+static PyObject *__pyx_int_0x1000;
+static PyObject *__pyx_int_0x2000;
+static PyObject *__pyx_int_0x4000;
+static PyObject *__pyx_int_0x8000;
+static PyObject *__pyx_int_0x10000;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
+static PyObject *__pyx_int_4096;
+static PyObject *__pyx_int_0xFF;
+static PyObject *__pyx_int_16;
+static PyObject *__pyx_int_0xFF0000;
+static PyObject *__pyx_int_8;
+static PyObject *__pyx_int_0xFF00;
+static PyObject *__pyx_int_1024;
+static char __pyx_k___main__[] = "__main__";
+static PyObject *__pyx_kp___main__;
+static char __pyx_k___init__[] = "__init__";
+static PyObject *__pyx_kp___init__;
+static char __pyx_k___dealloc__[] = "__dealloc__";
+static PyObject *__pyx_kp___dealloc__;
+static char __pyx_k__check_open[] = "_check_open";
+static PyObject *__pyx_kp__check_open;
+static char __pyx_k_Close[] = "Close";
+static PyObject *__pyx_kp_Close;
+static char __pyx_k_Abort[] = "Abort";
+static PyObject *__pyx_kp_Abort;
+static char __pyx_k_Write[] = "Write";
+static PyObject *__pyx_kp_Write;
+static char __pyx_k_WriteShort[] = "WriteShort";
+static PyObject *__pyx_kp_WriteShort;
+static char __pyx_k_WriteSysEx[] = "WriteSysEx";
+static PyObject *__pyx_kp_WriteSysEx;
+static char __pyx_k_SetFilter[] = "SetFilter";
+static PyObject *__pyx_kp_SetFilter;
+static char __pyx_k_SetChannelMask[] = "SetChannelMask";
+static PyObject *__pyx_kp_SetChannelMask;
+static char __pyx_k_Poll[] = "Poll";
+static PyObject *__pyx_kp_Poll;
+static char __pyx_k_Read[] = "Read";
+static PyObject *__pyx_kp_Read;
+static char __pyx_k_i[] = "i";
+static PyObject *__pyx_kp_i;
+static char __pyx_k_err[] = "err";
+static PyObject *__pyx_kp_err;
+static char __pyx_k_chan[] = "chan";
+static PyObject *__pyx_kp_chan;
+static char __pyx_k_OutputDevice[] = "OutputDevice";
+static PyObject *__pyx_kp_OutputDevice;
+static char __pyx_k_latency[] = "latency";
+static PyObject *__pyx_kp_latency;
+static char __pyx_k_data[] = "data";
+static PyObject *__pyx_kp_data;
+static char __pyx_k_status[] = "status";
+static PyObject *__pyx_kp_status;
+static char __pyx_k_1[] = "data1";
+static PyObject *__pyx_kp_1;
+static char __pyx_k_2[] = "data2";
+static PyObject *__pyx_kp_2;
+static char __pyx_k_when[] = "when";
+static PyObject *__pyx_kp_when;
+static char __pyx_k_msg[] = "msg";
+static PyObject *__pyx_kp_msg;
+static char __pyx_k_InputDevice[] = "InputDevice";
+static PyObject *__pyx_kp_InputDevice;
+static char __pyx_k_buffersize[] = "buffersize";
+static PyObject *__pyx_kp_buffersize;
+static char __pyx_k_filters[] = "filters";
+static PyObject *__pyx_kp_filters;
+static char __pyx_k_mask[] = "mask";
+static PyObject *__pyx_kp_mask;
+static char __pyx_k_length[] = "length";
+static PyObject *__pyx_kp_length;
+static char __pyx_k___version__[] = "__version__";
+static PyObject *__pyx_kp___version__;
+static char __pyx_k_array[] = "array";
+static PyObject *__pyx_kp_array;
+static char __pyx_k_FILT_ACTIVE[] = "FILT_ACTIVE";
+static PyObject *__pyx_kp_FILT_ACTIVE;
+static char __pyx_k_FILT_SYSEX[] = "FILT_SYSEX";
+static PyObject *__pyx_kp_FILT_SYSEX;
+static char __pyx_k_FILT_CLOCK[] = "FILT_CLOCK";
+static PyObject *__pyx_kp_FILT_CLOCK;
+static char __pyx_k_FILT_PLAY[] = "FILT_PLAY";
+static PyObject *__pyx_kp_FILT_PLAY;
+static char __pyx_k_4[] = "FILT_F9";
+static PyObject *__pyx_kp_4;
+static char __pyx_k_FILT_TICK[] = "FILT_TICK";
+static PyObject *__pyx_kp_FILT_TICK;