7#ifndef __LIBDRAGON_MIXER_H
8#define __LIBDRAGON_MIXER_H
58#define MIXER_MAX_CHANNELS 32
73#define MIXER_LOOP_OVERREAD 64
168 float c,
float sl,
float sr);
439typedef struct waveform_s {
491#define WAVEFORM_MAX_LEN 0x1FFFFFFF
501#define WAVEFORM_UNKNOWN_LEN WAVEFORM_MAX_LEN
bool mixer_ch_playing(int ch)
Return true if the channel is currently playing samples.
Definition mixer.c:448
void mixer_ch_play(int ch, waveform_t *wave)
Start playing the specified waveform on the specified channel.
Definition mixer.c:373
void * ctx
Opaque pointer provided as context to the read function.
Definition mixer.h:487
uint8_t bits
Width of a sample of this waveform, in bits.
Definition mixer.h:448
void mixer_add_event(int64_t delay, MixerEvent cb, void *ctx)
Register a time-based event into the mixer.
Definition mixer.c:700
void mixer_poll(int16_t *out, int nsamples)
Run the mixer to produce output samples.
Definition mixer.c:719
int loop_len
Length of the loop of the waveform (from the end).
Definition mixer.h:476
int(* MixerEvent)(void *ctx)
Callback invoked by mixer_poll at a specified time.
Definition mixer.h:329
void mixer_ch_set_vol(int ch, float lvol, float rvol)
Set channel volume (as left/right).
Definition mixer.c:265
WaveformRead read
Read function of the waveform.
Definition mixer.h:484
void mixer_ch_set_vol_pan(int ch, float vol, float pan)
Set channel volume (as volume and panning).
Definition mixer.c:272
void mixer_init(int num_channels)
Initialize the mixer.
Definition mixer.c:179
uint8_t channels
Number of interleaved audio channels in this waveforms.
Definition mixer.h:456
void mixer_ch_set_pos(int ch, float pos)
Change the current playback position within a waveform.
Definition mixer.c:422
int len
Length of the waveform, in number of samples.
Definition mixer.h:466
void mixer_close(void)
Deinitialize the mixer.
Definition mixer.c:244
void mixer_ch_set_vol_dolby(int ch, float fl, float fr, float c, float sl, float sr)
Set channel volume with Dolby Pro Logic II encoding.
Definition mixer.c:276
void mixer_ch_set_limits(int ch, int max_bits, float max_frequency, int max_buf_sz)
Configure the limits of a channel with respect to sample bit size, and frequency.
Definition mixer.c:454
void mixer_remove_event(MixerEvent cb, void *ctx)
Deregister a time-based event from the mixer.
Definition mixer.c:708
void(* WaveformRead)(void *ctx, samplebuffer_t *sbuf, int wpos, int wlen, bool seeking)
Waveform callback function invoked by the mixer to read/generate samples.
Definition mixer.h:418
float frequency
Desired playback frequency (in samples per second, aka Hz).
Definition mixer.h:459
const char * name
Name of the waveform (for debugging purposes)
Definition mixer.h:441
void mixer_ch_stop(int ch)
Stop playing samples on the specified channel.
Definition mixer.c:435
void mixer_set_vol(float vol)
Set master volume.
Definition mixer.c:240
void mixer_ch_set_freq(int ch, float frequency)
Change the frequency for the specified channel.
Definition mixer.c:258
float mixer_ch_get_pos(int ch)
Definition mixer.c:428
Definition samplebuffer.h:82