Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
/*
2
 * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
3
 * It is copyright by its individual contributors, as recorded in the
4
 * project's Git history.  See COPYING.txt at the top level for license
5
 * terms and a link to the Git history.
6
 */
7
/*
8
 * This is a dynamic interface to libADLMIDI, the OPL3 synthesizer library.
9
 */
10
 
11
#include <memory>
12
#include <stdint.h>
13
#include "dxxsconf.h"
14
 
15
#if DXX_USE_ADLMIDI
16
struct ADL_MIDIPlayer;
17
 
18
enum ADLMIDI_SampleType
19
{
20
        ADLMIDI_SampleType_S16 = 0
21
};
22
 
23
struct ADLMIDI_AudioFormat
24
{
25
        enum ADLMIDI_SampleType type;
26
        unsigned containerSize;
27
        unsigned sampleOffset;
28
};
29
 
30
enum ADL_Emulator
31
{
32
    ADLMIDI_EMU_DOSBOX = 2,
33
};
34
 
35
/*
36
 * A few embedded bank numbers.
37
 */
38
enum class ADL_EmbeddedBank
39
{
40
        MILES_AIL = 0,
41
        BISQWIT = 1,
42
        DESCENT = 2,
43
        // DESCENT_INT = 3,
44
        // DESCENT_HAM = 4,
45
        // DESCENT_RICK = 5,
46
        // DESCENT2 = 6,
47
        LBA_4OP = 31,
48
        THE_FATMAN_2OP = 58,
49
        THE_FATMAN_4OP = 59,
50
        JAMIE_OCONNELL = 66,
51
        NGUYEN_WOHLSTAND_4OP = 68,
52
        DMXOPL3 = 72,
53
        APOGEE_IMF90 = 74,
54
};
55
 
56
extern ADL_MIDIPlayer *(*adl_init)(long sample_rate);
57
extern void (*adl_close)(ADL_MIDIPlayer *device);
58
extern int (*adl_switchEmulator)(ADL_MIDIPlayer *device, int emulator);
59
extern int (*adl_setNumChips)(ADL_MIDIPlayer *device, int numChips);
60
extern int (*adl_setBank)(ADL_MIDIPlayer *device, int bank);
61
extern void (*adl_setSoftPanEnabled)(ADL_MIDIPlayer *device, int softPanEn);
62
extern void (*adl_setLoopEnabled)(ADL_MIDIPlayer *device, int loopEn);
63
extern int (*adl_openData)(ADL_MIDIPlayer *device, const void *mem, unsigned long size);
64
extern int (*adl_openFile)(ADL_MIDIPlayer *device, const char *filePath);
65
extern int (*adl_playFormat)(ADL_MIDIPlayer *device, int sampleCount, uint8_t *left, uint8_t *right, const ADLMIDI_AudioFormat *format);
66
 
67
struct ADLMIDI_delete
68
{
69
        void operator()(ADL_MIDIPlayer *x)
70
        {
71
                adl_close(x);
72
        }
73
};
74
 
75
typedef std::unique_ptr<ADL_MIDIPlayer, ADLMIDI_delete> ADL_MIDIPlayer_t;
76
#endif