FreeRTOS Emulator with SDL2 Based Graphics and Input Library
1.0
A POSIX wrapper to run FreeRTOS on an x86 machine with some basic input and output libraries aimed at making teaching FreeRTOS simpler.
|
An API wrapper around the SDL Mixer library to play a set of predefined pong waveforms. More...
Macros | |
#define | GEN_ENUM(ENUM) ENUM, |
#define | FOR_EACH_SAMPLE(SAMPLE) |
Enumerations | |
enum | gfxSound_samples_e { a3 , a4 , a5 , b3 , b4 , c3 , c4 , c5 , d3 , d4 , d5 , e3 , e4 , e5 , f3 , f4 , f5 , g3 , g4 , g5 } |
Enum containing the currently loaded wav samples. More... | |
Functions | |
int | gfxSoundInit (char *bin_dir_str) |
Initializes the SDL2 Mixer library and loads the wav samples specified in the gfxSound_samples_e. More... | |
void | gfxSoundExit (void) |
Deinitializes the SDL2 Mixer library. More... | |
void | gfxSoundPlaySample (unsigned char index) |
Plays a wav sample. More... | |
int | gfxSoundLoadUserSample (const char *filepath) |
Loads a .wav sample from disk. More... | |
int | gfxSoundPlayUserSample (const char *filename) |
Plays a loaded waveform. More... | |
An API wrapper around the SDL Mixer library to play a set of predefined pong waveforms.
#define FOR_EACH_SAMPLE | ( | SAMPLE | ) |
A list of wav filenames which are loaded
#define GEN_ENUM | ( | ENUM | ) | ENUM, |
Generates an enum entry for a given string ENUM pong sample
enum gfxSound_samples_e |
Enum containing the currently loaded wav samples.
The waveforms located in the resource/waveforms folder are added using the FOR_EACH_SAMPLE macro to generate an enum that can be used to access the appropriate sample from the internal sample list.
void gfxSoundExit | ( | void | ) |
Deinitializes the SDL2 Mixer library.
int gfxSoundInit | ( | char * | bin_dir_str | ) |
Initializes the SDL2 Mixer library and loads the wav samples specified in the gfxSound_samples_e.
bin_dir_str | String specifying where the program's binary is located |
int gfxSoundLoadUserSample | ( | const char * | filepath | ) |
Loads a .wav sample from disk.
The filepath must specify the location of the wavefile either relative to the executing binary or the absolute path. To ensure executing on other systems with different file system structures a relative path is recommended.
filepath | The location of the waveform on disk to be loaded |
void gfxSoundPlaySample | ( | unsigned char | index | ) |
Plays a wav sample.
index | Index to specify which sample to play, gfxSound_samples_e gives appropriate indices |
int gfxSoundPlayUserSample | ( | const char * | filename | ) |
Plays a loaded waveform.
Once loaded the wavefile can be played by providing either the entire filepath or the basename. Eg. A file with the path '../resources/my_sample.wav' could be played by either passing '../resources/my_sample.wav' or simply 'my_sample.wav'.
filename | The name of the waveform to be played |