pub enum InstrumentSource {
Sf2(PathBuf),
Sfz(PathBuf),
Dls(PathBuf),
Tone,
}Expand description
Source descriptor for an external instrument bank. Paired with
MidiDecoder::with_instrument_source so a caller that only knows
“I have an SF2 file at this path” doesn’t have to type the full
Arc::new(Sf2Instrument::open(...)) chain.
Variants§
Sf2(PathBuf)
SoundFont 2 bank — loaded via Sf2Instrument::open.
Sfz(PathBuf)
SFZ text patch — loaded via SfzInstrument::open (samples
are read off disk relative to the patch’s directory).
Dls(PathBuf)
DLS Level 1 / 2 bank — loaded via DlsInstrument::open.
Tone
Pure-tone fallback (no on-disk file).
Implementations§
Source§impl InstrumentSource
impl InstrumentSource
Sourcepub fn load(self) -> Result<Arc<dyn Instrument>>
pub fn load(self) -> Result<Arc<dyn Instrument>>
Load the bank at the named path and wrap it in an Arc<dyn Instrument>. Returns the underlying error (file-not-found,
invalid magic, malformed RIFF chunk, etc.) on failure.
Sourcepub fn sf2(path: impl AsRef<Path>) -> Self
pub fn sf2(path: impl AsRef<Path>) -> Self
Convenience constructors mirroring the enum variants. Each
takes anything Path-convertible.
pub fn sfz(path: impl AsRef<Path>) -> Self
pub fn dls(path: impl AsRef<Path>) -> Self
Trait Implementations§
Source§impl Clone for InstrumentSource
impl Clone for InstrumentSource
Source§fn clone(&self) -> InstrumentSource
fn clone(&self) -> InstrumentSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InstrumentSource
impl RefUnwindSafe for InstrumentSource
impl Send for InstrumentSource
impl Sync for InstrumentSource
impl Unpin for InstrumentSource
impl UnsafeUnpin for InstrumentSource
impl UnwindSafe for InstrumentSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more