Skip to content

Instantly share code, notes, and snippets.

@diclophis
Created April 13, 2012 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diclophis/2378558 to your computer and use it in GitHub Desktop.
Save diclophis/2378558 to your computer and use it in GitHub Desktop.
// setup a small scratch buffer
short *buffer;
buffer = new short[min_buffer_length];
void *pump_audio(void *) {
int wrote;
// zero out the scratch buffer
memset(buffer, 0, min_buffer_length * sizeof(short));
while (true) {
FillBuffer(buffer, min_buffer_length * sizeof(short));
wrote = PushBufferToDriver(buffer, min_buffer / sizeof(short));
if (wrote < 0) {
//unable to write to sound driver/card
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment