@4players/odin-plugin-web 1.0.0-alpha.4 → 1.0.0-alpha.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/cmake/dependencies.cmake +31 -0
  2. package/cmake/options.cmake +51 -0
  3. package/lib/plugin/index.d.ts +30 -0
  4. package/lib/plugin/index.js +1 -0
  5. package/lib/worker/shared.js +1 -0
  6. package/lib/worker/unshared.js +1 -0
  7. package/package.json +35 -30
  8. package/backend/lib/audioController.d.ts +0 -102
  9. package/backend/lib/audioController.d.ts.map +0 -1
  10. package/backend/lib/audioController.js +0 -442
  11. package/backend/lib/audioController.js.map +0 -1
  12. package/backend/lib/config.d.ts +0 -11
  13. package/backend/lib/config.d.ts.map +0 -1
  14. package/backend/lib/config.js +0 -11
  15. package/backend/lib/config.js.map +0 -1
  16. package/backend/lib/connectionPool.d.ts +0 -17
  17. package/backend/lib/connectionPool.d.ts.map +0 -1
  18. package/backend/lib/connectionPool.js +0 -111
  19. package/backend/lib/connectionPool.js.map +0 -1
  20. package/backend/lib/index.d.ts +0 -53
  21. package/backend/lib/index.d.ts.map +0 -1
  22. package/backend/lib/index.js +0 -293
  23. package/backend/lib/index.js.map +0 -1
  24. package/backend/lib/mainConnection.d.ts +0 -40
  25. package/backend/lib/mainConnection.d.ts.map +0 -1
  26. package/backend/lib/mainConnection.js +0 -294
  27. package/backend/lib/mainConnection.js.map +0 -1
  28. package/backend/lib/roomConnection.d.ts +0 -37
  29. package/backend/lib/roomConnection.d.ts.map +0 -1
  30. package/backend/lib/roomConnection.js +0 -299
  31. package/backend/lib/roomConnection.js.map +0 -1
  32. package/backend/lib/rpcConnection.d.ts +0 -49
  33. package/backend/lib/rpcConnection.d.ts.map +0 -1
  34. package/backend/lib/rpcConnection.js +0 -235
  35. package/backend/lib/rpcConnection.js.map +0 -1
  36. package/backend/lib/token.d.ts +0 -16
  37. package/backend/lib/token.d.ts.map +0 -1
  38. package/backend/lib/token.js +0 -67
  39. package/backend/lib/token.js.map +0 -1
  40. package/backend/package.json +0 -13
  41. package/wasm/lib/index.d.ts +0 -97
  42. package/wasm/lib/index.js +0 -19
  43. package/wasm/package.json +0 -14
  44. package/worker/lib/common.d.ts +0 -27
  45. package/worker/lib/index.d.ts +0 -46
  46. package/worker/lib/index.js +0 -2
  47. package/worker/lib/messages.d.ts +0 -93
  48. package/worker/package.json +0 -13
