-
-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #858 from samhocevar-forks/patch/a2-mutex
Protect the audio2 callbacks with a mutex
- Loading branch information
Showing
10 changed files
with
78 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
#include <kinc/audio2/audio.h> | ||
#include <stdlib.h> | ||
|
||
static void (*a2_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata) = NULL; | ||
static void *a2_userdata = NULL; | ||
static kinc_a2_buffer_t a2_buffer; | ||
|
||
void kinc_a2_init() {} | ||
void kinc_a2_init() { | ||
kinc_a2_internal_init(); | ||
} | ||
|
||
void kinc_a2_update() {} | ||
|
||
void kinc_a2_shutdown() {} | ||
|
||
void kinc_a2_set_callback(void (*kinc_a2_audio_callback)(kinc_a2_buffer_t *buffer, uint32_t samples, void *userdata), void *userdata) { | ||
a2_callback = kinc_a2_audio_callback; | ||
a2_userdata = userdata; | ||
} | ||
|
||
static uint32_t samples_per_second = 44100; | ||
static void (*sample_rate_callback)(void *userdata) = NULL; | ||
static void *sample_rate_callback_userdata = NULL; | ||
|
||
uint32_t kinc_a2_samples_per_second(void) { | ||
return samples_per_second; | ||
} | ||
|
||
void kinc_a2_set_sample_rate_callback(void (*kinc_a2_sample_rate_callback)(void *userdata), void *userdata) { | ||
sample_rate_callback_userdata = userdata; | ||
sample_rate_callback = kinc_a2_sample_rate_callback; | ||
} |
Oops, something went wrong.