🐛 eq over MCP takes up to 20 bands, for spectral matching
Browse files at this commit2ced44adc36b427ffd6a602bb6c10c634edfeee1Parent: bcb4dc52 changed files +6 -6
crates/mcp/src/help.rsmodified+1 -1
| @@ -650,7 +650,7 @@ const OP_TEXTS: &[(&str, &str)] = &[ | |||
| 650 | ), | 650 | ), |
| 651 | ( | 651 | ( |
| 652 | "eq", | 652 | "eq", |
| 653 | - "eq {clip, bands:[{f, db, q?, kind?}], reset?} — the clip's equalizer, up to 10 bands. f 20-20000 Hz; \ | 653 | + "eq {clip, bands:[{f, db, q?, kind?}], reset?} — the clip's equalizer, up to 20 bands. f 20-20000 Hz; \ |
| 654 | db -12 to +12; q 0.3-12 (default 0.707); kind: peak (default), low_shelf, high_shelf, low_cut \ | 654 | db -12 to +12; q 0.3-12 (default 0.707); kind: peak (default), low_shelf, high_shelf, low_cut \ |
| 655 | (high-pass: rumble, mic handling), high_cut (low-pass: hiss, air). bands replaces the whole \ | 655 | (high-pass: rumble, mic handling), high_cut (low-pass: hiss, air). bands replaces the whole \ |
| 656 | equalizer; reset:true takes it off.", | 656 | equalizer; reset:true takes it off.", |
crates/mcp/src/tools/edit_fx.rsmodified+5 -5
| @@ -1223,7 +1223,7 @@ fn fit(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> { | |||
| 1223 | Ok(done(format!("fit {raw} → {name}"), vec![(lane, start)])) | 1223 | Ok(done(format!("fit {raw} → {name}"), vec![(lane, start)])) |
| 1224 | } | 1224 | } |
| 1225 | 1225 | ||
| 1226 | -/// `eq {clip, bands?: [{f, db, q?, kind?}], reset?}`. At most 10 bands; the GUI | 1226 | +/// `eq {clip, bands?: [{f, db, q?, kind?}], reset?}`. At most 20 bands; the GUI |
| 1227 | /// caps are f 20–20000 Hz, db ±12, q 0.3–12. `q` defaults to 0.707 and `kind` | 1227 | /// caps are f 20–20000 Hz, db ±12, q 0.3–12. `q` defaults to 0.707 and `kind` |
| 1228 | /// to `peak`. `bands` replaces the clip's equalizer; `reset` takes it off. | 1228 | /// to `peak`. `bands` replaces the clip's equalizer; `reset` takes it off. |
| 1229 | fn eq(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> { | 1229 | fn eq(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> { |
| @@ -1242,8 +1242,8 @@ fn eq(s: &mut PlaybackSession, op: &Value) -> Result<Applied, String> { | |||
| 1242 | let arr = list | 1242 | let arr = list |
| 1243 | .as_array() | 1243 | .as_array() |
| 1244 | .ok_or_else(|| format!("{who}: bands must be a list of {{f, db, q, kind}}, got {}", kind_of(list)))?; | 1244 | .ok_or_else(|| format!("{who}: bands must be a list of {{f, db, q, kind}}, got {}", kind_of(list)))?; |
| 1245 | - if arr.len() > 10 { | 1245 | + if arr.len() > 20 { |
| 1246 | - return Err(format!("{who}: at most 10 bands, got {}", arr.len())); | 1246 | + return Err(format!("{who}: at most 20 bands, got {}", arr.len())); |
| 1247 | } | 1247 | } |
| 1248 | let mut bands = Vec::with_capacity(arr.len()); | 1248 | let mut bands = Vec::with_capacity(arr.len()); |
| 1249 | for (i, b) in arr.iter().enumerate() { | 1249 | for (i, b) in arr.iter().enumerate() { |
| @@ -3196,10 +3196,10 @@ mod tests { | |||
| 3196 | assert_eq!(eq.bands.len(), 1); | 3196 | assert_eq!(eq.bands.len(), 1); |
| 3197 | assert!(close(eq.bands[0].gain_db, 3.0)); | 3197 | assert!(close(eq.bands[0].gain_db, 3.0)); |
| 3198 | assert_eq!(eq.bands[0].kind, BandKind::Peak); | 3198 | assert_eq!(eq.bands[0].kind, BandKind::Peak); |
| 3199 | - let too_many: Vec<Value> = (0..11).map(|_| json!({"f": 100, "db": 0})).collect(); | 3199 | + let too_many: Vec<Value> = (0..21).map(|_| json!({"f": 100, "db": 0})).collect(); |
| 3200 | assert!(run(&mut s, json!({"op": "eq", "clip": "A1#0", "bands": too_many})) | 3200 | assert!(run(&mut s, json!({"op": "eq", "clip": "A1#0", "bands": too_many})) |
| 3201 | .unwrap_err() | 3201 | .unwrap_err() |
| 3202 | - .contains("at most 10")); | 3202 | + .contains("at most 20")); |
| 3203 | run(&mut s, json!({"op": "eq", "clip": "A1#0", "reset": true})).unwrap(); | 3203 | run(&mut s, json!({"op": "eq", "clip": "A1#0", "reset": true})).unwrap(); |
| 3204 | assert!(s.eq_of(Lane::new(LaneKind::Audio, 0), 0).is_none()); | 3204 | assert!(s.eq_of(Lane::new(LaneKind::Audio, 0), 0).is_none()); |
| 3205 | } | 3205 | } |