source: cmedia/trunk/Drv16/fmsynth.hpp@ 354

Last change on this file since 354 was 354, checked in by stevenhl, 17 years ago

Import untested baseline cmedia sources, work products and binaries
Binaries and work products should be deleted from repository.
once new builds are verified to work.

File size: 4.7 KB
Line 
1/* SCCSID = %W% %E% */
2/****************************************************************************
3 * *
4 * Copyright (c) IBM Corporation 1994 - 1997. *
5 * *
6 * The following IBM OS/2 source code is provided to you solely for the *
7 * the purpose of assisting you in your development of OS/2 device drivers. *
8 * You may use this code in accordance with the IBM License Agreement *
9 * provided in the IBM Device Driver Source Kit for OS/2. *
10 * *
11 ****************************************************************************/
12/**@internal %W%
13* FMSYNTH object definition.
14 * @version %I%
15 * @context
16 * Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
17 * @notes
18 * @history
19 */
20
21#ifndef FMSYNTH_INCLUDED
22#define FMSYNTH_INCLUDED
23
24#ifndef OS2_INCLUDED
25#define INCL_NOPMAPI
26#include <os2.h>
27#endif
28
29#include "maudio.hpp"
30#include "fmadlib.h" // NPALLOC_Q
31
32class FMSYNTH : public MIDIAUDIO {
33public:
34
35 // Constructors. No destructor needed.
36 FMSYNTH( USHORT portNum, TIMER* pTimer ) :
37 MIDIAUDIO ( AUDIOHW_FMSYNTH_PLAY, pTimer ), _port ( portNum ) {};
38
39 // Public methods
40// virtual int writeByte( BYTE b );
41// virtual int readByte( void );
42
43 inline int Initialize(void) { return FMInit(); }; // Initialize the board at task time
44
45 virtual int Start(STREAM *stream);
46 virtual int Stop(STREAM *stream);
47 virtual int Pause(STREAM *stream); // Pause the operation
48 virtual int Resume(STREAM *stream); // Resume the operation
49
50 // fmdo.cpp - Standard MIDI channel commands.
51 virtual void noteOff( BYTE mchan, BYTE note, BYTE velocity );
52 virtual void noteOn( BYTE mchan, BYTE note, BYTE velocity );
53 virtual void polyphonicPressure( BYTE mchan, BYTE note, BYTE value );
54 virtual void controlChange( BYTE mchan, BYTE control_number, BYTE value );
55 virtual void programChange( BYTE mchan, BYTE program_number );
56 virtual void channelPressure( BYTE mchan, BYTE value );
57 virtual void pitchBend( BYTE mchan, BYTE value_lsb, BYTE value_msb );
58
59
60private:
61 // Private data
62 const USHORT _port; // Port through which the FMSYNTH is operated.
63 // Often 0x388. 1st of 4 consecutive ports.
64 void (*fnPtr)(int op);
65
66 // fmadlib.cpp
67 void set_pitch_range(unsigned p_range);
68 long calc_pitch(int m_chan);
69 void set_pitch_of_this_voice(unsigned voice, long pitchBend);
70 void InitSlotParams(void);
71 void set_a_param_in_a_slot(unsigned slot, char * cParam);
72 void SndOutputSlot(int addr, int slot, int val);
73 void SndOutputVx(int addr, int vx, int val);
74 void SetVoicePan_and_FB(int voice, char pan); /* FeedBack field and C = ! FM */
75 void set_all_the_params_in_a_slot(int slot);
76 void set_the_ksl_in_a_slot(int slot);
77 void send_modulation_params(void);
78 void SetFreq(unsigned voice, int pitch);
79 void SoundChut(int voice);
80 void SetOplMode(int mode);
81 void SoundColdInit();
82 void SetVoiceVolume(int voice, unsigned volume);
83 void _NoteOn(unsigned voice, int pitch);
84 void _NoteOff(unsigned voice);
85
86 // fmassign.cpp
87 void do_sus_off(int op);
88 void for_all_ops_on_chan(BYTE mchan, int functionID );
89 void init_q(void);
90 void init_q_sub(NPALLOC_Q q, int size, int limit);
91 int remove_target(int p, int chan, int * op);
92 int remove_target2(int p, int chan, int * op);
93 int remove_target_sub(int p, int chan, int * op, NPALLOC_Q q);
94 void add_q(int p, int chan, int * op);
95 void add_q2(int p, int chan, int * op);
96 void add_q_sub(int p, int chan, int * op, NPALLOC_Q q, int limit);
97 void shut_off_chan_voice(int op);
98 void shut_off_oldest(NPALLOC_Q q);
99 void shut_off_all(void);
100 void shut_off_all_sub( NPALLOC_Q q);
101 void remove_next_q(int * op, NPALLOC_Q q);
102
103 // fmdo.cpp
104 void update_pgm(int pgm);
105 void update_drum_pgm(int pgm);
106 void set_normalized_voice_volume(int voice, int vel, int chan);
107 void handle_data_entry( BYTE mchan );
108 void do_handle_pitch_bend(int op);
109 int pitch_to_drum(int pitch);
110 void init_chan_etc(void);
111
112 // fmout.cpp
113 static void OplWrite(USHORT usPort, UCHAR uchOffset, UCHAR uchData);
114
115 inline void SndOutput1(USHORT addr, USHORT data)
116 {
117 OplWrite(_port, (UCHAR)addr, (UCHAR)data);
118 };
119
120 inline void SndOpl3_2_1(USHORT addr, USHORT data)
121 {
122 OplWrite(_port+2, (UCHAR)addr, (UCHAR)data);
123 };
124
125 // fmmain.cpp
126 BOOL FMInit();
127 void do_reset(int first);
128 void reset_all(void);
129};
130
131#endif // FMSYNTH_INCLUDED
Note: See TracBrowser for help on using the repository browser.