Skip to content

Commit 3c3ddd5

Browse files
committed
upd firefly-audio
1 parent 9e68467 commit 3c3ddd5

4 files changed

Lines changed: 24 additions & 17 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repository = "https://github.com/firefly-zero/firefly-runtime"
1010
[dependencies]
1111
embedded-graphics = "0.8.2"
1212
embedded-io = "0.6.1"
13-
firefly-audio = "0.2.1"
13+
firefly-audio = "0.3.0"
1414
firefly-hal = "0.4.0"
1515
firefly-types = "0.10.0"
1616
heapless = { version = "0.9.2", features = ["serde"] }

src/host/audio.rs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -227,32 +227,39 @@ pub(crate) fn mod_linear(
227227
mut caller: C,
228228
node_id: u32,
229229
param: u32,
230-
start: f32,
231-
end: f32,
230+
low: f32,
231+
high: f32,
232232
start_at: u32,
233233
end_at: u32,
234234
) {
235235
let state = caller.data_mut();
236236
state.called = "audio.mod_linear";
237-
let lfo = modulators::Linear::new(start, end, start_at, end_at);
238-
modulate(state, node_id, param, Box::new(lfo));
237+
let lfo = modulators::Linear::new(start_at, end_at);
238+
modulate(state, node_id, param, Box::new(lfo), low, high);
239239
}
240240

241-
pub(crate) fn mod_hold(mut caller: C, node_id: u32, param: u32, v1: f32, v2: f32, time: u32) {
241+
pub(crate) fn mod_hold(mut caller: C, node_id: u32, param: u32, low: f32, high: f32, time: u32) {
242242
let state = caller.data_mut();
243243
state.called = "audio.mod_hold";
244-
let lfo = modulators::Hold::new(v1, v2, time);
245-
modulate(state, node_id, param, Box::new(lfo));
244+
let lfo = modulators::Hold::new(time);
245+
modulate(state, node_id, param, Box::new(lfo), low, high);
246246
}
247247

248248
pub(crate) fn mod_sine(mut caller: C, node_id: u32, param: u32, freq: f32, low: f32, high: f32) {
249249
let state = caller.data_mut();
250250
state.called = "audio.mod_sine";
251-
let lfo = modulators::Sine::new(freq, low, high);
252-
modulate(state, node_id, param, Box::new(lfo));
251+
let lfo = modulators::Sine::new(freq);
252+
modulate(state, node_id, param, Box::new(lfo), low, high);
253253
}
254254

255-
fn modulate(state: &mut State, node_id: u32, param: u32, lfo: Box<dyn modulators::Modulator>) {
255+
fn modulate(
256+
state: &mut State,
257+
node_id: u32,
258+
param: u32,
259+
lfo: Box<dyn modulators::Modulator>,
260+
low: f32,
261+
high: f32,
262+
) {
256263
let node = match state.audio.get_node(node_id) {
257264
Ok(node) => node,
258265
Err(err) => {
@@ -264,7 +271,7 @@ fn modulate(state: &mut State, node_id: u32, param: u32, lfo: Box<dyn modulators
264271
state.log_error("param value is too high");
265272
return;
266273
}
267-
node.modulate(param as u8, lfo);
274+
node.modulate(param as u8, lfo, low, high);
268275
}
269276

270277
/// Reset the given node.

src/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const KB: u32 = 1024;
2222
const FUEL_INIT: u64 = 10_000_000;
2323
const FUEL_BOOT: u64 = 10_000_000;
2424
const FUEL_UPDATE: u64 = 10_000_000;
25-
const FUEL_RENDER: u64 = 100_000;
25+
const FUEL_RENDER: u64 = 10_000_000;
2626
const FUEL_BEFORE_EXIT: u64 = 10_000_000;
2727
const FUEL_CHEAT: u64 = 60_000;
2828

0 commit comments

Comments
 (0)