libadlmidi-js 2.0.0 → 2.1.0

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.
Files changed (60) hide show
  1. package/README.md +8 -5
  2. package/dist/core.d.ts +5 -0
  3. package/dist/fm_banks/manifest.json +1 -1
  4. package/dist/libadlmidi.d.ts +3 -1
  5. package/dist/libadlmidi.dosbox.browser.wasm +0 -0
  6. package/dist/libadlmidi.dosbox.core.wasm +0 -0
  7. package/dist/libadlmidi.dosbox.js +0 -0
  8. package/dist/libadlmidi.dosbox.processor.js +5 -0
  9. package/dist/libadlmidi.dosbox.slim.browser.wasm +0 -0
  10. package/dist/libadlmidi.dosbox.slim.core.wasm +0 -0
  11. package/dist/libadlmidi.dosbox.slim.js +0 -0
  12. package/dist/libadlmidi.dosbox.slim.processor.js +5 -0
  13. package/dist/libadlmidi.full.browser.wasm +0 -0
  14. package/dist/libadlmidi.full.core.wasm +0 -0
  15. package/dist/libadlmidi.full.js +0 -0
  16. package/dist/libadlmidi.full.processor.js +5 -0
  17. package/dist/libadlmidi.full.slim.browser.wasm +0 -0
  18. package/dist/libadlmidi.full.slim.core.wasm +0 -0
  19. package/dist/libadlmidi.full.slim.js +0 -0
  20. package/dist/libadlmidi.full.slim.processor.js +5 -0
  21. package/dist/libadlmidi.js +8 -3
  22. package/dist/libadlmidi.js.map +2 -2
  23. package/dist/libadlmidi.light.browser.wasm +0 -0
  24. package/dist/libadlmidi.light.core.wasm +0 -0
  25. package/dist/libadlmidi.light.js +0 -0
  26. package/dist/libadlmidi.light.processor.js +5 -0
  27. package/dist/libadlmidi.light.slim.browser.wasm +0 -0
  28. package/dist/libadlmidi.light.slim.core.wasm +0 -0
  29. package/dist/libadlmidi.light.slim.js +0 -0
  30. package/dist/libadlmidi.light.slim.processor.js +5 -0
  31. package/dist/libadlmidi.nuked.browser.wasm +0 -0
  32. package/dist/libadlmidi.nuked.core.wasm +0 -0
  33. package/dist/libadlmidi.nuked.js +0 -0
  34. package/dist/libadlmidi.nuked.processor.js +5 -0
  35. package/dist/libadlmidi.nuked.slim.browser.wasm +0 -0
  36. package/dist/libadlmidi.nuked.slim.core.wasm +0 -0
  37. package/dist/libadlmidi.nuked.slim.js +0 -0
  38. package/dist/libadlmidi.nuked.slim.processor.js +5 -0
  39. package/dist/profiles/dosbox.d.ts +6 -2
  40. package/dist/profiles/dosbox.slim.d.ts +6 -2
  41. package/dist/profiles/full.d.ts +6 -2
  42. package/dist/profiles/full.slim.d.ts +6 -2
  43. package/dist/profiles/light.d.ts +6 -2
  44. package/dist/profiles/light.slim.d.ts +6 -2
  45. package/dist/profiles/nuked.d.ts +6 -2
  46. package/dist/profiles/nuked.slim.d.ts +6 -2
  47. package/dist/utils/constants.d.ts +3 -1
  48. package/package.json +30 -9
  49. package/src/core.js +9 -0
  50. package/src/libadlmidi.js +5 -2
  51. package/src/processor.js +6 -0
  52. package/src/profiles/dosbox.js +13 -6
  53. package/src/profiles/dosbox.slim.js +13 -6
  54. package/src/profiles/full.js +14 -7
  55. package/src/profiles/full.slim.js +14 -7
  56. package/src/profiles/light.js +14 -7
  57. package/src/profiles/light.slim.js +14 -7
  58. package/src/profiles/nuked.js +14 -7
  59. package/src/profiles/nuked.slim.js +14 -7
  60. package/src/utils/constants.js +3 -1
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Zero-config full (slim) profile for libADLMIDI-JS
3
- *
3
+ *
4
4
  * Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
5
5
  * Slim builds require loading a WOPL bank at runtime.
6
- *
6
+ *
7
7
  * @module profiles/full.slim
8
8
  */
9
9
 
