Files
mice-3ds/source/playback.h
Mahyar Koshkouei 02746ec1d0 Fix playback bug & don't stop on every file select
Fixed a bug where ctrmus would freeze after selecting an unsupported
file.
Fixed a bug whereby selecting an unsupported file would stop playback.

Signed-off-by: Mahyar Koshkouei <deltabeard@users.noreply.github.com>
2017-02-15 16:03:37 +00:00

68 lines
1.1 KiB
C

#ifndef ctrmus_playback_h
#define ctrmus_playback_h
/* Channel to play music on */
#define CHANNEL 0x08
enum file_types
{
FILE_TYPE_ERROR = -1,
FILE_TYPE_WAV,
FILE_TYPE_FLAC,
FILE_TYPE_OGG,
FILE_TYPE_OPUS,
FILE_TYPE_MP3
};
struct decoder_fn
{
int (* init)(const char* file);
uint32_t (* rate)(void);
uint8_t (* channels)(void);
size_t buffSize;
uint64_t (* decode)(void*);
void (* exit)(void);
};
struct playbackInfo_t
{
char* file;
struct errInfo_t* errInfo;
};
/**
* Pause or play current file.
*
* \return True if paused.
*/
bool togglePlayback(void);
/**
* Stops current playback. Playback thread should exit as a result.
*/
void stopPlayback(void);
/**
* Returns whether music is playing or paused.
*/
bool isPlaying(void);
/**
* Obtains file type.
*
* \param file File location.
* \return File type, else negative and errno set.
*/
int getFileType(const char *file);
/**
* Should only be called from a new thread only, and have only one playback
* thread at time. This function has not been written for more than one
* playback thread in mind.
*
* \param infoIn Playback information.
*/
void playFile(void* infoIn);
#endif