reaper-osc 0.2.0 → 0.3.0

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/dist/Messages.js CHANGED
@@ -1,116 +1,116 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FloatMessage = exports.IntegerMessage = exports.ToggleMessage = exports.ActionMessage = exports.BooleanMessage = exports.StringMessage = exports.OscMessage = exports.FloatArgument = exports.BoolArgument = exports.IntArgument = exports.StringArgument = exports.OscArgument = exports.OscArgumentType = void 0;
4
- var OscArgumentType;
5
- (function (OscArgumentType) {
6
- /** 32-bit Integer */
7
- OscArgumentType["INT"] = "i";
8
- /** 64-bit Integer */
9
- OscArgumentType["LONG"] = "h";
10
- /** 32-bit Floating Point */
11
- OscArgumentType["FLOAT"] = "f";
12
- /** 64-bit Floating Point */
13
- OscArgumentType["DOUBLE"] = "d";
14
- /** String */
15
- OscArgumentType["STRING"] = "s";
16
- /** Single Character */
17
- OscArgumentType["CHAR"] = "c";
18
- /** Binary blob */
19
- OscArgumentType["BLOB"] = "b";
20
- /** True. No bytes are allocated in the argument data */
21
- OscArgumentType["TRUE"] = "T";
22
- /** False. No bytes are allocated in the argument data */
23
- OscArgumentType["FALSE"] = "F";
24
- /** Null. No bytes are allocated in the argument data */
25
- OscArgumentType["NULL"] = "N";
26
- /** Impulse aka bang. Used for event triggers. No bytes are allocated in the argument data */
27
- OscArgumentType["IMPULSE"] = "I";
28
- OscArgumentType["COLOR"] = "r";
29
- OscArgumentType["MIDI"] = "m";
30
- })(OscArgumentType = exports.OscArgumentType || (exports.OscArgumentType = {}));
31
- class OscArgument {
32
- constructor(type, value) {
33
- this.type = type;
34
- this.value = value;
35
- }
36
- }
37
- exports.OscArgument = OscArgument;
38
- class StringArgument extends OscArgument {
39
- constructor(value) {
40
- super(OscArgumentType.STRING, value);
41
- }
42
- }
43
- exports.StringArgument = StringArgument;
44
- class IntArgument extends OscArgument {
45
- constructor(value) {
46
- super(OscArgumentType.INT, value);
47
- }
48
- }
49
- exports.IntArgument = IntArgument;
50
- class BoolArgument extends IntArgument {
51
- constructor(value) {
52
- super(value ? 1 : 0);
53
- }
54
- }
55
- exports.BoolArgument = BoolArgument;
56
- class FloatArgument extends OscArgument {
57
- constructor(value) {
58
- super(OscArgumentType.FLOAT, value);
59
- }
60
- }
61
- exports.FloatArgument = FloatArgument;
62
- class OscMessage {
63
- constructor(address, args) {
64
- this.address = address;
65
- this.args = args !== null && args !== void 0 ? args : [];
66
- this.addressParts = address.split('/');
67
- }
68
- }
69
- exports.OscMessage = OscMessage;
70
- class StringMessage extends OscMessage {
71
- constructor(address, value) {
72
- super(address, [new StringArgument(value)]);
73
- }
74
- }
75
- exports.StringMessage = StringMessage;
76
- class BooleanMessage extends OscMessage {
77
- constructor(address, value) {
78
- const args = [new BoolArgument(value)];
79
- super(address, args);
80
- }
81
- }
82
- exports.BooleanMessage = BooleanMessage;
83
- class ActionMessage extends OscMessage {
84
- constructor(commandId, value = null) {
85
- if (typeof commandId === 'number') {
86
- commandId = commandId.toString();
87
- }
88
- const args = [new StringArgument(commandId)];
89
- if (value !== null) {
90
- args.push(new FloatArgument(value));
91
- }
92
- super('/action/str', args);
93
- }
94
- }
95
- exports.ActionMessage = ActionMessage;
96
- class ToggleMessage extends OscMessage {
97
- constructor(address) {
98
- super(address + '/toggle');
99
- }
100
- }
101
- exports.ToggleMessage = ToggleMessage;
102
- class IntegerMessage extends OscMessage {
103
- constructor(address, value) {
104
- const args = [new IntArgument(value)];
105
- super(address, args);
106
- }
107
- }
108
- exports.IntegerMessage = IntegerMessage;
109
- class FloatMessage extends OscMessage {
110
- constructor(address, value) {
111
- const args = [new FloatArgument(value)];
112
- super(address, args);
113
- }
114
- }
115
- exports.FloatMessage = FloatMessage;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FloatMessage = exports.IntegerMessage = exports.ToggleMessage = exports.ActionMessage = exports.BooleanMessage = exports.StringMessage = exports.OscMessage = exports.FloatArgument = exports.BoolArgument = exports.IntArgument = exports.StringArgument = exports.OscArgument = exports.OscArgumentType = void 0;
4
+ var OscArgumentType;
5
+ (function (OscArgumentType) {
6
+ /** 32-bit Integer */
7
+ OscArgumentType["INT"] = "i";
8
+ /** 64-bit Integer */
9
+ OscArgumentType["LONG"] = "h";
10
+ /** 32-bit Floating Point */
11
+ OscArgumentType["FLOAT"] = "f";
12
+ /** 64-bit Floating Point */
13
+ OscArgumentType["DOUBLE"] = "d";
14
+ /** String */
15
+ OscArgumentType["STRING"] = "s";
16
+ /** Single Character */
17
+ OscArgumentType["CHAR"] = "c";
18
+ /** Binary blob */
19
+ OscArgumentType["BLOB"] = "b";
20
+ /** True. No bytes are allocated in the argument data */
21
+ OscArgumentType["TRUE"] = "T";
22
+ /** False. No bytes are allocated in the argument data */
23
+ OscArgumentType["FALSE"] = "F";
24
+ /** Null. No bytes are allocated in the argument data */
25
+ OscArgumentType["NULL"] = "N";
26
+ /** Impulse aka bang. Used for event triggers. No bytes are allocated in the argument data */
27
+ OscArgumentType["IMPULSE"] = "I";
28
+ OscArgumentType["COLOR"] = "r";
29
+ OscArgumentType["MIDI"] = "m";
30
+ })(OscArgumentType = exports.OscArgumentType || (exports.OscArgumentType = {}));
31
+ class OscArgument {
32
+ constructor(type, value) {
33
+ this.type = type;
34
+ this.value = value;
35
+ }
36
+ }
37
+ exports.OscArgument = OscArgument;
38
+ class StringArgument extends OscArgument {
39
+ constructor(value) {
40
+ super(OscArgumentType.STRING, value);
41
+ }
42
+ }
43
+ exports.StringArgument = StringArgument;
44
+ class IntArgument extends OscArgument {
45
+ constructor(value) {
46
+ super(OscArgumentType.INT, value);
47
+ }
48
+ }
49
+ exports.IntArgument = IntArgument;
50
+ class BoolArgument extends IntArgument {
51
+ constructor(value) {
52
+ super(value ? 1 : 0);
53
+ }
54
+ }
55
+ exports.BoolArgument = BoolArgument;
56
+ class FloatArgument extends OscArgument {
57
+ constructor(value) {
58
+ super(OscArgumentType.FLOAT, value);
59
+ }
60
+ }
61
+ exports.FloatArgument = FloatArgument;
62
+ class OscMessage {
63
+ constructor(address, args) {
64
+ this.address = address;
65
+ this.args = args !== null && args !== void 0 ? args : [];
66
+ this.addressParts = address.split('/');
67
+ }
68
+ }
69
+ exports.OscMessage = OscMessage;
70
+ class StringMessage extends OscMessage {
71
+ constructor(address, value) {
72
+ super(address, [new StringArgument(value)]);
73
+ }
74
+ }
75
+ exports.StringMessage = StringMessage;
76
+ class BooleanMessage extends OscMessage {
77
+ constructor(address, value) {
78
+ const args = [new BoolArgument(value)];
79
+ super(address, args);
80
+ }
81
+ }
82
+ exports.BooleanMessage = BooleanMessage;
83
+ class ActionMessage extends OscMessage {
84
+ constructor(commandId, value = null) {
85
+ if (typeof commandId === 'number') {
86
+ commandId = commandId.toString();
87
+ }
88
+ const args = [new StringArgument(commandId)];
89
+ if (value !== null) {
90
+ args.push(new FloatArgument(value));
91
+ }
92
+ super('/action/str', args);
93
+ }
94
+ }
95
+ exports.ActionMessage = ActionMessage;
96
+ class ToggleMessage extends OscMessage {
97
+ constructor(address) {
98
+ super(address + '/toggle');
99
+ }
100
+ }
101
+ exports.ToggleMessage = ToggleMessage;
102
+ class IntegerMessage extends OscMessage {
103
+ constructor(address, value) {
104
+ const args = [new IntArgument(value)];
105
+ super(address, args);
106
+ }
107
+ }
108
+ exports.IntegerMessage = IntegerMessage;
109
+ class FloatMessage extends OscMessage {
110
+ constructor(address, value) {
111
+ const args = [new FloatArgument(value)];
112
+ super(address, args);
113
+ }
114
+ }
115
+ exports.FloatMessage = FloatMessage;
116
116
  //# sourceMappingURL=Messages.js.map