@@ -15,6 +15,10 @@ const PROCESSOR_URL = new URL('../../dist/libadlmidi.full.slim.processor.js', im
15
15
  const WASM_URL = new URL('../../dist/libadlmidi.full.slim.core.wasm', import.meta.url).href;
16
16
  const CORE_PATH = new URL('../../dist/libadlmidi.full.slim.core.js', import.meta.url).href;
17
17
 
18
+ // Default synth settings injected at init. NUKED_FAST is preferred when the
19
+ // profile bundles it (bit-exact vs Nuked 1.8, roughly 1.5x faster).
20
+ const DEFAULT_SETTINGS = { emulator: 1 };
21
+
18
22
  /**
19
23
  * Pre-configured AdlMidi for full slim profile.
20
24
  *
@@ -30,15 +34,17 @@ const CORE_PATH = new URL('../../dist/libadlmidi.full.slim.core.js', import.meta
30
34
  export class AdlMidi extends BaseAdlMidi {
31
35
  /**
32
36
  * Initialize the synthesizer with this profile's WASM.
33
- *
37
+ *
34
38
  * @param {string} [processorUrl] - Override processor URL (optional)
35
39
  * @param {string} [wasmUrl] - Override WASM URL (optional)
40
+ * @param {object} [defaultSettings] - Override profile's default synth settings
36
41
  * @returns {Promise<void>}
37
42
  */
38
- async init(processorUrl, wasmUrl) {
43
+ async init(processorUrl, wasmUrl, defaultSettings) {
39
44
  return super.init(
40
45
  processorUrl || PROCESSOR_URL,
41
- wasmUrl || WASM_URL
46
+ wasmUrl || WASM_URL,
47
+ defaultSettings || DEFAULT_SETTINGS
42
48
  );
43
49
  }
44
50
  }
@@ -60,13 +66,14 @@ export class AdlMidiCore {
60
66
  /**
61
67
  * Create a new AdlMidiCore instance with this profile's WASM.
62
68
  *
63
- * @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
69
+ * @param {{corePath?: string, defaultEmulator?: number, wasmBinary?: ArrayBuffer}} [options]
70
+ * Override profile defaults. corePath and defaultEmulator are pre-configured.
64
71
  * @returns {Promise<BaseAdlMidiCore>}
65
72
  */
66
73
  static async create(options = {}) {
67
74
  return BaseAdlMidiCore.create({
68
75
  ...options,
69
- corePath: options.corePath || CORE_PATH
76
+ corePath: options.corePath || CORE_PATH, defaultEmulator: options.defaultEmulator !== undefined ? options.defaultEmulator : 1
70
77
  });
71
78
  }
72
79
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Zero-config light profile for libADLMIDI-JS
3
- *
3
+ *
4
4
  * Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
5
5
  *
6
- *
6
+ *
7
7
  * @module profiles/light
8
8
  */
9
9
 
@@ -15,6 +15,10 @@ const PROCESSOR_URL = new URL('../../dist/libadlmidi.light.processor.js', import
15
15
  const WASM_URL = new URL('../../dist/libadlmidi.light.core.wasm', import.meta.url).href;
16
16
  const CORE_PATH = new URL('../../dist/libadlmidi.light.core.js', import.meta.url).href;
17
17
 
18
+ // Default synth settings injected at init. NUKED_FAST is preferred when the
19
+ // profile bundles it (bit-exact vs Nuked 1.8, roughly 1.5x faster).
20
+ const DEFAULT_SETTINGS = { emulator: 1 };
21
+
18
22
  /**
19
23
  * Pre-configured AdlMidi for light profile.
20
24
  *
@@ -30,15 +34,17 @@ const CORE_PATH = new URL('../../dist/libadlmidi.light.core.js', import.meta.url
30
34
  export class AdlMidi extends BaseAdlMidi {
31
35
  /**
32
36
  * Initialize the synthesizer with this profile's WASM.
33
- *
37
+ *
34
38
  * @param {string} [processorUrl] - Override processor URL (optional)
35
39
  * @param {string} [wasmUrl] - Override WASM URL (optional)
40
+ * @param {object} [defaultSettings] - Override profile's default synth settings
36
41
  * @returns {Promise<void>}
37
42
  */
38
- async init(processorUrl, wasmUrl) {
43
+ async init(processorUrl, wasmUrl, defaultSettings) {
39
44
  return super.init(
40
45
  processorUrl || PROCESSOR_URL,
41
- wasmUrl || WASM_URL
46
+ wasmUrl || WASM_URL,
47
+ defaultSettings || DEFAULT_SETTINGS
42
48
  );
43
49
  }
44
50
  }
@@ -60,13 +66,14 @@ export class AdlMidiCore {
60
66
  /**
61
67
  * Create a new AdlMidiCore instance with this profile's WASM.
62
68
  *
63
- * @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
69
+ * @param {{corePath?: string, defaultEmulator?: number, wasmBinary?: ArrayBuffer}} [options]
70
+ * Override profile defaults. corePath and defaultEmulator are pre-configured.
64
71
  * @returns {Promise<BaseAdlMidiCore>}
65
72
  */
66
73
  static async create(options = {}) {
67
74
  return BaseAdlMidiCore.create({
68
75
  ...options,
69
- corePath: options.corePath || CORE_PATH
76
+ corePath: options.corePath || CORE_PATH, defaultEmulator: options.defaultEmulator !== undefined ? options.defaultEmulator : 1
70
77
  });
71
78
  }
72
79
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Zero-config light (slim) profile for libADLMIDI-JS
3
- *
3
+ *
4
4
  * Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
5
5
  * Slim builds require loading a WOPL bank at runtime.
6
- *
6
+ *
7
7
  * @module profiles/light.slim
8
8
  */
9
9
 
@@ -15,6 +15,10 @@ const PROCESSOR_URL = new URL('../../dist/libadlmidi.light.slim.processor.js', i
15
15
  const WASM_URL = new URL('../../dist/libadlmidi.light.slim.core.wasm', import.meta.url).href;
16
16
  const CORE_PATH = new URL('../../dist/libadlmidi.light.slim.core.js', import.meta.url).href;
17
17
 
18
+ // Default synth settings injected at init. NUKED_FAST is preferred when the
19
+ // profile bundles it (bit-exact vs Nuked 1.8, roughly 1.5x faster).
20
+ const DEFAULT_SETTINGS = { emulator: 1 };
21
+
18
22
  /**
19
23
  * Pre-configured AdlMidi for light slim profile.
20
24
  *
@@ -30,15 +34,17 @@ const CORE_PATH = new URL('../../dist/libadlmidi.light.slim.core.js', import.met
30
34
  export class AdlMidi extends BaseAdlMidi {
31
35
  /**
32
36
  * Initialize the synthesizer with this profile's WASM.
33
- *
37
+ *
34
38
  * @param {string} [processorUrl] - Override processor URL (optional)
35
39
  * @param {string} [wasmUrl] - Override WASM URL (optional)
40
+ * @param {object} [defaultSettings] - Override profile's default synth settings
36
41
  * @returns {Promise<void>}
37
42
  */
38
- async init(processorUrl, wasmUrl) {
43
+ async init(processorUrl, wasmUrl, defaultSettings) {
39
44
  return super.init(
40
45
  processorUrl || PROCESSOR_URL,
41
- wasmUrl || WASM_URL
46
+ wasmUrl || WASM_URL,
47
+ defaultSettings || DEFAULT_SETTINGS
42
48
  );
43
49
  }
44
50
  }
@@ -60,13 +66,14 @@ export class AdlMidiCore {
60
66
  /**
61
67
  * Create a new AdlMidiCore instance with this profile's WASM.
62
68
  *
63
- * @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
69
+ * @param {{corePath?: string, defaultEmulator?: number, wasmBinary?: ArrayBuffer}} [options]
70
+ * Override profile defaults. corePath and defaultEmulator are pre-configured.
64
71
  * @returns {Promise<BaseAdlMidiCore>}
65
72
  */
66
73
  static async create(options = {}) {
67
74
  return BaseAdlMidiCore.create({
68
75
  ...options,
69
- corePath: options.corePath || CORE_PATH
76
+ corePath: options.corePath || CORE_PATH, defaultEmulator: options.defaultEmulator !== undefined ? options.defaultEmulator : 1
70
77
  });
71
78
  }
72
79
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Zero-config nuked profile for libADLMIDI-JS
3
- *
3
+ *
4
4
  * Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
5
5
  *
6
- *
6
+ *
7
7
  * @module profiles/nuked
8
8
  */
9
9
 
@@ -15,6 +15,10 @@ const PROCESSOR_URL = new URL('../../dist/libadlmidi.nuked.processor.js', import
15
15
  const WASM_URL = new URL('../../dist/libadlmidi.nuked.core.wasm', import.meta.url).href;
16
16
  const CORE_PATH = new URL('../../dist/libadlmidi.nuked.core.js', import.meta.url).href;
17
17
 
18
+ // Default synth settings injected at init. NUKED_FAST is preferred when the
19
+ // profile bundles it (bit-exact vs Nuked 1.8, roughly 1.5x faster).
20
+ const DEFAULT_SETTINGS = { emulator: 1 };
21
+
18
22
  /**
19
23
  * Pre-configured AdlMidi for nuked profile.
20
24
  *
@@ -30,15 +34,17 @@ const CORE_PATH = new URL('../../dist/libadlmidi.nuked.core.js', import.meta.url
30
34
  export class AdlMidi extends BaseAdlMidi {
31
35
  /**
32
36
  * Initialize the synthesizer with this profile's WASM.
33
- *
37
+ *
34
38
  * @param {string} [processorUrl] - Override processor URL (optional)
35
39
  * @param {string} [wasmUrl] - Override WASM URL (optional)
40
+ * @param {object} [defaultSettings] - Override profile's default synth settings
36
41
  * @returns {Promise<void>}
37
42
  */
38
- async init(processorUrl, wasmUrl) {
43
+ async init(processorUrl, wasmUrl, defaultSettings) {
39
44
  return super.init(
40
45
  processorUrl || PROCESSOR_URL,
41
- wasmUrl || WASM_URL
46
+ wasmUrl || WASM_URL,
47
+ defaultSettings || DEFAULT_SETTINGS
42
48
  );
43
49
  }
44
50
  }
@@ -60,13 +66,14 @@ export class AdlMidiCore {
60
66
  /**
61
67
  * Create a new AdlMidiCore instance with this profile's WASM.
62
68
  *
63
- * @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
69
+ * @param {{corePath?: string, defaultEmulator?: number, wasmBinary?: ArrayBuffer}} [options]
70
+ * Override profile defaults. corePath and defaultEmulator are pre-configured.
64
71
  * @returns {Promise<BaseAdlMidiCore>}
65
72
  */
66
73
  static async create(options = {}) {
67
74
  return BaseAdlMidiCore.create({
68
75
  ...options,
69
- corePath: options.corePath || CORE_PATH
76
+ corePath: options.corePath || CORE_PATH, defaultEmulator: options.defaultEmulator !== undefined ? options.defaultEmulator : 1
70
77
  });
71
78
  }
72
79
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Zero-config nuked (slim) profile for libADLMIDI-JS
3
- *
3
+ *
4
4
  * Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
5
5
  * Slim builds require loading a WOPL bank at runtime.
6
- *
6
+ *
7
7
  * @module profiles/nuked.slim
8
8
  */
9
9
 
@@ -15,6 +15,10 @@ const PROCESSOR_URL = new URL('../../dist/libadlmidi.nuked.slim.processor.js', i
15
15
  const WASM_URL = new URL('../../dist/libadlmidi.nuked.slim.core.wasm', import.meta.url).href;
16
16
  const CORE_PATH = new URL('../../dist/libadlmidi.nuked.slim.core.js', import.meta.url).href;
17
17
 
18
+ // Default synth settings injected at init. NUKED_FAST is preferred when the
19
+ // profile bundles it (bit-exact vs Nuked 1.8, roughly 1.5x faster).
20
+ const DEFAULT_SETTINGS = { emulator: 1 };
21
+
18
22
  /**
19
23
  * Pre-configured AdlMidi for nuked slim profile.
20
24
  *
@@ -30,15 +34,17 @@ const CORE_PATH = new URL('../../dist/libadlmidi.nuked.slim.core.js', import.met
30
34
  export class AdlMidi extends BaseAdlMidi {
31
35
  /**
32
36
  * Initialize the synthesizer with this profile's WASM.
33
- *
37
+ *
34
38
  * @param {string} [processorUrl] - Override processor URL (optional)
35
39
  * @param {string} [wasmUrl] - Override WASM URL (optional)
40
+ * @param {object} [defaultSettings] - Override profile's default synth settings
36
41
  * @returns {Promise<void>}
37
42
  */
38
- async init(processorUrl, wasmUrl) {
43
+ async init(processorUrl, wasmUrl, defaultSettings) {
39
44
  return super.init(
40
45
  processorUrl || PROCESSOR_URL,
41
- wasmUrl || WASM_URL
46
+ wasmUrl || WASM_URL,
47
+ defaultSettings || DEFAULT_SETTINGS
42
48
  );
43
49
  }
44
50
  }
@@ -60,13 +66,14 @@ export class AdlMidiCore {
60
66
  /**
61
67
  * Create a new AdlMidiCore instance with this profile's WASM.
62
68
  *
63
- * @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
69
+ * @param {{corePath?: string, defaultEmulator?: number, wasmBinary?: ArrayBuffer}} [options]
70
+ * Override profile defaults. corePath and defaultEmulator are pre-configured.
64
71
  * @returns {Promise<BaseAdlMidiCore>}
65
72
  */
66
73
  static async create(options = {}) {
67
74
  return BaseAdlMidiCore.create({
68
75
  ...options,
69
- corePath: options.corePath || CORE_PATH
76
+ corePath: options.corePath || CORE_PATH, defaultEmulator: options.defaultEmulator !== undefined ? options.defaultEmulator : 1
70
77
  });
71
78
  }
72
79
  }
@@ -12,7 +12,9 @@
12
12
  export const Emulator = Object.freeze({
13
13
  /** Nuked OPL3 v1.8 - Most accurate, higher CPU usage */
14
14
  NUKED: 0,
15
- /** Nuked OPL3 v1.7.4 - Slightly older version */
15
+ /** Optimized Nuked 1.8 fork by tgies with identical output */
16
+ NUKED_FAST: 1,
17
+ /** @deprecated Use NUKED_FAST */
16
18
  NUKED_174: 1,
17
19
  /** DosBox OPL3 - Good accuracy, lower CPU usage */
18
20
  DOSBOX: 2,