mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-12 13:21:51 +00:00
87d46ddd11
## 1.5.0 2020-09-28 * Drum note length expanding is now supported in real-time mode (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) * Added support for OPNA chip with Neko Project II Kai YM2602 emulator usage (Thanks to [Jean Pierre Cimalando](https://github.com/jpcima) for a work!) * Added VGM file dumper which allows to output OPN2 commands into VGM file. (A new MIDI to VGM tool is now created with basing on libOPNMIDI) * Fixed an incorrect work of CC-121 (See https://github.com/Wohlstand/libADLMIDI/issues/227 for details) * Internality has been refactored and improved
52 lines
1.2 KiB
C
52 lines
1.2 KiB
C
#ifndef __PSG_H__
|
|
#define __PSG_H__
|
|
|
|
#include <stdint.h>
|
|
#define PSG_SAMPLETYPE int32_t /* any of int16_t, int32_t or float will work here. */
|
|
|
|
/* Constants for the shift amounts used in the counters.
|
|
*/
|
|
enum {
|
|
toneshift = 24,
|
|
envshift = 22
|
|
};
|
|
|
|
typedef struct _PSG {
|
|
uint8_t reg[16];
|
|
|
|
const uint32_t *envelop;
|
|
uint32_t rng;
|
|
uint32_t olevel[3];
|
|
uint32_t scount[3], speriod[3];
|
|
uint32_t ecount, eperiod;
|
|
uint32_t ncount, nperiod;
|
|
uint32_t tperiodbase;
|
|
uint32_t eperiodbase;
|
|
int volume;
|
|
int mask;
|
|
} PSG;
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* Mostly self-explanatory.
|
|
// Actual descriptions of each function can be found in psg.c
|
|
// Also, PSGGetReg() is basically useless.
|
|
// (More info on that can *also* be found in psg.c). */
|
|
void PSGInit(PSG *psg);
|
|
void PSGReset(PSG *psg);
|
|
void PSGSetClock(PSG *psg, uint32_t clock, uint32_t rate);
|
|
void PSGSetChannelMask(PSG *psg, int c);
|
|
void PSGSetReg(PSG *psg, uint8_t regnum, uint8_t data);
|
|
void PSGMix(PSG *psg, int32_t *dest, uint32_t nsamples);
|
|
|
|
static inline uint32_t PSGGetReg(PSG *psg, uint8_t regnum) {
|
|
return psg->reg[regnum & 0x0f];
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PSG_H */
|