Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
dfcff26a
Commit
dfcff26a
authored
Feb 28, 2023
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up some of the AudioWorklets code.
parent
bfd66ab4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
40 deletions
+9
-40
miniaudio.h
miniaudio.h
+9
-40
No files found.
miniaudio.h
View file @
dfcff26a
...
@@ -39518,23 +39518,6 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const
...
@@ -39518,23 +39518,6 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const
}
}
/* This is for testing and will be removed later. */
#if 0
static EM_BOOL ma_on_canvas_click_testing__webaudio(int eventType, const EmscriptenMouseEvent* pMouseEvent, void* pUserData)
{
EMSCRIPTEN_WEBAUDIO_T audioContext = (EMSCRIPTEN_WEBAUDIO_T)pUserData;
if (emscripten_audio_context_state(audioContext) != AUDIO_CONTEXT_STATE_RUNNING) {
emscripten_resume_audio_context_sync(audioContext);
}
(void)eventType;
(void)pMouseEvent;
return EM_FALSE;
}
#endif
static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T audioContext, EM_BOOL success, void* pUserData)
static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T audioContext, EM_BOOL success, void* pUserData)
{
{
ma_audio_worklet_thread_initialized_data* pParameters = (ma_audio_worklet_thread_initialized_data*)pUserData;
ma_audio_worklet_thread_initialized_data* pParameters = (ma_audio_worklet_thread_initialized_data*)pUserData;
...
@@ -39578,26 +39561,13 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a
...
@@ -39578,26 +39561,13 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a
navigator.mediaDevices.getUserMedia({audio:true, video:false})
navigator.mediaDevices.getUserMedia({audio:true, video:false})
.then(function(stream) {
.then(function(stream) {
var channelCount = 1;
var audioTracks = stream.getAudioTracks();
if (audioTracks.length > 0) {
var audioTrackSettings = audioTracks[0].getSettings();
if ('channelCount' in audioTrackSettings) {
channelCount = audioTrackSettings.channelCount;
console.log('Found channel count: ' + channelCount);
} else {
channelCount = 2;
}
} else {
channelCount = 0;
}
/* TODO: We should probably reinitialize the data converter here in case the input has a different number of channels to the default which is 2. */
audioContext.streamNode = audioContext.createMediaStreamSource(stream);
audioContext.streamNode = audioContext.createMediaStreamSource(stream);
audioContext.streamNode.connect(workletNode);
audioContext.streamNode.connect(workletNode);
/*
Now that the worklet node has been connected, do we need to inspect workletNode.channelCount
to check the actual channel count, or is it safe to assume it's always 2?
*/
})
})
.catch(function(error) {
.catch(function(error) {
...
@@ -39613,11 +39583,6 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a
...
@@ -39613,11 +39583,6 @@ static void ma_audio_worklet_processor_created__webaudio(EMSCRIPTEN_WEBAUDIO_T a
pParameters->pDevice->webaudio.isInitialized = MA_TRUE;
pParameters->pDevice->webaudio.isInitialized = MA_TRUE;
/* For testing. Will be removed. */
#if 0
emscripten_set_click_callback("canvas", (void*)audioContext, 0, ma_on_canvas_click_testing__webaudio);
#endif
ma_log_postf(ma_device_get_log(pParameters->pDevice), MA_LOG_LEVEL_DEBUG, "AudioWorklets: Created worklet node: %d\n", workletNode);
ma_log_postf(ma_device_get_log(pParameters->pDevice), MA_LOG_LEVEL_DEBUG, "AudioWorklets: Created worklet node: %d\n", workletNode);
/* Our parameter data is no longer needed. */
/* Our parameter data is no longer needed. */
...
@@ -39742,6 +39707,10 @@ static ma_result ma_device_init_by_type__webaudio(ma_device* pDevice, const ma_d
...
@@ -39742,6 +39707,10 @@ static ma_result ma_device_init_by_type__webaudio(ma_device* pDevice, const ma_d
miniaudio can set up a data converter at a higher level.
miniaudio can set up a data converter at a higher level.
*/
*/
if (deviceType == ma_device_type_capture) {
if (deviceType == ma_device_type_capture) {
/*
For capture we won't actually know what the channel count is. Everything I've seen seems
to indicate that the default channel count is 2, so I'm sticking with that.
*/
channels = 2;
channels = 2;
} else {
} else {
/* Get the channel count from the audio context. */
/* Get the channel count from the audio context. */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment