Subversion Repositories eduke32

Rev

Rev 6158 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6158 hendricks2 1
#ifndef LIBXMP_MIXER_H
2
#define LIBXMP_MIXER_H
3
 
4
#define C4_PERIOD       428.0
5
 
6
#define SMIX_NUMVOC     128     /* default number of softmixer voices */
7
#define SMIX_SHIFT      16
8
#define SMIX_MASK       0xffff
9
 
10
#define FILTER_SHIFT    16
11
#define ANTICLICK_SHIFT 3
12
 
13
#ifdef LIBXMP_PAULA_SIMULATOR
14
#include "paula.h"
15
#endif
16
 
17
#define MIXER(f) void libxmp_mix_##f(struct mixer_voice *vi, int *buffer, \
18
        int count, int vl, int vr, int step, int ramp, int delta_l, int delta_r)
19
 
20
struct mixer_voice {
21
        int chn;                /* channel number */
22
        int root;               /* */
23
        int note;               /* */
24
#define PAN_SURROUND 0x8000
25
        int pan;                /* */
26
        int vol;                /* */
27
        double period;          /* current period */
28
        double pos;             /* position in sample */
29
        int pos0;               /* position in sample before mixing */
30
        int fidx;               /* mixer function index */
31
        int ins;                /* instrument number */
32
        int smp;                /* sample number */
33
        int end;                /* loop end */
34
        int act;                /* nna info & status of voice */
35
        int old_vl;             /* previous volume, left channel */
36
        int old_vr;             /* previous volume, right channel */
37
        int sleft;              /* last left sample output, in 32bit */
38
        int sright;             /* last right sample output, in 32bit */
39
#define VOICE_RELEASE   (1 << 0)
40
#define ANTICLICK       (1 << 1)        
41
#define SAMPLE_LOOP     (1 << 2)
42
        int flags;              /* flags */
8561 terminx 43
        int slen;               /* sample length */
6158 hendricks2 44
        void *sptr;             /* sample pointer */
45
#ifdef LIBXMP_PAULA_SIMULATOR
46
        struct paula_state *paula; /* paula simulation state */
47
#endif
48
 
49
#ifndef LIBXMP_CORE_DISABLE_IT
50
        struct {
51
                int r1;         /* filter variables */
52
                int r2;
53
                int l1;
54
                int l2;
55
                int a0;
56
                int b0;
57
                int b1;
58
                int cutoff;
59
                int resonance;
60
        } filter;
61
#endif
62
};
63
 
64
int     libxmp_mixer_on         (struct context_data *, int, int, int);
65
void    libxmp_mixer_off        (struct context_data *);
66
void    libxmp_mixer_setvol     (struct context_data *, int, int);
67
void    libxmp_mixer_seteffect  (struct context_data *, int, int, int);
68
void    libxmp_mixer_setpan     (struct context_data *, int, int);
69
int     libxmp_mixer_numvoices  (struct context_data *, int);
70
void    libxmp_mixer_softmixer  (struct context_data *);
71
void    libxmp_mixer_reset      (struct context_data *);
72
void    libxmp_mixer_setpatch   (struct context_data *, int, int, int);
73
void    libxmp_mixer_voicepos   (struct context_data *, int, double, int);
74
double  libxmp_mixer_getvoicepos(struct context_data *, int);
75
void    libxmp_mixer_setnote    (struct context_data *, int, int);
76
void    libxmp_mixer_setperiod  (struct context_data *, int, double);
77
void    libxmp_mixer_release    (struct context_data *, int, int);
78
 
79
#endif /* LIBXMP_MIXER_H */