all: move headers to include folder

Signed-off-by: Mahyar Koshkouei <mk@deltabeard.com>
This commit is contained in:
Mahyar Koshkouei
2023-07-08 11:49:04 +01:00
parent 983002a696
commit a09e44a462
11 changed files with 0 additions and 0 deletions

View File

@@ -1,13 +0,0 @@
#include <errno.h>
#include <stdio.h>
/* Adds extra debugging text */
//#define DEBUG
/* Prints more error information */
#define err_print(err) \
do { fprintf(stderr, "\nError %d:%s(): %s %s\n", __LINE__, __func__, \
err, strerror(errno)); } while (0)
#define delete(ptr) \
free((void*) ptr); ptr = NULL

View File

@@ -1,36 +0,0 @@
#if defined __arm__
#include <3ds.h>
#endif
/* Errors that can't be explained with errno */
#define NDSP_INIT_FAIL 1000
#define DECODER_INIT_FAIL 1001
#define FILE_NOT_SUPPORTED 1002
#define UNSUPPORTED_CHANNELS 1003
#if defined __arm__
/**
* Struct to help error handling across threads.
*/
struct errInfo_t
{
/* errno code or from defines listed above */
volatile int* error;
/* Extra information regarding error (Must be NULL if unused) */
volatile char* errstr;
/* Event to trigger on error */
Handle* failEvent;
};
/**
* Return string describing error number. Extends strerror to include some
* custom errors used in ctrmus.
*
* \param err Error number.
*/
char* ctrmus_strerror(int err);
#endif

View File

@@ -1,26 +0,0 @@
enum file_types
{
FILE_TYPE_ERROR = 0,
FILE_TYPE_WAV,
FILE_TYPE_FLAC,
FILE_TYPE_VORBIS,
FILE_TYPE_OPUS,
FILE_TYPE_MP3,
FILE_TYPE_SID
};
/**
* Obtain file type string from file_types enum.
*
* \param ft File type enum.
* \return String representation of enum.
*/
const char* fileToStr(enum file_types ft);
/**
* Obtains file type.
*
* \param file File location.
* \return file_types enum or 0 on error and errno set.
*/
enum file_types getFileType(const char *file);

View File

@@ -1,51 +0,0 @@
#include "playback.h"
/**
* Set decoder parameters for flac.
*
* \param decoder Structure to store parameters.
*/
void setFlac(struct decoder_fn* decoder);
/**
* Initialise Flac decoder.
*
* \param file Location of flac file to play.
* \return 0 on success, else failure.
*/
int initFlac(const char* file);
/**
* Get sampling rate of Flac file.
*
* \return Sampling rate.
*/
uint32_t rateFlac(void);
/**
* Get number of channels of Flac file.
*
* \return Number of channels for opened file.
*/
uint8_t channelFlac(void);
/**
* Decode part of open Flac file.
*
* \param buffer Decoded output.
* \return Samples read for each channel.
*/
uint64_t decodeFlac(void* buffer);
/**
* Free Flac decoder.
*/
void exitFlac(void);
/**
* Checks if the input file is Flac
*
* \param in Input file.
* \return 0 if Flac file, else not or failure.
*/
int isFlac(const char* in);

View File

@@ -1,55 +0,0 @@
/**
* ctrmus - 3DS Music Player
* Copyright (C) 2016 Mahyar Koshkouei
*
* This program comes with ABSOLUTELY NO WARRANTY and is free software. You are
* welcome to redistribute it under certain conditions; for details see the
* LICENSE file.
*/
#include <3ds.h>
#ifndef ctrmus_main_h
#define ctrmus_main_h
/* Default folder */
#define DEFAULT_DIR "sdmc:/"
/* Maximum number of lines that can be displayed */
#define MAX_LIST 28
struct watchdogInfo
{
PrintConsole* screen;
struct errInfo_t* errInfo;
};
struct dirList_t
{
char** files;
int fileNum;
char** directories;
int dirNum;
char* currentDir;
};
/**
* Allows the playback thread to return any error messages that it may
* encounter.
*
* \param infoIn Struct containing addresses of the event, the error code,
* and an optional error string.
*/
void playbackWatchdog(void* infoIn);
/**
* Get number of files in current working folder
*
* \return Number of files in current working folder, -1 on failure with
* errno set.
*/
int getNumberFiles(void);
#endif

