Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

fix: the gate's masked steps - voice style names through a literal t, and clippy over the stabilization code (#60, #253)

Jareer16e048b80fc6
diff --git a/src/crates/concat-vision/src/stabilize/path.rs b/src/crates/concat-vision/src/stabilize/path.rs
index 3866c59b..65a6c7d6 100644
--- a/src/crates/concat-vision/src/stabilize/path.rs
+++ b/src/crates/concat-vision/src/stabilize/path.rs
@@ -184,7 +184,7 @@ pub fn zoom_needed(map: &Similarity, aspect: f64) -> f64 {
/// The ends are padded by reflecting through the end points.
pub fn gaussian(values: &[f64], sigma: f64) -> Vec<f64> {
let n = values.len();
- if n < 2 || !(sigma >= 0.5) {
+ if n < 2 || sigma.is_nan() || sigma < 0.5 {
return values.to_vec();
}
// Three boxes of width w have the variance of a Gaussian of sigma
diff --git a/src/crates/concat-vision/src/stabilize/store.rs b/src/crates/concat-vision/src/stabilize/store.rs
index 0fb3d6fb..61b53889 100644
--- a/src/crates/concat-vision/src/stabilize/store.rs
+++ b/src/crates/concat-vision/src/stabilize/store.rs
@@ -116,8 +116,9 @@ impl Motion {
/// The movement cached in `dir`, or `None` when nothing is, or what is
/// there cannot be read. Read once per change of the file.
pub fn read(dir: &Path) -> Option<Arc<Motion>> {
- static CACHE: OnceLock<Mutex<HashMap<PathBuf, (SystemTime, u64, Arc<Motion>)>>> =
- OnceLock::new();
+ /// Each file's movement, by the modified time and length it was read at.
+ type Read = HashMap<PathBuf, (SystemTime, u64, Arc<Motion>)>;
+ static CACHE: OnceLock<Mutex<Read>> = OnceLock::new();
let file = motion_file(dir);
let meta = std::fs::metadata(&file).ok()?;
let stamp = (
diff --git a/src/crates/concat/src/panes/sounds.rs b/src/crates/concat/src/panes/sounds.rs
index 550eba6c..0b9302f6 100644
--- a/src/crates/concat/src/panes/sounds.rs
+++ b/src/crates/concat/src/panes/sounds.rs
@@ -488,7 +488,7 @@ impl Studio {
.iter()
.enumerate()
.map(|(row, style)| {
- let name = t(style.key);
+ let name = (style.name)();
let effects: Vec<String> = style
.effects
.iter()
diff --git a/src/crates/concat/src/panes/speech.rs b/src/crates/concat/src/panes/speech.rs
index e7cb944e..e22d253b 100644
--- a/src/crates/concat/src/panes/speech.rs
+++ b/src/crates/concat/src/panes/speech.rs
@@ -63,36 +63,37 @@ const DEFAULT_PAUSES: f32 = 0.2;
/// laid on the speech clip once it lands, where they stay as ordinary
/// effects to change or take off. Original looks of the effects alone -
/// no one's voice, no character's name. The Audio page's card carries
-/// its row; the key names it in the interface's language.
+/// its row; `name` names it in the interface's language, through a
+/// literal `t` so scripts/locales.py finds the key.
pub struct VoiceStyle {
- pub key: &'static str,
+ pub name: fn() -> String,
pub effects: &'static [&'static str],
}
/// The Audio page's Voices › Styles shelf, in its order.
pub const STYLES: [VoiceStyle; 6] = [
VoiceStyle {
- key: "voices.styleChipmunk",
+ name: || t("voices.styleChipmunk"),
effects: &["concat.chipmunk"],
},
VoiceStyle {
- key: "voices.styleRobot",
+ name: || t("voices.styleRobot"),
effects: &["concat.robot"],
},
VoiceStyle {
- key: "voices.styleTelephone",
+ name: || t("voices.styleTelephone"),
effects: &["concat.telephone"],
},
VoiceStyle {
- key: "voices.styleMegaphone",
+ name: || t("voices.styleMegaphone"),
effects: &["concat.megaphone"],
},
VoiceStyle {
- key: "voices.styleRadio",
+ name: || t("voices.styleRadio"),
effects: &["concat.radio"],
},
VoiceStyle {
- key: "voices.styleGiant",
+ name: || t("voices.styleGiant"),
effects: &["concat.deep", "concat.hall"],
},
];
@@ -854,7 +855,7 @@ impl SpeechPane {
style: self
.style
.and_then(|row| STYLES.get(row))
- .map(|style| t(style.key))
+ .map(|style| (style.name)())
.unwrap_or_default()
.into(),
save_name: self.save_name.as_str().into(),