timidity/playmidi.h
author Ozkan Sezer <sezeroz@gmail.com>
Sat, 13 Oct 2018 23:02:04 +0300
branchSDL-1.2
changeset 908 6b860486ce24
parent 518 8bc9b5fd2aae
child 782 e7d3a8f73e88
permissions -rw-r--r--
Mix_InitMP3: unload dll if mpg123_init() fails.
slouken@0
     1
/*
slouken@0
     2
    TiMidity -- Experimental MIDI to WAVE converter
slouken@0
     3
    Copyright (C) 1995 Tuukka Toivonen <toivonen@clinet.fi>
slouken@0
     4
slouken@0
     5
    This program is free software; you can redistribute it and/or modify
slouken@518
     6
    it under the terms of the Perl Artistic License, available in COPYING.
slouken@518
     7
 */
slouken@0
     8
slouken@0
     9
typedef struct {
slouken@0
    10
  int32 time;
slouken@0
    11
  uint8 channel, type, a, b;
slouken@0
    12
} MidiEvent;
slouken@0
    13
slouken@0
    14
/* Midi events */
slouken@0
    15
#define ME_NONE 	0
slouken@0
    16
#define ME_NOTEON	1
slouken@0
    17
#define ME_NOTEOFF	2
slouken@0
    18
#define ME_KEYPRESSURE	3
slouken@0
    19
#define ME_MAINVOLUME	4
slouken@0
    20
#define ME_PAN		5
slouken@0
    21
#define ME_SUSTAIN	6
slouken@0
    22
#define ME_EXPRESSION	7
slouken@0
    23
#define ME_PITCHWHEEL	8
slouken@0
    24
#define ME_PROGRAM	9
slouken@0
    25
#define ME_TEMPO	10
slouken@0
    26
#define ME_PITCH_SENS	11
slouken@0
    27
slouken@0
    28
#define ME_ALL_SOUNDS_OFF	12
slouken@0
    29
#define ME_RESET_CONTROLLERS	13
slouken@0
    30
#define ME_ALL_NOTES_OFF	14
slouken@0
    31
#define ME_TONE_BANK	15
slouken@0
    32
slouken@0
    33
#define ME_LYRIC	16
slouken@245
    34
#define ME_TONE_KIT	17
slouken@245
    35
#define ME_MASTERVOLUME	18
slouken@245
    36
#define ME_CHANNEL_PRESSURE 19
slouken@245
    37
slouken@245
    38
#define ME_HARMONICCONTENT	71
slouken@245
    39
#define ME_RELEASETIME		72
slouken@245
    40
#define ME_ATTACKTIME		73
slouken@245
    41
#define ME_BRIGHTNESS		74
slouken@245
    42
slouken@245
    43
#define ME_REVERBERATION	91
slouken@245
    44
#define ME_CHORUSDEPTH		93
slouken@0
    45
slouken@0
    46
#define ME_EOT		99
slouken@0
    47
slouken@245
    48
slouken@245
    49
#define SFX_BANKTYPE	64
slouken@245
    50
slouken@0
    51
typedef struct {
slouken@0
    52
  int
slouken@0
    53
    bank, program, volume, sustain, panning, pitchbend, expression, 
slouken@0
    54
    mono, /* one note only on this channel -- not implemented yet */
slouken@245
    55
    /* new stuff */
slouken@245
    56
    variationbank, reverberation, chorusdepth, harmoniccontent,
slouken@245
    57
    releasetime, attacktime, brightness, kit, sfx,
slouken@245
    58
    /* end new */
slouken@0
    59
    pitchsens;
slouken@245
    60
  FLOAT_T
slouken@0
    61
    pitchfactor; /* precomputed pitch bend factor to save some fdiv's */
slouken@245
    62
  char transpose;
slouken@245
    63
  char *name;
slouken@0
    64
} Channel;
slouken@0
    65
slouken@0
    66
/* Causes the instrument's default panning to be used. */
slouken@0
    67
#define NO_PANNING -1
slouken@245
    68
/* envelope points */
slouken@245
    69
#define MAXPOINT 7
slouken@0
    70
slouken@0
    71
