@sudobility/music_player 0.1.11 → 0.1.12

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.
@@ -40,6 +40,22 @@ export type RNMusicPlayerOptions = {
40
40
  * setup for anything shipping to a store.
41
41
  */
42
42
  packBase?: string;
43
+ /**
44
+ * Reads a pack body, given the URL `packBase`/`percussionBase` produced.
45
+ *
46
+ * The reason this is a function rather than only a base URL: a shipped native
47
+ * app should carry its instruments *inside* the bundle, and a bundled file is
48
+ * not something `fetch` can read — React Native's `fetch` does not handle
49
+ * `file://` on either platform. An app that copies the packs into its own
50
+ * bundle supplies this and reads them off disk, and then pressing play needs
51
+ * no network at all: no third-party host to be down, nothing to tell that
52
+ * host who is playing what, and no wait on a first note.
53
+ *
54
+ * Defaults to `fetch`, which is what a web-ish build or a self-hosted CDN
55
+ * wants. The URL is still built by `packBase`/`percussionBase`, so a loader
56
+ * only has to map a URL to bytes however its platform likes.
57
+ */
58
+ fetchPack?: (url: string) => Promise<string>;
43
59
  /**
44
60
  * Where the drum-kit packs are served from. **Required for percussion**;
45
61
  * there is no default because nobody publishes usably-licensed GM percussion.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/rn/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,CAAC;AAC1E;;;;;GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EACV,WAAW,EACX,cAAc,EACd,mBAAmB,GACpB,MAAM,gCAAg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AAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/E;;;;;;GAMG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,oBAAyB,GACjC,WAAW,CAQb;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,mHAS/D"}
package/dist/rn/index.js CHANGED
@@ -28,6 +28,7 @@ export function createMusicPlayer(options = {}) {
28
28
  return new MusicPlayer(new RNSamplePlaybackEngine({
29
29
  packBase: options.packBase,
30
30
  percussionBase: options.percussionBase,
31
+ ...(options.fetchPack ? { fetchPack: options.fetchPack } : {}),
31
32
  }));
32
33
  }
33
34
  /**
@@ -42,6 +43,10 @@ export function renderSamples(options = {}) {
42
43
  return createRNSoundfontRenderer({
43
44
  packBase: options.packBase,
44
45
  percussionBase: options.percussionBase,
46
+ // The same loader as live playback, for the same reason the bases are
47
+ // shared: an exported file has to be a recording of what was heard, and a
48
+ // renderer reading different bytes is a different instrument.
49
+ ...(options.fetchPack ? { fetchPack: options.fetchPack } : {}),
45
50
  }).render;
46
51
  }
47
52
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/rn/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BA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GAKG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAMlE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAM1E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAwC/E,gFAAgF;AAChF,MAAM,UAAU,iBAAiB,CAC/B,UAAgC,EAAE;IAElC,OAAO,IAAI,WAAW,CACpB,IAAI,sBAAsB,CAAC;QACzB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D,CAAC,CACH,CAAC;AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,UAAgC,EAAE;IAC9D,OAAO,yBAAyB,CAAC;QAC/B,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,sEAAsE;QACtE,0EAA0E;QAC1E,8DAA8D;QAC9D,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D,CAAC,CAAC,MAAM,CAAC;AACZ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/music_player",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Playback for ScoreSmith: transport, synth engines and offline rendering, for web and React Native",
5
5
  "author": "Sudobility",
6
6
  "license": "BUSL-1.1",
@@ -73,7 +73,7 @@
73
73
  "prepublishOnly": "bun run clean && bun run verify"
74
74
  },
75
75
  "peerDependencies": {
76
- "@sudobility/music_types": "^0.13.10",
76
+ "@sudobility/music_types": "^0.13.11",
77
77
  "js-synthesizer": "^1.13.0",
78
78
  "react-native-audio-api": ">=0.13.0"
79
79
  },
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@eslint/js": "^10.0.1",
90
- "@sudobility/music_types": "^0.13.10",
90
+ "@sudobility/music_types": "^0.13.11",
91
91
  "@types/node": "^26.2.0",
92
92
  "@typescript-eslint/eslint-plugin": "^8.65.0",
93
93
  "@typescript-eslint/parser": "^8.65.0",