| 1 |
// Commander X16 Emulator |
| 2 |
// Copyright (c) 2020 Frank van den Hoef |
| 3 |
// All rights reserved. License: 2-clause BSD |
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <stdint.h> |
| 8 |
#include <stdbool.h> |
| 9 |
|
| 10 |
struct VERAChannel { |
| 11 |
uint16_t freq; |
| 12 |
uint16_t volume; |
| 13 |
bool left, right; |
| 14 |
uint8_t pw; |
| 15 |
uint8_t waveform; |
| 16 |
|
| 17 |
unsigned phase; |
| 18 |
int lastOut; |
| 19 |
uint8_t noiseval; |
| 20 |
}; |
| 21 |
|
| 22 |
struct VERA_PSG { |
| 23 |
unsigned int chipType, noiseState, noiseOut; |
| 24 |
struct VERAChannel channels[16]; |
| 25 |
}; |
| 26 |
|
| 27 |
void psg_reset(struct VERA_PSG* psg); |
| 28 |
void psg_writereg(struct VERA_PSG* psg, uint8_t reg, uint8_t val); |
| 29 |
void psg_render(struct VERA_PSG* psg, int16_t *bufL, int16_t *bufR, unsigned num_samples); |