Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "host.h" | ||
#include "audio.h" | ||
#include "main.h" | ||
#include "snd.h" | ||
#include "sysdeps.h" | ||
|
||
#include <emscripten.h> | ||
|
||
void Audio_Output_Enable(bool bEnable) { | ||
|
||
} | ||
|
||
void Audio_Output_Init(void) { | ||
uint32_t sample_size = 16; | ||
uint32_t channels = 2; | ||
EM_ASM_({ workerApi.didOpenAudio($0, $1, $2, $3); }, SOUND_OUT_FREQUENCY, sample_size, channels); | ||
} | ||
|
||
void Audio_Output_UnInit(void) { | ||
|
||
} | ||
|
||
void Audio_Output_Queue(uint8_t* data, int len) { | ||
EM_ASM_({ workerApi.enqueueAudio($0, $1); }, data, len); | ||
} | ||
|
||
void Audio_Output_Queue_Clear(void) { | ||
|
||
} | ||
|
||
uint32_t Audio_Output_Queue_Size(void) { | ||
int js_audio_buffer_size = EM_ASM_INT_V({ return workerApi.audioBufferSize(); }); | ||
return js_audio_buffer_size; | ||
} | ||
|
||
// Audio input is currently unsupported | ||
void Audio_Input_Enable(bool bEnable) {} | ||
void Audio_Input_Init(void) {} | ||
void Audio_Input_UnInit(void) {} | ||
void Audio_Input_Lock(void) {} | ||
int Audio_Input_Read(int16_t* sample) { | ||
*sample = 0; // silence | ||
return 0; | ||
} | ||
int Audio_Input_BufSize(void) { | ||
return 0; | ||
} | ||
void Audio_Input_Unlock(void) {} |