8#ifndef __LIBDRAGON_MIXER_H
9#define __LIBDRAGON_MIXER_H
59#define MIXER_MAX_CHANNELS 32
74#define MIXER_LOOP_OVERREAD 64
169 float c,
float sl,
float sr);
440typedef struct waveform_s {
492#define WAVEFORM_MAX_LEN 0x1FFFFFFF
502#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:472
void mixer_ch_play(int ch, waveform_t *wave)
Start playing the specified waveform on the specified channel.
Definition mixer.c:377
void * ctx
Opaque pointer provided as context to the read function.
Definition mixer.h:488
uint8_t bits
Width of a sample of this waveform, in bits.
Definition mixer.h:449
void mixer_add_event(int64_t delay, MixerEvent cb, void *ctx)
Register a time-based event into the mixer.
Definition mixer.c:718
void mixer_poll(int16_t *out, int nsamples)
Run the mixer to produce output samples.
Definition mixer.c:737
int loop_len
Length of the loop of the waveform (from the end).
Definition mixer.h:477
int(* MixerEvent)(void *ctx)
Callback invoked by mixer_poll at a specified time.
Definition mixer.h:330
void mixer_ch_set_vol(int ch, float lvol, float rvol)
Set channel volume (as left/right).
Definition mixer.c:257
WaveformRead read
Read function of the waveform.
Definition mixer.h:485
void mixer_ch_set_vol_pan(int ch, float vol, float pan)
Set channel volume (as volume and panning).
Definition mixer.c:264
void mixer_init(int num_channels)
Initialize the mixer.
Definition mixer.c:182
uint8_t channels
Number of interleaved audio channels in this waveforms.
Definition mixer.h:457
void mixer_ch_set_pos(int ch, float pos)
Change the current playback position within a waveform.
Definition mixer.c:436
int len
Length of the waveform, in number of samples.
Definition mixer.h:467
void mixer_close(void)
Deinitialize the mixer.
Definition mixer.c:232
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:268
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:478
void mixer_remove_event(MixerEvent cb, void *ctx)
Deregister a time-based event from the mixer.
Definition mixer.c:726
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:419
float frequency
Desired playback frequency (in samples per second, aka Hz).
Definition mixer.h:460
const char * name
Name of the waveform (for debugging purposes)
Definition mixer.h:442
void mixer_ch_stop(int ch)
Stop playing samples on the specified channel.
Definition mixer.c:449
void mixer_set_vol(float vol)
Set master volume.
Definition mixer.c:228
void mixer_ch_set_freq(int ch, float frequency)
Change the frequency for the specified channel.
Definition mixer.c:247
float mixer_ch_get_pos(int ch)
Definition mixer.c:442
Definition samplebuffer.h:83