@4players/odin-plugin-web 1.0.0-alpha.57 → 1.0.0-alpha.59
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.
- package/README.md +1 -1
- package/cmake/options.cmake +2 -1
- package/esbuild.config.ts +49 -0
- package/lib/plugin/index.d.ts +14 -0
- package/lib/plugin/index.js +1 -1
- package/lib/worker/shared.js +1 -1
- package/lib/worker/unshared.js +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Contact us through the listed methods below to receive answers to your questions
|
|
|
14
14
|
|
|
15
15
|
Join our official Discord server to chat with us directly and become a part of the 4Players ODIN community.
|
|
16
16
|
|
|
17
|
-
[](https://4np.de/discord)
|
|
18
18
|
|
|
19
19
|
### Twitter
|
|
20
20
|
|
package/cmake/options.cmake
CHANGED
|
@@ -38,7 +38,8 @@ endif()
|
|
|
38
38
|
|
|
39
39
|
set_target_properties(${CMAKE_EXECUTABLE_NAME} PROPERTIES
|
|
40
40
|
CXX_STANDARD 20
|
|
41
|
-
LINK_FLAGS "
|
|
41
|
+
LINK_FLAGS "--bind \
|
|
42
|
+
-s SHARED_MEMORY=${SHARED_MEMORY} \
|
|
42
43
|
-s EXPORT_NAME=Load${EXPORT_NAME} \
|
|
43
44
|
-s MODULARIZE=1 \
|
|
44
45
|
-s WASM=1 \
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as esbuild from 'esbuild';
|
|
2
|
+
import type { BuildOptions } from 'esbuild'; // Optional: for type safety
|
|
3
|
+
|
|
4
|
+
const packageVersion = process.env.npm_package_version;
|
|
5
|
+
const distPath = 'dist/odin-plugin';
|
|
6
|
+
|
|
7
|
+
if (!packageVersion) {
|
|
8
|
+
console.error(
|
|
9
|
+
'Error: npm_package_version is not set. Please run this script using an npm script (e.g., npm run bundle).'
|
|
10
|
+
);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const sharedConfig: BuildOptions = {
|
|
15
|
+
entryPoints: ['lib/plugin/index.js'],
|
|
16
|
+
bundle: true,
|
|
17
|
+
minify: true,
|
|
18
|
+
platform: 'browser',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
async function main() {
|
|
22
|
+
console.log(`Starting esbuild for version: ${packageVersion}`);
|
|
23
|
+
try {
|
|
24
|
+
// IIFE Build
|
|
25
|
+
await esbuild.build({
|
|
26
|
+
...sharedConfig,
|
|
27
|
+
format: 'iife',
|
|
28
|
+
globalName: 'ODIN',
|
|
29
|
+
outfile: `${distPath}-iife_${packageVersion}.js`,
|
|
30
|
+
});
|
|
31
|
+
console.log(`Successfully built: ${distPath}-iife_${packageVersion}.js`);
|
|
32
|
+
|
|
33
|
+
// ESM Build
|
|
34
|
+
await esbuild.build({
|
|
35
|
+
...sharedConfig,
|
|
36
|
+
format: 'esm',
|
|
37
|
+
outfile: `${distPath}-esm_${packageVersion}.js`,
|
|
38
|
+
});
|
|
39
|
+
console.log(`Successfully built: ${distPath}-esm_${packageVersion}.js`);
|
|
40
|
+
|
|
41
|
+
console.log('Build completed successfully.');
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.error('Build failed:');
|
|
44
|
+
console.error(error);
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
main().catch(console.error);
|
package/lib/plugin/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { Backend, LogRecord, Logger } from '@4players/odin-common';
|
|
2
2
|
|
|
3
3
|
export type OnLogMessage = (formattedString: string, record: LogRecord) => void;
|
|
4
|
+
export type VifConfig = {
|
|
5
|
+
enabled: true;
|
|
6
|
+
attenuationLimit: number;
|
|
7
|
+
postFilterBeta: number;
|
|
8
|
+
} | {
|
|
9
|
+
enabled: false;
|
|
10
|
+
};
|
|
11
|
+
export type CreateAudioCaptureParameters = Backend.CreateAudioCaptureParameters & {
|
|
12
|
+
readonly device?: WebDevice;
|
|
13
|
+
};
|
|
4
14
|
export type AudioContextFactory = (sampleRate: number | undefined) => Promise<AudioContext>;
|
|
5
15
|
export type DeviceInfo = {
|
|
6
16
|
name: string;
|
|
@@ -24,8 +34,12 @@ export interface WebPlugin extends Backend.Plugin {
|
|
|
24
34
|
joinRoom(parameters: Backend.JoinRoomParameters): WebRoom;
|
|
25
35
|
enumerateDevices(): Promise<WebDevice[]>;
|
|
26
36
|
setOutputDevice(device: WebDeviceParameters): Promise<void>;
|
|
37
|
+
createAudioCapture(parameters: CreateAudioCaptureParameters): Promise<WebAudioCapture>;
|
|
27
38
|
}
|
|
28
39
|
export interface WebRoom extends Backend.Room {
|
|
29
40
|
}
|
|
41
|
+
export interface WebAudioCapture extends Backend.AudioCapture {
|
|
42
|
+
setVif(config: VifConfig): void;
|
|
43
|
+
}
|
|
30
44
|
|
|
31
45
|
export {};
|