Skip to content

Commit 9eb17cd

Browse files
committed
cargo fmt
1 parent 040e897 commit 9eb17cd

File tree

14 files changed

+180
-161
lines changed

14 files changed

+180
-161
lines changed

examples/inputs_tour_steps/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
pub mod step_mod_ranges;
21
pub mod step_h_sliders;
32
pub mod step_knobs;
3+
pub mod step_mod_ranges;
44
pub mod step_ramps;
55
pub mod step_v_sliders;
66
pub mod step_xy_pads;

examples/inputs_tour_steps/step_mod_ranges.rs

Lines changed: 87 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use iced::{Column, Element, Length, Row, Text, Align};
1+
use iced::{Align, Column, Element, Length, Row, Text};
22

3-
use iced_audio::{knob, ModulationRange, FloatRange, Knob,
4-
mod_range_input, ModRangeInput, h_slider, HSlider, v_slider, VSlider};
3+
use iced_audio::{
4+
h_slider, knob, mod_range_input, v_slider, FloatRange, HSlider, Knob,
5+
ModRangeInput, ModulationRange, VSlider,
6+
};
57

68
use crate::{style, Step};
79

@@ -84,18 +86,20 @@ impl Default for ModRanges {
8486
.modulation_range(mod_range),
8587

8688
auto_input1_state: mod_range_input::State::new(
87-
float_range_bipolar.create_param_default(ModRangesID::ModRangeInput1),
89+
float_range_bipolar
90+
.create_param_default(ModRangesID::ModRangeInput1),
8891
),
89-
92+
9093
knob_auto1_state: knob::State::new(
9194
float_range.create_param_default(ModRangesID::ModKnob1),
9295
)
9396
.modulation_range(ModulationRange::default()),
9497

9598
auto_input2_state: mod_range_input::State::new(
96-
float_range_bipolar.create_param_default(ModRangesID::ModRangeInput2),
99+
float_range_bipolar
100+
.create_param_default(ModRangesID::ModRangeInput2),
97101
),
98-
102+
99103
knob_auto2_state: knob::State::new(
100104
float_range.create_param_default(ModRangesID::ModKnob2),
101105
)
@@ -197,28 +201,30 @@ impl ModRanges {
197201
if let Some(mod_range) =
198202
&mut self.knob_auto1_state.modulation_range
199203
{
200-
let auto_value = self.float_range_bipolar
204+
let auto_value = self
205+
.float_range_bipolar
201206
.to_value(self.auto_input1_state.param.normal);
202207

203-
mod_range.start = self.knob_auto1_state.param.normal;
204-
mod_range.end = (mod_range.start.value() +
205-
auto_value).into();
208+
mod_range.start =
209+
self.knob_auto1_state.param.normal;
210+
mod_range.end =
211+
(mod_range.start.value() + auto_value).into();
206212
}
207213
}
208214
ModRangesID::ModRangeInput1 => {
209-
let auto_value = self.float_range_bipolar
215+
let auto_value = self
216+
.float_range_bipolar
210217
.to_value(self.auto_input1_state.param.normal);
211218

212-
self.output_text = crate::info_text_f32(
213-
id,
214-
auto_value,
215-
);
219+
self.output_text = crate::info_text_f32(id, auto_value);
216220

217221
if let Some(mod_range) =
218222
&mut self.knob_auto1_state.modulation_range
219223
{
220-
mod_range.end = (self.knob_auto1_state.param.normal.value() +
221-
auto_value).into();
224+
mod_range.end =
225+
(self.knob_auto1_state.param.normal.value()
226+
+ auto_value)
227+
.into();
222228
}
223229
}
224230

@@ -232,28 +238,30 @@ impl ModRanges {
232238
if let Some(mod_range) =
233239
&mut self.knob_auto2_state.modulation_range
234240
{
235-
let auto_value = self.float_range_bipolar
241+
let auto_value = self
242+
.float_range_bipolar
236243
.to_value(self.auto_input2_state.param.normal);
237244

238-
mod_range.start = self.knob_auto2_state.param.normal;
239-
mod_range.end = (mod_range.start.value() +
240-
auto_value).into();
245+
mod_range.start =
246+
self.knob_auto2_state.param.normal;
247+
mod_range.end =
248+
(mod_range.start.value() + auto_value).into();
241249
}
242250
}
243251
ModRangesID::ModRangeInput2 => {
244-
let auto_value = self.float_range_bipolar
252+
let auto_value = self
253+
.float_range_bipolar
245254
.to_value(self.auto_input2_state.param.normal);
246255

247-
self.output_text = crate::info_text_f32(
248-
id,
249-
auto_value,
250-
);
256+
self.output_text = crate::info_text_f32(id, auto_value);
251257

252258
if let Some(mod_range) =
253259
&mut self.knob_auto2_state.modulation_range
254260
{
255-
mod_range.end = (self.knob_auto2_state.param.normal.value() +
256-
auto_value).into();
261+
mod_range.end =
262+
(self.knob_auto2_state.param.normal.value()
263+
+ auto_value)
264+
.into();
257265
}
258266
}
259267
}
@@ -270,19 +278,18 @@ impl ModRanges {
270278

271279
let knob_end = Knob::new(&mut self.knob_end_state, Message::KnobMoved);
272280

273-
let knob1 =
274-
Knob::new(&mut self.knob1_state, Message::KnobMoved)
275-
.style(style::KnobCustomArc);
276-
281+
let knob1 = Knob::new(&mut self.knob1_state, Message::KnobMoved)
282+
.style(style::KnobCustomArc);
283+
277284
let auto_input1 =
278285
ModRangeInput::new(&mut self.auto_input1_state, Message::KnobMoved)
279286
.size(Length::from(10))
280287
.style(style::ModRangeInputCustom);
281-
288+
282289
let knob_auto1 =
283290
Knob::new(&mut self.knob_auto1_state, Message::KnobMoved)
284291
.style(style::KnobCustomStyleCircle);
285-
292+
286293
let h_slider1 =
287294
HSlider::new(&mut self.h_slider1_state, Message::KnobMoved)
288295
.style(style::HSliderRectStyle);
@@ -291,55 +298,63 @@ impl ModRanges {
291298
VSlider::new(&mut self.v_slider1_state, Message::KnobMoved)
292299
.width(Length::from(Length::Units(30)))
293300
.style(style::VSliderRectStyle);
294-
301+
295302
let auto_input2 =
296303
ModRangeInput::new(&mut self.auto_input2_state, Message::KnobMoved)
297304
.size(Length::from(15))
298305
.style(mod_range_input::DefaultInvisible);
299-
306+
300307
let knob_auto2 =
301308
Knob::new(&mut self.knob_auto2_state, Message::KnobMoved)
302309
.style(style::KnobCustomStyleCircle);
303310

304311
// push the widgets into rows
305-
let knob_row = Row::new().spacing(20).push(
306-
Column::new()
307-
.max_width(125)
308-
.spacing(10)
309-
.push(Text::new("Range Start"))
310-
.push(knob_start)
311-
.push(Text::new("Range End"))
312-
.push(knob_end)
313-
)
314-
.push(Column::new()
315-
.max_width(125)
316-
.max_height(250)
317-
.align_items(Align::Center)
312+
let knob_row = Row::new()
318313
.spacing(20)
319-
.push(knob1)
320-
.push(h_slider1)
321-
.push(v_slider1)
322-
)
323-
.push(Column::new()
324-
.width(Length::Fill)
325-
.spacing(10)
326-
.push(Column::new()
327-
.width(Length::Fill)
328-
.spacing(10)
329-
.align_items(Align::Center)
330-
.push(Text::new("Custom Style with ModRangeInput"))
331-
.push(auto_input1)
332-
.push(knob_auto1),
314+
.push(
315+
Column::new()
316+
.max_width(125)
317+
.spacing(10)
318+
.push(Text::new("Range Start"))
319+
.push(knob_start)
320+
.push(Text::new("Range End"))
321+
.push(knob_end),
333322
)
334-
.push(Column::new()
335-
.width(Length::Fill)
336-
.spacing(0)
337-
.align_items(Align::Center)
338-
.push(Text::new("Custom Style with invisible ModRangeInput"))
339-
.push(auto_input2)
340-
.push(knob_auto2),
323+
.push(
324+
Column::new()
325+
.max_width(125)
326+
.max_height(250)
327+
.align_items(Align::Center)
328+
.spacing(20)
329+
.push(knob1)
330+
.push(h_slider1)
331+
.push(v_slider1),
341332
)
342-
);
333+
.push(
334+
Column::new()
335+
.width(Length::Fill)
336+
.spacing(10)
337+
.push(
338+
Column::new()
339+
.width(Length::Fill)
340+
.spacing(10)
341+
.align_items(Align::Center)
342+
.push(Text::new("Custom Style with ModRangeInput"))
343+
.push(auto_input1)
344+
.push(knob_auto1),
345+
)
346+
.push(
347+
Column::new()
348+
.width(Length::Fill)
349+
.spacing(0)
350+
.align_items(Align::Center)
351+
.push(Text::new(
352+
"Custom Style with invisible ModRangeInput",
353+
))
354+
.push(auto_input2)
355+
.push(knob_auto2),
356+
),
357+
);
343358

344359
let content = Column::new()
345360
.spacing(20)

examples/inputs_tour_steps/style.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use iced::{button, image, Background, Color, Vector};
2-
use iced_audio::{mod_range_input, h_slider, knob, ramp, v_slider, xy_pad};
2+
use iced_audio::{h_slider, knob, mod_range_input, ramp, v_slider, xy_pad};
33

44
pub enum Button {
55
Primary,
@@ -175,8 +175,18 @@ impl v_slider::StyleSheet for VSliderRectStyle {
175175
offset: 10,
176176
placement: v_slider::ModRangePlacement::Center,
177177
color_empty: None,
178-
color: Color { r: 0.0, g: 0.7, b: 0.0, a: 0.3 },
179-
color_inverse: Color { r: 0.0, g: 0.7, b: 0.0, a: 0.5 },
178+
color: Color {
179+
r: 0.0,
180+
g: 0.7,
181+
b: 0.0,
182+
a: 0.3,
183+
},
184+
color_inverse: Color {
185+
r: 0.0,
186+
g: 0.7,
187+
b: 0.0,
188+
a: 0.5,
189+
},
180190
})
181191
}
182192
}

iced_audio.7z

256 KB
Binary file not shown.

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,14 @@ pub use crate::core::*;
246246
mod platform {
247247
#[doc(no_inline)]
248248
pub use crate::wgpu::{
249-
mod_range_input, db_meter, h_slider, knob, ramp, v_slider, xy_pad,
249+
db_meter, h_slider, knob, mod_range_input, ramp, v_slider, xy_pad,
250250
};
251251

252252
#[doc(no_inline)]
253253
pub use {
254-
mod_range_input::ModRangeInput, db_meter::DBMeter, h_slider::HSlider,
255-
knob::Knob, ramp::Ramp, v_slider::VSlider, xy_pad::XYPad,
254+
db_meter::DBMeter, h_slider::HSlider, knob::Knob,
255+
mod_range_input::ModRangeInput, ramp::Ramp, v_slider::VSlider,
256+
xy_pad::XYPad,
256257
};
257258
}
258259

src/native/h_slider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use iced_native::{
1212

1313
use std::hash::Hash;
1414

15-
use crate::core::{Normal, Param, TickMarkGroup, ModulationRange};
15+
use crate::core::{ModulationRange, Normal, Param, TickMarkGroup};
1616

1717
static DEFAULT_HEIGHT: u16 = 14;
1818
static DEFAULT_MODIFIER_SCALAR: f32 = 0.02;

src/native/v_slider.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use iced_native::{
1212

1313
use std::hash::Hash;
1414

15-
use crate::core::{Normal, Param, TickMarkGroup, ModulationRange};
15+
use crate::core::{ModulationRange, Normal, Param, TickMarkGroup};
1616

1717
static DEFAULT_WIDTH: u16 = 14;
1818
static DEFAULT_MODIFIER_SCALAR: f32 = 0.02;

src/style/h_slider.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub struct ModRangeStyle {
231231
/// The width of the line
232232
pub width: u16,
233233
/// The offset of the line from the edge of the widget.
234-
/// If `placement` is `ModRangePlacement::center`, then
234+
/// If `placement` is `ModRangePlacement::center`, then
235235
/// this will be the padding from the edge of the widget.
236236
pub offset: i32,
237237
/// The placement of the line relative to the widget
@@ -244,7 +244,6 @@ pub struct ModRangeStyle {
244244
/// The color of a filled portion of the ring when `end` is less than
245245
/// `start`.
246246
pub color_inverse: Color,
247-
248247
}
249248

250249
/// A set of rules that dictate the style of an [`HSlider`].

src/style/mod_range_input.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl StyleSheet for Default {
102102
}
103103

104104
/// An invisible [`StyleSheet`] for an [`ModRangeInput`]
105-
///
105+
///
106106
/// Appearance is invisible, but the input is still interactable. Useful
107107
/// if placed right on top of a [`Knob`] with a [`ModRangeRingStyle`].
108108
///

src/style/v_slider.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub struct ModRangeStyle {
231231
/// The width of the line
232232
pub width: u16,
233233
/// The offset of the line from the edge of the widget.
234-
/// If `placement` is `ModRangePlacement::center`, then
234+
/// If `placement` is `ModRangePlacement::center`, then
235235
/// this will be the padding from the edge of the widget.
236236
pub offset: i32,
237237
/// The placement of the line relative to the widget
@@ -244,7 +244,6 @@ pub struct ModRangeStyle {
244244
/// The color of a filled portion of the ring when `end` is less than
245245
/// `start`.
246246
pub color_inverse: Color,
247-
248247
}
249248

250249
/// A set of rules that dictate the style of an [`VSlider`].

0 commit comments

Comments
 (0)