// Commander X16 Emulator // Copyright (c) 2020 Frank van den Hoef // All rights reserved. License: 2-clause BSD #pragma once #include #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) #define AUDIO_SAMPLERATE (25000000 / 512) void audio_callback(void *userdata, Uint8 *stream, int len); void audio_init(int num_audio_buffers); void audio_close(void); void audio_step(int cpu_clocks); void audio_render(); void audio_usage(void); #ifndef IN_AUDIO_C extern uint32_t buffer_size; #endif