-
Notifications
You must be signed in to change notification settings - Fork 3
/
pyopl.pyi
45 lines (35 loc) · 1.45 KB
/
pyopl.pyi
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
"""
PyOPL: OPL2/3 emulation for Python
Copyright 2011-2012 Adam Nielsen <[email protected]>
http://www.github.com/Malvineous/pyopl
PyOPL is a simple wrapper around an OPL synthesiser so that it can be accessed
from within Python. It uses the DOSBox synth, which has been released under
the GPL license.
PyOPL does not include any audio output mechanism, it simply converts register
and value pairs into PCM data. The example programs use PyAudio for audio
output. Note that PyGame is not suitable for this as it lacks a method for
streaming audio generated on-the-fly, and faking it by creating new Sound
objects is unreliable as they do not always queue correctly.
"""
# noinspection PyPep8Naming
class opl:
"""
OPL emulator
"""
def __init__(self, freq: int, sampleSize: int, channels: int) -> None:
"""Creates an OPL emulator instance.
:param freq: The playback rate.
:param sampleSize: The sample size. Must be 2.
:param channels: Channel count. 1 for mono, 2 for stereo.
"""
def writeReg(self, reg: int, val: int) -> None:
"""Write a value to an OPL register.
:param reg: The register.
:param val: The value.
:return: None
"""
def getSamples(self, buffer: bytearray) -> None:
"""Fills the supplied buffer with audio samples.
:param buffer: The buffer. Note that this is a positional argument, not keyword.
:return: None
"""