reaper-osc 0.2.0 → 0.3.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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Ben Simpson
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Ben Simpson
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 CHANGED
@@ -1,36 +1,32 @@
1
- # reaper-osc
2
-
3
- A Node.js library for controlling Cockos Reaper using Open Sound Control (OSC).
4
-
5
- ## API Reference
6
-
7
- You can find the API documentation [here](https://lykaiosnz.github.io/reaper-osc.js/)
8
-
9
- ## Installation
10
-
11
- Yarn: `yarn add reaper-osc`
12
- npm: `npm i reaper-osc`
13
-
14
- ## Basic usage
15
-
16
- ```javascript
17
- import {Reaper} from 'reaper-osc';
18
-
19
- var reaper = new Reaper();
20
-
21
- // Start listening for messages
22
- reaper.startOsc();
23
-
24
- // Subscribe to state changes
25
- reaper.tracks[0].onPropertyChanged('isMuted', () => {
26
- console.log(`Track 1 was ${reaper.tracks[0].isMuted ? 'muted' : 'unmuted'}`);
27
- });
28
-
29
- // Wait for the port to open, then start sending commands
30
- reaper.onReady(() => {
31
- reaper.transport.play();
32
-
33
- reaper.tracks[0].mute();
34
- reaper.tracks[0].unmute();
35
- });
1
+ # reaper-osc
2
+
3
+ A Node.js library for controlling Cockos Reaper using Open Sound Control (OSC).
4
+
5
+ ## API Reference
6
+
7
+ You can find the API documentation [here](https://lykaiosnz.github.io/reaper-osc.js/)
8
+
9
+ ## Installation
10
+
11
+ Yarn: `yarn add reaper-osc`
12
+ npm: `npm i reaper-osc`
13
+
14
+ ## Basic usage
15
+
16
+ ```javascript
17
+ import {Reaper} from 'reaper-osc';
18
+
19
+ var reaper = new Reaper();
20
+
21
+ // Start listening for messages
22
+ await reaper.start()
23
+
24
+ // Subscribe to state changes
25
+ reaper.tracks[0].onPropertyChanged('isMuted', () => {
26
+ console.log(`Track 1 was ${reaper.tracks[0].isMuted ? 'muted' : 'unmuted'}`);
27
+ });
28
+
29
+ reaper.transport.play();
30
+ reaper.tracks[0].mute();
31
+ reaper.tracks[0].unmute();
36
32
  ```
package/dist/Fx.d.ts CHANGED
@@ -1,72 +1,72 @@
1
- /**
2
- * Contains classes for controlling FX in Reaper
3
- * @module
4
- */
5
- import { INotifyPropertyChanged } from './Notify';
6
- import { IMessageHandler } from './Handlers';
7
- import { ISendOscMessage, OscMessage } from './Messages';
8
- /**
9
- * A Reaper FX.
10
- *
11
- * @example
12
- * ```typescript
13
- * // Open an FX UI window
14
- * fx.openUi();
15
- * // Bypass the FX
16
- * fx.bypass();
17
- * ```
18
- */
19
- export declare class Fx implements INotifyPropertyChanged {
20
- readonly oscAddress: string;
21
- private _isBypassed;
22
- private _isUiOpen;
23
- private _name;
24
- private _preset;
25
- protected readonly _handlers: IMessageHandler[];
26
- protected readonly _sendOscMessage: ISendOscMessage;
27
- /**
28
- * @param name The FX name
29
- * @param oscAddress The OSC address of the FX
30
- * @param sendOscMessage A callback used to send OSC messages to Reaper
31
- */
32
- constructor(name: string, oscAddress: string, sendOscMessage: ISendOscMessage);
33
- /** Bypass the FX */
34
- bypass(): void;
35
- /** Close the UI of the FX */
36
- closeUi(): void;
37
- /** Indicates whether the FX is bypassed */
38
- get isBypassed(): boolean;
39
- /** Indicates whether the FX's UI is open */
40
- get isUiOpen(): boolean;
41
- /** The name of the FX */
42
- get name(): string;
43
- /** Load the next FX preset */
44
- nextPreset(): void;
45
- onPropertyChanged(property: string, callback: () => void): void;
46
- /** Open the UI of the FX */
47
- openUi(): void;
48
- /** The name of the current preset, if any */
49
- get preset(): string;
50
- /** Load the previous FX preset */
51
- previousPreset(): void;
52
- /**
53
- * Receive and handle an OSC message
54
- * @param message The message to be handled
55
- */
56
- receive(message: OscMessage): boolean;
57
- /** Unbypass the FX */
58
- unbypass(): void;
59
- }
60
- /**
61
- * An FX on a {@link Track}
62
- */
63
- export declare class TrackFx extends Fx {
64
- readonly trackNumber: number;
65
- readonly fxNumber: number;
66
- /**
67
- * @param trackNumber The number of the track the FX is on
68
- * @param fxNumber The FX number in the current bank
69
- * @param sendOscMessage A callback used to send OSC messages to Reaper
70
- */
71
- constructor(trackNumber: number, fxNumber: number, sendOscMessage: ISendOscMessage);
72
- }
1
+ /**
2
+ * Contains classes for controlling FX in Reaper
3
+ * @module
4
+ */
5
+ import { INotifyPropertyChanged } from './Notify';
6
+ import { IMessageHandler } from './Handlers';
7
+ import { ISendOscMessage, OscMessage } from './Messages';
8
+ /**
9
+ * A Reaper FX.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * // Open an FX UI window
14
+ * fx.openUi();
15
+ * // Bypass the FX
16
+ * fx.bypass();
17
+ * ```
18
+ */
19
+ export declare class Fx implements INotifyPropertyChanged {
20
+ readonly oscAddress: string;
21
+ private _isBypassed;
22
+ private _isUiOpen;
23
+ private _name;
24
+ private _preset;
25
+ protected readonly _handlers: IMessageHandler[];
26
+ protected readonly _sendOscMessage: ISendOscMessage;
27
+ /**
28
+ * @param name The FX name
29
+ * @param oscAddress The OSC address of the FX
30
+ * @param sendOscMessage A callback used to send OSC messages to Reaper
31
+ */
32
+ constructor(name: string, oscAddress: string, sendOscMessage: ISendOscMessage);
33
+ /** Bypass the FX */
34
+ bypass(): void;
35
+ /** Close the UI of the FX */
36
+ closeUi(): void;
37
+ /** Indicates whether the FX is bypassed */
38
+ get isBypassed(): boolean;
39
+ /** Indicates whether the FX's UI is open */
40
+ get isUiOpen(): boolean;
41
+ /** The name of the FX */
42
+ get name(): string;
43
+ /** Load the next FX preset */
44
+ nextPreset(): void;
45
+ onPropertyChanged(property: string, callback: () => void): () => void;
46
+ /** Open the UI of the FX */
47
+ openUi(): void;
48
+ /** The name of the current preset, if any */
49
+ get preset(): string;
50
+ /** Load the previous FX preset */
51
+ previousPreset(): void;
52
+ /**
53
+ * Receive and handle an OSC message
54
+ * @param message The message to be handled
55
+ */
56
+ receive(message: OscMessage): boolean;
57
+ /** Unbypass the FX */
58
+ unbypass(): void;
59
+ }
60
+ /**
61
+ * An FX on a {@link Track}
62
+ */
63
+ export declare class TrackFx extends Fx {
64
+ readonly trackNumber: number;
65
+ readonly fxNumber: number;
66
+ /**
67
+ * @param trackNumber The number of the track the FX is on
68
+ * @param fxNumber The FX number in the current bank
69
+ * @param sendOscMessage A callback used to send OSC messages to Reaper
70
+ */
71
+ constructor(trackNumber: number, fxNumber: number, sendOscMessage: ISendOscMessage);
72
+ }
package/dist/Fx.js CHANGED
@@ -1,137 +1,137 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.TrackFx = exports.Fx = void 0;
10
- /**
11
- * Contains classes for controlling FX in Reaper
12
- * @module
13
- */
14
- const Notify_1 = require("./Notify");
15
- const Handlers_1 = require("./Handlers");
16
- const Messages_1 = require("./Messages");
17
- /**
18
- * A Reaper FX.
19
- *
20
- * @example
21
- * ```typescript
22
- * // Open an FX UI window
23
- * fx.openUi();
24
- * // Bypass the FX
25
- * fx.bypass();
26
- * ```
27
- */
28
- let Fx = class Fx {
29
- /**
30
- * @param name The FX name
31
- * @param oscAddress The OSC address of the FX
32
- * @param sendOscMessage A callback used to send OSC messages to Reaper
33
- */
34
- constructor(name, oscAddress, sendOscMessage) {
35
- this.oscAddress = oscAddress;
36
- this._isBypassed = false;
37
- this._isUiOpen = false;
38
- this._preset = 'No preset';
39
- this._handlers = [
40
- new Handlers_1.StringMessageHandler(this.oscAddress + '/name', value => (this._name = value)),
41
- new Handlers_1.BooleanMessageHandler(this.oscAddress + '/bypass', value => (this._isBypassed = !value)),
42
- new Handlers_1.BooleanMessageHandler(this.oscAddress + '/openui', value => (this._isUiOpen = value)),
43
- new Handlers_1.StringMessageHandler(this.oscAddress + '/preset', value => (this._preset = value)),
44
- ];
45
- this._sendOscMessage = sendOscMessage;
46
- this._name = name;
47
- }
48
- /** Bypass the FX */
49
- bypass() {
50
- this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/bypass', false)); // false to bypass
51
- }
52
- /** Close the UI of the FX */
53
- closeUi() {
54
- this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/openui', false));
55
- }
56
- /** Indicates whether the FX is bypassed */
57
- get isBypassed() {
58
- return this._isBypassed;
59
- }
60
- /** Indicates whether the FX's UI is open */
61
- get isUiOpen() {
62
- return this._isUiOpen;
63
- }
64
- /** The name of the FX */
65
- get name() {
66
- return this._name;
67
- }
68
- /** Load the next FX preset */
69
- nextPreset() {
70
- this._sendOscMessage(new Messages_1.OscMessage(this.oscAddress + '/preset+'));
71
- }
72
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
73
- onPropertyChanged(property, callback) {
74
- throw new Error('not implemented');
75
- }
76
- /** Open the UI of the FX */
77
- openUi() {
78
- this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/openui', true));
79
- }
80
- /** The name of the current preset, if any */
81
- get preset() {
82
- return this._preset;
83
- }
84
- /** Load the previous FX preset */
85
- previousPreset() {
86
- this._sendOscMessage(new Messages_1.OscMessage(this.oscAddress + '/preset-'));
87
- }
88
- /**
89
- * Receive and handle an OSC message
90
- * @param message The message to be handled
91
- */
92
- receive(message) {
93
- for (const handler of this._handlers) {
94
- if (handler.handle(message)) {
95
- return true;
96
- }
97
- }
98
- return false;
99
- }
100
- /** Unbypass the FX */
101
- unbypass() {
102
- this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/bypass', true)); // true to unbypass
103
- }
104
- };
105
- __decorate([
106
- Notify_1.notify('isBypassed')
107
- ], Fx.prototype, "_isBypassed", void 0);
108
- __decorate([
109
- Notify_1.notify('isUiOpen')
110
- ], Fx.prototype, "_isUiOpen", void 0);
111
- __decorate([
112
- Notify_1.notify('name')
113
- ], Fx.prototype, "_name", void 0);
114
- __decorate([
115
- Notify_1.notify('preset')
116
- ], Fx.prototype, "_preset", void 0);
117
- Fx = __decorate([
118
- Notify_1.notifyOnPropertyChanged
119
- ], Fx);
120
- exports.Fx = Fx;
121
- /**
122
- * An FX on a {@link Track}
123
- */
124
- class TrackFx extends Fx {
125
- /**
126
- * @param trackNumber The number of the track the FX is on
127
- * @param fxNumber The FX number in the current bank
128
- * @param sendOscMessage A callback used to send OSC messages to Reaper
129
- */
130
- constructor(trackNumber, fxNumber, sendOscMessage) {
131
- super(`Fx ${fxNumber}`, `/track/${trackNumber}/fx/${fxNumber}`, sendOscMessage);
132
- this.trackNumber = trackNumber;
133
- this.fxNumber = fxNumber;
134
- }
135
- }
136
- exports.TrackFx = TrackFx;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TrackFx = exports.Fx = void 0;
10
+ /**
11
+ * Contains classes for controlling FX in Reaper
12
+ * @module
13
+ */
14
+ const Notify_1 = require("./Notify");
15
+ const Handlers_1 = require("./Handlers");
16
+ const Messages_1 = require("./Messages");
17
+ /**
18
+ * A Reaper FX.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * // Open an FX UI window
23
+ * fx.openUi();
24
+ * // Bypass the FX
25
+ * fx.bypass();
26
+ * ```
27
+ */
28
+ let Fx = class Fx {
29
+ /**
30
+ * @param name The FX name
31
+ * @param oscAddress The OSC address of the FX
32
+ * @param sendOscMessage A callback used to send OSC messages to Reaper
33
+ */
34
+ constructor(name, oscAddress, sendOscMessage) {
35
+ this.oscAddress = oscAddress;
36
+ this._isBypassed = false;
37
+ this._isUiOpen = false;
38
+ this._preset = 'No preset';
39
+ this._handlers = [
40
+ new Handlers_1.StringMessageHandler(this.oscAddress + '/name', value => (this._name = value)),
41
+ new Handlers_1.BooleanMessageHandler(this.oscAddress + '/bypass', value => (this._isBypassed = !value)),
42
+ new Handlers_1.BooleanMessageHandler(this.oscAddress + '/openui', value => (this._isUiOpen = value)),
43
+ new Handlers_1.StringMessageHandler(this.oscAddress + '/preset', value => (this._preset = value)),
44
+ ];
45
+ this._sendOscMessage = sendOscMessage;
46
+ this._name = name;
47
+ }
48
+ /** Bypass the FX */
49
+ bypass() {
50
+ this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/bypass', false)); // false to bypass
51
+ }
52
+ /** Close the UI of the FX */
53
+ closeUi() {
54
+ this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/openui', false));
55
+ }
56
+ /** Indicates whether the FX is bypassed */
57
+ get isBypassed() {
58
+ return this._isBypassed;
59
+ }
60
+ /** Indicates whether the FX's UI is open */
61
+ get isUiOpen() {
62
+ return this._isUiOpen;
63
+ }
64
+ /** The name of the FX */
65
+ get name() {
66
+ return this._name;
67
+ }
68
+ /** Load the next FX preset */
69
+ nextPreset() {
70
+ this._sendOscMessage(new Messages_1.OscMessage(this.oscAddress + '/preset+'));
71
+ }
72
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
73
+ onPropertyChanged(property, callback) {
74
+ throw new Error('not implemented');
75
+ }
76
+ /** Open the UI of the FX */
77
+ openUi() {
78
+ this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/openui', true));
79
+ }
80
+ /** The name of the current preset, if any */
81
+ get preset() {
82
+ return this._preset;
83
+ }
84
+ /** Load the previous FX preset */
85
+ previousPreset() {
86
+ this._sendOscMessage(new Messages_1.OscMessage(this.oscAddress + '/preset-'));
87
+ }
88
+ /**
89
+ * Receive and handle an OSC message
90
+ * @param message The message to be handled
91
+ */
92
+ receive(message) {
93
+ for (const handler of this._handlers) {
94
+ if (handler.handle(message)) {
95
+ return true;
96
+ }
97
+ }
98
+ return false;
99
+ }
100
+ /** Unbypass the FX */
101
+ unbypass() {
102
+ this._sendOscMessage(new Messages_1.BooleanMessage(this.oscAddress + '/bypass', true)); // true to unbypass
103
+ }
104
+ };
105
+ __decorate([
106
+ Notify_1.notify('isBypassed')
107
+ ], Fx.prototype, "_isBypassed", void 0);
108
+ __decorate([
109
+ Notify_1.notify('isUiOpen')
110
+ ], Fx.prototype, "_isUiOpen", void 0);
111
+ __decorate([
112
+ Notify_1.notify('name')
113
+ ], Fx.prototype, "_name", void 0);
114
+ __decorate([
115
+ Notify_1.notify('preset')
116
+ ], Fx.prototype, "_preset", void 0);
117
+ Fx = __decorate([
118
+ Notify_1.notifyOnPropertyChanged
119
+ ], Fx);
120
+ exports.Fx = Fx;
121
+ /**
122
+ * An FX on a {@link Track}
123
+ */
124
+ class TrackFx extends Fx {
125
+ /**
126
+ * @param trackNumber The number of the track the FX is on
127
+ * @param fxNumber The FX number in the current bank
128
+ * @param sendOscMessage A callback used to send OSC messages to Reaper
129
+ */
130
+ constructor(trackNumber, fxNumber, sendOscMessage) {
131
+ super(`Fx ${fxNumber}`, `/track/${trackNumber}/fx/${fxNumber}`, sendOscMessage);
132
+ this.trackNumber = trackNumber;
133
+ this.fxNumber = fxNumber;
134
+ }
135
+ }
136
+ exports.TrackFx = TrackFx;
137
137
  //# sourceMappingURL=Fx.js.map
@@ -1,62 +1,62 @@
1
- import { OscMessage } from './Messages';
2
- import { Track } from './Tracks';
3
- import { Transport } from './Transport';
4
- import { TrackFx } from './Fx';
5
- /** An OSC message handler */
6
- export interface IMessageHandler {
7
- /**
8
- * Handle an OSC message
9
- * @param message The message to handle
10
- */
11
- handle(message: OscMessage): boolean;
12
- }
13
- /**
14
- * Routes messages to the appropriate track
15
- * @param trackSelector A function that can be used to get a track
16
- * */
17
- export declare class TrackMessageHandler implements IMessageHandler {
18
- private readonly trackSelector;
19
- constructor(trackSelector: (trackNumber: number) => Track | null);
20
- handle(message: OscMessage): boolean;
21
- }
22
- /** Routes messages to the transport */
23
- export declare class TransportMessageHandler implements IMessageHandler {
24
- private readonly transport;
25
- constructor(transport: Transport);
26
- handle(message: OscMessage): boolean;
27
- }
28
- /** Routes messages to the appropriate track fx */
29
- export declare class TrackFxMessageHandler implements IMessageHandler {
30
- private readonly fxSelector;
31
- constructor(fxSelector: (fxNumber: number) => TrackFx | null);
32
- handle(message: OscMessage): boolean;
33
- }
34
- /**
35
- * Handles an OSC message containing a single boolean value (0 or 1)
36
- * @param address The address of the message to handle
37
- * @param callback The callback to be called when a message with the specified OSC address is received
38
- */
39
- export declare class BooleanMessageHandler implements IMessageHandler {
40
- readonly address: string;
41
- private readonly _callback;
42
- constructor(address: string, callback: (value: boolean) => void);
43
- handle(message: OscMessage): boolean;
44
- }
45
- export declare class IntegerMessageHandler implements IMessageHandler {
46
- readonly address: string;
47
- private readonly _callback;
48
- constructor(address: string, callback: (value: number) => void);
49
- handle(message: OscMessage): boolean;
50
- }
51
- export declare class StringMessageHandler implements IMessageHandler {
52
- readonly address: string;
53
- private readonly _callback;
54
- constructor(address: string, callback: (value: string) => void);
55
- handle(message: OscMessage): boolean;
56
- }
57
- export declare class FloatMessageHandler implements IMessageHandler {
58
- readonly address: string;
59
- private readonly _callback;
60
- constructor(address: string, callback: (value: number) => void);
61
- handle(message: OscMessage): boolean;
62
- }
1
+ import { OscMessage } from './Messages';
2
+ import { Track } from './Tracks';
3
+ import { Transport } from './Transport';
4
+ import { TrackFx } from './Fx';
5
+ /** An OSC message handler */
6
+ export interface IMessageHandler {
7
+ /**
8
+ * Handle an OSC message
9
+ * @param message The message to handle
10
+ */
11
+ handle(message: OscMessage): boolean;
12
+ }
13
+ /**
14
+ * Routes messages to the appropriate track
15
+ * @param trackSelector A function that can be used to get a track
16
+ * */
17
+ export declare class TrackMessageHandler implements IMessageHandler {
18
+ private readonly trackSelector;
19
+ constructor(trackSelector: (trackNumber: number) => Track | null);
20
+ handle(message: OscMessage): boolean;
21
+ }
22
+ /** Routes messages to the transport */
23
+ export declare class TransportMessageHandler implements IMessageHandler {
24
+ private readonly transport;
25
+ constructor(transport: Transport);
26
+ handle(message: OscMessage): boolean;
27
+ }
28
+ /** Routes messages to the appropriate track fx */
29
+ export declare class TrackFxMessageHandler implements IMessageHandler {
30
+ private readonly fxSelector;
31
+ constructor(fxSelector: (fxNumber: number) => TrackFx | null);
32
+ handle(message: OscMessage): boolean;
33
+ }
34
+ /**
35
+ * Handles an OSC message containing a single boolean value (0 or 1)
36
+ * @param address The address of the message to handle
37
+ * @param callback The callback to be called when a message with the specified OSC address is received
38
+ */
39
+ export declare class BooleanMessageHandler implements IMessageHandler {
40
+ readonly address: string;
41
+ private readonly _callback;
42
+ constructor(address: string, callback: (value: boolean) => void);
43
+ handle(message: OscMessage): boolean;
44
+ }
45
+ export declare class IntegerMessageHandler implements IMessageHandler {
46
+ readonly address: string;
47
+ private readonly _callback;
48
+ constructor(address: string, callback: (value: number) => void);
49
+ handle(message: OscMessage): boolean;
50
+ }
51
+ export declare class StringMessageHandler implements IMessageHandler {
52
+ readonly address: string;
53
+ private readonly _callback;
54
+ constructor(address: string, callback: (value: string) => void);
55
+ handle(message: OscMessage): boolean;
56
+ }
57
+ export declare class FloatMessageHandler implements IMessageHandler {
58
+ readonly address: string;
59
+ private readonly _callback;
60
+ constructor(address: string, callback: (value: number) => void);
61
+ handle(message: OscMessage): boolean;
62
+ }