![]() |
libdragon
|
Go to the source code of this file.
Data Structures | |
struct | AYChannel |
A AY-3-8910 channel. More... | |
struct | AYEnvelope |
Envelope of AY-3-8910. More... | |
struct | AYNoise |
Noise of AY-3-8910. More... | |
struct | AY8910 |
A AY-3-8910 emulator. More... | |
Macros | |
#define | AY8910_DECIMATE 3 |
Decimation factor for AY8910. | |
#define | AY8910_OUTPUT_STEREO 1 |
Generate stereo output. | |
#define | AY8910_VOLUME_ATTENUATE 0.8 |
Define the global attenuation applied to volumes (range 0.0 - 1.0). | |
#define | AY8910_CENTER_SILENCE 1 |
Generate silence as 0. | |
Functions | |
void | ay8910_reset (AY8910 *ay) |
Reset the AY8910 emulator. | |
void | ay8910_set_ports (AY8910 *ay, uint8_t(*PortRead)(int), void(*PortWrite)(int, uint8_t)) |
Configure the I/O port callbacks. | |
void | ay8910_write_addr (AY8910 *ay, uint8_t addr) |
Write to the AY8910 address line. | |
void | ay8910_write_data (AY8910 *ay, uint8_t val) |
Write to the AY8910 data line. | |
uint8_t | ay8910_read_data (AY8910 *ay) |
Read from the AY8910 data line. | |
bool | ay8910_is_mute (AY8910 *ay) |
Return true if ay8910 is currently muted (all channels disabled) | |
int | ay8910_gen (AY8910 *ay, int16_t *out, int nsamples) |
Generate audio for the specified number of samples. | |
struct AYChannel |
A AY-3-8910 channel.
struct AYEnvelope |
Envelope of AY-3-8910.
struct AYNoise |
#define AY8910_DECIMATE 3 |
Decimation factor for AY8910.
AY8910 is usually clocked at a very high frequency (>100K), and thus it requires downsampling to be played back. This emulator offers a very basic downsampling filter via decimation (taking average of Nth consecutive samples) that is usually a good compromise between quality and speed, for realtime playback. It will not sound as good as a real downsampling filter though.
It is suggested to configure this number to the smallest value that brings the AY8910 output frequency within the playback sample rate.
#define AY8910_OUTPUT_STEREO 1 |
Generate stereo output.
If 1, AY8910 will generate a stereo output with fixed pans for each of the three internal channels, similar to what Arkos Tracker 2 does in stereo mode.
#define AY8910_VOLUME_ATTENUATE 0.8 |
Define the global attenuation applied to volumes (range 0.0 - 1.0).
The AY8910 often clips so it's important to lower a bit the volume to avoid sound artifacts.
#define AY8910_CENTER_SILENCE 1 |
Generate silence as 0.
Normally, AY8910 generates output samples in which the silence is represented by -32768 (minimum volume). This is a little inconvenient if the caller wants to skip generation when the AY8910 is muted for performance reasons, because audio mixers normally assume that muted channels are made by samples with value 0, otherwise disabling the AY8910 would affect the volume of all other channels.
By setting this macro to 1, the dynamic range will be halved in the range 0-32767, so the silence will be as expected, but the audio will be somehow "duller".
int ay8910_gen | ( | AY8910 * | ay, |
int16_t * | out, | ||
int | nsamples | ||
) |
Generate audio for the specified number of samples.
"nsamples" is the number of samples after decimation (so the exact number of samples written in the output buffer).