1 // **************************************************************************** 2 // 3 // CEchoGals_midi.cpp 4 // 5 // Implementation file for the CEchoGals driver class (midi functions). 6 // 7 // Set editor tabs to 3 for your viewing pleasure. 8 // 9 // ---------------------------------------------------------------------------- 10 // 11 // This file is part of Echo Digital Audio's generic driver library. 12 // Copyright Echo Digital Audio Corporation (c) 1998 - 2005 13 // All rights reserved 14 // www.echoaudio.com 15 // 16 // This library is free software; you can redistribute it and/or 17 // modify it under the terms of the GNU Lesser General Public 18 // License as published by the Free Software Foundation; either 19 // version 2.1 of the License, or (at your option) any later version. 20 // 21 // This library is distributed in the hope that it will be useful, 22 // but WITHOUT ANY WARRANTY; without even the implied warranty of 23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 24 // Lesser General Public License for more details. 25 // 26 // You should have received a copy of the GNU Lesser General Public 27 // License along with this library; if not, write to the Free Software 28 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 29 // 30 // **************************************************************************** 31 32 #include "CEchoGals.h" 33 34 35 #ifdef MIDI_SUPPORT 36 37 /**************************************************************************** 38 39 MIDI output 40 41 ****************************************************************************/ 42 43 //=========================================================================== 44 // 45 // Write a bunch of MIDI data to the MIDI output 46 // 47 // The DSP only buffers up 64 bytes internally for MIDI output; if you try 48 // to send more than the DSP can handle, the actual count sent will be returned 49 // to you. ECHOSTATUS_BUSY is returned if the DSP is still processing the 50 // last driver command. 51 // 52 //=========================================================================== 53 54 ECHOSTATUS CEchoGals::WriteMidi 55 ( 56 DWORD dwExpectedCt, 57 PBYTE pBuffer, 58 PDWORD pdwActualCt 59 ) 60 { 61 return GetDspCommObject()->WriteMidi( pBuffer, 62 dwExpectedCt, 63 pdwActualCt ); 64 } // ECHOSTATUS CLayla24::WriteMidi 65 66 67 68 69 /**************************************************************************** 70 71 MIDI input 72 73 ****************************************************************************/ 74 75 76 //=========================================================================== 77 // 78 // Read a single MIDI byte from the circular MIDI input buffer 79 // 80 //=========================================================================== 81 82 ECHOSTATUS CEchoGals::ReadMidiByte 83 ( 84 ECHOGALS_MIDI_IN_CONTEXT *pContext, 85 DWORD &dwMidiData, 86 LONGLONG &llTimestamp 87 ) 88 { 89 90 return m_MidiIn.GetMidi(pContext,dwMidiData,llTimestamp); 91 92 } // ReadMidiByte 93 94 95 //=========================================================================== 96 // 97 // Open and enable the MIDI input 98 // 99 // The context struct should be set to zero before calling OpenMidiInput 100 // 101 //=========================================================================== 102 103 ECHOSTATUS CEchoGals::OpenMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext) 104 { 105 106 return m_MidiIn.Arm(pContext); 107 108 } // OpenMidiInput 109 110 111 //=========================================================================== 112 // 113 // Close and disable the MIDI input 114 // 115 //=========================================================================== 116 117 ECHOSTATUS CEchoGals::CloseMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext) 118 { 119 return m_MidiIn.Disarm(pContext); 120 } 121 122 123 //=========================================================================== 124 // 125 // Reset the MIDI input, but leave it open and enabled 126 // 127 //=========================================================================== 128 129 ECHOSTATUS CEchoGals::ResetMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext) 130 { 131 m_MidiIn.Reset(pContext); 132 133 return ECHOSTATUS_OK; 134 } 135 136 137 138 #endif // MIDI_SUPPORT 139 140