|
@@ -19,11 +19,14 @@ export class BasicAudioPlayer implements IAudioPlayer<SoundfontPlayer.Player> {
|
|
|
protected memoryLoadedSoundFonts: Map<MidiInstrument, SoundfontPlayer.Player> = new Map();
|
|
|
protected channelToSoundFont: Map<number, number> = new Map();
|
|
|
|
|
|
+ public SoundfontInstrumentOptions = {}; // e.g. set { from: 'server.com/soundfonts/' } for soundfont fetching url
|
|
|
+
|
|
|
public async open(uniqueInstruments: number[], numberOfinstruments: number = 16): Promise<void> {
|
|
|
if (this.piano === undefined) {
|
|
|
this.piano = await SoundfontPlayer.instrument(
|
|
|
this.ac as unknown as AudioContext,
|
|
|
- midiNames[MidiInstrument.Acoustic_Grand_Piano].toLowerCase() as any
|
|
|
+ midiNames[MidiInstrument.Acoustic_Grand_Piano].toLowerCase() as any,
|
|
|
+ this.SoundfontInstrumentOptions
|
|
|
);
|
|
|
}
|
|
|
|
|
@@ -84,7 +87,8 @@ export class BasicAudioPlayer implements IAudioPlayer<SoundfontPlayer.Player> {
|
|
|
|
|
|
const player: SoundfontPlayer.Player = await SoundfontPlayer.instrument(
|
|
|
this.ac as unknown as AudioContext,
|
|
|
- midiNames[soundId].toLowerCase() as any
|
|
|
+ midiNames[soundId].toLowerCase() as any,
|
|
|
+ this.SoundfontInstrumentOptions
|
|
|
);
|
|
|
this.memoryLoadedSoundFonts.set(soundId, player);
|
|
|
return player;
|