Skip to content

Instantly share code, notes, and snippets.

View alirezamhm's full-sized avatar

Alireza Mohammadian alirezamhm

View GitHub Profile
@alirezamhm
alirezamhm / playwav.c
Created December 28, 2018 10:42 — forked from armornick/playwav.c
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played