source: cmedia/trunk/Drv16/fmmain.cpp@ 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: 3.1 KB
Line 
1/* SCCSID = %W% %E% */
2/****************************************************************************
3 * *
4 * Copyright (c) IBM Corporation 1994 - 1997. *
5 * Copyright (c) Voyetra Technologies 1990-1993. All rights reserved *
6 * *
7 * The following IBM OS/2 source code is provided to you solely for the *
8 * the purpose of assisting you in your development of OS/2 device drivers. *
9 * You may use this code in accordance with the IBM License Agreement *
10 * provided in the IBM Device Driver Source Kit for OS/2. *
11 * *
12 ****************************************************************************/
13/**@internal %W%
14 * Initialization routines for the FMSYNTH object.
15 * @version %I%
16 * @context
17 * Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
18 * @notes
19 * @history
20 */
21
22extern "C" {
23#include <os2.h>
24#include <os2medef.h>
25#include <ssm.h>
26#include <audio.h>
27#include <meerror.h>
28#include "fmadlib.h"
29#include "fmglobal.h"
30}
31#include "fmsynth.hpp"
32
33/* Macros
34*/
35
36#define min(a,b) (((a) < (b)) ? (a) : (b))
37#define max(a,b) (((a) > (b)) ? (a) : (b))
38
39/* ------------------------------ FMInit -
40** SapiMain
41** Synth Driver initialization function
42*/
43BOOL FMSYNTH::FMInit()
44{
45 int bend;
46// BOOL fRet=TRUE;
47
48 // percussion_channel = GetDrumCh() -1;
49 percussion_channel = 10-1;
50 bend = 2;
51
52 sapi_pitch_range = (int) min (max (bend,1),12);
53/*
54 if (fRet)
55 {
56 #ifdef FM_MONITOR
57 StringOut("FMMAIN:Reset OPL-3");
58 #endif
59
60 #ifdef FM_MONITOR
61 StringOut("FMMAIN:Reset OPL-3 OK");
62 #endif
63 }
64*/
65 reset_all();
66
67 return TRUE;
68}
69
70static void clear_pgms(void)
71{
72 int i;
73
74 for (i=0; i < MAX_NUMBER_OF_OPERATORS; i++)
75 last_pgm[i] = (char) 0xff;
76}
77
78
79/* ---------------------------- do_reset -
80** Main reset module. Initialize the module.
81** Flag true means cold init.
82*/
83void FMSYNTH::do_reset(int first)
84{
85 shut_off_all(); // shut off any notes which are playing
86 init_q(); // reset note queue vars
87 clear_pgms();
88 if (first)
89 {
90 init_chan_etc(); // initialize channel stat structure
91 SoundColdInit();
92 set_pitch_range(sapi_pitch_range);
93 }
94}
95
96
97/* -------------------------- reset_all -
98** Initialize entire module : cold
99*/
100void FMSYNTH::reset_all(void)
101{
102 max_melo_voice = MAX_PERC_MODE_VX;
103 fm_mode = MODE_PERC;
104 num_slots = NUM_SLOTS_CHIP;
105 number_of_operators = NUMBER_OF_OPERATORS_CHIP; // make sure these are ok
106 // 9/9/91
107 do_reset(1);
108 SetOplMode(fm_mode == MODE_PERC); // 9/23/91 bgf
109}
Note: See TracBrowser for help on using the repository browser.