@neurodevs/node-lsl 0.0.1

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 (60) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.js +3 -0
  3. package/.nvmrc +1 -0
  4. package/.vscode/launch.json +58 -0
  5. package/.vscode/settings.json +70 -0
  6. package/.vscode/tasks.json +112 -0
  7. package/LICENSE +21 -0
  8. package/README.md +2 -0
  9. package/build/.spruce/errors/errors.types.d.ts +21 -0
  10. package/build/.spruce/errors/errors.types.js +5 -0
  11. package/build/.spruce/errors/errors.types.js.map +1 -0
  12. package/build/.spruce/errors/nodeLsl/failedToLoadLiblsl.schema.d.ts +3 -0
  13. package/build/.spruce/errors/nodeLsl/failedToLoadLiblsl.schema.js +19 -0
  14. package/build/.spruce/errors/nodeLsl/failedToLoadLiblsl.schema.js.map +1 -0
  15. package/build/.spruce/errors/options.types.d.ts +7 -0
  16. package/build/.spruce/errors/options.types.js +3 -0
  17. package/build/.spruce/errors/options.types.js.map +1 -0
  18. package/build/.spruce/schemas/fields/fieldClassMap.d.ts +2 -0
  19. package/build/.spruce/schemas/fields/fieldClassMap.js +5 -0
  20. package/build/.spruce/schemas/fields/fieldClassMap.js.map +1 -0
  21. package/build/.spruce/schemas/fields/fields.types.d.ts +1 -0
  22. package/build/.spruce/schemas/fields/fields.types.js +3 -0
  23. package/build/.spruce/schemas/fields/fields.types.js.map +1 -0
  24. package/build/.spruce/settings.json +13 -0
  25. package/build/Liblsl.d.ts +47 -0
  26. package/build/Liblsl.js +81 -0
  27. package/build/Liblsl.js.map +1 -0
  28. package/build/LslOutlet.d.ts +30 -0
  29. package/build/LslOutlet.js +122 -0
  30. package/build/LslOutlet.js.map +1 -0
  31. package/build/__tests__/behavioral/LslOutlet.test.d.ts +26 -0
  32. package/build/__tests__/behavioral/LslOutlet.test.js +232 -0
  33. package/build/__tests__/behavioral/LslOutlet.test.js.map +1 -0
  34. package/build/__tests__/implementation/Liblsl.test.d.ts +28 -0
  35. package/build/__tests__/implementation/Liblsl.test.js +236 -0
  36. package/build/__tests__/implementation/Liblsl.test.js.map +1 -0
  37. package/build/errors/SpruceError.d.ts +6 -0
  38. package/build/errors/SpruceError.js +26 -0
  39. package/build/errors/SpruceError.js.map +1 -0
  40. package/build/errors/failedToLoadLiblsl.builder.d.ts +11 -0
  41. package/build/errors/failedToLoadLiblsl.builder.js +14 -0
  42. package/build/errors/failedToLoadLiblsl.builder.js.map +1 -0
  43. package/build/index.d.ts +4 -0
  44. package/build/index.js +27 -0
  45. package/build/index.js.map +1 -0
  46. package/package.json +80 -0
  47. package/src/.spruce/errors/errors.types.ts +40 -0
  48. package/src/.spruce/errors/nodeLsl/failedToLoadLiblsl.schema.ts +22 -0
  49. package/src/.spruce/errors/options.types.ts +10 -0
  50. package/src/.spruce/schemas/fields/fieldClassMap.ts +6 -0
  51. package/src/.spruce/schemas/fields/fields.types.ts +1 -0
  52. package/src/.spruce/settings.json +13 -0
  53. package/src/Liblsl.ts +151 -0
  54. package/src/LslOutlet.ts +143 -0
  55. package/src/__tests__/behavioral/LslOutlet.test.ts +217 -0
  56. package/src/__tests__/implementation/Liblsl.test.ts +231 -0
  57. package/src/errors/SpruceError.ts +23 -0
  58. package/src/errors/failedToLoadLiblsl.builder.ts +12 -0
  59. package/src/index.ts +5 -0
  60. package/tsconfig.json +40 -0
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ build
2
+ esm
3
+ node_modules
package/.eslintrc.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ extends: 'spruce',
3
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ lts/*
@@ -0,0 +1,58 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "attach",
7
+ "name": "attach.tests",
8
+ "port": 5200,
9
+ "restart": true,
10
+ "timeout": 10000
11
+ },
12
+ {
13
+ "type": "node",
14
+ "request": "launch",
15
+ "name": "test.file",
16
+ "runtimeExecutable": "node",
17
+ "runtimeArgs": [
18
+ "--inspect-brk",
19
+ "--trace-warnings",
20
+ "${workspaceFolder}/node_modules/.bin/jest",
21
+ "${fileBasenameNoExtension}",
22
+ "--detectOpenHandles"
23
+ ],
24
+ "cwd": "${workspaceFolder}",
25
+ "console": "integratedTerminal",
26
+ "internalConsoleOptions": "neverOpen"
27
+ },
28
+ {
29
+ "type": "node",
30
+ "request": "launch",
31
+ "name": "test.all",
32
+ "runtimeExecutable": "node",
33
+ "runtimeArgs": [
34
+ "--inspect-brk",
35
+ "--trace-warnings",
36
+ "${workspaceFolder}/node_modules/.bin/jest"
37
+ ],
38
+ "cwd": "${workspaceFolder}",
39
+ "console": "integratedTerminal",
40
+ "internalConsoleOptions": "neverOpen"
41
+ },
42
+ {
43
+ "type": "node",
44
+ "request": "launch",
45
+ "name": "boot",
46
+ "runtimeExecutable": "yarn",
47
+ "runtimeArgs": [
48
+ "run",
49
+ "--inspect-brk",
50
+ "--trace-warnings",
51
+ "boot"
52
+ ],
53
+ "cwd": "${workspaceFolder}",
54
+ "console": "integratedTerminal",
55
+ "internalConsoleOptions": "neverOpen"
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,70 @@
1
+ {
2
+ "debug.node.autoAttach": "on",
3
+ "git.ignoreLimitWarning": true,
4
+ "javascript.validate.enable": false,
5
+ "editor.formatOnSave": true,
6
+ "files.watcherExclude": {
7
+ "**/.git/objects/**": true,
8
+ "**/.git/subtree-cache/**": true,
9
+ "**/build/**": true,
10
+ "**/node_modules/**": true,
11
+ },
12
+ "search.exclude": {
13
+ "**/build/**": true,
14
+ "**/node_modules/**": true,
15
+ "**/.next/**": true
16
+ },
17
+ "editor.maxTokenizationLineLength": 20000000,
18
+ "eslint.enable": true,
19
+ "eslint.validate": [
20
+ "javascript",
21
+ "javascriptreact",
22
+ "typescript",
23
+ "typescriptreact"
24
+ ],
25
+ "[javascript]": {
26
+ "editor.formatOnSave": false
27
+ },
28
+ "[javascriptreact]": {
29
+ "editor.formatOnSave": false
30
+ },
31
+ "[typescript]": {
32
+ "editor.formatOnSave": false
33
+ },
34
+ "[typescriptreact]": {
35
+ "editor.formatOnSave": false
36
+ },
37
+ "[handlebars]": {
38
+ "editor.formatOnSave": false
39
+ },
40
+ "eslint.options": {
41
+ "extensions": [
42
+ ".js",
43
+ ".jsx",
44
+ ".ts",
45
+ ".tsx"
46
+ ]
47
+ },
48
+ "typescript.tsdk": "node_modules/typescript/lib",
49
+ "editor.codeActionsOnSave": {
50
+ "source.fixAll.eslint": true
51
+ },
52
+ "cSpell.ignorePaths": [
53
+ "**/package-lock.json",
54
+ "**/node_modules/**",
55
+ "**/build/**",
56
+ "**/vscode-extension/**",
57
+ "**/.git/objects/**",
58
+ ".vscode",
59
+ ".spruce"
60
+ ],
61
+ "cSpell.words": [
62
+ "arkit",
63
+ "autogenerated",
64
+ "scrollable",
65
+ "serializable"
66
+ ],
67
+ "debug.javascript.unmapMissingSources": true,
68
+ "javascript.preferences.importModuleSpecifier": "relative",
69
+ "typescript.preferences.importModuleSpecifier": "relative"
70
+ }
@@ -0,0 +1,112 @@
1
+ {
2
+ "version": "2.0.0",
3
+ "tasks": [
4
+ {
5
+ "type": "npm",
6
+ "script": "watch.build.dev",
7
+ "group": "build",
8
+ "label": "watch.build.dev & problem.watcher",
9
+ "isBackground": true,
10
+ "runOptions": {
11
+ "runOn": "folderOpen"
12
+ },
13
+ "promptOnClose": false,
14
+ "presentation": {
15
+ "focus": false,
16
+ "reveal": "never"
17
+ },
18
+ "problemMatcher": {
19
+ "base": "$tsc-watch",
20
+ "applyTo": "allDocuments"
21
+ }
22
+ },
23
+ {
24
+ "label": "test.file",
25
+ "command": "spruce",
26
+ "args": [
27
+ "test",
28
+ "--inspect",
29
+ "5200",
30
+ "--pattern",
31
+ "${fileBasenameNoExtension}",
32
+ "--watchMode",
33
+ "standard"
34
+ ],
35
+ "promptOnClose": false,
36
+ "group": {
37
+ "kind": "test",
38
+ "isDefault": true
39
+ },
40
+ "presentation": {
41
+ "reveal": "always",
42
+ "panel": "dedicated",
43
+ },
44
+ "problemMatcher": []
45
+ },
46
+ {
47
+ "label": "test.reporter",
48
+ "command": "spruce",
49
+ "args": [
50
+ "test",
51
+ "--shouldHoldAtStart",
52
+ "true",
53
+ "--watchMode",
54
+ "smart"
55
+ ],
56
+ "promptOnClose": false,
57
+ "group": "test",
58
+ "runOptions": {
59
+ "runOn": "folderOpen"
60
+ },
61
+ "presentation": {
62
+ "panel": "shared",
63
+ "focus": true,
64
+ "reveal": "always"
65
+ }
66
+ },
67
+ {
68
+ "label": "spruce",
69
+ "type": "shell",
70
+ "command": "spruce ${input:spruceCommand}",
71
+ "problemMatcher": [],
72
+ "presentation": {
73
+ "reveal": "always",
74
+ "focus": true,
75
+ "panel": "new",
76
+ "clear": false
77
+ }
78
+ },
79
+ {
80
+ "label": "shell",
81
+ "type": "shell",
82
+ "command": "${input:command} ${input:optionsCommand}",
83
+ "problemMatcher": [],
84
+ "presentation": {
85
+ "reveal": "always",
86
+ "focus": true,
87
+ "panel": "new",
88
+ "clear": false
89
+ }
90
+ }
91
+ ],
92
+ "inputs": [
93
+ {
94
+ "id": "spruceCommand",
95
+ "description": "spruce command",
96
+ "default": "create.test",
97
+ "type": "promptString"
98
+ },
99
+ {
100
+ "id": "command",
101
+ "description": "command",
102
+ "default": "yarn",
103
+ "type": "promptString"
104
+ },
105
+ {
106
+ "id": "optionsCommand",
107
+ "description": "optionsCommand",
108
+ "default": "add",
109
+ "type": "promptString"
110
+ }
111
+ ]
112
+ }
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 neurodevs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # node-lsl
2
+ Lab Streaming Layer (LSL) on Node
@@ -0,0 +1,21 @@
1
+ import { default as SchemaEntity } from '@sprucelabs/schema';
2
+ import * as SpruceSchema from '@sprucelabs/schema';
3
+ export declare namespace SpruceErrors.NodeLsl {
4
+ interface FailedToLoadLiblsl {
5
+ 'liblslPath': string;
6
+ }
7
+ interface FailedToLoadLiblslSchema extends SpruceSchema.Schema {
8
+ id: 'failedToLoadLiblsl';
9
+ namespace: 'NodeLsl';
10
+ name: 'FAILED_TO_LOAD_LIBLSL';
11
+ fields: {
12
+ /** . */
13
+ 'liblslPath': {
14
+ type: 'text';
15
+ isRequired: true;
16
+ options: undefined;
17
+ };
18
+ };
19
+ }
20
+ type FailedToLoadLiblslEntity = SchemaEntity<SpruceErrors.NodeLsl.FailedToLoadLiblslSchema>;
21
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/no-namespace */
3
+ /* eslint-disable no-redeclare */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=errors.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.types.js","sourceRoot":"","sources":["../../../src/.spruce/errors/errors.types.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,iCAAiC"}
@@ -0,0 +1,3 @@
1
+ import { SpruceErrors } from '../errors.types';
2
+ declare const failedToLoadLiblslSchema: SpruceErrors.NodeLsl.FailedToLoadLiblslSchema;
3
+ export default failedToLoadLiblslSchema;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
4
+ const failedToLoadLiblslSchema = {
5
+ id: 'failedToLoadLiblsl',
6
+ namespace: 'NodeLsl',
7
+ name: 'FAILED_TO_LOAD_LIBLSL',
8
+ fields: {
9
+ /** . */
10
+ 'liblslPath': {
11
+ type: 'text',
12
+ isRequired: true,
13
+ options: undefined
14
+ },
15
+ }
16
+ };
17
+ schema_1.SchemaRegistry.getInstance().trackSchema(failedToLoadLiblslSchema);
18
+ exports.default = failedToLoadLiblslSchema;
19
+ //# sourceMappingURL=failedToLoadLiblsl.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failedToLoadLiblsl.schema.js","sourceRoot":"","sources":["../../../../src/.spruce/errors/nodeLsl/failedToLoadLiblsl.schema.ts"],"names":[],"mappings":";;AAAA,+CAAmD;AAKnD,MAAM,wBAAwB,GAAmD;IAChF,EAAE,EAAE,oBAAoB;IACxB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,uBAAuB;IACzB,MAAM,EAAE;QACA,QAAQ;QACR,YAAY,EAAE;YACV,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,IAAI;YAChB,OAAO,EAAE,SAAS;SACrB;KACR;CACL,CAAA;AAED,uBAAc,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAA;AAElE,kBAAe,wBAAwB,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { SpruceErrors } from "./errors.types";
2
+ import { ErrorOptions as ISpruceErrorOptions } from "@sprucelabs/error";
3
+ export interface FailedToLoadLiblslErrorOptions extends SpruceErrors.NodeLsl.FailedToLoadLiblsl, ISpruceErrorOptions {
4
+ code: 'FAILED_TO_LOAD_LIBLSL';
5
+ }
6
+ type ErrorOptions = FailedToLoadLiblslErrorOptions;
7
+ export default ErrorOptions;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=options.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.types.js","sourceRoot":"","sources":["../../../src/.spruce/errors/options.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { fieldClassMap } from '@sprucelabs/schema';
2
+ export default fieldClassMap;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schema_1 = require("@sprucelabs/schema");
4
+ exports.default = schema_1.fieldClassMap;
5
+ //# sourceMappingURL=fieldClassMap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldClassMap.js","sourceRoot":"","sources":["../../../../src/.spruce/schemas/fields/fieldClassMap.ts"],"names":[],"mappings":";;AAAA,+CAAkD;AAKlD,kBAAe,sBAAa,CAAA"}
@@ -0,0 +1 @@
1
+ export { FieldDefinitions, FieldDefinitionMap, FieldValueTypeGeneratorMap, FieldMap } from '@sprucelabs/schema';
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=fields.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.types.js","sourceRoot":"","sources":["../../../../src/.spruce/schemas/fields/fields.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ {
2
+ "scriptUpdater": {
3
+ "skipped": []
4
+ },
5
+ "skipped": [
6
+ "skill"
7
+ ],
8
+ "installed": [
9
+ "test",
10
+ "schema",
11
+ "error"
12
+ ]
13
+ }
@@ -0,0 +1,47 @@
1
+ import ffi from 'ffi-napi';
2
+ export default class LiblslImpl implements Liblsl {
3
+ private static instance?;
4
+ static ffi: typeof ffi;
5
+ private bindings;
6
+ static getInstance(): Liblsl;
7
+ static reset(): void;
8
+ static setInstance(instance: Liblsl): void;
9
+ constructor();
10
+ private loadBindings;
11
+ pushSample(outlet: LslBindingsOutlet, sample: LslSample): void;
12
+ createOutlet(options: CreateOutletOptions): LslBindingsOutlet;
13
+ createStreamInfo(options: CreateStreamInfoOptions): StreamInfo;
14
+ }
15
+ export interface Liblsl {
16
+ createStreamInfo(options: CreateStreamInfoOptions): LslBindingsStreamInfo;
17
+ createOutlet(options: CreateOutletOptions): LslBindingsOutlet;
18
+ pushSample(outlet: LslBindingsOutlet, sample: LslSample): void;
19
+ }
20
+ export type LslSample = (number | string | undefined)[];
21
+ export interface StreamInfo {
22
+ }
23
+ export interface CreateStreamInfoOptions {
24
+ name: string;
25
+ type: string;
26
+ channelCount: number;
27
+ sampleRate: number;
28
+ channelFormat: number;
29
+ sourceId: string;
30
+ manufacturer?: string;
31
+ unit?: string;
32
+ }
33
+ export interface LiblslBindings {
34
+ lsl_create_streaminfo(name: string, type: string, channelCount: number, sampleRate: number, channelFormat: number, sourceId: string): LslBindingsStreamInfo;
35
+ lsl_create_outlet(info: LslBindingsStreamInfo, chunkSize: number, maxBuffered: number): LslBindingsOutlet;
36
+ lsl_push_sample_ft(outlet: LslBindingsOutlet, sample: LslSample, timestamp: number): void;
37
+ lsl_local_clock(): number;
38
+ }
39
+ export interface CreateOutletOptions {
40
+ info: StreamInfo;
41
+ chunkSize: number;
42
+ maxBuffered: number;
43
+ }
44
+ export interface LslBindingsStreamInfo {
45
+ }
46
+ export interface LslBindingsOutlet {
47
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const schema_1 = require("@sprucelabs/schema");
7
+ const ffi_napi_1 = __importDefault(require("ffi-napi"));
8
+ const ref_array_napi_1 = __importDefault(require("ref-array-napi"));
9
+ const ref_napi_1 = __importDefault(require("ref-napi"));
10
+ const SpruceError_1 = __importDefault(require("./errors/SpruceError"));
11
+ class LiblslImpl {
12
+ static getInstance() {
13
+ if (!this.instance) {
14
+ this.instance = new this();
15
+ }
16
+ return this.instance;
17
+ }
18
+ static reset() {
19
+ delete this.instance;
20
+ }
21
+ static setInstance(instance) {
22
+ this.instance = instance;
23
+ }
24
+ constructor() {
25
+ const path = process.env.LIBLSL_PATH;
26
+ if (!path) {
27
+ (0, schema_1.assertOptions)(process, ['env.LIBLSL_PATH']);
28
+ }
29
+ try {
30
+ this.bindings = this.loadBindings(path);
31
+ }
32
+ catch (err) {
33
+ console.error(err);
34
+ throw new SpruceError_1.default({
35
+ code: 'FAILED_TO_LOAD_LIBLSL',
36
+ liblslPath: path,
37
+ });
38
+ }
39
+ }
40
+ loadBindings(path) {
41
+ return LiblslImpl.ffi.Library(path, {
42
+ lsl_create_streaminfo: [
43
+ streamInfo,
44
+ ['string', 'string', 'int', 'double', 'int', 'string'],
45
+ ],
46
+ lsl_create_outlet: [outletType, [streamInfo, 'int', 'int']],
47
+ lsl_local_clock: ['double', []],
48
+ lsl_push_sample_ft: ['void', [outletType, FloatArray, 'double']],
49
+ });
50
+ }
51
+ pushSample(outlet, sample) {
52
+ (0, schema_1.assertOptions)({ outlet, sample }, ['outlet', 'sample']);
53
+ const clock = this.bindings.lsl_local_clock();
54
+ this.bindings.lsl_push_sample_ft(outlet, sample, clock);
55
+ }
56
+ createOutlet(options) {
57
+ const { info, chunkSize, maxBuffered } = (0, schema_1.assertOptions)(options, [
58
+ 'info',
59
+ 'chunkSize',
60
+ 'maxBuffered',
61
+ ]);
62
+ return this.bindings.lsl_create_outlet(info, chunkSize, maxBuffered);
63
+ }
64
+ createStreamInfo(options) {
65
+ const { name, type, channelCount, sampleRate, channelFormat, sourceId } = (0, schema_1.assertOptions)(options, [
66
+ 'name',
67
+ 'type',
68
+ 'channelCount',
69
+ 'sampleRate',
70
+ 'channelFormat',
71
+ 'sourceId',
72
+ ]);
73
+ return this.bindings.lsl_create_streaminfo(name, type, channelCount, sampleRate, channelFormat, sourceId);
74
+ }
75
+ }
76
+ LiblslImpl.ffi = ffi_napi_1.default;
77
+ exports.default = LiblslImpl;
78
+ const streamInfo = ref_napi_1.default.refType(ref_napi_1.default.types.void);
79
+ const outletType = ref_napi_1.default.refType(ref_napi_1.default.types.void);
80
+ const FloatArray = (0, ref_array_napi_1.default)(ref_napi_1.default.types.float);
81
+ //# sourceMappingURL=Liblsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Liblsl.js","sourceRoot":"","sources":["../src/Liblsl.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,30 @@
1
+ import { LslSample } from './Liblsl';
2
+ export default class LslOutlet {
3
+ private outletOptions;
4
+ constructor(options: LslOutletOptions);
5
+ private assertValidMaxBufferred;
6
+ private assertValidChunkSize;
7
+ private assertValidChannelFormat;
8
+ private assertValidSampleRate;
9
+ private assertValidChannelCount;
10
+ private isPositiveNumber;
11
+ private isPositiveIntegerOrZero;
12
+ private isPositiveInteger;
13
+ private get lsl();
14
+ pushSample(sample: LslSample): void;
15
+ }
16
+ declare const CHANNEL_FORMATS: readonly ["undefined", "float32", "double64", "string", "int32", "int16", "int8", "int64"];
17
+ export type ChannelFormat = (typeof CHANNEL_FORMATS)[number];
18
+ export interface LslOutletOptions {
19
+ name: string;
20
+ type: string;
21
+ channelCount: number;
22
+ sampleRate: number;
23
+ channelFormat: ChannelFormat;
24
+ sourceId: string;
25
+ manufacturer: string;
26
+ unit: string;
27
+ chunkSize: number;
28
+ maxBuffered: number;
29
+ }
30
+ export {};