pub enum InstrumentType {
Synth,
DrumRack,
DX7,
Jupiter8,
Odyssey,
Juno60,
Rhodes,
Sampler,
LittlePhatty,
Prophet6,
Sequencer,
}Variants§
Synth
DrumRack
DX7
Jupiter8
Odyssey
Juno60
Rhodes
Sampler
LittlePhatty
Prophet6
Sequencer
The step sequencer. Not an instrument: it drives one.
Implementations§
Source§impl InstrumentType
impl InstrumentType
Sourcepub const ALL: &[InstrumentType]
pub const ALL: &[InstrumentType]
Appended to, never reordered: a session stores an instrument by its key rather than by position, but the menu’s own order is what a player has learned, and the preset browser walks this list.
Sourcepub fn label(self) -> &'static str
pub fn label(self) -> &'static str
Examples found in repository?
examples/session_digest.rs (line 22)
14fn main() {
15 println!("== instrument layouts ==");
16 for instrument in InstrumentType::ALL {
17 let key = session::instrument_key(*instrument);
18 println!(
19 "{key:<10} params={:<3} layout={} label={:?}",
20 param_count(*instrument),
21 layout_fingerprint(*instrument),
22 instrument.label()
23 );
24 // Every selector on the panel, and how many positions it has, because
25 // that is what a stored position is an index into.
26 let count = param_count(*instrument);
27 let mut selectors = Vec::new();
28 for param in 0..count {
29 if let Some(positions) = phosphor_app::discrete::positions(*instrument, param) {
30 selectors.push(format!("{param}:{}", positions.len()));
31 }
32 }
33 println!(" selectors {}", selectors.join(" "));
34 }
35
36 for path in std::env::args().skip(1) {
37 println!("\n== {path} ==");
38 let file = match session::load(std::path::Path::new(&path)) {
39 Ok(f) => f,
40 Err(e) => {
41 println!(" unreadable: {e}");
42 continue;
43 }
44 };
45 println!(" version {} tracks {}", file.version, file.tracks.len());
46 for track in &file.tracks {
47 let Some(instrument) = session::parse_instrument_type(&track.instrument_type) else {
48 println!(" {:<12} UNKNOWN {}", track.name, track.instrument_type);
49 continue;
50 };
51 let mut params = track.synth_params.clone();
52 let clamped = session::apply_selectors(instrument, &mut params, &track.discrete);
53 let digest: u64 = params.iter().fold(0xcbf2_9ce4_8422_2325u64, |h, v| {
54 v.to_bits().to_le_bytes().iter().fold(h, |h, b| {
55 (h ^ u64::from(*b)).wrapping_mul(0x0000_0100_0000_01b3)
56 })
57 });
58 println!(
59 " {:<12} {:<10} n={:<3} digest={digest:016x} clamped={clamped:?}",
60 track.name, track.instrument_type, params.len()
61 );
62 }
63 }
64}pub fn description(self) -> &'static str
Sourcepub const fn is_sequencer(self) -> bool
pub const fn is_sequencer(self) -> bool
Whether picking this from the add-track menu builds a step sequencer rather than an instrument.
A sequencer track’s instrument_type is its child — the thing in
the plugin slot making the sound — so this entry never ends up stored
on a track. It is a choice in a menu, and the track it produces is an
ordinary instrument track with a pattern player in front of it.
Trait Implementations§
Source§impl Clone for InstrumentType
impl Clone for InstrumentType
Source§fn clone(&self) -> InstrumentType
fn clone(&self) -> InstrumentType
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 moreimpl Copy for InstrumentType
Source§impl Debug for InstrumentType
impl Debug for InstrumentType
impl Eq for InstrumentType
Source§impl PartialEq for InstrumentType
impl PartialEq for InstrumentType
impl StructuralPartialEq for InstrumentType
Auto Trait Implementations§
impl Freeze for InstrumentType
impl RefUnwindSafe for InstrumentType
impl Send for InstrumentType
impl Sync for InstrumentType
impl Unpin for InstrumentType
impl UnsafeUnpin for InstrumentType
impl UnwindSafe for InstrumentType
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