1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//! Default-SoundFont downloader.
//!
//! Round-1: stubbed. The intended bank is **TimGM6mb** (Tim Brechbill's
//! GM-compatible SoundFont, ~6 MB, GPL-2.0-licensed) — small enough to
//! be a reasonable "first run" download for users who don't already
//! have a SoundFont installed. Pulling in `oxideav-http` as a hard
//! dependency for one call is heavier than this stage warrants, so the
//! actual fetch is deferred to a follow-up round; this module fixes
//! the URL + hash + file name so the integration is mechanical when
//! the time comes.
//!
//! Round-2 plan:
//!
//! 1. Optional dependency on `oxideav-http` (workspace dep, already
//! pure-Rust + rustls).
//! 2. `download_default_soundfont(dest)` does:
//! * If `dest` exists and its SHA-256 matches [`TIMGM6MB_SHA256`],
//! return immediately.
//! * Otherwise, GET [`TIMGM6MB_URL`] via `oxideav_http::open_http`,
//! stream into `dest`, hash on-the-fly, and reject with
//! `Error::InvalidData` if the hash doesn't match.
//! 3. Surface progress via a callback or, more likely, hook into
//! `oxideav-source`'s `Read + Seek` plumbing so it Just Works.
use ;
use ;
/// URL hosting the canonical TimGM6mb SoundFont. Mirrored from the
/// upstream MIDI.org / Sourceforge page; we re-host on samples.oxideav.org
/// in round-2 to avoid availability flakiness from third-party hosts.
pub const TIMGM6MB_URL: &str = "https://samples.oxideav.org/instruments/sf2/TimGM6mb.sf2";
/// SHA-256 of the canonical TimGM6mb.sf2 (uppercase hex). Fixed at
/// round-2 once the mirrored file is finalised; the placeholder string
/// `"PENDING"` makes any premature use fail loudly.
pub const TIMGM6MB_SHA256: &str = "PENDING";
/// On-disk filename for the default SoundFont. Round-2 will write this
/// into `dest_dir.join(TIMGM6MB_FILENAME)`.
pub const TIMGM6MB_FILENAME: &str = "TimGM6mb.sf2";
/// Round-1 stub. Always returns `Error::Unsupported` until the
/// `oxideav-http` integration is wired up. Documented behaviour for
/// round-2 lives in the module-level rustdoc.
///
/// `dest` should be either a file path (full target name) or a directory
/// (we'll append [`TIMGM6MB_FILENAME`]); for now the parameter is
/// reserved.