spessasynth_core 4.0.7 → 4.0.9
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/index.d.ts +49 -68
- package/dist/index.js +566 -620
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1706,14 +1706,6 @@ var interpolationTypes = {
|
|
|
1706
1706
|
nearestNeighbor: 1,
|
|
1707
1707
|
hermite: 2
|
|
1708
1708
|
};
|
|
1709
|
-
var synthDisplayTypes = {
|
|
1710
|
-
// This message type is used to display text on the SoundCanvas display.
|
|
1711
|
-
soundCanvasText: 0,
|
|
1712
|
-
// This message type is used to display text on a Yamaha XG synthesizer.
|
|
1713
|
-
yamahaXGText: 1,
|
|
1714
|
-
// This message type is used to display a dot matrix display (pixelated graphics) on a SoundCanvas synthesizer.
|
|
1715
|
-
soundCanvasDotMatrix: 2
|
|
1716
|
-
};
|
|
1717
1709
|
var dataEntryStates = {
|
|
1718
1710
|
Idle: 0,
|
|
1719
1711
|
RPCoarse: 1,
|
|
@@ -6966,10 +6958,9 @@ var Generator = class {
|
|
|
6966
6958
|
}
|
|
6967
6959
|
}
|
|
6968
6960
|
}
|
|
6969
|
-
write(genData
|
|
6961
|
+
write(genData) {
|
|
6970
6962
|
writeWord(genData, this.generatorType);
|
|
6971
6963
|
writeWord(genData, this.generatorValue);
|
|
6972
|
-
indexes.gen++;
|
|
6973
6964
|
}
|
|
6974
6965
|
toString() {
|
|
6975
6966
|
return `${Object.keys(generatorTypes).find((k) => generatorTypes[k] === this.generatorType)}: ${this.generatorValue}`;
|
|
@@ -7114,30 +7105,6 @@ var BasicZone = class {
|
|
|
7114
7105
|
this.velRange = { ...zone.velRange };
|
|
7115
7106
|
this.keyRange = { ...zone.keyRange };
|
|
7116
7107
|
}
|
|
7117
|
-
getGenCount() {
|
|
7118
|
-
let count = this.generators.filter(
|
|
7119
|
-
(g) => g.generatorType !== generatorTypes.sampleID && g.generatorType !== generatorTypes.instrument && g.generatorType !== generatorTypes.keyRange && g.generatorType !== generatorTypes.velRange
|
|
7120
|
-
).length;
|
|
7121
|
-
if (this.hasVelRange) {
|
|
7122
|
-
count++;
|
|
7123
|
-
}
|
|
7124
|
-
if (this.hasKeyRange) {
|
|
7125
|
-
count++;
|
|
7126
|
-
}
|
|
7127
|
-
return count;
|
|
7128
|
-
}
|
|
7129
|
-
write(genData, modData, bagData, indexes, bank) {
|
|
7130
|
-
const generatorIndex = indexes.gen;
|
|
7131
|
-
const modulatorIndex = indexes.mod;
|
|
7132
|
-
writeWord(bagData.pdta, generatorIndex & 65535);
|
|
7133
|
-
writeWord(bagData.pdta, modulatorIndex & 65535);
|
|
7134
|
-
writeWord(bagData.xdta, generatorIndex >> 16);
|
|
7135
|
-
writeWord(bagData.xdta, modulatorIndex >> 16);
|
|
7136
|
-
indexes.bag++;
|
|
7137
|
-
const gens = this.getWriteGenerators(bank);
|
|
7138
|
-
gens.forEach((g) => g.write(genData, indexes));
|
|
7139
|
-
this.modulators.forEach((m) => m.write(modData, indexes));
|
|
7140
|
-
}
|
|
7141
7108
|
/**
|
|
7142
7109
|
* Filters the generators and prepends the range generators.
|
|
7143
7110
|
*/
|
|
@@ -7214,9 +7181,6 @@ var BasicPresetZone = class extends BasicZone {
|
|
|
7214
7181
|
this._instrument = instrument;
|
|
7215
7182
|
this._instrument.linkTo(this.parentPreset);
|
|
7216
7183
|
}
|
|
7217
|
-
getGenCount() {
|
|
7218
|
-
return super.getGenCount() + 1;
|
|
7219
|
-
}
|
|
7220
7184
|
getWriteGenerators(bank) {
|
|
7221
7185
|
const gens = super.getWriteGenerators(bank);
|
|
7222
7186
|
if (!bank) {
|
|
@@ -7281,9 +7245,6 @@ var BasicInstrumentZone = class extends BasicZone {
|
|
|
7281
7245
|
this._sample = sample;
|
|
7282
7246
|
sample.linkTo(this.parentInstrument);
|
|
7283
7247
|
}
|
|
7284
|
-
getGenCount() {
|
|
7285
|
-
return super.getGenCount() + 1;
|
|
7286
|
-
}
|
|
7287
7248
|
getWriteGenerators(bank) {
|
|
7288
7249
|
const gens = super.getWriteGenerators(bank);
|
|
7289
7250
|
const sampleID = bank.samples.indexOf(this.sample);
|
|
@@ -7536,31 +7497,12 @@ var BasicInstrument = class {
|
|
|
7536
7497
|
}
|
|
7537
7498
|
}
|
|
7538
7499
|
}
|
|
7539
|
-
|
|
7540
|
-
const modCount = this.zones.reduce(
|
|
7541
|
-
(count, zone) => zone.modulators.length + count,
|
|
7542
|
-
0
|
|
7543
|
-
) + this.globalZone.modulators.length;
|
|
7544
|
-
const genCount = this.zones.reduce((count, zone) => zone.getGenCount() + count, 0) + this.globalZone.getGenCount();
|
|
7545
|
-
return {
|
|
7546
|
-
mod: modCount * MOD_BYTE_SIZE,
|
|
7547
|
-
bag: (this.zones.length + 1) * BAG_BYTE_SIZE,
|
|
7548
|
-
// global zone
|
|
7549
|
-
gen: genCount * GEN_BYTE_SIZE,
|
|
7550
|
-
hdr: INST_BYTE_SIZE
|
|
7551
|
-
};
|
|
7552
|
-
}
|
|
7553
|
-
write(genData, modData, bagData, instData, indexes, bank) {
|
|
7500
|
+
write(instData, index) {
|
|
7554
7501
|
SpessaSynthInfo(`%cWriting ${this.name}...`, consoleColors.info);
|
|
7555
7502
|
writeBinaryStringIndexed(instData.pdta, this.name.substring(0, 20), 20);
|
|
7556
7503
|
writeBinaryStringIndexed(instData.xdta, this.name.substring(20), 20);
|
|
7557
|
-
writeWord(instData.pdta,
|
|
7558
|
-
writeWord(instData.xdta,
|
|
7559
|
-
indexes.hdr += this.zones.length + 1;
|
|
7560
|
-
this.globalZone.write(genData, modData, bagData, indexes, bank);
|
|
7561
|
-
this.zones.forEach(
|
|
7562
|
-
(z) => z.write(genData, modData, bagData, indexes, bank)
|
|
7563
|
-
);
|
|
7504
|
+
writeWord(instData.pdta, index & 65535);
|
|
7505
|
+
writeWord(instData.xdta, index >>> 16);
|
|
7564
7506
|
}
|
|
7565
7507
|
};
|
|
7566
7508
|
|
|
@@ -7665,20 +7607,6 @@ var BasicPreset = class {
|
|
|
7665
7607
|
matches(preset) {
|
|
7666
7608
|
return MIDIPatchTools.matches(this, preset);
|
|
7667
7609
|
}
|
|
7668
|
-
getSize() {
|
|
7669
|
-
const modCount = this.zones.reduce(
|
|
7670
|
-
(count, zone) => zone.modulators.length + count,
|
|
7671
|
-
0
|
|
7672
|
-
) + this.globalZone.modulators.length;
|
|
7673
|
-
const genCount = this.zones.reduce((count, zone) => zone.getGenCount() + count, 0) + this.globalZone.getGenCount();
|
|
7674
|
-
return {
|
|
7675
|
-
mod: modCount * MOD_BYTE_SIZE,
|
|
7676
|
-
bag: (this.zones.length + 1) * BAG_BYTE_SIZE,
|
|
7677
|
-
// global zone
|
|
7678
|
-
gen: genCount * GEN_BYTE_SIZE,
|
|
7679
|
-
hdr: PHDR_BYTE_SIZE
|
|
7680
|
-
};
|
|
7681
|
-
}
|
|
7682
7610
|
/**
|
|
7683
7611
|
* Returns the synthesis data from this preset
|
|
7684
7612
|
* @param midiNote the MIDI note number
|
|
@@ -7936,7 +7864,13 @@ var BasicPreset = class {
|
|
|
7936
7864
|
}
|
|
7937
7865
|
return outputInstrument;
|
|
7938
7866
|
}
|
|
7939
|
-
|
|
7867
|
+
// noinspection JSUnusedGlobalSymbols
|
|
7868
|
+
/**
|
|
7869
|
+
* Writes the SF2 header
|
|
7870
|
+
* @param phdrData
|
|
7871
|
+
* @param index
|
|
7872
|
+
*/
|
|
7873
|
+
write(phdrData, index) {
|
|
7940
7874
|
SpessaSynthInfo(`%cWriting ${this.name}...`, consoleColors.info);
|
|
7941
7875
|
writeBinaryStringIndexed(phdrData.pdta, this.name.substring(0, 20), 20);
|
|
7942
7876
|
writeBinaryStringIndexed(phdrData.xdta, this.name.substring(20), 20);
|
|
@@ -7949,17 +7883,12 @@ var BasicPreset = class {
|
|
|
7949
7883
|
}
|
|
7950
7884
|
writeWord(phdrData.pdta, wBank);
|
|
7951
7885
|
phdrData.xdta.currentIndex += 4;
|
|
7952
|
-
writeWord(phdrData.pdta,
|
|
7953
|
-
writeWord(phdrData.xdta,
|
|
7886
|
+
writeWord(phdrData.pdta, index & 65535);
|
|
7887
|
+
writeWord(phdrData.xdta, index >> 16);
|
|
7954
7888
|
writeDword(phdrData.pdta, this.library);
|
|
7955
7889
|
writeDword(phdrData.pdta, this.genre);
|
|
7956
7890
|
writeDword(phdrData.pdta, this.morphology);
|
|
7957
7891
|
phdrData.xdta.currentIndex += 12;
|
|
7958
|
-
indexes.hdr += this.zones.length + 1;
|
|
7959
|
-
this.globalZone.write(genData, modData, bagData, indexes, bank);
|
|
7960
|
-
this.zones.forEach(
|
|
7961
|
-
(z) => z.write(genData, modData, bagData, indexes, bank)
|
|
7962
|
-
);
|
|
7963
7892
|
}
|
|
7964
7893
|
};
|
|
7965
7894
|
|
|
@@ -8971,7 +8900,7 @@ function getTuning(byte1, byte2, byte3) {
|
|
|
8971
8900
|
return { midiNote, centTuning: fraction * 61e-4 };
|
|
8972
8901
|
}
|
|
8973
8902
|
function systemExclusiveInternal(syx, channelOffset = 0) {
|
|
8974
|
-
const
|
|
8903
|
+
const manufacturer = syx[0];
|
|
8975
8904
|
if (this.privateProps.masterParameters.deviceID !== ALL_CHANNELS_OR_DIFFERENT_ACTION && syx[1] !== 127) {
|
|
8976
8905
|
if (this.privateProps.masterParameters.deviceID !== syx[1]) {
|
|
8977
8906
|
return;
|
|
@@ -8988,16 +8917,7 @@ function systemExclusiveInternal(syx, channelOffset = 0) {
|
|
|
8988
8917
|
consoleColors.value
|
|
8989
8918
|
);
|
|
8990
8919
|
}
|
|
8991
|
-
|
|
8992
|
-
SpessaSynthInfo(
|
|
8993
|
-
`%cUnrecognized Roland %cGS %cSysEx: %c${arrayToHexString(syx)}`,
|
|
8994
|
-
consoleColors.warn,
|
|
8995
|
-
consoleColors.recognized,
|
|
8996
|
-
consoleColors.warn,
|
|
8997
|
-
consoleColors.unrecognized
|
|
8998
|
-
);
|
|
8999
|
-
}
|
|
9000
|
-
switch (type) {
|
|
8920
|
+
switch (manufacturer) {
|
|
9001
8921
|
default:
|
|
9002
8922
|
SpessaSynthInfo(
|
|
9003
8923
|
`%cUnrecognized SysEx: %c${arrayToHexString(syx)}`,
|
|
@@ -9005,8 +8925,9 @@ function systemExclusiveInternal(syx, channelOffset = 0) {
|
|
|
9005
8925
|
consoleColors.unrecognized
|
|
9006
8926
|
);
|
|
9007
8927
|
break;
|
|
9008
|
-
// Non realtime
|
|
8928
|
+
// Non realtime GM
|
|
9009
8929
|
case 126:
|
|
8930
|
+
// Realtime GM
|
|
9010
8931
|
case 127:
|
|
9011
8932
|
switch (syx[2]) {
|
|
9012
8933
|
case 4: {
|
|
@@ -9204,501 +9125,514 @@ function systemExclusiveInternal(syx, channelOffset = 0) {
|
|
|
9204
9125
|
// http://www.bandtrax.com.au/sysex.htm
|
|
9205
9126
|
// https://cdn.roland.com/assets/media/pdf/AT-20R_30R_MI.pdf
|
|
9206
9127
|
case 65:
|
|
9207
|
-
if (syx[
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9218
|
-
|
|
9219
|
-
|
|
9220
|
-
|
|
9221
|
-
|
|
9222
|
-
|
|
9223
|
-
|
|
9224
|
-
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
|
|
9261
|
-
|
|
9262
|
-
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
|
|
9267
|
-
|
|
9268
|
-
|
|
9269
|
-
|
|
9270
|
-
consoleColors.info,
|
|
9271
|
-
consoleColors.value
|
|
9272
|
-
);
|
|
9273
|
-
} else {
|
|
9274
|
-
channelObject.randomPan = false;
|
|
9275
|
-
channelObject.controllerChange(
|
|
9276
|
-
midiControllers.pan,
|
|
9277
|
-
panPosition
|
|
9278
|
-
);
|
|
9279
|
-
}
|
|
9280
|
-
break;
|
|
9281
|
-
}
|
|
9282
|
-
// Chorus send
|
|
9283
|
-
case 33:
|
|
9284
|
-
channelObject.controllerChange(
|
|
9285
|
-
midiControllers.chorusDepth,
|
|
9286
|
-
messageValue
|
|
9287
|
-
);
|
|
9288
|
-
break;
|
|
9289
|
-
// Reverb send
|
|
9290
|
-
case 34:
|
|
9291
|
-
channelObject.controllerChange(
|
|
9292
|
-
midiControllers.reverbDepth,
|
|
9293
|
-
messageValue
|
|
9294
|
-
);
|
|
9295
|
-
break;
|
|
9296
|
-
case 64:
|
|
9297
|
-
case 65:
|
|
9298
|
-
case 66:
|
|
9299
|
-
case 67:
|
|
9300
|
-
case 68:
|
|
9301
|
-
case 69:
|
|
9302
|
-
case 70:
|
|
9303
|
-
case 71:
|
|
9304
|
-
case 72:
|
|
9305
|
-
case 73:
|
|
9306
|
-
case 74:
|
|
9307
|
-
case 75: {
|
|
9308
|
-
const tuningBytes = syx.length - 9;
|
|
9309
|
-
const newTuning = new Int8Array(12);
|
|
9310
|
-
for (let i = 0; i < tuningBytes; i++) {
|
|
9311
|
-
newTuning[i] = syx[i + 7] - 64;
|
|
9312
|
-
}
|
|
9313
|
-
channelObject.setOctaveTuning(newTuning);
|
|
9314
|
-
const cents = messageValue - 64;
|
|
9315
|
-
niceLogging(
|
|
9316
|
-
channel,
|
|
9317
|
-
newTuning.join(" "),
|
|
9318
|
-
"octave scale tuning",
|
|
9319
|
-
"cents"
|
|
9320
|
-
);
|
|
9321
|
-
channelObject.setTuning(cents);
|
|
9322
|
-
break;
|
|
9323
|
-
}
|
|
9324
|
-
}
|
|
9325
|
-
return;
|
|
9326
|
-
} else if ((syx[5] & 32) > 0) {
|
|
9327
|
-
const channel = [
|
|
9328
|
-
9,
|
|
9329
|
-
0,
|
|
9330
|
-
1,
|
|
9331
|
-
2,
|
|
9332
|
-
3,
|
|
9333
|
-
4,
|
|
9334
|
-
5,
|
|
9335
|
-
6,
|
|
9336
|
-
7,
|
|
9337
|
-
8,
|
|
9338
|
-
10,
|
|
9339
|
-
11,
|
|
9340
|
-
12,
|
|
9341
|
-
13,
|
|
9342
|
-
14,
|
|
9343
|
-
15
|
|
9344
|
-
][syx[5] & 15] + channelOffset;
|
|
9345
|
-
const channelObject = this.midiChannels[channel];
|
|
9346
|
-
const centeredValue = messageValue - 64;
|
|
9347
|
-
const normalizedValue = centeredValue / 64;
|
|
9348
|
-
const normalizedNotCentered = messageValue / 128;
|
|
9349
|
-
const setupReceivers = (source, sourceName, bipolar = false) => {
|
|
9350
|
-
switch (syx[6] & 15) {
|
|
9351
|
-
case 0:
|
|
9352
|
-
if (source === NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel) {
|
|
9353
|
-
channelObject.controllerChange(
|
|
9354
|
-
midiControllers.registeredParameterMSB,
|
|
9355
|
-
0
|
|
9128
|
+
if (syx[3] === 18) {
|
|
9129
|
+
let notRecognized2 = function() {
|
|
9130
|
+
SpessaSynthInfo(
|
|
9131
|
+
`%cUnrecognized Roland %cGS %cSysEx: %c${arrayToHexString(syx)}`,
|
|
9132
|
+
consoleColors.warn,
|
|
9133
|
+
consoleColors.recognized,
|
|
9134
|
+
consoleColors.warn,
|
|
9135
|
+
consoleColors.unrecognized
|
|
9136
|
+
);
|
|
9137
|
+
};
|
|
9138
|
+
var notRecognized = notRecognized2;
|
|
9139
|
+
switch (syx[2]) {
|
|
9140
|
+
case 66: {
|
|
9141
|
+
const messageValue = syx[7];
|
|
9142
|
+
if (syx[4] === 64 || syx[4] === 0 && syx[6] === 127) {
|
|
9143
|
+
if ((syx[5] & 16) > 0) {
|
|
9144
|
+
const channel = [
|
|
9145
|
+
9,
|
|
9146
|
+
0,
|
|
9147
|
+
1,
|
|
9148
|
+
2,
|
|
9149
|
+
3,
|
|
9150
|
+
4,
|
|
9151
|
+
5,
|
|
9152
|
+
6,
|
|
9153
|
+
7,
|
|
9154
|
+
8,
|
|
9155
|
+
10,
|
|
9156
|
+
11,
|
|
9157
|
+
12,
|
|
9158
|
+
13,
|
|
9159
|
+
14,
|
|
9160
|
+
15
|
|
9161
|
+
][syx[5] & 15] + channelOffset;
|
|
9162
|
+
const channelObject = this.midiChannels[channel];
|
|
9163
|
+
switch (syx[6]) {
|
|
9164
|
+
default:
|
|
9165
|
+
notRecognized2();
|
|
9166
|
+
break;
|
|
9167
|
+
case 21: {
|
|
9168
|
+
const isDrums = messageValue > 0 && syx[5] >> 4 > 0;
|
|
9169
|
+
channelObject.setGSDrums(isDrums);
|
|
9170
|
+
SpessaSynthInfo(
|
|
9171
|
+
`%cChannel %c${channel}%c ${isDrums ? "is now a drum channel" : "now isn't a drum channel"}%c via: %c${arrayToHexString(syx)}`,
|
|
9172
|
+
consoleColors.info,
|
|
9173
|
+
consoleColors.value,
|
|
9174
|
+
consoleColors.recognized,
|
|
9175
|
+
consoleColors.info,
|
|
9176
|
+
consoleColors.value
|
|
9177
|
+
);
|
|
9178
|
+
return;
|
|
9179
|
+
}
|
|
9180
|
+
case 22: {
|
|
9181
|
+
const keyShift = messageValue - 64;
|
|
9182
|
+
channelObject.setCustomController(
|
|
9183
|
+
customControllers.channelKeyShift,
|
|
9184
|
+
keyShift
|
|
9185
|
+
);
|
|
9186
|
+
niceLogging(
|
|
9187
|
+
channel,
|
|
9188
|
+
keyShift,
|
|
9189
|
+
"key shift",
|
|
9190
|
+
"keys"
|
|
9356
9191
|
);
|
|
9192
|
+
return;
|
|
9193
|
+
}
|
|
9194
|
+
// Pan position
|
|
9195
|
+
case 28: {
|
|
9196
|
+
const panPosition = messageValue;
|
|
9197
|
+
if (panPosition === 0) {
|
|
9198
|
+
channelObject.randomPan = true;
|
|
9199
|
+
SpessaSynthInfo(
|
|
9200
|
+
`%cRandom pan is set to %cON%c for %c${channel}`,
|
|
9201
|
+
consoleColors.info,
|
|
9202
|
+
consoleColors.recognized,
|
|
9203
|
+
consoleColors.info,
|
|
9204
|
+
consoleColors.value
|
|
9205
|
+
);
|
|
9206
|
+
} else {
|
|
9207
|
+
channelObject.randomPan = false;
|
|
9208
|
+
channelObject.controllerChange(
|
|
9209
|
+
midiControllers.pan,
|
|
9210
|
+
panPosition
|
|
9211
|
+
);
|
|
9212
|
+
}
|
|
9213
|
+
break;
|
|
9214
|
+
}
|
|
9215
|
+
// Chorus send
|
|
9216
|
+
case 33:
|
|
9357
9217
|
channelObject.controllerChange(
|
|
9358
|
-
midiControllers.
|
|
9359
|
-
|
|
9218
|
+
midiControllers.chorusDepth,
|
|
9219
|
+
messageValue
|
|
9360
9220
|
);
|
|
9221
|
+
break;
|
|
9222
|
+
// Reverb send
|
|
9223
|
+
case 34:
|
|
9361
9224
|
channelObject.controllerChange(
|
|
9362
|
-
midiControllers.
|
|
9363
|
-
|
|
9225
|
+
midiControllers.reverbDepth,
|
|
9226
|
+
messageValue
|
|
9364
9227
|
);
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9228
|
+
break;
|
|
9229
|
+
case 64:
|
|
9230
|
+
case 65:
|
|
9231
|
+
case 66:
|
|
9232
|
+
case 67:
|
|
9233
|
+
case 68:
|
|
9234
|
+
case 69:
|
|
9235
|
+
case 70:
|
|
9236
|
+
case 71:
|
|
9237
|
+
case 72:
|
|
9238
|
+
case 73:
|
|
9239
|
+
case 74:
|
|
9240
|
+
case 75: {
|
|
9241
|
+
const tuningBytes = syx.length - 9;
|
|
9242
|
+
const newTuning = new Int8Array(12);
|
|
9243
|
+
for (let i = 0; i < tuningBytes; i++) {
|
|
9244
|
+
newTuning[i] = syx[i + 7] - 64;
|
|
9245
|
+
}
|
|
9246
|
+
channelObject.setOctaveTuning(
|
|
9247
|
+
newTuning
|
|
9371
9248
|
);
|
|
9249
|
+
const cents = messageValue - 64;
|
|
9372
9250
|
niceLogging(
|
|
9373
9251
|
channel,
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
"
|
|
9252
|
+
newTuning.join(" "),
|
|
9253
|
+
"octave scale tuning",
|
|
9254
|
+
"cents"
|
|
9377
9255
|
);
|
|
9256
|
+
channelObject.setTuning(cents);
|
|
9257
|
+
break;
|
|
9378
9258
|
}
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9387
|
-
|
|
9388
|
-
|
|
9389
|
-
|
|
9390
|
-
|
|
9391
|
-
|
|
9392
|
-
|
|
9393
|
-
|
|
9394
|
-
|
|
9395
|
-
|
|
9396
|
-
|
|
9397
|
-
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9410
|
-
|
|
9411
|
-
|
|
9412
|
-
|
|
9413
|
-
|
|
9414
|
-
|
|
9415
|
-
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
|
|
9471
|
-
|
|
9472
|
-
|
|
9473
|
-
|
|
9474
|
-
|
|
9475
|
-
|
|
9476
|
-
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9480
|
-
|
|
9481
|
-
|
|
9482
|
-
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9490
|
-
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
|
|
9259
|
+
}
|
|
9260
|
+
return;
|
|
9261
|
+
} else if ((syx[5] & 32) > 0) {
|
|
9262
|
+
const channel = [
|
|
9263
|
+
9,
|
|
9264
|
+
0,
|
|
9265
|
+
1,
|
|
9266
|
+
2,
|
|
9267
|
+
3,
|
|
9268
|
+
4,
|
|
9269
|
+
5,
|
|
9270
|
+
6,
|
|
9271
|
+
7,
|
|
9272
|
+
8,
|
|
9273
|
+
10,
|
|
9274
|
+
11,
|
|
9275
|
+
12,
|
|
9276
|
+
13,
|
|
9277
|
+
14,
|
|
9278
|
+
15
|
|
9279
|
+
][syx[5] & 15] + channelOffset;
|
|
9280
|
+
const channelObject = this.midiChannels[channel];
|
|
9281
|
+
const centeredValue = messageValue - 64;
|
|
9282
|
+
const normalizedValue = centeredValue / 64;
|
|
9283
|
+
const normalizedNotCentered = messageValue / 128;
|
|
9284
|
+
const setupReceivers = (source, sourceName, bipolar = false) => {
|
|
9285
|
+
switch (syx[6] & 15) {
|
|
9286
|
+
case 0:
|
|
9287
|
+
if (source === NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel) {
|
|
9288
|
+
channelObject.controllerChange(
|
|
9289
|
+
midiControllers.registeredParameterMSB,
|
|
9290
|
+
0
|
|
9291
|
+
);
|
|
9292
|
+
channelObject.controllerChange(
|
|
9293
|
+
midiControllers.registeredParameterLSB,
|
|
9294
|
+
0
|
|
9295
|
+
);
|
|
9296
|
+
channelObject.controllerChange(
|
|
9297
|
+
midiControllers.dataEntryMSB,
|
|
9298
|
+
Math.floor(centeredValue)
|
|
9299
|
+
);
|
|
9300
|
+
} else {
|
|
9301
|
+
channelObject.sysExModulators.setModulator(
|
|
9302
|
+
source,
|
|
9303
|
+
generatorTypes.fineTune,
|
|
9304
|
+
centeredValue * 100,
|
|
9305
|
+
bipolar
|
|
9306
|
+
);
|
|
9307
|
+
niceLogging(
|
|
9308
|
+
channel,
|
|
9309
|
+
centeredValue,
|
|
9310
|
+
`${sourceName} pitch control`,
|
|
9311
|
+
"semitones"
|
|
9312
|
+
);
|
|
9313
|
+
}
|
|
9314
|
+
break;
|
|
9315
|
+
case 1:
|
|
9316
|
+
channelObject.sysExModulators.setModulator(
|
|
9317
|
+
source,
|
|
9318
|
+
generatorTypes.initialFilterFc,
|
|
9319
|
+
normalizedValue * 9600,
|
|
9320
|
+
bipolar
|
|
9321
|
+
);
|
|
9322
|
+
niceLogging(
|
|
9323
|
+
channel,
|
|
9324
|
+
normalizedValue * 9600,
|
|
9325
|
+
`${sourceName} pitch control`,
|
|
9326
|
+
"cents"
|
|
9327
|
+
);
|
|
9328
|
+
break;
|
|
9329
|
+
case 2:
|
|
9330
|
+
channelObject.sysExModulators.setModulator(
|
|
9331
|
+
source,
|
|
9332
|
+
generatorTypes.initialAttenuation,
|
|
9333
|
+
normalizedValue * 960,
|
|
9334
|
+
// Spec says "100%" so 960cB in sf2
|
|
9335
|
+
bipolar
|
|
9336
|
+
);
|
|
9337
|
+
niceLogging(
|
|
9338
|
+
channel,
|
|
9339
|
+
normalizedValue * 960,
|
|
9340
|
+
`${sourceName} amplitude`,
|
|
9341
|
+
"cB"
|
|
9342
|
+
);
|
|
9343
|
+
break;
|
|
9344
|
+
// Rate control is ignored as it is in hertz
|
|
9345
|
+
case 4:
|
|
9346
|
+
channelObject.sysExModulators.setModulator(
|
|
9347
|
+
source,
|
|
9348
|
+
generatorTypes.vibLfoToPitch,
|
|
9349
|
+
normalizedNotCentered * 600,
|
|
9350
|
+
bipolar
|
|
9351
|
+
);
|
|
9352
|
+
niceLogging(
|
|
9353
|
+
channel,
|
|
9354
|
+
normalizedNotCentered * 600,
|
|
9355
|
+
`${sourceName} LFO1 pitch depth`,
|
|
9356
|
+
"cents"
|
|
9357
|
+
);
|
|
9358
|
+
break;
|
|
9359
|
+
case 5:
|
|
9360
|
+
channelObject.sysExModulators.setModulator(
|
|
9361
|
+
source,
|
|
9362
|
+
generatorTypes.vibLfoToFilterFc,
|
|
9363
|
+
normalizedNotCentered * 2400,
|
|
9364
|
+
bipolar
|
|
9365
|
+
);
|
|
9366
|
+
niceLogging(
|
|
9367
|
+
channel,
|
|
9368
|
+
normalizedNotCentered * 2400,
|
|
9369
|
+
`${sourceName} LFO1 filter depth`,
|
|
9370
|
+
"cents"
|
|
9371
|
+
);
|
|
9372
|
+
break;
|
|
9373
|
+
case 6:
|
|
9374
|
+
channelObject.sysExModulators.setModulator(
|
|
9375
|
+
source,
|
|
9376
|
+
generatorTypes.vibLfoToVolume,
|
|
9377
|
+
normalizedValue * 960,
|
|
9378
|
+
bipolar
|
|
9379
|
+
);
|
|
9380
|
+
niceLogging(
|
|
9381
|
+
channel,
|
|
9382
|
+
normalizedValue * 960,
|
|
9383
|
+
`${sourceName} LFO1 amplitude depth`,
|
|
9384
|
+
"cB"
|
|
9385
|
+
);
|
|
9386
|
+
break;
|
|
9387
|
+
// Rate control is ignored as it is in hertz
|
|
9388
|
+
case 8:
|
|
9389
|
+
channelObject.sysExModulators.setModulator(
|
|
9390
|
+
source,
|
|
9391
|
+
generatorTypes.modLfoToPitch,
|
|
9392
|
+
normalizedNotCentered * 600,
|
|
9393
|
+
bipolar
|
|
9394
|
+
);
|
|
9395
|
+
niceLogging(
|
|
9396
|
+
channel,
|
|
9397
|
+
normalizedNotCentered * 600,
|
|
9398
|
+
`${sourceName} LFO2 pitch depth`,
|
|
9399
|
+
"cents"
|
|
9400
|
+
);
|
|
9401
|
+
break;
|
|
9402
|
+
case 9:
|
|
9403
|
+
channelObject.sysExModulators.setModulator(
|
|
9404
|
+
source,
|
|
9405
|
+
generatorTypes.modLfoToFilterFc,
|
|
9406
|
+
normalizedNotCentered * 2400,
|
|
9407
|
+
bipolar
|
|
9408
|
+
);
|
|
9409
|
+
niceLogging(
|
|
9410
|
+
channel,
|
|
9411
|
+
normalizedNotCentered * 2400,
|
|
9412
|
+
`${sourceName} LFO2 filter depth`,
|
|
9413
|
+
"cents"
|
|
9414
|
+
);
|
|
9415
|
+
break;
|
|
9416
|
+
case 10:
|
|
9417
|
+
channelObject.sysExModulators.setModulator(
|
|
9418
|
+
source,
|
|
9419
|
+
generatorTypes.modLfoToVolume,
|
|
9420
|
+
normalizedValue * 960,
|
|
9421
|
+
bipolar
|
|
9422
|
+
);
|
|
9423
|
+
niceLogging(
|
|
9424
|
+
channel,
|
|
9425
|
+
normalizedValue * 960,
|
|
9426
|
+
`${sourceName} LFO2 amplitude depth`,
|
|
9427
|
+
"cB"
|
|
9428
|
+
);
|
|
9429
|
+
break;
|
|
9430
|
+
}
|
|
9431
|
+
};
|
|
9432
|
+
switch (syx[6] & 240) {
|
|
9433
|
+
default:
|
|
9434
|
+
notRecognized2();
|
|
9435
|
+
break;
|
|
9436
|
+
case 0:
|
|
9437
|
+
setupReceivers(
|
|
9438
|
+
midiControllers.modulationWheel,
|
|
9439
|
+
"mod wheel"
|
|
9440
|
+
);
|
|
9441
|
+
break;
|
|
9442
|
+
case 16:
|
|
9443
|
+
setupReceivers(
|
|
9444
|
+
NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel,
|
|
9445
|
+
"pitch wheel",
|
|
9446
|
+
true
|
|
9447
|
+
);
|
|
9448
|
+
break;
|
|
9449
|
+
case 32:
|
|
9450
|
+
setupReceivers(
|
|
9451
|
+
NON_CC_INDEX_OFFSET + modulatorSources.channelPressure,
|
|
9452
|
+
"channel pressure"
|
|
9453
|
+
);
|
|
9454
|
+
break;
|
|
9455
|
+
case 48:
|
|
9456
|
+
setupReceivers(
|
|
9457
|
+
NON_CC_INDEX_OFFSET + modulatorSources.polyPressure,
|
|
9458
|
+
"poly pressure"
|
|
9459
|
+
);
|
|
9460
|
+
break;
|
|
9461
|
+
}
|
|
9462
|
+
return;
|
|
9463
|
+
} else if (syx[5] === 0) {
|
|
9464
|
+
switch (syx[6]) {
|
|
9465
|
+
default:
|
|
9466
|
+
notRecognized2();
|
|
9467
|
+
break;
|
|
9468
|
+
case 127:
|
|
9469
|
+
if (messageValue === 0) {
|
|
9470
|
+
SpessaSynthInfo(
|
|
9471
|
+
"%cGS Reset received!",
|
|
9472
|
+
consoleColors.info
|
|
9473
|
+
);
|
|
9474
|
+
this.resetAllControllers(false);
|
|
9475
|
+
this.setMasterParameter(
|
|
9476
|
+
"midiSystem",
|
|
9477
|
+
"gs"
|
|
9478
|
+
);
|
|
9479
|
+
} else if (messageValue === 127) {
|
|
9480
|
+
SpessaSynthInfo(
|
|
9481
|
+
"%cGS system off, switching to GM",
|
|
9482
|
+
consoleColors.info
|
|
9483
|
+
);
|
|
9484
|
+
this.resetAllControllers(false);
|
|
9485
|
+
this.setMasterParameter(
|
|
9486
|
+
"midiSystem",
|
|
9487
|
+
"gm"
|
|
9488
|
+
);
|
|
9489
|
+
}
|
|
9490
|
+
break;
|
|
9491
|
+
case 6:
|
|
9492
|
+
SpessaSynthInfo(
|
|
9493
|
+
`%cRoland GS Master Pan set to: %c${messageValue}%c with: %c${arrayToHexString(
|
|
9494
|
+
syx
|
|
9495
|
+
)}`,
|
|
9496
|
+
consoleColors.info,
|
|
9497
|
+
consoleColors.value,
|
|
9498
|
+
consoleColors.info,
|
|
9499
|
+
consoleColors.value
|
|
9500
|
+
);
|
|
9501
|
+
this.setMasterParameter(
|
|
9502
|
+
"masterPan",
|
|
9503
|
+
(messageValue - 64) / 64
|
|
9504
|
+
);
|
|
9505
|
+
break;
|
|
9506
|
+
case 4:
|
|
9507
|
+
SpessaSynthInfo(
|
|
9508
|
+
`%cRoland GS Master Volume set to: %c${messageValue}%c with: %c${arrayToHexString(
|
|
9509
|
+
syx
|
|
9510
|
+
)}`,
|
|
9511
|
+
consoleColors.info,
|
|
9512
|
+
consoleColors.value,
|
|
9513
|
+
consoleColors.info,
|
|
9514
|
+
consoleColors.value
|
|
9515
|
+
);
|
|
9516
|
+
this.setMIDIVolume(messageValue / 127);
|
|
9517
|
+
break;
|
|
9518
|
+
case 5: {
|
|
9519
|
+
const transpose = messageValue - 64;
|
|
9520
|
+
SpessaSynthInfo(
|
|
9521
|
+
`%cRoland GS Master Key-Shift set to: %c${transpose}%c with: %c${arrayToHexString(
|
|
9522
|
+
syx
|
|
9523
|
+
)}`,
|
|
9524
|
+
consoleColors.info,
|
|
9525
|
+
consoleColors.value,
|
|
9526
|
+
consoleColors.info,
|
|
9527
|
+
consoleColors.value
|
|
9528
|
+
);
|
|
9529
|
+
this.setMasterTuning(transpose * 100);
|
|
9530
|
+
break;
|
|
9531
|
+
}
|
|
9532
|
+
}
|
|
9533
|
+
return;
|
|
9534
|
+
} else if (syx[5] === 1) {
|
|
9535
|
+
switch (syx[6]) {
|
|
9536
|
+
default:
|
|
9537
|
+
notRecognized2();
|
|
9538
|
+
break;
|
|
9539
|
+
case 0: {
|
|
9540
|
+
const patchName = readBinaryString(
|
|
9541
|
+
syx,
|
|
9542
|
+
16,
|
|
9543
|
+
7
|
|
9544
|
+
);
|
|
9545
|
+
SpessaSynthInfo(
|
|
9546
|
+
`%cGS Patch name: %c${patchName}`,
|
|
9547
|
+
consoleColors.info,
|
|
9548
|
+
consoleColors.value
|
|
9549
|
+
);
|
|
9550
|
+
break;
|
|
9551
|
+
}
|
|
9552
|
+
case 51:
|
|
9553
|
+
SpessaSynthInfo(
|
|
9554
|
+
`%cGS Reverb level: %c${messageValue}`,
|
|
9555
|
+
consoleColors.info,
|
|
9556
|
+
consoleColors.value
|
|
9557
|
+
);
|
|
9558
|
+
this.privateProps.reverbSend = messageValue / 64;
|
|
9559
|
+
break;
|
|
9560
|
+
// Unsupported reverb params
|
|
9561
|
+
case 48:
|
|
9562
|
+
case 49:
|
|
9563
|
+
case 50:
|
|
9564
|
+
case 52:
|
|
9565
|
+
case 53:
|
|
9566
|
+
case 55:
|
|
9567
|
+
SpessaSynthInfo(
|
|
9568
|
+
`%cUnsupported GS Reverb Parameter: %c${syx[6].toString(16)}`,
|
|
9569
|
+
consoleColors.warn,
|
|
9570
|
+
consoleColors.unrecognized
|
|
9571
|
+
);
|
|
9572
|
+
break;
|
|
9573
|
+
case 58:
|
|
9574
|
+
SpessaSynthInfo(
|
|
9575
|
+
`%cGS Chorus level: %c${messageValue}`,
|
|
9576
|
+
consoleColors.info,
|
|
9577
|
+
consoleColors.value
|
|
9578
|
+
);
|
|
9579
|
+
this.privateProps.chorusSend = messageValue / 64;
|
|
9580
|
+
break;
|
|
9581
|
+
// Unsupported chorus params
|
|
9582
|
+
case 56:
|
|
9583
|
+
case 57:
|
|
9584
|
+
case 59:
|
|
9585
|
+
case 60:
|
|
9586
|
+
case 61:
|
|
9587
|
+
case 62:
|
|
9588
|
+
case 63:
|
|
9589
|
+
case 64:
|
|
9590
|
+
SpessaSynthInfo(
|
|
9591
|
+
`%cUnsupported GS Chorus Parameter: %c${syx[6].toString(16)}`,
|
|
9592
|
+
consoleColors.warn,
|
|
9593
|
+
consoleColors.unrecognized
|
|
9594
|
+
);
|
|
9595
|
+
break;
|
|
9596
|
+
}
|
|
9495
9597
|
}
|
|
9496
|
-
}
|
|
9497
|
-
|
|
9498
|
-
default:
|
|
9499
|
-
notRecognized();
|
|
9500
|
-
break;
|
|
9501
|
-
case 0:
|
|
9502
|
-
setupReceivers(
|
|
9503
|
-
midiControllers.modulationWheel,
|
|
9504
|
-
"mod wheel"
|
|
9505
|
-
);
|
|
9506
|
-
break;
|
|
9507
|
-
case 16:
|
|
9508
|
-
setupReceivers(
|
|
9509
|
-
NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel,
|
|
9510
|
-
"pitch wheel",
|
|
9511
|
-
true
|
|
9512
|
-
);
|
|
9513
|
-
break;
|
|
9514
|
-
case 32:
|
|
9515
|
-
setupReceivers(
|
|
9516
|
-
NON_CC_INDEX_OFFSET + modulatorSources.channelPressure,
|
|
9517
|
-
"channel pressure"
|
|
9518
|
-
);
|
|
9519
|
-
break;
|
|
9520
|
-
case 48:
|
|
9521
|
-
setupReceivers(
|
|
9522
|
-
NON_CC_INDEX_OFFSET + modulatorSources.polyPressure,
|
|
9523
|
-
"poly pressure"
|
|
9524
|
-
);
|
|
9525
|
-
break;
|
|
9598
|
+
} else {
|
|
9599
|
+
notRecognized2();
|
|
9526
9600
|
}
|
|
9527
9601
|
return;
|
|
9528
|
-
}
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
|
|
9535
|
-
SpessaSynthInfo(
|
|
9536
|
-
"%cGS Reset received!",
|
|
9537
|
-
consoleColors.info
|
|
9538
|
-
);
|
|
9539
|
-
this.resetAllControllers(false);
|
|
9540
|
-
this.setMasterParameter("midiSystem", "gs");
|
|
9541
|
-
} else if (messageValue === 127) {
|
|
9542
|
-
SpessaSynthInfo(
|
|
9543
|
-
"%cGS system off, switching to GM2",
|
|
9544
|
-
consoleColors.info
|
|
9545
|
-
);
|
|
9546
|
-
this.resetAllControllers(false);
|
|
9547
|
-
this.setMasterParameter(
|
|
9548
|
-
"midiSystem",
|
|
9549
|
-
"gm2"
|
|
9550
|
-
);
|
|
9551
|
-
}
|
|
9552
|
-
break;
|
|
9553
|
-
case 6:
|
|
9554
|
-
SpessaSynthInfo(
|
|
9555
|
-
`%cRoland GS Master Pan set to: %c${messageValue}%c with: %c${arrayToHexString(
|
|
9556
|
-
syx
|
|
9557
|
-
)}`,
|
|
9558
|
-
consoleColors.info,
|
|
9559
|
-
consoleColors.value,
|
|
9560
|
-
consoleColors.info,
|
|
9561
|
-
consoleColors.value
|
|
9562
|
-
);
|
|
9563
|
-
this.setMasterParameter(
|
|
9564
|
-
"masterPan",
|
|
9565
|
-
(messageValue - 64) / 64
|
|
9566
|
-
);
|
|
9567
|
-
break;
|
|
9568
|
-
case 4:
|
|
9569
|
-
SpessaSynthInfo(
|
|
9570
|
-
`%cRoland GS Master Volume set to: %c${messageValue}%c with: %c${arrayToHexString(
|
|
9571
|
-
syx
|
|
9572
|
-
)}`,
|
|
9573
|
-
consoleColors.info,
|
|
9574
|
-
consoleColors.value,
|
|
9575
|
-
consoleColors.info,
|
|
9576
|
-
consoleColors.value
|
|
9602
|
+
}
|
|
9603
|
+
case 69: {
|
|
9604
|
+
if (syx[4] === 16) {
|
|
9605
|
+
if (syx[5] === 0) {
|
|
9606
|
+
this.privateProps.callEvent(
|
|
9607
|
+
"synthDisplay",
|
|
9608
|
+
Array.from(syx)
|
|
9577
9609
|
);
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
SpessaSynthInfo(
|
|
9583
|
-
`%cRoland GS Master Key-Shift set to: %c${transpose}%c with: %c${arrayToHexString(
|
|
9584
|
-
syx
|
|
9585
|
-
)}`,
|
|
9586
|
-
consoleColors.info,
|
|
9587
|
-
consoleColors.value,
|
|
9588
|
-
consoleColors.info,
|
|
9589
|
-
consoleColors.value
|
|
9610
|
+
} else if (syx[5] === 1) {
|
|
9611
|
+
this.privateProps.callEvent(
|
|
9612
|
+
"synthDisplay",
|
|
9613
|
+
Array.from(syx)
|
|
9590
9614
|
);
|
|
9591
|
-
|
|
9592
|
-
|
|
9615
|
+
} else {
|
|
9616
|
+
notRecognized2();
|
|
9593
9617
|
}
|
|
9594
9618
|
}
|
|
9595
9619
|
return;
|
|
9596
|
-
} else if (syx[5] === 1) {
|
|
9597
|
-
switch (syx[6]) {
|
|
9598
|
-
default:
|
|
9599
|
-
notRecognized();
|
|
9600
|
-
break;
|
|
9601
|
-
case 0: {
|
|
9602
|
-
const patchName = readBinaryString(syx, 16, 7);
|
|
9603
|
-
SpessaSynthInfo(
|
|
9604
|
-
`%cGS Patch name: %c${patchName}`,
|
|
9605
|
-
consoleColors.info,
|
|
9606
|
-
consoleColors.value
|
|
9607
|
-
);
|
|
9608
|
-
break;
|
|
9609
|
-
}
|
|
9610
|
-
case 51:
|
|
9611
|
-
SpessaSynthInfo(
|
|
9612
|
-
`%cGS Reverb level: %c${messageValue}`,
|
|
9613
|
-
consoleColors.info,
|
|
9614
|
-
consoleColors.value
|
|
9615
|
-
);
|
|
9616
|
-
this.privateProps.reverbSend = messageValue / 64;
|
|
9617
|
-
break;
|
|
9618
|
-
// Unsupported reverb params
|
|
9619
|
-
case 48:
|
|
9620
|
-
case 49:
|
|
9621
|
-
case 50:
|
|
9622
|
-
case 52:
|
|
9623
|
-
case 53:
|
|
9624
|
-
case 55:
|
|
9625
|
-
SpessaSynthInfo(
|
|
9626
|
-
`%cUnsupported GS Reverb Parameter: %c${syx[6].toString(16)}`,
|
|
9627
|
-
consoleColors.warn,
|
|
9628
|
-
consoleColors.unrecognized
|
|
9629
|
-
);
|
|
9630
|
-
break;
|
|
9631
|
-
case 58:
|
|
9632
|
-
SpessaSynthInfo(
|
|
9633
|
-
`%cGS Chorus level: %c${messageValue}`,
|
|
9634
|
-
consoleColors.info,
|
|
9635
|
-
consoleColors.value
|
|
9636
|
-
);
|
|
9637
|
-
this.privateProps.chorusSend = messageValue / 64;
|
|
9638
|
-
break;
|
|
9639
|
-
// Unsupported chorus params
|
|
9640
|
-
case 56:
|
|
9641
|
-
case 57:
|
|
9642
|
-
case 59:
|
|
9643
|
-
case 60:
|
|
9644
|
-
case 61:
|
|
9645
|
-
case 62:
|
|
9646
|
-
case 63:
|
|
9647
|
-
case 64:
|
|
9648
|
-
SpessaSynthInfo(
|
|
9649
|
-
`%cUnsupported GS Chorus Parameter: %c${syx[6].toString(16)}`,
|
|
9650
|
-
consoleColors.warn,
|
|
9651
|
-
consoleColors.unrecognized
|
|
9652
|
-
);
|
|
9653
|
-
break;
|
|
9654
|
-
}
|
|
9655
|
-
}
|
|
9656
|
-
} else {
|
|
9657
|
-
notRecognized();
|
|
9658
|
-
}
|
|
9659
|
-
return;
|
|
9660
|
-
} else if (syx[2] === 69 && syx[3] === 18) {
|
|
9661
|
-
if (syx[4] === 16 && // Sound Canvas Display
|
|
9662
|
-
syx[6] === 0) {
|
|
9663
|
-
if (syx[5] === 0) {
|
|
9664
|
-
const text = new Uint8Array(
|
|
9665
|
-
syx.slice(7, syx.length - 2)
|
|
9666
|
-
);
|
|
9667
|
-
this.privateProps.callEvent("synthDisplay", {
|
|
9668
|
-
displayData: text,
|
|
9669
|
-
displayType: synthDisplayTypes.soundCanvasText
|
|
9670
|
-
});
|
|
9671
|
-
} else if (syx[5] === 1) {
|
|
9672
|
-
const dotMatrixData = new Uint8Array(
|
|
9673
|
-
syx.slice(7, syx.length - 3)
|
|
9674
|
-
);
|
|
9675
|
-
this.privateProps.callEvent("synthDisplay", {
|
|
9676
|
-
displayData: dotMatrixData,
|
|
9677
|
-
displayType: synthDisplayTypes.soundCanvasDotMatrix
|
|
9678
|
-
});
|
|
9679
|
-
SpessaSynthInfo(
|
|
9680
|
-
`%cRoland SC Display Dot Matrix via: %c${arrayToHexString(
|
|
9681
|
-
syx
|
|
9682
|
-
)}`,
|
|
9683
|
-
consoleColors.info,
|
|
9684
|
-
consoleColors.value
|
|
9685
|
-
);
|
|
9686
|
-
} else {
|
|
9687
|
-
notRecognized();
|
|
9688
9620
|
}
|
|
9621
|
+
case 22:
|
|
9622
|
+
if (syx[4] === 16) {
|
|
9623
|
+
this.setMIDIVolume(syx[7] / 100);
|
|
9624
|
+
SpessaSynthInfo(
|
|
9625
|
+
`%cRoland Master Volume control set to: %c${syx[7]}%c via: %c${arrayToHexString(
|
|
9626
|
+
syx
|
|
9627
|
+
)}`,
|
|
9628
|
+
consoleColors.info,
|
|
9629
|
+
consoleColors.value,
|
|
9630
|
+
consoleColors.info,
|
|
9631
|
+
consoleColors.value
|
|
9632
|
+
);
|
|
9633
|
+
return;
|
|
9634
|
+
}
|
|
9689
9635
|
}
|
|
9690
|
-
} else if (syx[2] === 22 && syx[3] === 18 && syx[4] === 16) {
|
|
9691
|
-
this.setMIDIVolume(syx[7] / 100);
|
|
9692
|
-
SpessaSynthInfo(
|
|
9693
|
-
`%cRoland Master Volume control set to: %c${syx[7]}%c via: %c${arrayToHexString(
|
|
9694
|
-
syx
|
|
9695
|
-
)}`,
|
|
9696
|
-
consoleColors.info,
|
|
9697
|
-
consoleColors.value,
|
|
9698
|
-
consoleColors.info,
|
|
9699
|
-
consoleColors.value
|
|
9700
|
-
);
|
|
9701
|
-
return;
|
|
9702
9636
|
} else {
|
|
9703
9637
|
SpessaSynthInfo(
|
|
9704
9638
|
`%cUnrecognized Roland SysEx: %c${arrayToHexString(syx)}`,
|
|
@@ -9835,13 +9769,10 @@ function systemExclusiveInternal(syx, channelOffset = 0) {
|
|
|
9835
9769
|
}
|
|
9836
9770
|
} else if (syx[3] === 6 && // XG System parameter
|
|
9837
9771
|
syx[4] === 0) {
|
|
9838
|
-
|
|
9839
|
-
|
|
9772
|
+
this.privateProps.callEvent(
|
|
9773
|
+
"synthDisplay",
|
|
9774
|
+
Array.from(syx)
|
|
9840
9775
|
);
|
|
9841
|
-
this.privateProps.callEvent("synthDisplay", {
|
|
9842
|
-
displayData: textData,
|
|
9843
|
-
displayType: synthDisplayTypes.yamahaXGText
|
|
9844
|
-
});
|
|
9845
9776
|
} else if (BankSelectHacks.isSystemXG(
|
|
9846
9777
|
this.privateProps.masterParameters.midiSystem
|
|
9847
9778
|
)) {
|
|
@@ -11506,10 +11437,12 @@ function computeModulators(voice, sourceUsesCC = -1, sourceIndex = 0) {
|
|
|
11506
11437
|
if (sourceUsesCC === -1) {
|
|
11507
11438
|
modulatedGenerators.set(generators);
|
|
11508
11439
|
modulators.forEach((mod) => {
|
|
11509
|
-
modulatedGenerators[mod.destination]
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11440
|
+
modulatedGenerators[mod.destination] = Math.min(
|
|
11441
|
+
32767,
|
|
11442
|
+
Math.max(
|
|
11443
|
+
-32768,
|
|
11444
|
+
modulatedGenerators[mod.destination] + computeModulator(this.midiControllers, mod, voice)
|
|
11445
|
+
)
|
|
11513
11446
|
);
|
|
11514
11447
|
});
|
|
11515
11448
|
for (let gen = 0; gen < modulatedGenerators.length; gen++) {
|
|
@@ -11543,17 +11476,17 @@ function computeModulators(voice, sourceUsesCC = -1, sourceIndex = 0) {
|
|
|
11543
11476
|
if (mod.primarySource.isCC === sourceCC && mod.primarySource.index === sourceIndex || mod.secondarySource.isCC === sourceCC && mod.secondarySource.index === sourceIndex) {
|
|
11544
11477
|
const destination = mod.destination;
|
|
11545
11478
|
if (!computedDestinations.has(destination)) {
|
|
11546
|
-
|
|
11479
|
+
let outputValue = generators[destination];
|
|
11547
11480
|
computeModulator(this.midiControllers, mod, voice);
|
|
11548
11481
|
modulators.forEach((m) => {
|
|
11549
11482
|
if (m.destination === destination) {
|
|
11550
|
-
|
|
11483
|
+
outputValue += m.currentValue;
|
|
11551
11484
|
}
|
|
11552
11485
|
});
|
|
11553
11486
|
const limits = generatorLimits[destination];
|
|
11554
11487
|
modulatedGenerators[destination] = Math.max(
|
|
11555
11488
|
limits.min,
|
|
11556
|
-
Math.min(
|
|
11489
|
+
Math.min(outputValue, limits.max)
|
|
11557
11490
|
);
|
|
11558
11491
|
computedDestinations.add(destination);
|
|
11559
11492
|
}
|
|
@@ -12824,62 +12757,76 @@ function writeSF2Elements(bank, isPreset = false) {
|
|
|
12824
12757
|
const bagHeader = isPreset ? "pbag" : "ibag";
|
|
12825
12758
|
const hdrHeader = isPreset ? "phdr" : "inst";
|
|
12826
12759
|
const hdrByteSize = isPreset ? PHDR_BYTE_SIZE : INST_BYTE_SIZE;
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
const
|
|
12760
|
+
let currentGenIndex = 0;
|
|
12761
|
+
const generatorIndexes = new Array();
|
|
12762
|
+
let currentModIndex = 0;
|
|
12763
|
+
const modulatorIndexes = new Array();
|
|
12764
|
+
const generators = new Array();
|
|
12765
|
+
const modulators = new Array();
|
|
12766
|
+
let zoneIndex = 0;
|
|
12767
|
+
const zoneIndexes = new Array();
|
|
12768
|
+
const writeZone = (z) => {
|
|
12769
|
+
generatorIndexes.push(currentGenIndex);
|
|
12770
|
+
const gens = z.getWriteGenerators(bank);
|
|
12771
|
+
currentGenIndex += gens.length;
|
|
12772
|
+
generators.push(...gens);
|
|
12773
|
+
modulatorIndexes.push(currentModIndex);
|
|
12774
|
+
const mods = z.modulators;
|
|
12775
|
+
currentModIndex += mods.length;
|
|
12776
|
+
modulators.push(...mods);
|
|
12777
|
+
};
|
|
12778
|
+
elements.forEach((el) => {
|
|
12779
|
+
zoneIndexes.push(zoneIndex);
|
|
12780
|
+
writeZone(el.globalZone);
|
|
12781
|
+
el.zones.forEach(writeZone);
|
|
12782
|
+
zoneIndex += el.zones.length + 1;
|
|
12783
|
+
});
|
|
12784
|
+
generators.push(new Generator(0, 0, false));
|
|
12785
|
+
modulators.push(new DecodedModulator(0, 0, 0, 0, 0));
|
|
12786
|
+
generatorIndexes.push(currentGenIndex);
|
|
12787
|
+
modulatorIndexes.push(currentModIndex);
|
|
12788
|
+
zoneIndexes.push(zoneIndex);
|
|
12789
|
+
const genSize = generators.length * GEN_BYTE_SIZE;
|
|
12831
12790
|
const genData = new IndexedByteArray(genSize);
|
|
12832
|
-
|
|
12791
|
+
generators.forEach((g) => g.write(genData));
|
|
12792
|
+
const modSize = modulators.length * MOD_BYTE_SIZE;
|
|
12833
12793
|
const modData = new IndexedByteArray(modSize);
|
|
12834
|
-
|
|
12794
|
+
modulators.forEach((m) => m.write(modData));
|
|
12795
|
+
const bagSize = modulatorIndexes.length * BAG_BYTE_SIZE;
|
|
12835
12796
|
const bagData = {
|
|
12836
12797
|
pdta: new IndexedByteArray(bagSize),
|
|
12837
12798
|
xdta: new IndexedByteArray(bagSize)
|
|
12838
12799
|
};
|
|
12839
|
-
|
|
12800
|
+
modulatorIndexes.forEach((modulatorIndex, i) => {
|
|
12801
|
+
const generatorIndex = generatorIndexes[i];
|
|
12802
|
+
writeWord(bagData.pdta, generatorIndex & 65535);
|
|
12803
|
+
writeWord(bagData.pdta, modulatorIndex & 65535);
|
|
12804
|
+
writeWord(bagData.xdta, generatorIndex >> 16);
|
|
12805
|
+
writeWord(bagData.xdta, modulatorIndex >> 16);
|
|
12806
|
+
});
|
|
12807
|
+
const hdrSize = (elements.length + 1) * hdrByteSize;
|
|
12840
12808
|
const hdrData = {
|
|
12841
12809
|
pdta: new IndexedByteArray(hdrSize),
|
|
12842
12810
|
xdta: new IndexedByteArray(hdrSize)
|
|
12843
12811
|
};
|
|
12844
|
-
|
|
12845
|
-
gen: 0,
|
|
12846
|
-
bag: 0,
|
|
12847
|
-
mod: 0,
|
|
12848
|
-
hdr: 0
|
|
12849
|
-
};
|
|
12850
|
-
elements.forEach((element) => {
|
|
12851
|
-
if (element instanceof BasicPreset) {
|
|
12852
|
-
element.write(genData, modData, bagData, hdrData, indexes, bank);
|
|
12853
|
-
} else {
|
|
12854
|
-
element.write(genData, modData, bagData, hdrData, indexes, bank);
|
|
12855
|
-
}
|
|
12856
|
-
});
|
|
12812
|
+
elements.forEach((el, i) => el.write(hdrData, zoneIndexes[i]));
|
|
12857
12813
|
if (isPreset) {
|
|
12858
12814
|
writeBinaryStringIndexed(hdrData.pdta, "EOP", 20);
|
|
12859
12815
|
hdrData.pdta.currentIndex += 4;
|
|
12860
|
-
writeWord(hdrData.pdta,
|
|
12816
|
+
writeWord(hdrData.pdta, zoneIndex & 65535);
|
|
12861
12817
|
hdrData.pdta.currentIndex += 12;
|
|
12862
12818
|
writeBinaryStringIndexed(hdrData.xdta, "", 20);
|
|
12863
12819
|
hdrData.xdta.currentIndex += 4;
|
|
12864
|
-
writeWord(hdrData.xdta,
|
|
12820
|
+
writeWord(hdrData.xdta, zoneIndex >> 16);
|
|
12865
12821
|
hdrData.xdta.currentIndex += 12;
|
|
12866
12822
|
} else {
|
|
12867
12823
|
writeBinaryStringIndexed(hdrData.pdta, "EOI", 20);
|
|
12824
|
+
writeWord(hdrData.pdta, zoneIndex & 65535);
|
|
12868
12825
|
writeBinaryStringIndexed(hdrData.xdta, "", 20);
|
|
12869
|
-
writeWord(hdrData.
|
|
12870
|
-
writeWord(hdrData.xdta, indexes.hdr >> 16);
|
|
12826
|
+
writeWord(hdrData.xdta, zoneIndex >> 16);
|
|
12871
12827
|
}
|
|
12872
|
-
writeWord(bagData.pdta, indexes.gen & 65535);
|
|
12873
|
-
writeWord(bagData.xdta, indexes.gen >> 16);
|
|
12874
|
-
writeWord(bagData.pdta, indexes.mod & 65535);
|
|
12875
|
-
writeWord(bagData.xdta, indexes.mod >> 16);
|
|
12876
12828
|
return {
|
|
12877
|
-
writeXdta: Math.max(
|
|
12878
|
-
genSize / GEN_BYTE_SIZE,
|
|
12879
|
-
modSize / MOD_BYTE_SIZE,
|
|
12880
|
-
bagSize / BAG_BYTE_SIZE,
|
|
12881
|
-
hdrSize / hdrByteSize
|
|
12882
|
-
) > 65535,
|
|
12829
|
+
writeXdta: Math.max(currentGenIndex, currentModIndex, zoneIndex) > 65535,
|
|
12883
12830
|
gen: {
|
|
12884
12831
|
pdta: writeRIFFChunkRaw(genHeader, genData),
|
|
12885
12832
|
// Same as pmod, this chunk includes only the terminal generator record to allow reuse of the pdta parser.
|
|
@@ -17174,7 +17121,6 @@ export {
|
|
|
17174
17121
|
modulatorSources,
|
|
17175
17122
|
modulatorTransformTypes,
|
|
17176
17123
|
sampleTypes,
|
|
17177
|
-
setResetValue
|
|
17178
|
-
synthDisplayTypes
|
|
17124
|
+
setResetValue
|
|
17179
17125
|
};
|
|
17180
17126
|
//# sourceMappingURL=index.js.map
|