Skip to content
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
448425f
Add emscripten_sleep implementation of Pa_Sleep
fwcd Mar 10, 2024
01f8f8d
Stub out Web Audio hostapi based on skeleton
fwcd Mar 10, 2024
a8aee40
Create an audio context and enable audio worklets
fwcd Mar 10, 2024
ac876e6
Make sure that PortAudio and consumers are compiled with -pthread
fwcd Mar 10, 2024
0770e36
Add a README.md for building/testing the Web Audio hostapi
fwcd Mar 10, 2024
8da3745
Include pa_debugprint
fwcd Mar 10, 2024
848fbdd
Set up a basic 2-channel default output device
fwcd Mar 10, 2024
da02a65
Add experimental Emscripten/Wasm CI
fwcd Mar 10, 2024
c1a6865
Disable jack feature when targeting emscripten
fwcd Mar 10, 2024
1706a88
Set VCPKG_CHAINLOAD_TOOLCHAIN_FILE in CI
fwcd Mar 10, 2024
be3f169
Disable unavailable -Wno-error=stringop-overflow
fwcd Mar 10, 2024
692d915
Rename to WebAudioHostProcessingLoop
fwcd Mar 10, 2024
83eb5a5
Experimentally set up Wasm Audio Worklet
fwcd Mar 10, 2024
1431da1
Create a separate audio context per stream
fwcd Mar 10, 2024
a02a4e2
Implement IsStreamStopped and IsStreamActive
fwcd Mar 10, 2024
42bdb7c
Update comments
fwcd Mar 10, 2024
d27dbc5
Add missing newlines to debug statements
fwcd Mar 10, 2024
d2639d6
Add some tips
fwcd Mar 10, 2024
33c679a
Await context suspend/resume
fwcd Mar 10, 2024
6e356cd
Wait for user interaction when attempting to resume context
fwcd Mar 10, 2024
c8d1abf
Add note on user interaction
fwcd Mar 10, 2024
edffb12
Handle the buffers in host loop properly
fwcd Mar 10, 2024
deb8a57
Use C wrapper for querying audio context state
fwcd Mar 10, 2024
4057598
Connect node to context destination
fwcd Mar 10, 2024
6d2ff90
Set sample rate during audio context creation
fwcd Mar 10, 2024
a2102c5
Use proper host format (non-interleaved 32-bit float)
fwcd Mar 10, 2024
47d4202
Format code towards the prevalent style
fwcd Mar 10, 2024
6375db9
Add utility function for suspension and suspend initially
fwcd Mar 10, 2024
831c636
Add PA_WEBAUDIO_ASYNCIFY and experimental synchronous mode
fwcd Mar 11, 2024
c80758a
Experimentally build examples with PROXY_TO_PTHREAD
fwcd Mar 11, 2024
3a6a5b7
Add checks to not block the main thread
fwcd Mar 11, 2024
c9015e5
Add missing <emscripten/threading.h> import
fwcd Mar 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,25 @@ elseif(UNIX)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_SNDIO=1")
set(PKGCONFIG_REQUIRES_PRIVATE "${PKGCONFIG_REQUIRES_PRIVATE} sndio")
endif()

if(EMSCRIPTEN)
option(PA_USE_WEBAUDIO "Enable support for Web Audio" ON)

if(PA_USE_WEBAUDIO)
target_sources(PortAudio PRIVATE
src/hostapi/webaudio/pa_webaudio.c
)
target_compile_definitions(PortAudio PUBLIC PA_USE_WEBAUDIO=1)
target_compile_options(PortAudio PUBLIC -pthread)
target_link_options(PortAudio PUBLIC -sASYNCIFY -sAUDIO_WORKLET -sWASM_WORKERS)
set(PKGCONFIG_CFLAGS "${PKGCONFIG_CFLAGS} -DPA_USE_WEBAUDIO=1")
endif()

# This makes it easy to run the examples. The default output format is .js
# and is set in the Emscripten toolchain file, so it cannot be overriden
# from the command-line with -DCMAKE_EXECUTABLE_SUFFIX.
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif()
endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions src/hostapi/webaudio/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pa_hostapi_skeleton.c provides a starting point for implementing support for a new host API with PortAudio. The idea is that you copy it to a new directory inside /hostapi and start editing.
Comment thread
fwcd marked this conversation as resolved.
Outdated
Loading