fix: browser microphone connection to Csound with user warnings#428
fix: browser microphone connection to Csound with user warnings#428Nandos0804 wants to merge 1 commit intocsound:developfrom
Conversation
- warning in case of user -iadc
|
If this is a clear sign of errors on @csound/wasm build, than this PR is safe to close without review. Attempt to fix #411 |
| const hasAdcInputFlagInCsOptions = (csd: string = ""): boolean => { | ||
| const match = csd.match(/<CsOptions>[\s\S]*?<\/CsOptions>/i); | ||
| if (!match) { | ||
| return false; | ||
| } | ||
| const options = match[0].replace(/;.*$/gm, ""); | ||
| return ( | ||
| /(^|\s)-i\s*(?:"adc"|'adc'|adc)(?=\s|$)/i.test(options) || | ||
| /(^|\s)--input\s*(?:=\s*)?(?:"adc"|'adc'|adc)(?=\s|$)/i.test(options) | ||
| ); | ||
| }; |
There was a problem hiding this comment.
I'll try to help here, we can probably get this more reliably. There's a chance that the regex doesn't find the option in some cases, or some cases where the option isn't set in the file. For example project settings should be able to configure flags. Other parts look fine, I'll review better this weekend.
There was a problem hiding this comment.
Ok thank you. It would be nice also to double check if orc + sco project without explicit csd option can now use input
|
As I said in the issue - there is no problem getting audio input in other projects using Csound wasm, so the audio input problem is the web ide code. |
Yes agreed, sorry for not explaining my self well. The problem as I was able to identify is on the ide, because without rebuild Csound wasm I was able to connect the input. But my knowledge is very limited in scope so I am not able to identify possible better solution (in the ide itself, or elsewhere). Thank you for the patience |
This PR introduces support for routing browser microphone input directly into Csound when the
-iadcor--input=adcflags are present in the Csound options.Detects
-iadc/--input=adcflags in<CsOptions>and strips them from the CSD before compiling, mapping them to browser microphone input instead.Adds error handling for microphone input startup, including user notification and proper cleanup if permissions or browser policy prevent audio input.
Installs the microphone bridge and ensures audio input is enabled at the correct time in the Csound startup sequence.