pub struct FluxCells { /* private fields */ }Expand description
While this object is in the form of flux cells, it can actually be used for
any form of track data: flux streams, bit streams, or nibble streams.
Each bit in the stream represents a flux-cell where there may be a flux transition.
If fshift < bshift, we have a flux stream.
If fshift == bshift, we have a bit stream.
If uniform-length nibbles are tightly packed, we have a nibble stream.
Implementations§
Source§impl FluxCells
impl FluxCells
Sourcepub fn from_woz_bits(
bit_count: usize,
buf: &[u8],
time: u64,
double_speed: bool,
) -> Self
pub fn from_woz_bits( bit_count: usize, buf: &[u8], time: u64, double_speed: bool, ) -> Self
Create cells from a track buffer in the form of a nibble stream or bit stream, assuming 4 microsecond bit cells
Sourcepub fn from_woz_flux(
byte_count: usize,
buf: &[u8],
time: u64,
double_speed: bool,
) -> Self
pub fn from_woz_flux( byte_count: usize, buf: &[u8], time: u64, double_speed: bool, ) -> Self
Create cells from a WOZ flux track buffer, the flux cells will
be set to 500/250 ns. Any padding in buf is ignored.
Sourcepub fn change_resolution(&mut self, flux_shift: usize)
pub fn change_resolution(&mut self, flux_shift: usize)
Change the resolution of the cells. Mainly useful for converting between bitstream tracks and flux tracks. N.b. if resolution is being reduced information will be lost, in general.
Sourcepub fn to_woz_buf(
&self,
padded_len: Option<usize>,
padded_val: u8,
) -> (Vec<u8>, usize)
pub fn to_woz_buf( &self, padded_len: Option<usize>, padded_val: u8, ) -> (Vec<u8>, usize)
Convert the cells to the native WOZ or NIB track buffer, works
for any kind of cell. If padded_len==None the result is padded
to the nearest 512 byte boundary. If padded_len==Some and the data fits within
the prescribed length, it is used, otherwise panic.
Returns (buf,count), where count is either the
bit count for bit streams, or byte count for flux streams.
Sourcepub fn sync_to_other_track(&mut self, other: &FluxCells)
pub fn sync_to_other_track(&mut self, other: &FluxCells)
Synchronize these cells to another set of cells, used when switching tracks. This will impose alignment of the time-pointer to a flux cell boundary.
pub fn set_ptr(&mut self, ticks: usize)
Sourcepub fn rev(&mut self, ticks: usize)
pub fn rev(&mut self, ticks: usize)
Go back on the track by ticks, this will also reverse the elapsed time (pegs to 0).
Avoid using, saving and restoring state is usually preferable.
Sourcepub fn ticks_since(&self, ref_tick: u64) -> u64
pub fn ticks_since(&self, ref_tick: u64) -> u64
ticks since the reference tick, if ref_tick is in the future return 0
Sourcepub fn ps_since(&self, ref_tick: u64) -> u64
pub fn ps_since(&self, ref_tick: u64) -> u64
picoseconds since the reference tick, if ref_tick is in the future return 0