If you have any wierd behaviour with RootNote data I'm sharing an excerpt from my source code here.
alisomay opened this issue ยท 4 comments
impl TryFrom<u8> for RootNote {
type Error = ConversionError;
// TODO:
// When a pattern is sent (or maybe something else happens) the notes are between 0 and 11
// But by default they are between 96 and 108
// This indicates probably a flag encoding somewhere in the data.
// I'm a bit lazy to figure out what it is, so I'm just going to do a quick hack here.
// But if a lost flag is waiting to be discovered in this context one can start analyzing this behaviour.
fn try_from(note: u8) -> Result<Self, Self::Error> {
match note {
0 | 96 => Ok(Self::C),
1 | 97 => Ok(Self::CSharp),
2 | 98 => Ok(Self::D),
3 | 99 => Ok(Self::EFlat),
4 | 100 => Ok(Self::E),
5 | 101 => Ok(Self::F),
6 | 102 => Ok(Self::FSharp),
7 | 103 => Ok(Self::G),
8 | 104 => Ok(Self::GSharp),
9 | 105 => Ok(Self::A),
10 | 107 => Ok(Self::BFlat),
11 | 108 => Ok(Self::B),
_ => Err(ConversionError::Range {
value: note.to_string(),
type_name: "RootNote".into(),
}),
}
}
}
When do you see those 0..11 notes ? this is how it looks on my (mk1) AR (using the prt
debug command in my editor):
[FUNC+PLAY] (clear pattern), then set trig on track 1 / step 1 (default note=C-3):
[dbg] handleCmdReadPatternTrig: stepIdx=0 trig=$0381 note=127(127) vel=255(127) dur=255 mic=0 rlen=46 rrat=9 rvel=0 cond=127
p-lock step 1 to note C#3:
[dbg] handleCmdReadPatternTrig: stepIdx=0 trig=$0381 note=61(61) vel=255(127) dur=255 mic=0 rlen=46 rrat=9 rvel=0 cond=127
p-lock step 1 to note C-4:
[dbg] handleCmdReadPatternTrig: stepIdx=0 trig=$0381 note=72(72) vel=255(127) dur=255 mic=0 rlen=46 rrat=9 rvel=0 cond=127
i.e. initially the note is set to 127 (with the MSB condition bit masked out) which means "use the track's default note".
p-locking the note sets it to the (MIDI?) note number, e.g. 61 = (5*12)+1 = C#3, or 72 = (6*12) = C-4
(the AR seems to use the Yamaha "Middle C" notation, i.e. middle C = C-3)
This does not look like there are any more hidden flags.
p.s.: I just merged your pull requests (sry for the delay. the ctrl_in_* fields seem to be mkII only, couldn't find them on my mk1)
on second thought: you are talking about the pad scale root note, not the trigs, right ?
sU8 root_note; /* @0x0284 <ali> Root Note 96..107 From C to B */