SDL
2.0
|
Go to the source code of this file.
Data Structures | |
struct | sound |
Macros | |
#define | NUM_CHANNELS 8 /* max number of sounds we can play at once */ |
#define | NUM_DRUMS 4 /* number of drums in our set */ |
Functions | |
void | handleMouseButtonDown (SDL_Event *event) |
void | handleMouseButtonUp (SDL_Event *event) |
int | playSound (struct sound *) |
void | initializeButtons (SDL_Renderer *) |
void | audioCallback (void *userdata, Uint8 *stream, int len) |
void | loadSound (const char *file, struct sound *s) |
void | render (SDL_Renderer *renderer) |
int | main (int argc, char *argv[]) |
Variables | |
struct { | |
SDL_Rect rect | |
SDL_Color upColor | |
SDL_Color downColor | |
int isPressed | |
int touchIndex | |
} | buttons [NUM_DRUMS] |
static struct sound | drums [NUM_DRUMS] |
struct { | |
struct { | |
Uint8 * position | |
Uint32 remaining | |
Uint32 timestamp | |
} channels [NUM_CHANNELS] | |
SDL_AudioSpec outputSpec | |
int numSoundsPlaying | |
} | mixer |
#define NUM_CHANNELS 8 /* max number of sounds we can play at once */ |
Definition at line 10 of file mixer.c.
Referenced by audioCallback(), and playSound().
Definition at line 11 of file mixer.c.
Referenced by handleMouseButtonDown(), handleMouseButtonUp(), initializeButtons(), main(), and render().
Definition at line 234 of file mixer.c.
References i, mixer, NULL, NUM_CHANNELS, SDL_memset, SDL_MIX_MAXVOLUME, SDL_MixAudioFormat, and SDL_PauseAudio.
Referenced by main().
Definition at line 122 of file mixer.c.
References buttons, drums, i, NUM_DRUMS, playSound(), rect, SDL_GetMouseState, and SDL_Rect::x.
Referenced by main().
Definition at line 152 of file mixer.c.
References buttons, i, NUM_DRUMS, and touchIndex.
Referenced by main().
void initializeButtons | ( | SDL_Renderer * | renderer | ) |
Definition at line 54 of file mixer.c.
References buttons, downColor, SDL_Rect::h, i, NUM_DRUMS, SDL_RenderGetLogicalSize, upColor, SDL_Rect::w, SDL_Rect::x, and SDL_Rect::y.
Referenced by main().
Definition at line 88 of file mixer.c.
References SDL_AudioCVT::buf, sound::buffer, SDL_AudioSpec::channels, fatalError(), SDL_AudioSpec::format, SDL_AudioSpec::freq, SDL_AudioCVT::len, SDL_AudioCVT::len_cvt, SDL_AudioCVT::len_mult, sound::length, mixer, NULL, SDL_BuildAudioCVT, SDL_ConvertAudio, SDL_free, SDL_LoadWAV, SDL_malloc, SDL_memcpy, and spec.
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 272 of file mixer.c.
References AUDIO_S16LSB, audioCallback(), done, drums, fatalError(), handleMouseButtonDown(), handleMouseButtonUp(), i, initializeButtons(), loadSound(), mixer, NULL, NUM_DRUMS, render(), renderer, SDL_CreateRenderer, SDL_CreateWindow, SDL_Delay, SDL_free, SDL_GetWindowSize, SDL_Init, SDL_INIT_AUDIO, SDL_INIT_VIDEO, SDL_memset, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP, SDL_OpenAudio, SDL_PollEvent, SDL_Quit, SDL_QUIT, SDL_RenderSetLogicalSize, SDL_WINDOW_ALLOW_HIGHDPI, SDL_WINDOW_BORDERLESS, and SDL_Event::type.
int playSound | ( | struct sound * | s | ) |
Definition at line 187 of file mixer.c.
References sound::buffer, i, sound::length, mixer, NULL, NUM_CHANNELS, SDL_GetTicks(), and SDL_PauseAudio.
Referenced by handleMouseButtonDown().
void render | ( | SDL_Renderer * | renderer | ) |
Definition at line 166 of file mixer.c.
References SDL_Color::a, SDL_Color::b, buttons, SDL_Color::g, i, NUM_DRUMS, SDL_Color::r, rect, SDL_RenderClear, SDL_RenderFillRect, SDL_RenderPresent, and SDL_SetRenderDrawColor.
Referenced by main().
struct { ... } buttons[NUM_DRUMS] |
struct { ... } channels[NUM_CHANNELS] |
Referenced by IMA_ADPCM_decode().
SDL_Color downColor |
Definition at line 17 of file mixer.c.
Referenced by initializeButtons().
Definition at line 29 of file mixer.c.
Referenced by handleMouseButtonDown(), and main().
struct { ... } mixer |
Referenced by audioCallback(), loadSound(), main(), and playSound().
SDL_AudioSpec outputSpec |
Uint8* position |
Definition at line 44 of file mixer.c.
Referenced by MoveSprites(), and SDLTest_PrintEvent().
SDL_Rect rect |
Definition at line 15 of file mixer.c.
Referenced by handleMouseButtonDown(), and render().
Uint32 timestamp |
Definition at line 46 of file mixer.c.
Referenced by SDLTest_TimestampToString().
int touchIndex |
Definition at line 19 of file mixer.c.
Referenced by handleMouseButtonUp().
SDL_Color upColor |
Definition at line 16 of file mixer.c.
Referenced by initializeButtons().