spessasynth_lib 3.23.2 → 3.23.6
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/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +1 -1
- package/@types/soundfont/basic_soundfont/modulator.d.ts +2 -1
- package/@types/soundfont/dls/articulator_converter.d.ts +9 -0
- package/@types/soundfont/dls/dls_sample.d.ts +1 -1
- package/@types/soundfont/dls/dls_sources.d.ts +5 -0
- package/@types/soundfont/read_sf2/samples.d.ts +2 -2
- package/@types/synthetizer/key_modifier_manager.d.ts +14 -0
- package/@types/synthetizer/synth_event_handler.d.ts +5 -0
- package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +2 -2
- package/@types/utils/byte_functions/string.d.ts +5 -0
- package/@types/utils/indexed_array.d.ts +1 -1
- package/midi_parser/rmidi_writer.js +4 -4
- package/package.json +1 -1
- package/soundfont/basic_soundfont/modulator.js +4 -2
- package/soundfont/basic_soundfont/riff_chunk.js +1 -1
- package/soundfont/basic_soundfont/write_dls/art2.js +17 -0
- package/soundfont/basic_soundfont/write_dls/ins.js +2 -2
- package/soundfont/basic_soundfont/write_dls/modulator_converter.js +12 -6
- package/soundfont/basic_soundfont/write_dls/rgn2.js +30 -25
- package/soundfont/basic_soundfont/write_dls/wave.js +8 -3
- package/soundfont/basic_soundfont/write_dls/write_dls.js +3 -2
- package/soundfont/basic_soundfont/write_dls/wsmp.js +2 -2
- package/soundfont/dls/articulator_converter.js +12 -10
- package/soundfont/dls/dls_sources.js +36 -1
- package/soundfont/dls/read_articulation.js +3 -15
- package/soundfont/dls/read_instrument.js +3 -14
- package/synthetizer/key_modifier_manager.js +30 -1
- package/synthetizer/synth_event_handler.js +17 -1
- package/synthetizer/worklet_processor.min.js +10 -10
- package/synthetizer/worklet_system/main_processor.js +2 -2
- package/synthetizer/worklet_system/worklet_methods/note_on.js +1 -1
- package/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.js +3 -3
- package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +20 -13
- package/utils/byte_functions/string.js +9 -0
|
@@ -9,6 +9,12 @@ export class KeyModifierManager
|
|
|
9
9
|
constructor(synth)
|
|
10
10
|
{
|
|
11
11
|
this.synth = synth;
|
|
12
|
+
/**
|
|
13
|
+
* The velocity override mappings for MIDI keys
|
|
14
|
+
* @type {KeyModifier[][]}
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
this._keyModifiers = [];
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
/**
|
|
@@ -44,12 +50,29 @@ export class KeyModifierManager
|
|
|
44
50
|
const velocity = options?.velocity ?? -1;
|
|
45
51
|
const program = options?.patch?.program ?? -1;
|
|
46
52
|
const bank = options?.patch?.bank ?? -1;
|
|
53
|
+
const mod = new KeyModifier(velocity, bank, program);
|
|
54
|
+
if (this._keyModifiers[channel] === undefined)
|
|
55
|
+
{
|
|
56
|
+
this._keyModifiers[channel] = [];
|
|
57
|
+
}
|
|
58
|
+
this._keyModifiers[channel][midiNote] = mod;
|
|
47
59
|
this._sendToWorklet(
|
|
48
60
|
workletKeyModifierMessageType.addMapping,
|
|
49
|
-
[channel, midiNote,
|
|
61
|
+
[channel, midiNote, mod]
|
|
50
62
|
);
|
|
51
63
|
}
|
|
52
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Gets a key modifier
|
|
67
|
+
* @param channel {number} the channel affected. Usually 0-15
|
|
68
|
+
* @param midiNote {number} the MIDI note to change. 0-127
|
|
69
|
+
* @returns {KeyModifier|undefined}
|
|
70
|
+
*/
|
|
71
|
+
getModifier(channel, midiNote)
|
|
72
|
+
{
|
|
73
|
+
return this._keyModifiers?.[channel]?.[midiNote];
|
|
74
|
+
}
|
|
75
|
+
|
|
53
76
|
/**
|
|
54
77
|
* Deletes a key modifier
|
|
55
78
|
* @param channel {number} the channel affected. Usually 0-15
|
|
@@ -61,6 +84,11 @@ export class KeyModifierManager
|
|
|
61
84
|
workletKeyModifierMessageType.deleteMapping,
|
|
62
85
|
[channel, midiNote]
|
|
63
86
|
);
|
|
87
|
+
if (this._keyModifiers[channel]?.[midiNote] === undefined)
|
|
88
|
+
{
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this._keyModifiers[channel][midiNote] = undefined;
|
|
64
92
|
}
|
|
65
93
|
|
|
66
94
|
/**
|
|
@@ -69,5 +97,6 @@ export class KeyModifierManager
|
|
|
69
97
|
clearModifiers()
|
|
70
98
|
{
|
|
71
99
|
this._sendToWorklet(workletKeyModifierMessageType.clearMappings, undefined);
|
|
100
|
+
this._keyModifiers = [];
|
|
72
101
|
}
|
|
73
102
|
}
|
|
@@ -119,6 +119,12 @@ export class EventHandler
|
|
|
119
119
|
"allcontrollerreset": {},
|
|
120
120
|
"soundfonterror": {}
|
|
121
121
|
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Set to 0 to disabled, otherwise in seconds
|
|
125
|
+
* @type {number}
|
|
126
|
+
*/
|
|
127
|
+
this.timeDelay = 0;
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
/**
|
|
@@ -151,7 +157,17 @@ export class EventHandler
|
|
|
151
157
|
{
|
|
152
158
|
if (this.events[name])
|
|
153
159
|
{
|
|
154
|
-
|
|
160
|
+
if (this.timeDelay > 0)
|
|
161
|
+
{
|
|
162
|
+
setTimeout(() =>
|
|
163
|
+
{
|
|
164
|
+
Object.values(this.events[name]).forEach(ev => ev(eventData));
|
|
165
|
+
}, this.timeDelay * 1000);
|
|
166
|
+
}
|
|
167
|
+
else
|
|
168
|
+
{
|
|
169
|
+
Object.values(this.events[name]).forEach(ev => ev(eventData));
|
|
170
|
+
}
|
|
155
171
|
}
|
|
156
172
|
}
|
|
157
173
|
}
|