src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_MidiOut.c

Print this page




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #define USE_ERROR
  27 #define USE_TRACE
  28 
  29 #include "PLATFORM_API_WinOS_Util.h"
  30 
  31 #if USE_PLATFORM_MIDI_OUT == TRUE
  32 
  33 
  34 #ifdef USE_ERROR
  35 #include <stdio.h>






  36 #define MIDIOUT_CHECK_ERROR  { \
  37         if (err != MMSYSERR_NOERROR) \
  38             ERROR3("MIDI OUT Error in %s:%d : %s\n", __FILE__, __LINE__, MIDI_OUT_GetErrorStr((INT32) err)); \
  39         }
  40 #else
  41 #define MIDIOUT_CHECK_ERROR
  42 #endif
  43 
  44 /* *************************** MidiOutDeviceProvider implementation *********************************** */
  45 
  46 /* not thread safe */
  47 static char winMidiOutErrMsg[WIN_MAX_ERROR_LEN];
  48 
  49 char* MIDI_OUT_GetErrorStr(INT32 err) {
  50     winMidiOutErrMsg[0] = 0;
  51     midiOutGetErrorText((MMRESULT) err, winMidiOutErrMsg, WIN_MAX_ERROR_LEN);
  52     return winMidiOutErrMsg;
  53 }
  54 
  55 INT32 MIDI_OUT_GetNumDevices() {
  56     // add one for the MIDI_MAPPER
  57     // we want to return it first so it'll be the default, so we
  58     // decrement each deviceID for these methods....




  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #define USE_ERROR
  27 #define USE_TRACE
  28 
  29 #include "PLATFORM_API_WinOS_Util.h"
  30 
  31 #if USE_PLATFORM_MIDI_OUT == TRUE
  32 
  33 
  34 #ifdef USE_ERROR
  35 #include <stdio.h>
  36 
  37 /* Use THIS_FILE when it is available. */
  38 #ifndef THIS_FILE
  39     #define THIS_FILE __FILE__
  40 #endif
  41 
  42 #define MIDIOUT_CHECK_ERROR  { \
  43         if (err != MMSYSERR_NOERROR) \
  44             ERROR3("MIDI OUT Error in %s:%d : %s\n", THIS_FILE, __LINE__, MIDI_OUT_GetErrorStr((INT32) err)); \
  45         }
  46 #else
  47 #define MIDIOUT_CHECK_ERROR
  48 #endif
  49 
  50 /* *************************** MidiOutDeviceProvider implementation *********************************** */
  51 
  52 /* not thread safe */
  53 static char winMidiOutErrMsg[WIN_MAX_ERROR_LEN];
  54 
  55 char* MIDI_OUT_GetErrorStr(INT32 err) {
  56     winMidiOutErrMsg[0] = 0;
  57     midiOutGetErrorText((MMRESULT) err, winMidiOutErrMsg, WIN_MAX_ERROR_LEN);
  58     return winMidiOutErrMsg;
  59 }
  60 
  61 INT32 MIDI_OUT_GetNumDevices() {
  62     // add one for the MIDI_MAPPER
  63     // we want to return it first so it'll be the default, so we
  64     // decrement each deviceID for these methods....