aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alMidi.h
blob: 6cc13b208c5527a66c7941aea282d8587eceb370 (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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#ifndef ALMIDI_H
#define ALMIDI_H

#include "alMain.h"
#include "atomic.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct ALsfgenerator {
    ALenum Generator;
    ALint Value;
} ALsfgenerator;

typedef struct ALsfmodulator {
    ALenum SourceOp;
    ALenum DestOp;
    ALint Amount;
    ALenum AmountSourceOp;
    ALenum TransformOp;
} ALsfmodulator;

typedef struct ALsfzone {
    ALsfgenerator *Generators;
    ALsizei NumGenerators;
    ALsizei GeneratorsMax;

    ALsfmodulator *Modulators;
    ALsizei NumModulators;
    ALsizei ModulatorsMax;

    /* NOTE: Preset zones may have a reference to an ALsfinstrument. Instrument
     * zones may have a reference to an ALsfsample. */
    ALvoid *Object;
} ALsfzone;

void ALsfzone_Construct(ALsfzone *self);
void ALsfzone_Destruct(ALsfzone *self);
ALenum ALsfzone_addGenerator(ALsfzone *self, ALenum generator, ALint value);
ALenum ALsfzone_addModulator(ALsfzone *self, ALenum sourceop, ALenum destop, ALint amount, ALenum amtsourceop, ALenum transop);
/* Stores a new object pointer in the zone. Returns the old object pointer. */
ALvoid *ALsfzone_setRefObject(ALsfzone *self, ALvoid *object);


typedef struct ALsfsample {
    volatile RefCount ref;

    ALuint Start;
    ALuint End;
    ALuint LoopStart;
    ALuint LoopEnd;
    ALuint SampleRate;
    ALubyte PitchKey;
    ALbyte PitchCorrection;
    ALushort SampleLink;
    ALenum SampleType;

    ALuint id;
} ALsfsample;

void ALsfsample_Construct(ALsfsample *self);
void ALsfsample_Destruct(ALsfsample *self);


typedef struct ALsfinstrument {
    volatile RefCount ref;

    ALsfzone *Zones;
    ALsizei NumZones;

    ALuint id;
} ALsfinstrument;

void ALsfinstrument_Construct(ALsfinstrument *self);
void ALsfinstrument_Destruct(ALsfinstrument *self);


typedef struct ALsfpreset {
    volatile RefCount ref;

    ALint Program;
    ALint Bank;

    ALsfzone *Zones;
    ALsizei NumZones;

    ALuint id;
} ALsfpreset;

void ALsfpreset_Construct(ALsfpreset *self);
void ALsfpreset_Destruct(ALsfpreset *self);


typedef struct ALsoundfont {
    volatile RefCount ref;

    ALsfpreset **Presets;
    ALsizei NumPresets;

    ALshort *SampleData;
    ALint SampleDataLen;

    ALuint id;
} ALsoundfont;

void ALsoundfont_Construct(ALsoundfont *self);
void ALsoundfont_Destruct(ALsoundfont *self);

inline struct ALsoundfont *LookupSfont(ALCdevice *device, ALuint id)
{ return (struct ALsoundfont*)LookupUIntMapKey(&device->SfontMap, id); }
inline struct ALsoundfont *RemoveSfont(ALCdevice *device, ALuint id)
{ return (struct ALsoundfont*)RemoveUIntMapKey(&device->SfontMap, id); }

void ReleaseALSoundfonts(ALCdevice *device);

#ifdef __cplusplus
}
#endif

#endif /* ALMIDI_H */