looper/backends/playback/zsm/x16emu/audio.h

32 lines
979 B
C
Raw Normal View History

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);
2024-09-28 10:31:06 -07:00
void audio_init(int num_audio_buffers);
2024-08-08 13:12:37 -07:00
void audio_close(void);
void audio_step(int cpu_clocks);
void audio_render();
void audio_usage(void);
2024-09-28 10:31:06 -07:00
#ifndef IN_AUDIO_C
extern uint32_t buffer_size;
#endif