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

22 lines
738 B
C

// Commander X16 Emulator
// Copyright (c) 2020 Frank van den Hoef
// All rights reserved. License: 2-clause BSD
#pragma once
#include <SDL.h>
#include "glue.h"
#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)