View File

@@ -1,44 +0,0 @@
#include <stdint.h>
#include "playback.h"
/**
* Set decoder parameters for MP3.
*
* \param decoder Structure to store parameters.
*/
void setMp3(struct decoder_fn* decoder);
/**
* Initialise MP3 decoder.
*
* \param file Location of MP3 file to play.
* \return 0 on success, else failure.
*/
int initMp3(const char* file);
/**
* Get sampling rate of MP3 file.
*
* \return Sampling rate.
*/
uint32_t rateMp3(void);
/**
* Get number of channels of MP3 file.
*
* \return Number of channels for opened file.
*/
uint8_t channelMp3(void);
/**
* Decode part of open MP3 file.
*
* \param buffer Decoded output.
* \return Samples read for each channel.
*/
uint64_t decodeMp3(void* buffer);
/**
* Free MP3 decoder.
*/
void exitMp3(void);

View File

@@ -1,20 +0,0 @@
#include <opus/opusfile.h>
#include "playback.h"
void setOpus(struct decoder_fn* decoder);
int initOpus(const char* file);
uint32_t rateOpus(void);
uint8_t channelOpus(void);
uint64_t decodeOpus(void* buffer);
void exitOpus(void);
int playOpus(const char* in);
uint64_t fillOpusBuffer(int16_t* bufferOut);
int isOpus(const char* in);

View File

@@ -1,51 +0,0 @@
#include <stdbool.h>
#ifndef ctrmus_playback_h
#define ctrmus_playback_h
/* Channel to play music on */
#define CHANNEL 0x08
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);
/**
* 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

View File

@@ -1,44 +0,0 @@
#include <stdint.h>
#include "playback.h"
/**
* Set decoder parameters for SID.
*
* \param decoder Structure to store parameters.
*/
void setSid(struct decoder_fn* decoder);
/**
* Initialise SID playback.
*
* \param file Location of SID file to play.
* \return 0 on success, else failure.
*/
int initSid(const char* file);
/**
* Get sampling rate of SID file.
*
* \return Sampling rate.
*/
uint32_t rateSid(void);
/**
* Get number of channels of SID file.
*
* \return Number of channels for opened file.
*/
uint8_t channelSid(void);
/**
* Read part of open SID file.
*
* \param buffer Output.
* \return Samples read for each channel.
*/
uint64_t readSid(void* buffer);
/**
* Free SID file.
*/
void exitSid(void);

View File

@@ -1,21 +0,0 @@
#include <tremor/ivorbiscodec.h>
#include <tremor/ivorbisfile.h>
#include "playback.h"
void setVorbis(struct decoder_fn* decoder);
int initVorbis(const char* file);
uint32_t rateVorbis(void);
uint8_t channelVorbis(void);
uint64_t decodeVorbis(void* buffer);
void exitVorbis(void);
int playVorbis(const char* in);
uint64_t fillVorbisBuffer(char* bufferOut);
int isVorbis(const char* in);

View File

@@ -1,44 +0,0 @@
#include <stdint.h>
#include "playback.h"
/**
* Set decoder parameters for WAV.
*
* \param decoder Structure to store parameters.
*/
void setWav(struct decoder_fn* decoder);
/**
* Initialise WAV playback.
*
* \param file Location of WAV file to play.
* \return 0 on success, else failure.
*/
int initWav(const char* file);
/**
* Get sampling rate of Wav file.
*
* \return Sampling rate.
*/
uint32_t rateWav(void);
/**
* Get number of channels of Wav file.
*
* \return Number of channels for opened file.
*/
uint8_t channelWav(void);
/**
* Read part of open Wav file.
*
* \param buffer Output.
* \return Samples read for each channel.
*/
uint64_t readWav(void* buffer);
/**
* Free Wav file.
*/
void exitWav(void);