package/dist/Notify.d.ts CHANGED
@@ -1,28 +1,29 @@
1
- /** Allows a subscriber to be notified of changes to the object's properties */
2
- export interface INotifyPropertyChanged {
3
- /**
4
- * An event that can be subscribed to for property change notifications
5
- * @param property The name of the property to subscribe to
6
- * @param callback A callback to be called when the state of the specified property changes
7
- */
8
- onPropertyChanged(property: string, callback: () => void): void;
9
- }
10
- /**
11
- * Changes to the property will cause an event containing the name of the property to be fired by {@link INotifyPropertyChanged.onPropertyChanged}.
12
- * Initializing the property will trigger the event.
13
- *
14
- * @remarks
15
- * Requires {@link notifyOnPropertyChanged} decorator on the class
16
- *
17
- * @param overrideName Use to specify a different property name in the event. Useful for notifying changes to a get-only property from a change to a private backing file
18
- */
19
- export declare function notify<T>(overrideName?: keyof T): (target: Object, propertyKey: string) => void;
20
- /**
21
- * Adds an implementation of {@link INotifyPropertyChanged.onPropertyChanged} to the class.
22
- *
23
- * @remarks
24
- * Use in conjunction with {@link INotifyPropertyChanged} and decorating properties with {@link notify}
25
- */
26
- export declare function notifyOnPropertyChanged<T extends {
27
- new (...args: any[]): {};
28
- }>(constructor: T): T;
1
+ /** Allows a subscriber to be notified of changes to the object's properties */
2
+ export interface INotifyPropertyChanged {
3
+ /**
4
+ * An event that can be subscribed to for property change notifications
5
+ * @param property The name of the property to subscribe to
6
+ * @param callback A callback to be called when the state of the specified property changes
7
+ * @returns A function that unsubscribes the event handler
8
+ */
9
+ onPropertyChanged(property: string, callback: () => void): () => void;
10
+ }
11
+ /**
12
+ * Changes to the property will cause an event containing the name of the property to be fired by {@link INotifyPropertyChanged.onPropertyChanged}.
13
+ * Initializing the property will trigger the event.
14
+ *
15
+ * @remarks
16
+ * Requires {@link notifyOnPropertyChanged} decorator on the class
17
+ *
18
+ * @param overrideName Use to specify a different property name in the event. Useful for notifying changes to a get-only property from a change to a private backing file
19
+ */
20
+ export declare function notify<T>(overrideName?: keyof T): (target: Object, propertyKey: string) => void;
21
+ /**
22
+ * Adds an implementation of {@link INotifyPropertyChanged.onPropertyChanged} to the class.
23
+ *
24
+ * @remarks
25
+ * Use in conjunction with {@link INotifyPropertyChanged} and decorating properties with {@link notify}
26
+ */
27
+ export declare function notifyOnPropertyChanged<T extends {
28
+ new (...args: any[]): {};
29
+ }>(constructor: T): T;
package/dist/Notify.js CHANGED
@@ -1,64 +1,64 @@
1
- "use strict";
2
- /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
3
- /* eslint-disable @typescript-eslint/ban-types */
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.notifyOnPropertyChanged = exports.notify = void 0;
7
- const ste_simple_events_1 = require("ste-simple-events");
8
- /**
9
- * Changes to the property will cause an event containing the name of the property to be fired by {@link INotifyPropertyChanged.onPropertyChanged}.
10
- * Initializing the property will trigger the event.
11
- *
12
- * @remarks
13
- * Requires {@link notifyOnPropertyChanged} decorator on the class
14
- *
15
- * @param overrideName Use to specify a different property name in the event. Useful for notifying changes to a get-only property from a change to a private backing file
16
- */
17
- function notify(overrideName) {
18
- return (target, propertyKey) => {
19
- // Create a new prop to hold the value
20
- const valueKey = `_${propertyKey}Notify`;
21
- // Replace the decorated prop with getter/setter that handles the notifications
22
- Object.defineProperty(target, propertyKey, {
23
- set(value) {
24
- const oldValue = this[propertyKey];
25
- if (value === oldValue) {
26
- return;
27
- }
28
- this[valueKey] = value;
29
- if (this._propertyChanged === undefined) {
30
- return;
31
- }
32
- const propertyName = overrideName ? overrideName : propertyKey;
33
- this._propertyChanged.dispatch(propertyName);
34
- },
35
- get() {
36
- return this[valueKey];
37
- },
38
- });
39
- };
40
- }
41
- exports.notify = notify;
42
- /**
43
- * Adds an implementation of {@link INotifyPropertyChanged.onPropertyChanged} to the class.
44
- *
45
- * @remarks
46
- * Use in conjunction with {@link INotifyPropertyChanged} and decorating properties with {@link notify}
47
- */
48
- function notifyOnPropertyChanged(constructor) {
49
- return class extends constructor {
50
- constructor() {
51
- super(...arguments);
52
- this._propertyChanged = new ste_simple_events_1.SimpleEventDispatcher();
53
- }
54
- onPropertyChanged(property, callback) {
55
- this._propertyChanged.sub(prop => {
56
- if (property === prop) {
57
- callback();
58
- }
59
- });
60
- }
61
- };
62
- }
63
- exports.notifyOnPropertyChanged = notifyOnPropertyChanged;
1
+ "use strict";
2
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
3
+ /* eslint-disable @typescript-eslint/ban-types */
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.notifyOnPropertyChanged = exports.notify = void 0;
7
+ const ste_simple_events_1 = require("ste-simple-events");
8
+ /**
9
+ * Changes to the property will cause an event containing the name of the property to be fired by {@link INotifyPropertyChanged.onPropertyChanged}.
10
+ * Initializing the property will trigger the event.
11
+ *
12
+ * @remarks
13
+ * Requires {@link notifyOnPropertyChanged} decorator on the class
14
+ *
15
+ * @param overrideName Use to specify a different property name in the event. Useful for notifying changes to a get-only property from a change to a private backing file
16
+ */
17
+ function notify(overrideName) {
18
+ return (target, propertyKey) => {
19
+ // Create a new prop to hold the value
20
+ const valueKey = `_${propertyKey}Notify`;
21
+ // Replace the decorated prop with getter/setter that handles the notifications
22
+ Object.defineProperty(target, propertyKey, {
23
+ set(value) {
24
+ const oldValue = this[propertyKey];
25
+ if (value === oldValue) {
26
+ return;
27
+ }
28
+ this[valueKey] = value;
29
+ if (this._propertyChanged === undefined) {
30
+ return;
31
+ }
32
+ const propertyName = overrideName ? overrideName : propertyKey;
33
+ this._propertyChanged.dispatch(propertyName);
34
+ },
35
+ get() {
36
+ return this[valueKey];
37
+ },
38
+ });
39
+ };
40
+ }
41
+ exports.notify = notify;
42
+ /**
43
+ * Adds an implementation of {@link INotifyPropertyChanged.onPropertyChanged} to the class.
44
+ *
45
+ * @remarks
46
+ * Use in conjunction with {@link INotifyPropertyChanged} and decorating properties with {@link notify}
47
+ */
48
+ function notifyOnPropertyChanged(constructor) {
49
+ return class extends constructor {
50
+ constructor() {
51
+ super(...arguments);
52
+ this._propertyChanged = new ste_simple_events_1.SimpleEventDispatcher();
53
+ }
54
+ onPropertyChanged(property, callback) {
55
+ return this._propertyChanged.sub(prop => {
56
+ if (property === prop) {
57
+ callback();
58
+ }
59
+ });
60
+ }
61
+ };
62
+ }
63
+ exports.notifyOnProperty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iB,CAAC,QAAgB,EAAE,QAAoB;YAC7D,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gBACtC,IAAI,QAAQ,KAAK,IAAI,EAAE;oBACrB,QAAQ,EAAE,CAAC;iBACZ;YACH,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC;AAZD,0DAYC"}
package/dist/Reaper.d.ts CHANGED
@@ -1,93 +1,95 @@
1
- /**
2
- * Contains classes for controlling Reaper via OSC
3
- * @module
4
- */
5
- import { OscMessage } from './Messages';
6
- import { Track } from './Tracks';
7
- import { Transport } from './Transport';
8
- import { INotifyPropertyChanged } from './Notify';
9
- /**
10
- * Allows control of an instance of Reaper via OSC.
11
- *
12
- * @example
13
- * ```typescript
14
- * // Create an instance of Reaper using default settings
15
- * const reaper = new Reaper();
16
- * // Start OSC
17
- * reaper.startOsc();
18
- * // Give the port a chance to open, then tell Reaper to start playback
19
- * setTimeout(() => {reaper.transport.play();}, 100);
20
- *```
21
- */
22
- export declare class Reaper implements INotifyPropertyChanged {
23
- private _isMetronomeEnabled;
24
- private readonly _afterMessageReceived;
25
- private readonly _handlers;
26
- private _isReady;
27
- private readonly _masterTrack;
28
- private readonly _osc;
29
- private readonly _readyDispatcher;
30
- private readonly _tracks;
31
- private readonly _transport;
32
- constructor(config?: ReaperConfiguration);
33
- /** Indicates whether the metronome is enabled */
34
- get isMetronomeEnabled(): boolean;
35
- /** Indicates whether OSC is ready to send and receive messages */
36
- get isReady(): boolean;
37
- /** The master track */
38
- get master(): Track;
39
- onPropertyChanged(property: string, callback: () => void): void;
40
- /** An event that can be subscribed to for notification when OSC is ready */
41
- onReady(callback: () => void): void;
42
- /**
43
- * Triggers the action `Control surface: Refresh all surfaces` (Command ID: 41743)
44
- */
45
- refreshControlSurfaces(): void;
46
- /**
47
- * Send a message to Reaper via OSC. Messages may not be sent while {@link Reaper.isReady} is false.
48
- * @param message The OSC message to be sent
49
- */
50
- sendOscMessage(message: OscMessage): void;
51
- /** Open the OSC port and start listening for messages */
52
- startOsc(): void;
53
- /** Stop listening for OSC messages */
54
- stopOsc(): void;
55
- /** Toggle the metronome on or off */
56
- toggleMetronome(): void;
57
- /** The current bank of tracks */
58
- get tracks(): ReadonlyArray<Track>;
59
- /** Transport controls */
60
- get transport(): Transport;
61
- /**
62
- * Trigger a Reaper action
63
- * @param commandId The Command ID of the action to be triggered.
64
- * @param value The value to send for the action. Note that some actions expect the CC value (0-127) while others expect a decimal value between 0 and 1.
65
- * @example
66
- * ```typescript
67
- * // Trigger action 'Track: Toggle mute for master track'
68
- * reaper.triggerAction(14);
69
- * // Trigger SWS Extension action 'SWS/S&M: Live Config #1 - Apply config (MIDI/OSC only)' with a CC value of 3, selects config #3
70
- * reaper.triggerAction('_S&M_LIVECFG_APPLY1', 3);
71
- * // Trigger action 'Track: Set volume for track 01 (MIDI CC/OSC only)' with a value of 0.75, sets volume of track 1 to +0.0dB
72
- * reaper.triggerAction(20, 0.7156)
73
- * ```
74
- */
75
- triggerAction(commandId: number | string, value?: number | null): void;
76
- private initHandlers;
77
- private initOsc;
78
- }
79
- export declare class ReaperConfiguration {
80
- afterMessageReceived: ((message: OscMessage, handled: boolean) => void) | null;
81
- /** The address to listen for Reaper OSC messages on */
82
- localAddress: string;
83
- /** The port to listen for Reaper OSC messages on */
84
- localPort: number;
85
- /** Number of FX per track */
86
- numberOfFx: number;
87
- /** Number of tracks per bank */
88
- numberOfTracks: number;
89
- /** The address to send Reaper OSC messages to */
90
- remoteAddress: string;
91
- /** The port to send Reaper OSC messages to */
92
- remotePort: number;
93
- }
1
+ /**
2
+ * Contains classes for controlling Reaper via OSC
3
+ * @module
4
+ */
5
+ import { OscMessage } from './Messages';
6
+ import { Track } from './Tracks';
7
+ import { Transport } from './Transport';
8
+ import { INotifyPropertyChanged } from './Notify';
9
+ /**
10
+ * Allows control of an instance of Reaper via OSC.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * // Create an instance of Reaper using default settings
15
+ * const reaper = new Reaper();
16
+ * // Start OSC
17
+ * reaper.startOsc();
18
+ * // Give the port a chance to open, then tell Reaper to start playback
19
+ * setTimeout(() => {reaper.transport.play();}, 100);
20
+ *```
21
+ */
22
+ export declare class Reaper implements INotifyPropertyChanged {
23
+ private _isMetronomeEnabled;
24
+ private readonly _afterMessageReceived;
25
+ private readonly _handlers;
26
+ private _isReady;
27
+ private readonly _log;
28
+ private readonly _masterTrack;
29
+ private readonly _osc;
30
+ private readonly _tracks;
31
+ private readonly _transport;
32
+ constructor(config?: ReaperConfiguration);
33
+ /** Indicates whether the metronome is enabled */
34
+ get isMetronomeEnabled(): boolean;
35
+ /** Indicates whether OSC is ready to send and receive messages */
36
+ get isReady(): boolean;
37
+ /** The master track */
38
+ get master(): Track;
39
+ onPropertyChanged(property: string, callback: () => void): () => void;
40
+ /**
41
+ * Triggers the action `Control surface: Refresh all surfaces` (Command ID: 41743)
42
+ */
43
+ refreshControlSurfaces(): void;
44
+ /**
45
+ * Send a message to Reaper via OSC. Messages may not be sent while {@link Reaper.isReady} is false.
46
+ * @param message The OSC message to be sent
47
+ */
48
+ sendOscMessage(message: OscMessage): void;
49
+ /** Open the OSC port and start listening for messages */
50
+ start(): Promise<void>;
51
+ /** Stop listening for OSC messages */
52
+ stop(): Promise<void>;
53
+ /** Toggle the metronome on or off */
54
+ toggleMetronome(): void;
55
+ /** The current bank of tracks */
56
+ get tracks(): ReadonlyArray<Track>;
57
+ /** Transport controls */
58
+ get transport(): Transport;
59
+ /**
60
+ * Trigger a Reaper action
61
+ * @param commandId The Command ID of the action to be triggered.
62
+ * @param value The value to send for the action. Note that some actions expect the CC value (0-127) while others expect a decimal value between 0 and 1.
63
+ * @example
64
+ * ```typescript
65
+ * // Trigger action 'Track: Toggle mute for master track'
66
+ * reaper.triggerAction(14);
67
+ * // Trigger SWS Extension action 'SWS/S&M: Live Config #1 - Apply config (MIDI/OSC only)' with a CC value of 3, selects config #3
68
+ * reaper.triggerAction('_S&M_LIVECFG_APPLY1', 3);
69
+ * // Trigger action 'Track: Set volume for track 01 (MIDI CC/OSC only)' with a value of 0.75, sets volume of track 1 to +0.0dB
70
+ * reaper.triggerAction(20, 0.7156)
71
+ * ```
72
+ */
73
+ triggerAction(commandId: number | string, value?: number | null): void;
74
+ private initHandlers;
75
+ private initOsc;
76
+ }
77
+ export declare class ReaperConfiguration {
78
+ afterMessageReceived: ((message: OscMessage, handled: boolean) => void) | null;
79
+ /** The address to listen for Reaper OSC messages on */
80
+ localAddress: string;
81
+ /** The port to listen for Reaper OSC messages on */
82
+ localPort: number;
83
+ /** Function for logging messages. Defaults to logging to console */
84
+ log: Logger;
85
+ /** Number of FX per track */
86
+ numberOfFx: number;
87
+ /** Number of tracks per bank */
88
+ numberOfTracks: number;
89
+ /** The address to send Reaper OSC messages to */
90
+ remoteAddress: string;
91
+ /** The port to send Reaper OSC messages to */
92
+ remotePort: number;
93
+ }
94
+ export declare type LogLevel = 'debug' | 'info' | 'warn' | 'error';
95
+ export declare type Logger = (level: LogLevel, message: string, ...optionalParams: any[]) => void;