| 1 | /* $Id: maudio.hpp,v 1.1 2000/04/23 14:55:17 ktk Exp $ */
 | 
|---|
| 2 | 
 | 
|---|
| 3 | /* SCCSID = %W% %E% */
 | 
|---|
| 4 | /****************************************************************************
 | 
|---|
| 5 |  *                                                                          *
 | 
|---|
| 6 |  * Copyright (c) IBM Corporation 1994 - 1997.                               *
 | 
|---|
| 7 |  *                                                                          *
 | 
|---|
| 8 |  * The following IBM OS/2 source code is provided to you solely for the     *
 | 
|---|
| 9 |  * the purpose of assisting you in your development of OS/2 device drivers. *
 | 
|---|
| 10 |  * You may use this code in accordance with the IBM License Agreement       *
 | 
|---|
| 11 |  * provided in the IBM Device Driver Source Kit for OS/2.                   *
 | 
|---|
| 12 |  *                                                                          *
 | 
|---|
| 13 |  ****************************************************************************/
 | 
|---|
| 14 | /**@internal %W%
 | 
|---|
| 15 |  *  MIDI audio hardware object definition.
 | 
|---|
| 16 |  * @version %I%
 | 
|---|
| 17 |  * @context
 | 
|---|
| 18 |  *  Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
 | 
|---|
| 19 |  * @notes
 | 
|---|
| 20 |  * @history
 | 
|---|
| 21 |  */
 | 
|---|
| 22 | 
 | 
|---|
| 23 | #ifndef MIDIAUDIO_INCLUDED
 | 
|---|
| 24 | #define MIDIAUDIO_INCLUDED
 | 
|---|
| 25 | 
 | 
|---|
| 26 | #ifndef OS2_INCLUDED
 | 
|---|
| 27 | #define INCL_NOPMAPI
 | 
|---|
| 28 | #include <os2.h>
 | 
|---|
| 29 | #endif
 | 
|---|
| 30 | 
 | 
|---|
| 31 | #include "..\midi\midi_idc.h"          // RTMIDI interfaces, MIDI_NAME_LENGTH
 | 
|---|
| 32 | #include "audiohw.hpp"                 // Object definition.
 | 
|---|
| 33 | #include "timer.hpp"                   // Object definition.
 | 
|---|
| 34 | 
 | 
|---|
| 35 | class MIDIAUDIO : public AUDIOHW {
 | 
|---|
| 36 | protected:
 | 
|---|
| 37 |    MIDIAUDIO (USHORT devicetype, TIMER* pTimer ) :
 | 
|---|
| 38 |      AUDIOHW( devicetype ), _pTimer ( pTimer )          {};
 | 
|---|
| 39 | 
 | 
|---|
| 40 | public:
 | 
|---|
| 41 |    // RT MIDI Data
 | 
|---|
| 42 |    char szRTMIDI_Name[MIDI_NAME_LENGTH];
 | 
|---|
| 43 |                                        // RTMIDI gets a pointer to this string.
 | 
|---|
| 44 |    ULONG ulRTMIDI_Caps;                // RTMIDI defined capability bits.
 | 
|---|
| 45 |    ULONG ulRTMIDI_Handle;              // Provided to us by RTMIDI (aka MIDI.SYS)
 | 
|---|
| 46 | 
 | 
|---|
| 47 |    // Entry points into RTMIDI (MIDI.SYS) provided to us by IDC interface.
 | 
|---|
| 48 |    PFNMIDI_SENDBYTE pfnSendByte;
 | 
|---|
| 49 |    PFNMIDI_SENDSTRING pfnSendString;
 | 
|---|
| 50 |    PFNMIDI_DEREGISTER pfnDeregister;
 | 
|---|
| 51 | 
 | 
|---|
| 52 |    // Methods
 | 
|---|
| 53 | 
 | 
|---|
| 54 |    // Writes byte to data port.  Returns 0 if failure, 1 on success
 | 
|---|
| 55 |    virtual int writeByte(BYTE);
 | 
|---|
| 56 | 
 | 
|---|
| 57 |    // Read data port.  Data read is in LSB with MSB==0 on good read.
 | 
|---|
| 58 |    // Returns -1 on err.
 | 
|---|
| 59 |    virtual int readByte(void);
 | 
|---|
| 60 | 
 | 
|---|
| 61 |    // Device caps for MMPM/2 IOCTL interface.
 | 
|---|
| 62 |    virtual void DevCaps(PAUDIO_CAPS pCaps);
 | 
|---|
| 63 | 
 | 
|---|
| 64 |    // Standard MIDI channel commands.
 | 
|---|
| 65 |    virtual void noteOff( BYTE mchan, BYTE note, BYTE velocity ) = 0;
 | 
|---|
| 66 |    virtual void noteOn( BYTE mchan, BYTE note, BYTE velocity ) = 0;
 | 
|---|
| 67 |    virtual void polyphonicPressure( BYTE mchan, BYTE note, BYTE value ) = 0;
 | 
|---|
| 68 |    virtual void controlChange( BYTE mchan, BYTE control_number, BYTE value ) = 0;
 | 
|---|
| 69 |    virtual void programChange( BYTE mchan, BYTE program_number ) = 0;
 | 
|---|
| 70 |    virtual void channelPressure( BYTE mchan, BYTE value ) = 0;
 | 
|---|
| 71 |    virtual void pitchBend( BYTE mchan, BYTE value_lsb, BYTE value_msb ) = 0;
 | 
|---|
| 72 | 
 | 
|---|
| 73 |    // Services provided to the RTMIDI interface.
 | 
|---|
| 74 |    virtual USHORT RTMIDI_OpenReceive(void);
 | 
|---|
| 75 |    virtual USHORT RTMIDI_OpenSend(void);
 | 
|---|
| 76 |    virtual USHORT RTMIDI_CloseReceive(void);
 | 
|---|
| 77 |    virtual USHORT RTMIDI_CloseSend(void);
 | 
|---|
| 78 | 
 | 
|---|
| 79 |    // Timer association.
 | 
|---|
| 80 |    inline TIMER* getTimer( void ) { return _pTimer; }
 | 
|---|
| 81 | 
 | 
|---|
| 82 | private:
 | 
|---|
| 83 |    TIMER* _pTimer;                     // Timer associated with this hardware.
 | 
|---|
| 84 | 
 | 
|---|
| 85 | };
 | 
|---|
| 86 | 
 | 
|---|
| 87 | #endif
 | 
|---|
| 88 | 
 | 
|---|