ocarina/include/core/audio.h

85 lines
2.0 KiB
C

/*
* Copyright 2013 (c) Anna Schumaker.
*
* The gst_init() function parses command line options passed to Ocarina
* through argv. Use the command `gst-inspect-1.0 --help-gst` to find
* what options are supported.
*/
#ifndef OCARINA_CORE_AUDIO_H
#define OCARINA_CORE_AUDIO_H
#include <core/tags/track.h>
#include <gst/gst.h>
struct audio_callbacks {
/* Called when a track is loaded. */
void (*audio_cb_load)(struct track *);
/* Called when playback state changes. */
void (*audio_cb_state_change)(GstState);
/* Called when the automatic pause state changes. */
void (*audio_cb_config_pause)(int);
};
/* Called to initialize the audio manager. */
void audio_init(int *, char ***, struct audio_callbacks *);
/* Called to deinitialize the audio manager. */
void audio_deinit();
/* Called to force-save the current track. */
void audio_save();
/* Called to load either a track or file for playback. */
bool audio_load(struct track *);
bool audio_load_filepath(const gchar *);
/* Called to get the current track. */
struct track *audio_cur_track();
/* Called to get the current playback state. */
GstState audio_cur_state();
/* Called to set the playback volume. */
void audio_set_volume(unsigned int);
/* Called to get the playback volume. */
unsigned int audio_get_volume();
/* Called to begin playback. */
bool audio_play();
/* Called to pause playback. */
bool audio_pause();
/* Called to seek playback to a specific offset, in nanoseconds. */
bool audio_seek(gint64);
/* Called to find the current playback position, in nanoseconds. */
gint64 audio_position();
/* Called to find the duration of the current track. */
gint64 audio_duration();
/* Called to load the next track. */
struct track *audio_next();
/* Called to load the previous track. */
struct track *audio_prev();
/* Called to configure automatic pausing. */
void audio_pause_after(int);
#ifdef CONFIG_TESTING
void test_audio_eos();
void test_audio_error(GError *, gchar *);
GstElement *test_audio_pipeline();
#endif /* CONFIG_TESTING */
#endif /* OCARINA_CORE_AUDIO_H */