furnace/src/engine/platform/sound/vera_psg.h

30 lines
629 B
C
Raw Normal View History

2022-03-10 20:51:27 +00:00
// Commander X16 Emulator
// Copyright (c) 2020 Frank van den Hoef
// All rights reserved. License: 2-clause BSD
#pragma once
#include <stdint.h>
#include <stdbool.h>
struct VERAChannel {
uint16_t freq;
uint8_t volume;
bool left, right;
uint8_t pw;
uint8_t waveform;
unsigned phase;
int lastOut;
2022-03-10 20:51:27 +00:00
uint8_t noiseval;
};
struct VERA_PSG {
2022-03-10 21:52:59 +00:00
unsigned int noiseState, noiseOut;
2022-03-10 20:51:27 +00:00
struct VERAChannel channels[16];
};
void psg_reset(struct VERA_PSG* psg);
void psg_writereg(struct VERA_PSG* psg, uint8_t reg, uint8_t val);
2022-03-10 21:52:59 +00:00
void psg_render(struct VERA_PSG* psg, int16_t *bufL, int16_t *bufR, unsigned num_samples);