2024-08-08 13:12:37 -07:00
|
|
|
// Commander X16 Emulator
|
|
|
|
// Copyright (c) 2020 Frank van den Hoef
|
|
|
|
// All rights reserved. License: 2-clause BSD
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <SDL.h>
|
2024-09-16 15:05:53 -07:00
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
|
#define SAMPLES_PER_BUFFER (1024)
|
|
|
|
#define SAMP_POS_FRAC_BITS (22)
|
|
|
|
#else
|
|
|
|
#define SAMPLES_PER_BUFFER (256)
|
|
|
|
#define SAMP_POS_FRAC_BITS (24)
|
|
|
|
#endif
|
|
|
|
#define VERA_SAMP_CLKS_PER_CPU_CLK ((25000000ULL << SAMP_POS_FRAC_BITS) / 512 / MHZ / 1000000)
|
|
|
|
#define YM_SAMP_CLKS_PER_CPU_CLK ((3579545ULL << SAMP_POS_FRAC_BITS) / 64 / MHZ / 1000000)
|
|
|
|
#define SAMPLE_BYTES (2 * sizeof(int16_t))
|
|
|
|
#define SAMP_POS_MASK (SAMPLES_PER_BUFFER - 1)
|
|
|
|
#define SAMP_POS_MASK_FRAC (((uint32_t)SAMPLES_PER_BUFFER << SAMP_POS_FRAC_BITS) - 1)
|
2024-08-08 13:12:37 -07:00
|
|
|
|
|
|
|
#define AUDIO_SAMPLERATE (25000000 / 512)
|
|
|
|
void audio_callback(void *userdata, Uint8 *stream, int len);
|
|
|
|
void audio_init(const char *dev_name, int num_audio_buffers);
|
|
|
|
void audio_close(void);
|
|
|
|
void audio_step(int cpu_clocks);
|
|
|
|
void audio_render();
|
|
|
|
|
|
|
|
void audio_usage(void);
|