src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c
author rwestberg
Fri, 01 Jun 2018 10:15:48 +0200
changeset 50336 1b6ea6bcd21a
parent 47216 71c04702a3d5
child 52161 f1b6c4079be0
permissions -rw-r--r--
8203237: JFR TestBiasedLockRevocationEvents should ignore events unrelated to the test Reviewed-by: egahlin, mgronlun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 13678
diff changeset
     2
 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#define USE_ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define USE_TRACE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "PLATFORM_API_WinOS_Util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    31
/* include to prevent charset problem */
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    32
#include "PLATFORM_API_WinOS_Charset_Util.h"
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    33
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#if USE_PLATFORM_MIDI_OUT == TRUE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#ifdef USE_ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#include <stdio.h>
13678
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    39
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    40
/* Use THIS_FILE when it is available. */
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    41
#ifndef THIS_FILE
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    42
    #define THIS_FILE __FILE__
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    43
#endif
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    44
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define MIDIOUT_CHECK_ERROR  { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
        if (err != MMSYSERR_NOERROR) \
13678
5c8001201f98 7197771: Adjust jdk sources to avoid use of implementation defined value of __FILE__
ohair
parents: 5506
diff changeset
    47
            ERROR3("MIDI OUT Error in %s:%d : %s\n", THIS_FILE, __LINE__, MIDI_OUT_GetErrorStr((INT32) err)); \
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#define MIDIOUT_CHECK_ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
/* *************************** MidiOutDeviceProvider implementation *********************************** */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
/* not thread safe */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
static char winMidiOutErrMsg[WIN_MAX_ERROR_LEN];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
char* MIDI_OUT_GetErrorStr(INT32 err) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    winMidiOutErrMsg[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    midiOutGetErrorText((MMRESULT) err, winMidiOutErrMsg, WIN_MAX_ERROR_LEN);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    return winMidiOutErrMsg;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
INT32 MIDI_OUT_GetNumDevices() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    // add one for the MIDI_MAPPER
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    // we want to return it first so it'll be the default, so we
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    // decrement each deviceID for these methods....
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    return (INT32) (midiOutGetNumDevs() + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    72
INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    if (deviceID == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        deviceID = MIDI_MAPPER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        deviceID--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    }
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    78
    (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    return ((*err) == MMSYSERR_NOERROR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
INT32 MIDI_OUT_GetDeviceName(INT32 deviceID, char *name, UINT32 nameLength) {
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    84
    MIDIOUTCAPSW midiOutCaps;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    INT32 err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
    88
        UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        return MIDI_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    return err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
INT32 MIDI_OUT_GetDeviceVendor(INT32 deviceID, char *name, UINT32 nameLength) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    return MIDI_NOT_SUPPORTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
INT32 MIDI_OUT_GetDeviceDescription(INT32 deviceID, char *name, UINT32 nameLength) {
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
   102
    MIDIOUTCAPSW midiOutCaps;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    char *desc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    INT32 err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        int tech = (int)midiOutCaps.wTechnology;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        switch(tech) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
        case MOD_MIDIPORT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
            desc = "External MIDI Port";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        case MOD_SQSYNTH:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
            desc = "Internal square wave synthesizer";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        case MOD_FMSYNTH:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            desc = "Internal FM synthesizer";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        case MOD_SYNTH:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            desc = "Internal synthesizer (generic)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        case MOD_MAPPER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
            desc = "Windows MIDI_MAPPER";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        case 7 /* MOD_SWSYNTH*/:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
            desc = "Internal software synthesizer";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            return MIDI_NOT_SUPPORTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        strncpy(name, desc, nameLength-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        name[nameLength-1] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        return MIDI_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    return err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
INT32 MIDI_OUT_GetDeviceVersion(INT32 deviceID, char *name, UINT32 nameLength) {
47191
8c95ea7056b7 8177951: Charset problem when the name of the sound device contains Chinese character
serb
parents: 25859
diff changeset
   139
    MIDIOUTCAPSW midiOutCaps;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    INT32 err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        return MIDI_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    return err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
/* *************************** MidiOutDevice implementation ***************************************** */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
INT32 unprepareLongBuffers(MidiDeviceHandle* handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    SysExQueue* sysex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    MMRESULT err = MMSYSERR_NOERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    if (!handle || !handle->deviceHandle || !handle->longBuffers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
        ERROR0("MIDI_OUT_unprepareLongBuffers: handle, deviceHandle, or longBuffers == NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        return MIDI_INVALID_HANDLE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    sysex = (SysExQueue*) handle->longBuffers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    for (i = 0; i<sysex->count; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        MIDIHDR* hdr = &(sysex->header[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        if (hdr->dwFlags) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            err = midiOutUnprepareHeader((HMIDIOUT) handle->deviceHandle, hdr, sizeof(MIDIHDR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
INT32 freeLongBuffer(MIDIHDR* hdr, HMIDIOUT deviceHandle, INT32 minToLeaveData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    MMRESULT err = MMSYSERR_NOERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    if (!hdr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        ERROR0("MIDI_OUT_freeLongBuffer: hdr == NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        return MIDI_INVALID_HANDLE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    if (hdr->dwFlags && deviceHandle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        err = midiOutUnprepareHeader(deviceHandle, hdr, sizeof(MIDIHDR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    if (hdr->lpData && (((INT32) hdr->dwBufferLength) < minToLeaveData || minToLeaveData < 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        free(hdr->lpData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        hdr->lpData=NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        hdr->dwBufferLength=0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    hdr->dwBytesRecorded=0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    hdr->dwFlags=0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
INT32 freeLongBuffers(MidiDeviceHandle* handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    SysExQueue* sysex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    MMRESULT err = MMSYSERR_NOERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    if (!handle || !handle->longBuffers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        ERROR0("MIDI_OUT_freeLongBuffers: handle or longBuffers == NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        return MIDI_INVALID_HANDLE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    sysex = (SysExQueue*) handle->longBuffers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    for (i = 0; i<sysex->count; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        err = freeLongBuffer(&(sysex->header[i]), (HMIDIOUT) handle->deviceHandle, -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
INT32 MIDI_OUT_OpenDevice(INT32 deviceID, MidiDeviceHandle** handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    MMRESULT err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    TRACE1(">> MIDI_OUT_OpenDevice: deviceID: %d\n", deviceID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    if (deviceID == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        deviceID = MIDI_MAPPER;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        deviceID--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
#ifdef USE_ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    setvbuf(stdout, NULL, (int)_IONBF, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    setvbuf(stderr, NULL, (int)_IONBF, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    (*handle) = (MidiDeviceHandle*) malloc(sizeof(MidiDeviceHandle));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    if (!(*handle)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        ERROR0("ERROR: MIDI_OUT_OpenDevice: out of memory\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        return MIDI_OUT_OF_MEMORY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    memset(*handle, 0, sizeof(MidiDeviceHandle));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    // create long buffer queue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    if (!MIDI_WinCreateEmptyLongBufferQueue(*handle, MIDI_OUT_LONG_QUEUE_SIZE)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        ERROR0("ERROR: MIDI_OUT_OpenDevice: could not create long Buffers\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        free(*handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        (*handle) = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        return MIDI_OUT_OF_MEMORY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    // create notification event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    (*handle)->platformData = (void*) CreateEvent(NULL, FALSE /*manual reset*/, FALSE /*signaled*/, NULL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    if (!(*handle)->platformData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        ERROR0("ERROR: MIDI_OUT_StartDevice: could not create event\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        MIDI_WinDestroyLongBufferQueue(*handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        free(*handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        (*handle) = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        return MIDI_OUT_OF_MEMORY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    // finally open the device
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    err = midiOutOpen((HMIDIOUT*) &((*handle)->deviceHandle), deviceID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                      (UINT_PTR) (*handle)->platformData, (UINT_PTR) (*handle), CALLBACK_EVENT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    if ((err != MMSYSERR_NOERROR) || (!(*handle)->deviceHandle)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        /* some devices return non zero, but no error! */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        if (midiOutShortMsg((HMIDIOUT) ((*handle)->deviceHandle),0) == MMSYSERR_INVALHANDLE) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
            MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
            CloseHandle((HANDLE) (*handle)->platformData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            MIDI_WinDestroyLongBufferQueue(*handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
            free(*handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
            (*handle) = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    //$$fb enable high resolution time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    timeBeginPeriod(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    MIDI_SetStartTime(*handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    TRACE0("<< MIDI_OUT_OpenDevice: succeeded\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    return MIDI_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
INT32 MIDI_OUT_CloseDevice(MidiDeviceHandle* handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    MMRESULT err = MMSYSERR_NOERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    HANDLE event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    TRACE0("> MIDI_OUT_CloseDevice\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    if (!handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        ERROR0("ERROR: MIDI_OUT_StopDevice: handle is NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        return MIDI_INVALID_HANDLE; // failure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    // encourage MIDI_OUT_SendLongMessage to return soon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    event = handle->platformData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    handle->platformData = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    if (event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        SetEvent(event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        ERROR0("ERROR: MIDI_OUT_StopDevice: event is NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    if (handle->deviceHandle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        //$$fb disable high resolution time
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        timeEndPeriod(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        err = midiOutReset((HMIDIOUT) handle->deviceHandle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        ERROR0("ERROR: MIDI_OUT_CloseDevice: deviceHandle is NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    // issue a "SUSTAIN OFF" message to each MIDI channel, 0 to 15.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    // "CONTROL CHANGE" is 176, "SUSTAIN CONTROLLER" is 64, and the value is 0.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    // $$fb 2002-04-04: It is responsability of the application developer to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    // leave the device in a consistent state. So I put this in comments
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      for (channel = 0; channel < 16; channel++)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      MIDI_OUT_SendShortMessage(deviceHandle, (unsigned char)(176 + channel), (unsigned char)64, (unsigned char)0, (UINT32)-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    if (event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        // wait until MIDI_OUT_SendLongMessage has finished
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        while (handle->isWaiting) Sleep(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    unprepareLongBuffers(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    if (handle->deviceHandle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
        err = midiOutClose((HMIDIOUT) handle->deviceHandle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
        MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        handle->deviceHandle = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    freeLongBuffers(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    if (event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
        CloseHandle(event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    MIDI_WinDestroyLongBufferQueue(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    free(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    TRACE0("< MIDI_OUT_CloseDevice\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
/* return time stamp in microseconds */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
INT64 MIDI_OUT_GetTimeStamp(MidiDeviceHandle* handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    return MIDI_GetTimeStamp(handle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
INT32 MIDI_OUT_SendShortMessage(MidiDeviceHandle* handle, UINT32 packedMsg, UINT32 timestamp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    MMRESULT err = MMSYSERR_NOERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    TRACE2("> MIDI_OUT_SendShortMessage %x, time: %d\n", packedMsg, timestamp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    if (!handle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        ERROR0("ERROR: MIDI_OUT_SendShortMessage: handle is NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        return MIDI_INVALID_HANDLE; // failure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    err = midiOutShortMsg((HMIDIOUT) handle->deviceHandle, packedMsg);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    TRACE0("< MIDI_OUT_SendShortMessage\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
INT32 MIDI_OUT_SendLongMessage(MidiDeviceHandle* handle, UBYTE* data, UINT32 size, UINT32 timestamp) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    MMRESULT err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    SysExQueue* sysex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    MIDIHDR* hdr = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    INT32 remainingSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    int i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    TRACE2("> MIDI_OUT_SendLongMessage size %d, time: %d\n", size, timestamp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    if (!handle || !data || !handle->longBuffers) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        ERROR0("< ERROR: MIDI_OUT_SendLongMessage: handle, data, or longBuffers is NULL\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        return MIDI_INVALID_HANDLE; // failure
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    if (size == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        return MIDI_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    sysex = (SysExQueue*) handle->longBuffers;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    remainingSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    // send in chunks of 512 bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    size = 512;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    while (remainingSize > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        if (remainingSize < (INT32) size) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
            size = (UINT32) remainingSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        while (!hdr && handle->platformData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            /* find a non-queued header */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            for (i = 0; i < sysex->count; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
                hdr = &(sysex->header[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
                if ((hdr->dwFlags & MHDR_DONE) || (hdr->dwFlags == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                hdr = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            /* wait for a buffer to free up */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            if (!hdr && handle->platformData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                DWORD res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                TRACE0(" Need to wait for free buffer\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
                handle->isWaiting = TRUE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
                res = WaitForSingleObject((HANDLE) handle->platformData, 700);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                handle->isWaiting = FALSE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
                if (res == WAIT_TIMEOUT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                    // break out back to Java if no buffer freed up after 700 milliseconds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                    TRACE0("-> TIMEOUT. Need to go back to Java\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        if (!hdr) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            // no free buffer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            return MIDI_NOT_SUPPORTED;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        TRACE2("-> sending %d bytes with buffer index=%d\n", (int) size, (int) hdr->dwUser);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        freeLongBuffer(hdr, handle->deviceHandle, (INT32) size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        if (hdr->lpData == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            hdr->lpData = malloc(size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
            hdr->dwBufferLength = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
        hdr->dwBytesRecorded = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        memcpy(hdr->lpData, data, size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        err = midiOutPrepareHeader((HMIDIOUT) handle->deviceHandle, hdr, sizeof(MIDIHDR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
        if (err != MMSYSERR_NOERROR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            freeLongBuffer(hdr, handle->deviceHandle, -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
            MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
            return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        err = midiOutLongMsg((HMIDIOUT) handle->deviceHandle, hdr, sizeof(MIDIHDR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        if (err != MMSYSERR_NOERROR) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            freeLongBuffer(hdr, handle->deviceHandle, -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            ERROR0("ERROR: MIDI_OUT_SendLongMessage: midiOutLongMsg returned error:\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
            MIDIOUT_CHECK_ERROR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
            return (INT32) err;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        remainingSize -= size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        data += size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    TRACE0("< MIDI_OUT_SendLongMessage success\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    return MIDI_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
#endif // USE_PLATFORM_MIDI_OUT