pub struct Waterfall { /* private fields */ }Expand description
Waterfall.
This object is used to create and add a WebGL2 waterfall display to a
RenderEngine and to modify the parameters of the waterfall.
Implementations§
source§impl Waterfall
impl Waterfall
sourcepub fn new(
engine: &mut RenderEngine,
performance: Performance
) -> Result<Waterfall, JsValue>
pub fn new( engine: &mut RenderEngine, performance: Performance ) -> Result<Waterfall, JsValue>
Creates a new waterfall, adding it to the RenderEngine.
The performance parameter should contain a performance object obtained
with web_sys::Window::performance.
sourcepub fn put_waterfall_spectrum(&mut self, spectrum_linear: &Float32Array)
pub fn put_waterfall_spectrum(&mut self, spectrum_linear: &Float32Array)
Adds a spectrum line to the waterfall.
This function updates the waterfall by adding a new spectrum line to it. The spectrum is given in linear power units.
sourcepub fn prepare_render(
&mut self,
engine: &mut RenderEngine,
dt: f32
) -> Result<(), JsValue>
pub fn prepare_render( &mut self, engine: &mut RenderEngine, dt: f32 ) -> Result<(), JsValue>
Updates the waterfall for rendering.
This function must be called before each call to
RenderEngine::render. It updates and prepares the waterfall render
objects for rendering. The vale of dt should be the timestamp given
to the request_animation_frame callback in which this function is
called. It is currently unused, since the waterfall scroll rate is
determined by how often
put_waterfall_spectrum is called.
sourcepub fn resize_canvas(
&mut self,
engine: &mut RenderEngine
) -> Result<(), JsValue>
pub fn resize_canvas( &mut self, engine: &mut RenderEngine ) -> Result<(), JsValue>
Updates the waterfall according to the new dimensions of the canvas.
This function should be called each time that the canvas size or the device pixel ratio changes, so that the waterfall can be update accordingly.
sourcepub fn set_freq_samprate(
&mut self,
center_freq: f64,
samp_rate: f64,
engine: &mut RenderEngine
) -> Result<(), JsValue>
pub fn set_freq_samprate( &mut self, center_freq: f64, samp_rate: f64, engine: &mut RenderEngine ) -> Result<(), JsValue>
Updates the waterfall with a new center frequency and sample rate.
The center frequency and sample rate should be given in units of Hz and samples per second.
sourcepub fn get_freq_samprate(&self) -> (f64, f64)
pub fn get_freq_samprate(&self) -> (f64, f64)
Returns the current waterfall center frequency and sample rate.
The center frequency and sample rate are given in units of Hz and samples per second.
sourcepub fn is_channel_visible(&self) -> bool
pub fn is_channel_visible(&self) -> bool
Returns whether the DDC channel is visible in the waterfall.
sourcepub fn set_channel_visible(&self, visible: bool)
pub fn set_channel_visible(&self, visible: bool)
Sets whether the DDC channel is visible in the waterfall.
By default the channel is not visible.
sourcepub fn get_channel_frequency(&self) -> f64
pub fn get_channel_frequency(&self) -> f64
Returns the frequency of the DDC channel in the waterfall.
The frequency is given in Hz of offset with respect to the waterfall center frequency.
sourcepub fn set_channel_frequency(&mut self, frequency: f64)
pub fn set_channel_frequency(&mut self, frequency: f64)
Sets the frequency of the DDC channel in the waterfall.
This function shall be called when the DDC frequency changes. The
frequency is given in Hz of offset with respect to the waterfall
center frequency.
This funciton must also be called when the sample rate is changed using [Self::set_freq_samp_rate].
sourcepub fn set_channel_decimation(&mut self, decimation: u32)
pub fn set_channel_decimation(&mut self, decimation: u32)
Sets the decimation factor of the DDC channel in the waterfall.
This function shall be called when the DDC decimation factor changes.
sourcepub fn load_colormap(
&self,
engine: &mut RenderEngine,
colormap: &[u8]
) -> Result<(), JsValue>
pub fn load_colormap( &self, engine: &mut RenderEngine, colormap: &[u8] ) -> Result<(), JsValue>
Loads a new colormap for the waterfall.
The colormap is given as a slice whose length is a multiple of 3 and
contains the concatenation of the RGB values of the list of colors that
defines the colormap (typically, 256 colors are used for the colormap,
so the length of the colormap slice is 3 * 256).
sourcepub fn set_center_frequency(&mut self, frequency: f32)
pub fn set_center_frequency(&mut self, frequency: f32)
Sets the center frequency of the waterfall.
This function is used when dragging the waterfall to scroll in
frequency. The frequency does not use physical units, but rather has a
value between -1 and 1 that corresponds to screen coordinates.
sourcepub fn get_center_frequency(&self) -> f32
pub fn get_center_frequency(&self) -> f32
Returns the current center frequency of the waterfall.
The frequency is defined as in the
set_center_frequency function.
sourcepub fn set_waterfall_min(&mut self, value: f32)
pub fn set_waterfall_min(&mut self, value: f32)
Sets the waterfall minimum power value.
The minimum value is used to scale the colormap. The value is in dB
units.
sourcepub fn set_waterfall_max(&mut self, value: f32)
pub fn set_waterfall_max(&mut self, value: f32)
Sets the waterfall maximum power value.
The maximum value is used to scale the colormap. The value is in dB
units.
sourcepub fn get_channel_frequency_uniform(&self) -> f32
pub fn get_channel_frequency_uniform(&self) -> f32
Returns the value of the uniform associated with the DDC channel frequency.
sourcepub fn get_channel_width_uniform(&self) -> f32
pub fn get_channel_width_uniform(&self) -> f32
Returns the value of the uniform associated with the DDC channel width.
sourcepub fn set_waterfall_update_rate(&mut self, rate: f32)
pub fn set_waterfall_update_rate(&mut self, rate: f32)
Sets the waterfall update rate.
The waterfall update rate is used for smooth animation interpolation between waterfall lines. If the rate is not set, smooth animation interpolation is not used.
The rate is indicated in Hz (updates per second).