@@ -0,0 +1,31 @@
1
+ include(FetchContent)
2
+
3
+ ### Opus audio codec
4
+
5
+ message(STATUS "Installing Opus audio codec")
6
+
7
+ set(OPUS_BUILD_SHARED_LIBRARY CACHE BOOL OFF FORCE)
8
+ set(OPUS_BUILD_PROGRAMS CACHE BOOL ON FORCE)
9
+ set(OPUS_BUILD_TESTING CACHE BOOL OFF FORCE)
10
+ set(BUILD_TESTING CACHE BOOL OFF FORCE)
11
+ set(STACK_PROTECTOR_SUPPORTED CACHE BOOL OFF FORCE)
12
+ set(FORTIFY_SOURCE_SUPPORTED CACHE BOOL OFF FORCE)
13
+
14
+ FetchContent_Declare(
15
+ opus
16
+ GIT_REPOSITORY https://gitlab.4players.de/odin/deps/opus.git
17
+ GIT_TAG v1.5.2
18
+ )
19
+ FetchContent_MakeAvailable(opus)
20
+ target_link_libraries(${CMAKE_EXECUTABLE_NAME} PUBLIC opus)
21
+
22
+ ### RNN VAD
23
+
24
+ message(STATUS "Installing RNN VAD")
25
+
26
+ FetchContent_Declare(
27
+ rnn_vad
28
+ GIT_REPOSITORY https://gitlab.4players.de/odin/deps/rnn-vad.git
29
+ )
30
+ FetchContent_MakeAvailable(rnn_vad)
31
+ target_link_libraries(${CMAKE_EXECUTABLE_NAME} PUBLIC rnn_vad)
@@ -0,0 +1,51 @@
1
+ ### Set global compiler flags
2
+
3
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
4
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
5
+
6
+ ### Set compiler flags for the release configuration
7
+
8
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
9
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
10
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -O3")
11
+
12
+ ### Set compiler flags for the debug configuration
13
+
14
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
15
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
16
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g")
17
+
18
+ ### Conditional logic to include pthread when SharedArrayBuffer is enabled
19
+
20
+ if(NOT DEFINED SHARED_MEMORY)
21
+ message(STATUS "Enabling SharedArrayBuffer")
22
+
23
+ set(EXPORT_NAME "OdinWasmUnsharedMemory")
24
+ set(SHARED_MEMORY 0)
25
+ else()
26
+ message(STATUS "Disabling SharedArrayBuffer")
27
+
28
+ set(EXPORT_NAME "OdinWasmSharedMemory")
29
+ set(SHARED_MEMORY 1)
30
+
31
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pthread")
32
+ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -pthread")
33
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pthread")
34
+ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pthread")
35
+ endif()
36
+
37
+ ### Set flags for WebAssembly target output
38
+
39
+ set_target_properties(${CMAKE_EXECUTABLE_NAME} PROPERTIES
40
+ CXX_STANDARD 20
41
+ LINK_FLAGS "-s SHARED_MEMORY=${SHARED_MEMORY} \
42
+ -s EXPORT_NAME=Load${EXPORT_NAME} \
43
+ -s MODULARIZE=1 \
44
+ -s WASM=1 \
45
+ -s SINGLE_FILE=1 \
46
+ -s ALLOW_TABLE_GROWTH=1 \
47
+ -s BINARYEN_ASYNC_COMPILATION=0 \
48
+ -s FILESYSTEM=0 \
49
+ -s ENVIRONMENT=web,worker \
50
+ -s EXPORTED_FUNCTIONS=_malloc,_free"
51
+ )
@@ -0,0 +1,30 @@
1
+ import { Backend, LogRecord, Logger } from '@4players/odin-common';
2
+
3
+ export type OnLogMessage = (formattedString: string, record: LogRecord) => void;
4
+ export type AudioContextFactory = (sampleRate: number | undefined) => Promise<AudioContext>;
5
+ export type DeviceInfo = {
6
+ name: string;
7
+ deviceId: string;
8
+ kind: "audioinput" | "audiooutput";
9
+ };
10
+ export interface WebDevice extends Backend.Device {
11
+ readonly device: DeviceInfo;
12
+ }
13
+ export interface WebDeviceParameters extends Backend.DeviceParameters {
14
+ readonly device?: WebDevice;
15
+ onStatusChanged?: Backend.OnStatusChanged;
16
+ }
17
+ export declare function createPlugin(audioContextFactory: AudioContextFactory, options?: WebPluginOptions): WebPlugin;
18
+ export interface WebPluginOptions {
19
+ logger?: Logger;
20
+ onLogMessage?: OnLogMessage;
21
+ }
22
+ export interface WebPlugin extends Backend.Plugin {
23
+ joinRoom(parameters: Backend.JoinRoomParameters): WebRoom;
24
+ enumerateDevices(): Promise<WebDevice[]>;
25
+ setOutputDevice(device: WebDeviceParameters): Promise<void>;
26
+ }
27
+ export interface WebRoom extends Backend.Room {
28
+ }
29
+
30
+ export {};