pub fn setup_window(
    name: &str,
    preferred_height: Option<usize>,
    preferred_width: Option<usize>,
    preferred_x_range: Option<Range<f64>>,
    preferred_y_range: Option<Range<f64>>,
    x_desc: &str,
    y_desc: &str,
    audio_buffer_len: usize,
    time_per_sample: f64
) -> (Window, ChartState<Cartesian2d<RangedCoordf64, RangedCoordf64>>, ChartState<Cartesian2d<RangedCoordf64, RangedCoordf64>>, PixelBuf)
Expand description

Initializes the minifb window and draws the initial grid into it. It splits the drawing area into an upper chart and a lower chart. The upper exists to show original audio data. The lower exists to show transformed audio data, e.g. spectrum or lowpass filter.

Parameters

  • name Name of the GUI window
  • preferred_height Preferred height of GUI window. Default is DEFAULT_H.
  • preferred_width Preferred height of GUI window. Default is DEFAULT_W.
  • preferred_x_range Preferred range for the x-axis of the lower (=custom) diagram. If no value is present, the same value as for the upper diagram is used.
  • preferred_y_range Preferred range for the y-axis of the lower (=custom) diagram. If no value is present, the same value as for the upper diagram is used.
  • x_desc Description for the x-axis of the lower (=custom) diagram.
  • y_desc Description for the y-axis of the lower (=custom) diagram.
  • audio_buffer_len Number of elements in the audio buffer. Needed for the scaling of the x-axis.
  • time_per_sample Time per sample. Needed for the scaling of the x-axis.

Returns

  • window object
  • chartstate of the upper chart
  • chartstate of the lower chart
  • the shared pixel buf