1 | /* $Id: mpu401.hpp 147 2000-04-24 19:45:21Z sandervl $ */
|
---|
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 | * MPU_401 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 MPU401_INCLUDED
|
---|
24 | #define MPU401_INCLUDED
|
---|
25 |
|
---|
26 | #ifndef OS2_INCLUDED
|
---|
27 | #define INCL_NOPMAPI
|
---|
28 | #include <os2.h>
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #include "maudio.hpp"
|
---|
32 | #include "irq.hpp"
|
---|
33 |
|
---|
34 | #define DSR 0x80
|
---|
35 | #define DRR 0x40
|
---|
36 |
|
---|
37 | unsigned MPUcommand(USHORT, BYTE);
|
---|
38 | // sends byte to an I/O address. Returns non-zero if error
|
---|
39 |
|
---|
40 | class MPU_401 : public MIDIAUDIO {
|
---|
41 | int fOpenedSend; // TRUE if opened for RTMIDI Send (recording)
|
---|
42 | int fOpenedRecv; // TRUE if opened for RTMIDI Receive (playback)
|
---|
43 | BYTE n; // This is the nth MPU-401
|
---|
44 | int _iAllNotesOff(void); // function to turn all notes off
|
---|
45 | ULONG midiInStreamId;
|
---|
46 | ULONG midiOutStreamId;
|
---|
47 | public:
|
---|
48 | // Constructor.
|
---|
49 | MPU_401( TIMER* pTimer );
|
---|
50 |
|
---|
51 | // Standard MIDI channel commands.
|
---|
52 | virtual void noteOff( BYTE mchan, BYTE note, BYTE velocity );
|
---|
53 | virtual void noteOn( BYTE mchan, BYTE note, BYTE velocity );
|
---|
54 | virtual void polyphonicPressure( BYTE mchan, BYTE note, BYTE value );
|
---|
55 | virtual void controlChange( BYTE mchan, BYTE control_number, BYTE value );
|
---|
56 | virtual void programChange( BYTE mchan, BYTE program_number );
|
---|
57 | virtual void channelPressure( BYTE mchan, BYTE value );
|
---|
58 | virtual void pitchBend( BYTE mchan, BYTE value_lsb, BYTE value_msb );
|
---|
59 |
|
---|
60 | // Direct byte level IO... used for handling System Common & Exclusive
|
---|
61 | // commands, as well as for RTMIDI
|
---|
62 | virtual int writeByte(BYTE b);
|
---|
63 | virtual int readByte(void);
|
---|
64 |
|
---|
65 | // Stream control.
|
---|
66 | virtual int Reset(STREAM *stream);
|
---|
67 | virtual int Start(STREAM *stream);
|
---|
68 | virtual int Stop(STREAM *stream);
|
---|
69 | virtual int Pause(STREAM *stream);
|
---|
70 | virtual int Resume(STREAM *stream);
|
---|
71 |
|
---|
72 | // Services provided to the RTMIDI interface.
|
---|
73 | virtual USHORT RTMIDI_OpenReceive(void);
|
---|
74 | virtual USHORT RTMIDI_OpenSend(void);
|
---|
75 | virtual USHORT RTMIDI_CloseReceive(void);
|
---|
76 | virtual USHORT RTMIDI_CloseSend(void);
|
---|
77 | };
|
---|
78 |
|
---|
79 | #endif
|
---|