typedef struct {
slouken@0
    72
  uint8
slouken@245
    73
    status, channel, note, velocity, clone_type;
slouken@0
    74
  Sample *sample;
slouken@245
    75
  Sample *left_sample;
slouken@245
    76
  Sample *right_sample;
slouken@245
    77
  int32 clone_voice;
slouken@0
    78
  int32
slouken@0
    79
    orig_frequency, frequency,
slouken@245
    80
    sample_offset, loop_start, loop_end;
slouken@245
    81
  int32
slouken@245
    82
    envelope_volume, modulation_volume;
slouken@245
    83
  int32
slouken@245
    84
    envelope_target, modulation_target;
slouken@245
    85
  int32
slouken@245
    86
    tremolo_sweep, tremolo_sweep_position, tremolo_phase,
slouken@245
    87
    lfo_sweep, lfo_sweep_position, lfo_phase,
slouken@245
    88
    vibrato_sweep, vibrato_sweep_position, vibrato_depth, vibrato_delay,
slouken@245
    89
    starttime, echo_delay_count;
slouken@245
    90
  int32
slouken@245
    91
    echo_delay,
slouken@245
    92
    sample_increment,
slouken@245
    93
    envelope_increment,
slouken@245
    94
    modulation_increment,
slouken@245
    95
    tremolo_phase_increment,
slouken@245
    96
    lfo_phase_increment;
slouken@0
    97
  
slouken@245
    98
  final_volume_t left_mix, right_mix, lr_mix, rr_mix, ce_mix, lfe_mix;
slouken@0
    99
slouken@245
   100
  FLOAT_T
slouken@245
   101
    left_amp, right_amp, lr_amp, rr_amp, ce_amp, lfe_amp,
slouken@245
   102
    volume, tremolo_volume, lfo_volume;
slouken@0
   103
  int32
slouken@0
   104
    vibrato_sample_increment[VIBRATO_SAMPLE_INCREMENTS];
slouken@245
   105
  int32
slouken@245
   106
    envelope_rate[MAXPOINT], envelope_offset[MAXPOINT];
slouken@245
   107
  int32
slouken@0
   108
    vibrato_phase, vibrato_control_ratio, vibrato_control_counter,
slouken@245
   109
    envelope_stage, modulation_stage, control_counter,
slouken@245
   110
    modulation_delay, modulation_counter, panning, panned;
slouken@0
   111
} Voice;
slouken@0
   112
slouken@0
   113
/* Voice status options: */
slouken@0
   114
#define VOICE_FREE 0
slouken@0
   115
#define VOICE_ON 1
slouken@0
   116
#define VOICE_SUSTAINED 2
slouken@0
   117
#define VOICE_OFF 3
slouken@0
   118
#define VOICE_DIE 4
slouken@0
   119
slouken@0
   120
/* Voice panned options: */
slouken@0
   121
#define PANNED_MYSTERY 0
slouken@0
   122
#define PANNED_LEFT 1
slouken@0
   123
#define PANNED_RIGHT 2
slouken@0
   124
#define PANNED_CENTER 3
slouken@0
   125
/* Anything but PANNED_MYSTERY only uses the left volume */
slouken@0
   126
slouken@245
   127
/* Envelope stages: */
slouken@245
   128
#define ATTACK 0
slouken@245
   129
#define HOLD 1
slouken@245
   130
#define DECAY 2
slouken@245
   131
#define RELEASE 3
slouken@245
   132
#define RELEASEB 4
slouken@245
   133
#define RELEASEC 5
slouken@245
   134
#define DELAY 6
slouken@245
   135
slouken@0
   136
extern Channel channel[16];
slouken@0
   137
extern Voice voice[MAX_VOICES];
slouken@245
   138
extern signed char drumvolume[MAXCHAN][MAXNOTE];
slouken@245
   139
extern signed char drumpanpot[MAXCHAN][MAXNOTE];
slouken@245
   140
extern signed char drumreverberation[MAXCHAN][MAXNOTE];
slouken@245
   141
extern signed char drumchorusdepth[MAXCHAN][MAXNOTE];
slouken@0
   142
slouken@0
   143
extern int32 control_ratio, amp_with_poly, amplification;
slouken@0
   144
extern int32 drumchannels;
slouken@0
   145
extern int adjust_panning_immediately;
slouken@0
   146
extern int voices;
slouken@0
   147
slouken@0
   148
#define ISDRUMCHANNEL(c) ((drumchannels & (1<<(c))))
slouken@0
   149
slouken@245
   150
extern int GM_System_On;
slouken@245
   151
extern int XG_System_On;
slouken@245
   152
extern int GS_System_On;
slouken@245
   153
slouken@245
   154
extern int XG_System_reverb_type;
slouken@245
   155
extern int XG_System_chorus_type;
slouken@245
   156
extern int XG_System_variation_type;
slouken@245
   157
slouken@0
   158
extern int play_midi(MidiEvent *el, int32 events, int32 samples);
slouken@433
   159
extern int play_midi_file(const char *fn);
slouken@0
   160
extern void dumb_pass_playing_list(int number_of_files, char *list_of_files[]);