summaryrefslogtreecommitdiff
path: root/apps/plugins/rockboy/sound.h
blob: e40fbad2d5e40f0f06a8c2448f681c2441d0da08 (plain)
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
#ifndef __SOUND_H__
#define __SOUND_H__

#include "defs.h"

struct sndchan
{
    /* S1, S2, S3, S4 */
    int on, len, skip, cont;
    unsigned int pos;

    /* S1, S2, S4 */
    int enlen, envol, endir, enlenreload;
    
    /* S1, S2 */
    const byte *wave;
    
    /* S1 only */
    int swlen, swlenreload, swsteps, swstep, swdir;

    /* S3 only */
    int outputlevel;

    /* S4 only */
    int shiftskip, shiftpos, shiftright, shiftleft;
    int nsteps, clock;

};

struct snd
{
    int level1, level2, balance;
    bool gbDigitalSound;
    int rate;
    int quality;
    struct sndchan ch[4];
};

extern struct snd snd;

#if defined(ICODE_ATTR) && defined(CPU_ARM)
#undef ICODE_ATTR
#define ICODE_ATTR
#endif

byte sound_read(byte r) ICODE_ATTR;
void sound_write(byte r, byte b) ICODE_ATTR;
void sound_dirty(void);
void sound_reset(void);
void sound_mix(void) ICODE_ATTR;

#endif