reaper-osc
Version:
Controls Cockos Reaper using OSC
92 lines • 4.79 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ViewPort = void 0;
/**
* Contains classes for controlling Reaper's arrange-view scroll and zoom
* @module
*/
const Commands_1 = require("./Client/Commands");
/**
* Controls the Reaper arrange-view scroll position and zoom level.
*
* Two styles of command are available for each axis:
* - **Boolean (held)**: `startScrollLeft()` / `stopScrollLeft()`, `startZoomInX()` / `stopZoomInX()`
* etc. — models a held button. Scrolling/zooming continues while active and stops when
* released, matching the behaviour of hardware controller buttons. Mirrors how
* {@link Transport.startRewinding} works.
* - **Rotary**: `scrollX(value)` / `zoomX(value)` etc. — sends a single relative step to
* a rotary encoder address. Positive values move right/down/zoom-in; negative values move
* left/up/zoom-out. Larger magnitudes scroll/zoom further per message.
*
* Reaper does not send feedback for any scroll or zoom command, so these are fire-and-forget.
*/
class ViewPort {
constructor(_send) {
this._send = _send;
}
// ─── Scroll: boolean (held) ───────────────────────────────────────────────
/** Start scrolling the arrange view left */
startScrollLeft() { this._send(Commands_1.SetScrollLeft(true)); }
/** Stop scrolling the arrange view left */
stopScrollLeft() { this._send(Commands_1.SetScrollLeft(false)); }
/** Start scrolling the arrange view right */
startScrollRight() { this._send(Commands_1.SetScrollRight(true)); }
/** Stop scrolling the arrange view right */
stopScrollRight() { this._send(Commands_1.SetScrollRight(false)); }
/** Start scrolling the arrange view up */
startScrollUp() { this._send(Commands_1.SetScrollUp(true)); }
/** Stop scrolling the arrange view up */
stopScrollUp() { this._send(Commands_1.SetScrollUp(false)); }
/** Start scrolling the arrange view down */
startScrollDown() { this._send(Commands_1.SetScrollDown(true)); }
/** Stop scrolling the arrange view down */
stopScrollDown() { this._send(Commands_1.SetScrollDown(false)); }
// ─── Zoom: boolean (held) ─────────────────────────────────────────────────
/** Start zooming in horizontally (X axis) */
startZoomInX() { this._send(Commands_1.SetZoomInX(true)); }
/** Stop zooming in horizontally (X axis) */
stopZoomInX() { this._send(Commands_1.SetZoomInX(false)); }
/** Start zooming out horizontally (X axis) */
startZoomOutX() { this._send(Commands_1.SetZoomOutX(true)); }
/** Stop zooming out horizontally (X axis) */
stopZoomOutX() { this._send(Commands_1.SetZoomOutX(false)); }
/** Start zooming in vertically (Y axis) */
startZoomInY() { this._send(Commands_1.SetZoomInY(true)); }
/** Stop zooming in vertically (Y axis) */
stopZoomInY() { this._send(Commands_1.SetZoomInY(false)); }
/** Start zooming out vertically (Y axis) */
startZoomOutY() { this._send(Commands_1.SetZoomOutY(true)); }
/** Stop zooming out vertically (Y axis) */
stopZoomOutY() { this._send(Commands_1.SetZoomOutY(false)); }
// ─── Scroll/Zoom: rotary ──────────────────────────────────────────────────
/**
* Scroll the arrange view horizontally by a relative amount.
* Positive values scroll right; negative values scroll left.
* Larger magnitudes scroll further per message.
* @param value Relative scroll amount
*/
scrollX(value) { this._send(Commands_1.ScrollX(value)); }
/**
* Scroll the arrange view vertically by a relative amount.
* Positive values scroll down; negative values scroll up.
* Larger magnitudes scroll further per message.
* @param value Relative scroll amount
*/
scrollY(value) { this._send(Commands_1.ScrollY(value)); }
/**
* Adjust horizontal zoom by a relative amount.
* Positive values zoom in; negative values zoom out.
* Larger magnitudes zoom further per message.
* @param value Relative zoom amount
*/
zoomX(value) { this._send(Commands_1.ZoomX(value)); }
/**
* Adjust vertical zoom by a relative amount.
* Positive values zoom in (expand track height); negative values zoom out.
* Larger magnitudes zoom further per message.
* @param value Relative zoom amount
*/
zoomY(value) { this._send(Commands_1.ZoomY(value)); }
}
exports.ViewPort = ViewPort;
//# sourceMappingURL=ViewPort.js.map