libdragon
Loading...
Searching...
No Matches
Macros | Functions
ay8910.c File Reference

AY8910 PSG implementation. More...

Macros

#define AY8910_TRACE   0
 Enable AY8910 tracing.
 
#define tracef(fmt, ...)   ({ })
 Trace function for AY8910 debugging.
 
#define V(f)   ((f) * AY8910_VOLUME_ATTENUATE)
 Volume conversion function.
 
#define SAMPLE_CONV(f)   ((f) * 65535.0f - 32768.0f)
 Sample conversion function.
 
#define OUTS(s)
 Output sample in stereo mode.
 
#define OUT(s_)
 Output mono sample.
 

Functions

int ay8910_gen (AY8910 *ay, int16_t *out, int nsamples)
 Generate audio for the specified number of samples.
 
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.
 
bool ay8910_is_mute (AY8910 *ay)
 Return true if ay8910 is currently muted (all channels disabled)
 
void ay8910_write_addr (AY8910 *ay, uint8_t addr)
 Write to the AY8910 address line.
 
uint8_t ay8910_read_data (AY8910 *ay)
 Read from the AY8910 data line.
 
void ay8910_write_data (AY8910 *ay, uint8_t val)
 Write to the AY8910 data line.
 

Detailed Description

AY8910 PSG implementation.

Author
Giovanni Bajo giova.nosp@m.nnib.nosp@m.ajo@g.nosp@m.mail.nosp@m..com

Macro Definition Documentation

◆ OUTS

#define OUTS (   s)
Value:
({ \
*out++ = (int16_t)SAMPLE_CONV(s); \
if (AY8910_OUTPUT_STEREO) *out++ = (int16_t)SAMPLE_CONV(s); \
})
#define SAMPLE_CONV(f)
Sample conversion function.
Definition ay8910.c:34

Output sample in stereo mode.

◆ OUT

#define OUT (   s_)
Value:
({ \
int16_t s = (int16_t)(s_); \
*out++ = (int16_t)(s); \
})

Output mono sample.

Function Documentation

◆ ay8910_gen()

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).