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 // Copyright Echo Digital Audio Corporation (c) 1998 - 2002 10 // All rights reserved 11 // www.echoaudio.com 12 // 13 // Permission is hereby granted, free of charge, to any person obtaining a 14 // copy of this software and associated documentation files (the 15 // "Software"), to deal with the Software without restriction, including 16 // without limitation the rights to use, copy, modify, merge, publish, 17 // distribute, sublicense, and/or sell copies of the Software, and to 18 // permit persons to whom the Software is furnished to do so, subject to 19 // the following conditions: 20 // 21 // - Redistributions of source code must retain the above copyright 22 // notice, this list of conditions and the following disclaimers. 23 // 24 // - Redistributions in binary form must reproduce the above copyright 25 // notice, this list of conditions and the following disclaimers in the 26 // documentation and/or other materials provided with the distribution. 27 // 28 // - Neither the name of Echo Digital Audio, nor the names of its 29 // contributors may be used to endorse or promote products derived from 30 // this Software without specific prior written permission. 31 // 32 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 33 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 34 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 35 // IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR 36 // ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 37 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 38 // SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. 39 // 40 // **************************************************************************** 41 42 #include "CEchoGals.h" 43 44 45 #ifdef MIDI_SUPPORT 46 47 /**************************************************************************** 48 49 MIDI output 50 51 ****************************************************************************/ 52 53 //=========================================================================== 54 // 55 // Write a bunch of MIDI data to the MIDI output 56 // 57 // The DSP only buffers up 16 bytes internally for MIDI output; if you try 58 // to send more than the DSP can handle, the actual count sent will be returned 59 // to you and you get ECHOSTATUS_BUSY as the return value. 60 // 61 //=========================================================================== 62 63 ECHOSTATUS CEchoGals::WriteMidi 64 ( 65 DWORD dwExpectedCt, 66 PBYTE pBuffer, 67 PDWORD pdwActualCt 68 ) 69 { 70 return GetDspCommObject()->WriteMidi( pBuffer, 71 dwExpectedCt, 72 pdwActualCt ); 73 } // ECHOSTATUS CLayla24::WriteMidi 74 75 76 77 78 /**************************************************************************** 79 80 MIDI input 81 82 ****************************************************************************/ 83 84 85 //=========================================================================== 86 // 87 // Read a single MIDI byte from the circular MIDI input buffer 88 // 89 //=========================================================================== 90 91 ECHOSTATUS CEchoGals::ReadMidiByte(BYTE &Midi) 92 { 93 94 return m_MidiIn.GetMidi(Midi); 95 96 } // ReadMidiByte 97 98 99 //=========================================================================== 100 // 101 // Open and enable the MIDI input 102 // 103 //=========================================================================== 104 105 ECHOSTATUS CEchoGals::OpenMidiInput() 106 { 107 108 return m_MidiIn.Arm(); 109 110 } // OpenMidiInput 111 112 113 //=========================================================================== 114 // 115 // Close and disable the MIDI input 116 // 117 //=========================================================================== 118 119 ECHOSTATUS CEchoGals::CloseMidiInput() 120 { 121 m_MidiIn.Disarm(); 122 123 return ECHOSTATUS_OK; 124 } 125 126 127 //=========================================================================== 128 // 129 // Reset the MIDI input, but leave it open and enabled 130 // 131 //=========================================================================== 132 133 ECHOSTATUS CEchoGals::ResetMidiInput() 134 { 135 m_MidiIn.Reset(); 136 137 return ECHOSTATUS_OK; 138 } 139 140 141 142 #endif // MIDI_SUPPORT 143 144