2362N/A * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A/* *************************** MidiOutDeviceProvider implementation *********************************** */ 0N/A/* not thread safe */ 0N/A // add one for the MIDI_MAPPER 0N/A // we want to return it first so it'll be the default, so we 0N/A // decrement each deviceID for these methods.... 0N/A desc =
"Internal square wave synthesizer";
0N/A desc =
"Internal synthesizer (generic)";
0N/A case 7 /* MOD_SWSYNTH*/:
0N/A desc =
"Internal software synthesizer";
0N/A/* *************************** MidiOutDevice implementation ***************************************** */ 0N/A ERROR0(
"MIDI_OUT_unprepareLongBuffers: handle, deviceHandle, or longBuffers == NULL\n");
0N/A ERROR0(
"MIDI_OUT_freeLongBuffer: hdr == NULL\n");
0N/A ERROR0(
"MIDI_OUT_freeLongBuffers: handle or longBuffers == NULL\n");
0N/A ERROR0(
"ERROR: MIDI_OUT_OpenDevice: out of memory\n");
0N/A // create long buffer queue 0N/A ERROR0(
"ERROR: MIDI_OUT_OpenDevice: could not create long Buffers\n");
0N/A // create notification event 0N/A ERROR0(
"ERROR: MIDI_OUT_StartDevice: could not create event\n");
0N/A // finally open the device 0N/A /* some devices return non zero, but no error! */ 0N/A //$$fb enable high resolution time 0N/A TRACE0(
"<< MIDI_OUT_OpenDevice: succeeded\n");
0N/A ERROR0(
"ERROR: MIDI_OUT_StopDevice: handle is NULL\n");
0N/A // encourage MIDI_OUT_SendLongMessage to return soon 0N/A ERROR0(
"ERROR: MIDI_OUT_StopDevice: event is NULL\n");
0N/A //$$fb disable high resolution time 0N/A ERROR0(
"ERROR: MIDI_OUT_CloseDevice: deviceHandle is NULL\n");
0N/A // issue a "SUSTAIN OFF" message to each MIDI channel, 0 to 15. 0N/A // "CONTROL CHANGE" is 176, "SUSTAIN CONTROLLER" is 64, and the value is 0. 0N/A // $$fb 2002-04-04: It is responsability of the application developer to 0N/A // leave the device in a consistent state. So I put this in comments 0N/A for (channel = 0; channel < 16; channel++) 0N/A MIDI_OUT_SendShortMessage(deviceHandle, (unsigned char)(176 + channel), (unsigned char)64, (unsigned char)0, (UINT32)-1); 0N/A // wait until MIDI_OUT_SendLongMessage has finished 0N/A/* return time stamp in microseconds */ 0N/A ERROR0(
"ERROR: MIDI_OUT_SendShortMessage: handle is NULL\n");
0N/A ERROR0(
"< ERROR: MIDI_OUT_SendLongMessage: handle, data, or longBuffers is NULL\n");
0N/A // send in chunks of 512 bytes 0N/A /* find a non-queued header */ 0N/A /* wait for a buffer to free up */ 0N/A // break out back to Java if no buffer freed up after 700 milliseconds 0N/A TRACE0(
"-> TIMEOUT. Need to go back to Java\n");
0N/A ERROR0(
"ERROR: MIDI_OUT_SendLongMessage: midiOutLongMsg returned error:\n");
0N/A TRACE0(
"< MIDI_OUT_SendLongMessage success\n");
0N/A#
endif // USE_PLATFORM_MIDI_OUT