Sync
This commit is contained in:
@@ -357,14 +357,36 @@ export class PedalboardSplitItem extends PedalboardItem {
|
||||
}
|
||||
|
||||
|
||||
let TWO_POWER_52 = 4503599627370496; // Maximum Javascript integer value.
|
||||
let TWO_POWER_48 = 281474976710656; // Number of possible instance IDs for Main Pedalboards.
|
||||
let MAX_INSTANCE_ID = TWO_POWER_48;
|
||||
|
||||
|
||||
|
||||
export enum InstanceType {
|
||||
MainPedalboard,
|
||||
MainInsert,
|
||||
AuxInsert
|
||||
}
|
||||
|
||||
|
||||
export class Pedalboard implements Deserializable<Pedalboard> {
|
||||
|
||||
static readonly CHANNEL_ROUTER_CONTROLS_INSTANCE_ID = -4; // Reserved Instance ID for Router Main Inserts.
|
||||
static readonly CHANNEL_ROUTER_MAIN_INSERT_ID = -5; // Reserved Instance ID for Router Main Inserts.
|
||||
static readonly CHANNEL_ROUTER_AUX_INSERT_ID = -6; // Reserved Instance ID for Router Aux inserts.
|
||||
|
||||
static readonly MAIN_INSERT_INSTANCE_BASE = TWO_POWER_52-2*MAX_INSTANCE_ID;
|
||||
static readonly AUX_INSERT_INSTANCE_BASE = TWO_POWER_52-1*MAX_INSTANCE_ID;
|
||||
|
||||
static readonly START_CONTROL = -2; // synthetic PedalboardItem for input volume.
|
||||
static readonly END_CONTROL = -3; // synthetic PedalboardItem for output volume.
|
||||
static readonly CHANNEL_MIXER_INSTANCE_ID = -4; // Synthetic instance ID for the channel routing mixer.
|
||||
static readonly MAIN_INSERT_START_CONTROL_ID = Pedalboard.MAIN_INSERT_INSTANCE_BASE + MAX_INSTANCE_ID -2;
|
||||
static readonly MAIN_INSERT_END_CONTROL_ID = Pedalboard.MAIN_INSERT_INSTANCE_BASE + MAX_INSTANCE_ID -3;
|
||||
static readonly AUX_INSERT_START_CONTROL_ID = Pedalboard.AUX_INSERT_INSTANCE_BASE + MAX_INSTANCE_ID -2;
|
||||
static readonly AUX_INSERT_END_CONTROL_ID = Pedalboard.AUX_INSERT_INSTANCE_BASE + MAX_INSTANCE_ID -3;
|
||||
|
||||
|
||||
static readonly START_PEDALBOARD_ITEM_URI = "uri://two-play/pipedal/pedalboard#Start";
|
||||
static readonly END_PEDALBOARD_ITEM_URI = "uri://two-play/pipedal/pedalboard#End";
|
||||
|
||||
@@ -373,7 +395,7 @@ export class Pedalboard implements Deserializable<Pedalboard> {
|
||||
this.input_volume_db = input.input_volume_db;
|
||||
this.output_volume_db = input.output_volume_db;
|
||||
this.items = PedalboardItem.deserializeArray(input.items);
|
||||
this.nextInstanceId = input.nextInstanceId ?? -1;
|
||||
this.nextInstanceId = input.nextInstanceId ?? 0;
|
||||
this.snapshots = input.snapshots ? Snapshot.deserializeArray(input.snapshots): [];
|
||||
this.selectedSnapshot = input.selectedSnapshot;
|
||||
this.pathProperties = input.pathProperties;
|
||||
@@ -381,6 +403,25 @@ export class Pedalboard implements Deserializable<Pedalboard> {
|
||||
return this;
|
||||
}
|
||||
|
||||
static getInstanceTypeFromInstanceId(instanceId: number): InstanceType {
|
||||
if (instanceId >= Pedalboard.MAIN_INSERT_INSTANCE_BASE) {
|
||||
return InstanceType.MainInsert;
|
||||
}
|
||||
if (instanceId >= Pedalboard.AUX_INSERT_INSTANCE_BASE) {
|
||||
return InstanceType.AuxInsert;
|
||||
}
|
||||
return InstanceType.MainPedalboard;
|
||||
}
|
||||
getInstanceType(): InstanceType {
|
||||
if (this.nextInstanceId >= Pedalboard.MAIN_INSERT_INSTANCE_BASE) {
|
||||
return InstanceType.MainInsert;
|
||||
}
|
||||
if (this.nextInstanceId >= Pedalboard.AUX_INSERT_INSTANCE_BASE) {
|
||||
return InstanceType.AuxInsert;
|
||||
}
|
||||
return InstanceType.MainPedalboard;
|
||||
}
|
||||
|
||||
clone(): Pedalboard {
|
||||
return new Pedalboard().deserialize(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user