BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / drivers / audio / echo / generic / CEchoGals_midi.cpp
blob7129d07f6faa28b07c30e0722fcc5f2b40f1dacd
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 // ----------------------------------------------------------------------------
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
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.
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.
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
30 // ****************************************************************************
32 #include "CEchoGals.h"
35 #ifdef MIDI_SUPPORT
37 /****************************************************************************
39 MIDI output
41 ****************************************************************************/
43 //===========================================================================
45 // Write a bunch of MIDI data to the MIDI output
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.
52 //===========================================================================
54 ECHOSTATUS CEchoGals::WriteMidi
56 DWORD dwExpectedCt,
57 PBYTE pBuffer,
58 PDWORD pdwActualCt
61 return GetDspCommObject()->WriteMidi( pBuffer,
62 dwExpectedCt,
63 pdwActualCt );
64 } // ECHOSTATUS CLayla24::WriteMidi
69 /****************************************************************************
71 MIDI input
73 ****************************************************************************/
76 //===========================================================================
78 // Read a single MIDI byte from the circular MIDI input buffer
79 //
80 //===========================================================================
82 ECHOSTATUS CEchoGals::ReadMidiByte
84 ECHOGALS_MIDI_IN_CONTEXT *pContext,
85 DWORD &dwMidiData,
86 LONGLONG &llTimestamp
90 return m_MidiIn.GetMidi(pContext,dwMidiData,llTimestamp);
92 } // ReadMidiByte
95 //===========================================================================
97 // Open and enable the MIDI input
99 // The context struct should be set to zero before calling OpenMidiInput
101 //===========================================================================
103 ECHOSTATUS CEchoGals::OpenMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext)
106 return m_MidiIn.Arm(pContext);
108 } // OpenMidiInput
111 //===========================================================================
113 // Close and disable the MIDI input
115 //===========================================================================
117 ECHOSTATUS CEchoGals::CloseMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext)
119 return m_MidiIn.Disarm(pContext);
123 //===========================================================================
125 // Reset the MIDI input, but leave it open and enabled
127 //===========================================================================
129 ECHOSTATUS CEchoGals::ResetMidiInput(ECHOGALS_MIDI_IN_CONTEXT *pContext)
131 m_MidiIn.Reset(pContext);
133 return ECHOSTATUS_OK;
138 #endif // MIDI_SUPPORT