My Project
Loading...
Searching...
No Matches
opl.h
1/*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 * OPL2/OPL3 emulation library
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef OPL_H
21#define OPL_H
22/*
23 * Originally based on ADLIBEMU.C, an AdLib/OPL2 emulation library by Ken Silverman
24 * Copyright (C) 1998-2001 Ken Silverman
25 * Ken Silverman's official web site: "http://www.advsys.net/ken"
26 */
27
28#include <stdint.h>
29
30typedef uintptr_t Bitu;
31typedef intptr_t Bits;
32typedef uint32_t Bit32u;
33typedef int32_t Bit32s;
34typedef uint16_t Bit16u;
35typedef int16_t Bit16s;
36typedef uint8_t Bit8u;
37typedef int8_t Bit8s;
38
39// general functions
40void adlib_init(Bit32u samplerate);
41void adlib_write(Bitu idx, Bit8u val);
42void adlib_getsample(Bit16s* sndptr, Bits numsamples);
43
44Bitu adlib_reg_read(Bitu port);
45void adlib_write_index(Bitu port, Bit8u val);
46
47#define opl_init() adlib_init(audioSampleRate)
48#define opl_write(reg, val) adlib_write(reg, val)
49#define opl_update(buf, num) adlib_getsample(buf, num)
50
51#endif /* OPL_H */