ocarina/include/core/audio.h

99 lines
2.0 KiB
C
Raw Normal View History

/**
* @file
* Copyright 2013 (c) Anna Schumaker.
*/
#ifndef OCARINA_CORE_AUDIO_H
#define OCARINA_CORE_AUDIO_H
#include <core/driver.h>
#include <core/tags/track.h>
#include <string>
/**
* Namespace for higher-level audio controls.
*/
namespace audio
{
/**
* Initializes the audio layer and currently configured audio driver.
*/
void init();
void play(); /** Begin playback. */
void pause(); /** Pause playback. */
/**
* Seek to a specific point in the track.
*
* @param pos Offset (in nanoseconds) from the beginning of the track.
*/
void seek_to(long);
/**
* Stop playback (equivalent to pause(); seek_to(0);).
*/
void stop();
/**
* @return The current position of the audio playback (in nanoseconds).
*/
long position();
/**
* @return The duration of the currently loaded track (in nanoseconds).
*/
long duration();
/**
* @return The current audio position, in a human readable format.
*/
std::string position_str();
void next(); /** Find and load the next track that should be played. */
void prev(); /** Call the deck :: previous() function and load the result. */
/**
* Load a specific track for playback.
*
* @param track The track that should be loaded.
*/
void load_track(Track *track);
/**
* @return A pointer to the currently playing track object.
*/
Track *current_track();
/**
* Configure the automatic pausing feature.
*
* @param enabled Set to true to enable pausing, false to disable.
* @param n Number of tracks to play before pausing.
*/
void pause_after(bool, unsigned int);
/**
* Call to find the current automatic pausing state.
*
* @return True if automatic pausing is enabled, false otherwise.
*/
bool pause_enabled();
/**
* Call to find the number of tracks remaining before pausing.
*
* @return The number of tracks before pausing.
*/
unsigned int pause_count();
/**
* Called to access an audio driver.
*
* @return The current driver used by the application.
*/
Driver *get_driver();
};
#endif /* OCARINA_CORE_AUDIO_H */