File: sequencer.h

package info (click to toggle)
lxmusserv 0.94-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 176 kB
  • ctags: 189
  • sloc: ansic: 1,530; makefile: 73
file content (106 lines) | stat: -rw-r--r-- 3,177 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*************************************************************************
 *  sequencer.h
 *
 *  new file - update to lxdoom (see NOTES)
 *  Copyright (C) 1999 Rafael Reilova (rreilova@ececs.uc.edu)
 *
 *  Original code
 *  Copyright (C) 1995 Michael Heasley (mheasley@hmc.edu)
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *************************************************************************/

#define FMVOL_ADJ     5      // can use 1-7 (7 = full scale, but may distort)

#define CHN_PERCUSSION         9
#define MUS_CHN_PERCUSSION    15
#define PERC_OFFSET    (128 - 35)

#define MUS_EVENT_NOTE_OFF     0
#define MUS_EVENT_NOTE_ON      1
#define MUS_EVENT_BENDER       2
#define MUS_EVENT_SYS          3
#define MUS_EVENT_CTL_CHANGE   4
/* event #5  ? */
#define MUS_EVENT_SCORE_END    6
/* event #7  ? */

#define MUS_SYS_ALL_SOUND_OFF 10
#define MUS_SYS_ALL_NOTES_OFF 11
#define MUS_SYS_MONO          12
#define MUS_SYS_POLY          13
#define MUS_SYS_RESET         14

#define MUS_CTL_PATCH_CHG      0
#define MUS_CTL_BNK_SEL        1
#define MUS_CTL_MOD_POT        2
#define MUS_CTL_MAIN_VOL       3
#define MUS_CTL_PAN_BAL        4
#define MUS_CTL_EXPR_POT       5
#define MUS_CTL_REVRB          6
#define MUS_CTL_CHORUS         7
#define MUS_CTL_SUSTAIN        8
#define MUS_CTL_SOFT_PEDAL     9

/* Std. tempo for all Doom/Heretic */
#define TICS_PER_SECOND 140

#define PAN_CENTER     64
#define MAIN_VOL_NRML 100
#define MAIN_VOL_MAX  127
#define PITCH_CENTER  0x2000

/*
 * state of FM-voices
 */
struct fm_voice
{
  int active;
  int note;
  int channel;
  int secondary;
  int patch;
  int time;
};

/*
 * MIDI sequencer routines
 */
extern void note_off(int note, int channel, int volume);
extern void note_on(int note, int channel, int volume);
extern void pitch_bend(int channel, int value);
extern void control_change(int controller, int channel, int value);
extern void patch_change(int patch, int channel);
extern void midi_wait(int wait_time);
extern void vol_change(int volume);
extern void system_event(int event_code, int channel);

/*
 * MIDI setup/control routines
 */
extern void fmload(const struct opl_instr *);
extern void cleanup_midi(void);
extern void midi_timer(mid_timer_t action);
extern void midi_sleep(void);
extern int midi_setup(synthdev_t pref_dev, int num_dev);

/*
 * shared MIDI init/sequencer stuff
 */
extern int mix_fd;
extern struct synth_info fm_sinfo;
extern synthdev_t synth_type;
extern int seqfd, seq_dev, has_opl3;
extern struct fm_voice *fmvoices;