/** * Copyright 2013 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_AUDIO_H #define OCARINA_CORE_AUDIO_H extern "C" { #include } #include #include #include struct audio_ops { /* Called when a track is loaded. */ void (*on_load)(struct track *, GstState); /* Called when the automatic pause state changes. */ void (*on_config_pause)(int); }; /** * The audio driver class gives us an interface for using multiple * audio frameworks for audio playback. */ class AudioDriver { public: AudioDriver(); /**< Default AudioDriver constructor. */ virtual ~AudioDriver(); /**< AudioDriver destructor. */ /** * Called to handle reaching the end-of-stream. */ void eos(); }; /** * Namespace for higher-level audio controls. */ namespace audio { /** * Called to access an audio driver. * * @return The current driver used by the application. */ AudioDriver *get_driver(); }; /* Called to initialize the audio manager. */ void audio_init(int *, char ***, struct audio_ops *); /* Called to deinitialize the audio manager. */ void audio_deinit(); /* Called to load a track for playback. */ bool audio_load(struct track *); /* Called to get the current track. */ struct track *audio_cur_track(); /* Called to get the current playback state. */ GstState audio_cur_state(); /* Called to begin playback. */ bool audio_play(); /* Called to pause playback. */ bool audio_pause(); /* Called to stop playback. */ bool audio_stop(); /* 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); GstElement *audio_get_player(); #endif /* OCARINA_CORE_AUDIO_H */