Skip to main content

scale_up

Function scale_up 

Source
pub fn scale_up(value: u32, src_bits: u32, dst_bits: u32) -> u32
Expand description

Scale value from src_bits up to dst_bits using the MIDI 2.0 Min-Center-Max bit-repeat algorithm. src_bits <= dst_bits <= 32.

Behaviour matches the MIDI Association reference: 0 maps to 0; values at or below the source center are a plain left shift; values above center repeat their low bits into the freed low bits so the maximum saturates.