Skip to content

FinitePlaybackDevice

The FinitePlaybackDevice struct refers to a single audio player.

typedef struct FinitePlaybackDevice FinitePlaybackDevice;
struct FinitePlaybackDevice {
char *name;
char *filename;
bool isPlaying;
bool isPaused;
short *audioBuffer;
FinitePlaybackDuration dur;
snd_pcm_t *device;
snd_pcm_format_t format;
snd_pcm_hw_params_t *params;
snd_pcm_uframes_t frames;
SNDFILE *file;
sf_count_t sfFrames;
uint32_t sample_rate;
uint32_t channels;
uint32_t buff_time;
uint32_t buff_per;
double freq;
int verbose;
int resample;
int per_event;
};
TypeDescription
char *nameThe name of the audio device in use. Defaults to “default”.
char *filenameThe name of the audio in use.
bool isPlayingWhether the audio stream is being read (the audio is playing sound)
bool isPausedWhether the audio is paused.
short *audioBufferThe audio period.
FinitePlaybackDuration durThe FinitePlaybackDuration
snd_pcm_t *deviceThe ALSA device.
snd_pcm_format_t formatThe ALSA format of the audio.
snd_pcm_hw_params_t *paramsThe ALSA audio hardware params.
snd_pcm_uframes_t framesThe size of the audio period.
SNDFILE *fileThe SND file descriptor for the audio.
sf_count_t sfFramesSND Audio Frames. Used to calcuate the actual audio duration.
uint32_t sample_rateThe Sample Rate of the audio
uint32_t channelsThe number of channels the audio supports. 1 = Mono and 2 = Stereo
uint32_t buff_timeUnused.
uint32_t buff_perUnused.
double freqUnused.
int verboseUnused.
int resampleThe resample rate of the audio.
int per_eventUnused.

This struct refers to a single audio. Do not reuse a FinitePlaybackDevice for multiple audios.

This struct should be created with finite_audio_device_init and destroyed with finite_audio_cleanup