The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.
Rust ffmpegfree-video-editormodel-context-protocolnon-linear-editoroffline-firstopen-source-video-editorself-hostedvideo-editingvideo-editing-automationvideo-editing-softwarevideo-editing-toolsvideo-editorvoice-cloningyoutube-automationyoutube-shorts
feat(media): shelve read-aloud voices under Generated › Speech
Jareerd48de78b0d4c
diff --git a/docs/api/types.md b/docs/api/types.mdindex e6d30960..a5631ad1 100644--- a/docs/api/types.md+++ b/docs/api/types.md@@ -198,6 +198,7 @@ meaningfully even when the file is missing.| `audioTracks` | *AudioTrack*[] | *optional*. Every audio stream, in file order || `placeholder` | bool | *optional*. True for a template slot || `colorRange` | string | *optional*. `limited` or `full`: the levels the picture is read as, over the file's own tag. Absent means "as tagged". Set with `setMediaColorRange` |+| `origin` | string | *optional*. `speech` for a file the speech sheet read aloud. Absent for an import. The bin shelves a file with an origin under Generated, not with the imports |### AudioTrack@@ -304,7 +305,7 @@ A probed file, as `addMedia`, `fillSlot`, `replaceClipMedia` and`freezeFrame` take it. The same fields as *MediaItem* minus `id` and`placeholder`: `path`, `name`, `duration`, `kind`, `width`, `height`,`frameRate`, `frameRateFraction`, `videoCodec`, `audioCodec`, `hasAudio`,-`audioTracks`.+`audioTracks`, and `origin` (*optional*; leave it out for an import).> [!TIP]> Build one from a `media.probe` reply: copy `path`, `duration`, `kind`diff --git a/src/crates/concat-api/src/lib.rs b/src/crates/concat-api/src/lib.rsindex 0ae510eb..d3b7f843 100644--- a/src/crates/concat-api/src/lib.rs+++ b/src/crates/concat-api/src/lib.rs@@ -792,6 +792,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,}}diff --git a/src/crates/concat-export/src/flatten.rs b/src/crates/concat-export/src/flatten.rsindex b8d86aa2..508053f2 100644--- a/src/crates/concat-export/src/flatten.rs+++ b/src/crates/concat-export/src/flatten.rs@@ -261,6 +261,7 @@ mod tests {audio_codec: None,has_audio: true,audio_tracks: Vec::new(),+ origin: None,},}).expect("adds media")diff --git a/src/crates/concat-host/src/media.rs b/src/crates/concat-host/src/media.rsindex 75809e1f..18007a34 100644--- a/src/crates/concat-host/src/media.rs+++ b/src/crates/concat-host/src/media.rs@@ -124,6 +124,7 @@ impl MediaSummary {.iter().map(AudioStreamInfo::to_track).collect(),+ origin: None,}}}@@ -1027,6 +1028,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},}).expect("adds")diff --git a/src/crates/concat-host/src/templates.rs b/src/crates/concat-host/src/templates.rsindex d1ad8d30..04d6df45 100644--- a/src/crates/concat-host/src/templates.rs+++ b/src/crates/concat-host/src/templates.rs@@ -444,6 +444,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},}}diff --git a/src/crates/concat-perf/src/main.rs b/src/crates/concat-perf/src/main.rsindex 8d02454c..d4394482 100644--- a/src/crates/concat-perf/src/main.rs+++ b/src/crates/concat-perf/src/main.rs@@ -165,6 +165,7 @@ fn ripple_delete_of_200() -> Measure {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},}).expect("adds media")@@ -256,6 +257,7 @@ fn undo_200_edits() -> Measure {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},}).expect("adds media")@@ -305,6 +307,7 @@ fn document_round_trip() -> Measure {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},}).expect("adds media")diff --git a/src/crates/concat-project/src/commands/clips.rs b/src/crates/concat-project/src/commands/clips.rsindex 5051cd60..5c3d5cd1 100644--- a/src/crates/concat-project/src/commands/clips.rs+++ b/src/crates/concat-project/src/commands/clips.rs@@ -343,6 +343,7 @@ pub(super) fn apply(audio_codec: item.audio_codec,has_audio: item.has_audio,audio_tracks: item.audio_tracks,+ origin: item.origin,placeholder: false,color_range: None,extra: Default::default(),@@ -423,6 +424,7 @@ pub(super) fn apply(audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: item.origin,placeholder: false,color_range: None,extra: Default::default(),diff --git a/src/crates/concat-project/src/commands/media.rs b/src/crates/concat-project/src/commands/media.rsindex bc153387..d0c7348b 100644--- a/src/crates/concat-project/src/commands/media.rs+++ b/src/crates/concat-project/src/commands/media.rs@@ -38,6 +38,7 @@ pub(super) fn apply(audio_codec: item.audio_codec,has_audio: item.has_audio,audio_tracks: item.audio_tracks,+ origin: item.origin,placeholder: false,color_range: None,extra: Default::default(),diff --git a/src/crates/concat-project/src/commands/mod.rs b/src/crates/concat-project/src/commands/mod.rsindex adf3a642..861cfb76 100644--- a/src/crates/concat-project/src/commands/mod.rs+++ b/src/crates/concat-project/src/commands/mod.rs@@ -14,8 +14,8 @@ use serde::{Deserialize, Serialize};use crate::model::{AnimationSlot, AppliedFilter, AudioTrack, Clip, ClipAnimation, ClipKind, ColorRange, Crop,- CustomFont, Cutout, CutoutMode, KeyEase, KeyProperty, MediaItem, MediaKind, Project,- SpeedPoint, Stroke, TextStyle, Timeline, Track, Transition, VideoSettings,+ CustomFont, Cutout, CutoutMode, KeyEase, KeyProperty, MediaItem, MediaKind, MediaOrigin,+ Project, SpeedPoint, Stroke, TextStyle, Timeline, Track, Transition, VideoSettings,};mod audio;@@ -208,6 +208,11 @@ pub struct NewMedia {/// Defaulted so a caller from before the list can still add media.#[serde(default)]pub audio_tracks: Vec<AudioTrack>,+ /// What made the file, when the editor did; see `MediaItem::origin`.+ /// Defaulted so an import, and a caller from before origins, says+ /// nothing.+ #[serde(default)]+ pub origin: Option<MediaOrigin>,}/// Every edit, as the window sends it: a tagged `op` plus camelCasediff --git a/src/crates/concat-project/src/lib.rs b/src/crates/concat-project/src/lib.rsindex 0351db5c..44b9eda7 100644--- a/src/crates/concat-project/src/lib.rs+++ b/src/crates/concat-project/src/lib.rs@@ -40,7 +40,9 @@ mod tests {use crate::commands::{ClipMove, ClipPatch, Command, NewMedia, TrackFlag, TrimEdge};use crate::doc::DocumentSettings;use crate::editor::Editor;- use crate::model::{AudioTrack, ClipKind, MediaItem, MediaKind, Project, TextStyle};+ use crate::model::{+ AudioTrack, ClipKind, MediaItem, MediaKind, MediaOrigin, Project, TextStyle,+ };fn media(path: &str, duration: f64, has_audio: bool) -> Command {Command::AddMedia {@@ -57,6 +59,7 @@ mod tests {audio_codec: has_audio.then(|| "aac".to_owned()),has_audio,audio_tracks: Vec::new(),+ origin: None,},}}@@ -633,6 +636,7 @@ mod tests {audio_codec: Some("aac".into()),has_audio: true,audio_tracks: Vec::new(),+ origin: None,};let outcome = editor.apply(Command::ReplaceClipMedia {@@ -696,6 +700,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,}};assert!(@@ -737,6 +742,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,};let freeze_id = editor.apply(Command::FreezeFrame {@@ -830,6 +836,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,}),}).expect("freezes")@@ -2347,6 +2354,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},}).expect("fills");@@ -2386,6 +2394,7 @@ mod tests {audio_codec: None,has_audio: false,audio_tracks: Vec::new(),+ origin: None,},});assert!(@@ -2480,6 +2489,57 @@ mod tests {assert!(!editor.project().media[0].placeholder);}+ #[test]+ fn a_medias_origin_round_trips_and_an_unknown_one_reads_as_an_import() {+ let mut editor = Editor::new();+ let Command::AddMedia { mut item } = media("/voice.wav", 3.0, true) else {+ unreachable!()+ };+ item.kind = MediaKind::Audio;+ item.origin = Some(MediaOrigin::Speech);+ editor.apply(Command::AddMedia { item }).expect("adds");+ editor.apply(media("/a.mp4", 10.0, true)).expect("adds");++ let document = editor.to_document(&settings());+ let media = document["media"].as_array().expect("a list");+ assert_eq!(media[0]["origin"], json!("speech"));+ assert!(+ media[1].get("origin").is_none(),+ "an import says nothing, so a document without voices stays byte-identical"+ );+ let restored = Editor::from_document(&document).expect("loads");+ assert_eq!(+ restored.project().media[0].origin,+ Some(MediaOrigin::Speech)+ );+ assert_eq!(restored.project().media[1].origin, None);++ // A document from a build that predates origins, and one from a+ // build with origins this one has not heard of: both load, and+ // both files are imports here.+ let legacy = json!({+ "name": "Old", "version": 1,+ "media": [+ { "id": "m1", "path": "/a.mp4", "name": "a.mp4", "kind": "video",+ "hasAudio": false },+ { "id": "m2", "path": "/b.wav", "name": "b.wav", "kind": "audio",+ "hasAudio": true, "origin": "telepathy" },+ { "id": "m3", "path": "/c.wav", "name": "c.wav", "kind": "audio",+ "hasAudio": true, "origin": 7 }+ ],+ "tracks": [{ "id": "T1", "name": "Track 1", "visible": true, "muted": false }],+ "clips": []+ });+ let editor = Editor::from_document(&legacy).expect("loads");+ assert!(+ editor+ .project()+ .media+ .iter()+ .all(|item| item.origin.is_none())+ );+ }+#[test]fn a_garbage_document_is_none_not_a_panic() {assert!(Editor::from_document(&json!("nonsense")).is_none());@@ -3584,6 +3644,7 @@ mod tests {audio_tracks: vec![],placeholder: false,color_range: None,+ origin: None,extra: Default::default(),});@@ -3621,6 +3682,7 @@ mod tests {audio_tracks: vec![],placeholder: false,color_range: None,+ origin: None,extra: Default::default(),});diff --git a/src/crates/concat-project/src/model.rs b/src/crates/concat-project/src/model.rsindex 200edb1d..2dd5ba69 100644--- a/src/crates/concat-project/src/model.rs+++ b/src/crates/concat-project/src/model.rs@@ -31,6 +31,16 @@ pub enum MediaKind {Image,}+/// What made a media file, when it was the editor and not the user's+/// import. The bin shelves such a file under Generated, by origin, and+/// keeps it out of the import shelves.+#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]+#[serde(rename_all = "lowercase")]+pub enum MediaOrigin {+ /// Read aloud by the speech sheet.+ Speech,+}+/// What a clip can be - wider than [`MediaKind`] because a text clip has no/// file behind it; it *is* its own content.#[derive(Clone, Copy, PartialEq, Eq, Debug, Serialize, Deserialize)]@@ -155,6 +165,14 @@ pub struct MediaItem {#[serde(default, skip_serializing_if = "Option::is_none")]#[serde(deserialize_with = "wire::maybe")]pub color_range: Option<ColorRange>,+ /// Where the file came from when the editor made it; see+ /// [`MediaOrigin`]. Absent, and left out of the document, for an+ /// import, and read as absent when it names an origin this build does+ /// not know - the file is still a file, just one shelved with the+ /// imports.+ #[serde(default, skip_serializing_if = "Option::is_none")]+ #[serde(deserialize_with = "wire::maybe")]+ pub origin: Option<MediaOrigin>,/// Fields this build does not know, kept so a document written by a/// newer or a different build round-trips through this one intact.#[serde(flatten, default, skip_serializing_if = "Map::is_empty")]diff --git a/src/crates/concat/locales/de.json b/src/crates/concat/locales/de.jsonindex 73cd1fce..f12a1f38 100644--- a/src/crates/concat/locales/de.json+++ b/src/crates/concat/locales/de.json@@ -235,6 +235,7 @@"Go to end": "Zum Ende","Go to start": "Zum Anfang","Green": "Grün",+ "Generated": "Generiert","Green Screen": "Greenscreen","Half": "Halb","Hall": "Saal",@@ -340,6 +341,7 @@"Nothing to read yet": "Noch nichts zu lesen","Nothing under the playhead": "Nichts unter dem Abspielkopf","Nothing was said in that clip": "In diesem Clip wurde nichts gesagt",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Noch nichts vorgelesen. Text zu Sprache legt seine Stimme hier ab.","Object": "Objekt","off": "aus","One repeat, fading.": "Eine Wiederholung, ausklingend.",diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.jsonindex 5eb42380..e66d8d4f 100644--- a/src/crates/concat/locales/en.json+++ b/src/crates/concat/locales/en.json@@ -369,6 +369,7 @@"Generate Captions": "Generate Captions","Generate captions": "Generate captions","Generate speech": "Generate speech",+ "Generated": "Generated","Generating voice": "Generating voice","Glitch": "Glitch","Glitch Warp": "Glitch Warp",@@ -560,6 +561,7 @@"not installed": "not installed","Nothing found to keep here, so the picture shows as shot. Try another subject, or custom removal.": "Nothing found to keep here, so the picture shows as shot. Try another subject, or custom removal.","Nothing of that kind in this project.": "Nothing of that kind in this project.",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Nothing read aloud yet. Text to speech puts its voice here.","Nothing starred yet — hover a tile and press its star.": "Nothing starred yet — hover a tile and press its star.","Nothing to caption yet": "Nothing to caption yet","Nothing to export": "Nothing to export",diff --git a/src/crates/concat/locales/es.json b/src/crates/concat/locales/es.jsonindex 9ff38053..ec5c68fc 100644--- a/src/crates/concat/locales/es.json+++ b/src/crates/concat/locales/es.json@@ -235,6 +235,7 @@"Go to end": "Ir al final","Go to start": "Ir al inicio","Green": "Verde",+ "Generated": "Generado","Green Screen": "Pantalla verde","Half": "Media","Hall": "Sala",@@ -340,6 +341,7 @@"Nothing to read yet": "Aún no hay nada que leer","Nothing under the playhead": "Nada bajo el cabezal","Nothing was said in that clip": "No se dijo nada en ese clip",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Aún no se ha leído nada. Texto a voz deja aquí su voz.","Object": "Objeto","off": "desactivado","One repeat, fading.": "Una repetición que se desvanece.",diff --git a/src/crates/concat/locales/fa.json b/src/crates/concat/locales/fa.jsonindex d529a465..2cb9eddb 100644--- a/src/crates/concat/locales/fa.json+++ b/src/crates/concat/locales/fa.json@@ -272,6 +272,7 @@"Generate Captions": "ساخت زیرنویسها","Generate captions": "ساخت زیرنویسها","Generate speech": "ساخت گفتار",+ "Generated": "تولیدشده","Generating voice": "در حال ساخت صدا","Glow": "درخشش","Go to end": "رفتن به انتها",@@ -417,6 +418,7 @@"not installed": "نصب نشده","Nothing found to keep here, so the picture shows as shot. Try another subject, or custom removal.": "چیزی برای نگهداشتن پیدا نشد، بنابراین تصویر به حالت اصلی نمایش داده میشود. سوژه دیگری را امتحان کنید یا از حذف سفارشی استفاده کنید.","Nothing of that kind in this project.": "هیچ موردی از این نوع در این پروژه وجود ندارد.",+ "Nothing read aloud yet. Text to speech puts its voice here.": "هنوز چیزی خوانده نشده است. تبدیل متن به گفتار صدای خود را اینجا میگذارد.","Nothing starred yet — hover a tile and press its star.": "هنوز چیزی ستاره نشده است؛ نشانگر را روی کاشی ببرید و ستاره آن را بزنید.","Nothing to caption yet": "هنوز چیزی برای زیرنویس کردن وجود ندارد","Nothing to export": "چیزی برای خروجی گرفتن وجود ندارد",diff --git a/src/crates/concat/locales/fr.json b/src/crates/concat/locales/fr.jsonindex 76336a76..607c9bc0 100644--- a/src/crates/concat/locales/fr.json+++ b/src/crates/concat/locales/fr.json@@ -235,6 +235,7 @@"Go to end": "Aller à la fin","Go to start": "Aller au début","Green": "Vert",+ "Generated": "Généré","Green Screen": "Fond vert","Half": "Moitié","Hall": "Salle",@@ -340,6 +341,7 @@"Nothing to read yet": "Rien à lire pour l'instant","Nothing under the playhead": "Rien sous la tête de lecture","Nothing was said in that clip": "Rien n'a été dit dans ce clip",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Rien n'a encore été lu. La synthèse vocale dépose sa voix ici.","Object": "Objet","off": "désactivé","One repeat, fading.": "Une répétition qui s'estompe.",diff --git a/src/crates/concat/locales/hr.json b/src/crates/concat/locales/hr.jsonindex 301f2def..28ad721b 100644--- a/src/crates/concat/locales/hr.json+++ b/src/crates/concat/locales/hr.json@@ -286,6 +286,7 @@"Go to end": "Idi na kraj","Go to start": "Idi na početak","Golden Hour": "Zlatni sat",+ "Generated": "Generirano","Grain": "Zrno","Green": "Zelena","Green Screen": "Zelena pozadina",@@ -424,6 +425,7 @@"Nothing to export": "Ništa za izvoz","Nothing to read yet": "Još ništa za čitanje","Nothing under the playhead": "Ništa pod playheadom",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Još ništa nije pročitano naglas. Tekst u govor ovdje ostavlja svoj glas.","Nothing was said in that clip": "U tom klipu ništa nije rečeno","Object": "Objekt","off": "isključeno",diff --git a/src/crates/concat/locales/it.json b/src/crates/concat/locales/it.jsonindex a9f478f4..23059204 100644--- a/src/crates/concat/locales/it.json+++ b/src/crates/concat/locales/it.json@@ -235,6 +235,7 @@"Go to end": "Vai alla fine","Go to start": "Vai all'inizio","Green": "Verde",+ "Generated": "Generato","Green Screen": "Green screen","Half": "Metà","Hall": "Sala",@@ -340,6 +341,7 @@"Nothing to read yet": "Ancora niente da leggere","Nothing under the playhead": "Niente sotto la testina","Nothing was said in that clip": "In quella clip non è stato detto nulla",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Non è stato ancora letto nulla. La sintesi vocale lascia qui la sua voce.","Object": "Oggetto","off": "disattivato","One repeat, fading.": "Una ripetizione che sfuma.",diff --git a/src/crates/concat/locales/ja.json b/src/crates/concat/locales/ja.jsonindex b555f6fc..a3c60858 100644--- a/src/crates/concat/locales/ja.json+++ b/src/crates/concat/locales/ja.json@@ -235,6 +235,7 @@"Go to end": "終端へ","Go to start": "先頭へ","Green": "緑",+ "Generated": "生成","Green Screen": "グリーンスクリーン","Half": "1/2","Hall": "ホール",@@ -340,6 +341,7 @@"Nothing to read yet": "読み上げる内容がまだありません","Nothing under the playhead": "再生ヘッドの下に何もありません","Nothing was said in that clip": "そのクリップには発話がありませんでした",+ "Nothing read aloud yet. Text to speech puts its voice here.": "まだ何も読み上げていません。テキスト読み上げの音声はここに入ります。","Object": "物体","off": "オフ","One repeat, fading.": "一回の繰り返しがフェードします。",diff --git a/src/crates/concat/locales/ko.json b/src/crates/concat/locales/ko.jsonindex aef625a0..418f33ed 100644--- a/src/crates/concat/locales/ko.json+++ b/src/crates/concat/locales/ko.json@@ -235,6 +235,7 @@"Go to end": "끝으로","Go to start": "처음으로","Green": "녹색",+ "Generated": "생성됨","Green Screen": "그린 스크린","Half": "1/2","Hall": "홀",@@ -340,6 +341,7 @@"Nothing to read yet": "아직 읽을 내용이 없습니다","Nothing under the playhead": "재생 헤드 아래에 아무것도 없습니다","Nothing was said in that clip": "그 클립에는 말소리가 없습니다",+ "Nothing read aloud yet. Text to speech puts its voice here.": "아직 읽어 준 것이 없습니다. 텍스트 음성 변환의 음성이 여기에 들어옵니다.","Object": "사물","off": "끔","One repeat, fading.": "한 번 반복하며 사라집니다.",diff --git a/src/crates/concat/locales/pt-BR.json b/src/crates/concat/locales/pt-BR.jsonindex cfea8c44..f5d8d432 100644--- a/src/crates/concat/locales/pt-BR.json+++ b/src/crates/concat/locales/pt-BR.json@@ -235,6 +235,7 @@"Go to end": "Ir para o fim","Go to start": "Ir para o início","Green": "Verde",+ "Generated": "Gerado","Green Screen": "Tela verde","Half": "Metade","Hall": "Salão",@@ -340,6 +341,7 @@"Nothing to read yet": "Nada para ler ainda","Nothing under the playhead": "Nada sob o cursor","Nothing was said in that clip": "Nada foi dito nesse clipe",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Nada foi lido ainda. Texto para fala deixa sua voz aqui.","Object": "Objeto","off": "desligado","One repeat, fading.": "Uma repetição que se esvai.",diff --git a/src/crates/concat/locales/ru.json b/src/crates/concat/locales/ru.jsonindex 10ff1ca6..87269464 100644--- a/src/crates/concat/locales/ru.json+++ b/src/crates/concat/locales/ru.json@@ -235,6 +235,7 @@"Go to end": "В конец","Go to start": "В начало","Green": "Зелёный",+ "Generated": "Созданное","Green Screen": "Зелёный экран","Half": "Половина","Hall": "Зал",@@ -340,6 +341,7 @@"Nothing to read yet": "Пока нечего читать","Nothing under the playhead": "Под курсором ничего нет","Nothing was said in that clip": "В этом клипе ничего не сказано",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Пока ничего не озвучено. Озвучивание текста кладёт свой голос сюда.","Object": "Предмет","off": "выкл.","One repeat, fading.": "Один повтор, затухающий.",diff --git a/src/crates/concat/locales/tr.json b/src/crates/concat/locales/tr.jsonindex 28423538..37296d2e 100644--- a/src/crates/concat/locales/tr.json+++ b/src/crates/concat/locales/tr.json@@ -235,6 +235,7 @@"Go to end": "Sona git","Go to start": "Başa git","Green": "Yeşil",+ "Generated": "Oluşturulan","Green Screen": "Yeşil perde","Half": "Yarım","Hall": "Salon",@@ -340,6 +341,7 @@"Nothing to read yet": "Henüz okunacak bir şey yok","Nothing under the playhead": "Oynatma imlecinin altında bir şey yok","Nothing was said in that clip": "O klipte hiçbir şey söylenmedi",+ "Nothing read aloud yet. Text to speech puts its voice here.": "Henüz hiçbir şey seslendirilmedi. Metinden konuşma sesini buraya bırakır.","Object": "Nesne","off": "kapalı","One repeat, fading.": "Sönen tek bir tekrar.",diff --git a/src/crates/concat/locales/zh-Hans.json b/src/crates/concat/locales/zh-Hans.jsonindex 04d917c8..bbafbc7f 100644--- a/src/crates/concat/locales/zh-Hans.json+++ b/src/crates/concat/locales/zh-Hans.json@@ -235,6 +235,7 @@"Go to end": "跳到结尾","Go to start": "跳到开头","Green": "绿色",+ "Generated": "已生成","Green Screen": "绿幕","Half": "1/2","Hall": "大厅",@@ -340,6 +341,7 @@"Nothing to read yet": "还没有可朗读的内容","Nothing under the playhead": "播放头下方没有内容","Nothing was said in that clip": "该片段中没有说话内容",+ "Nothing read aloud yet. Text to speech puts its voice here.": "尚未朗读任何内容。文字转语音的声音会放在这里。","Object": "物体","off": "关","One repeat, fading.": "一次重复,逐渐消失。",diff --git a/src/crates/concat/locales/zh-TW.json b/src/crates/concat/locales/zh-TW.jsonindex f46d362e..96af4b1c 100644--- a/src/crates/concat/locales/zh-TW.json+++ b/src/crates/concat/locales/zh-TW.json@@ -368,6 +368,7 @@"Generate Captions": "產生字幕","Generate captions": "產生字幕","Generate speech": "產生語音",+ "Generated": "已生成","Generating voice": "正在產生語音","Glitch": "故障","Glitch Warp": "故障扭曲",@@ -559,6 +560,7 @@"not installed": "未安裝","Nothing found to keep here, so the picture shows as shot. Try another subject, or custom removal.": "找不到可保留的主體,因此顯示原始畫面。請嘗試其他主體選項,或使用 [自訂去背]。","Nothing of that kind in this project.": "此專案沒有這類內容。",+ "Nothing read aloud yet. Text to speech puts its voice here.": "尚未朗讀任何內容。文字轉語音的聲音會放在這裡。","Nothing starred yet — hover a tile and press its star.": "尚無收藏。請將游標移至卡片上,再按下星號即可收藏。","Nothing to caption yet": "尚無可製作字幕的內容","Nothing to export": "沒有可匯出的內容",diff --git a/src/crates/concat/src/panes/media_bin.rs b/src/crates/concat/src/panes/media_bin.rsindex 844747dd..19069762 100644--- a/src/crates/concat/src/panes/media_bin.rs+++ b/src/crates/concat/src/panes/media_bin.rs@@ -16,7 +16,7 @@ use std::path::PathBuf;use concat_host::media::{self, MediaSummary};use concat_project::Command;-use concat_project::model::{self, MediaItem, Project};+use concat_project::model::{self, MediaItem, MediaOrigin, Project};use crate::format::wave_path;use crate::host::{probe_error, spawn};@@ -211,13 +211,18 @@ impl MediaBin {project.media_by_id(id)}- /// Whether the filter lets an item of this kind through.- fn shows(filter: MediaFilter, kind: model::MediaKind) -> bool {+ /// Whether the filter lets an item through. The Media shelves, "All+ /// media" included, are the imports: a file the editor made is on its+ /// origin's shelf under Generated and nowhere else, so a read-aloud+ /// voice is not also the fifth thing under Audio.+ fn shows(filter: MediaFilter, item: &MediaItem) -> bool {+ let imported = item.origin.is_none();match filter {- MediaFilter::All => true,- MediaFilter::Video => kind == model::MediaKind::Video,- MediaFilter::Audio => kind == model::MediaKind::Audio,- MediaFilter::Images => kind == model::MediaKind::Image,+ MediaFilter::All => imported,+ MediaFilter::Video => imported && item.kind == model::MediaKind::Video,+ MediaFilter::Audio => imported && item.kind == model::MediaKind::Audio,+ MediaFilter::Images => imported && item.kind == model::MediaKind::Image,+ MediaFilter::Speech => item.origin == Some(MediaOrigin::Speech),}}@@ -251,7 +256,7 @@ impl MediaBin {HashSet::new()};for item in &project.media {- if !Self::shows(self.filter, item.kind) {+ if !Self::shows(self.filter, item) {continue;}let (row, col) = (cell / columns.max(1), cell % columns.max(1));@@ -268,7 +273,7 @@ impl MediaBin {let mut visible: Vec<&MediaItem> = project.media.iter()- .filter(|item| Self::shows(self.filter, item.kind))+ .filter(|item| Self::shows(self.filter, item)).collect();match self.sort {// Added: the import order, as the document keeps it.@@ -406,6 +411,39 @@ mod tests {);}+ #[test]+ fn a_generated_voice_is_on_its_own_shelf_and_no_other() {+ let mut bin = MediaBin::default();+ let mut project = project();+ project.media.push(MediaItem {+ id: "s1".to_owned(),+ name: "Voice 1.wav".to_owned(),+ kind: Kind::Audio,+ origin: Some(MediaOrigin::Speech),+ ..MediaItem::default()+ });+ let names = |bin: &MediaBin| -> Vec<String> {+ bin.visible(&project)+ .iter()+ .map(|item| item.name.clone())+ .collect()+ };+ // Not under All media, not under Audio, though it is audio.+ bin.filter = MediaFilter::All;+ assert_eq!(names(&bin).len(), 4, "the imports, and only them");+ bin.filter = MediaFilter::Audio;+ assert_eq!(names(&bin), ["alpha.wav"]);+ bin.filter = MediaFilter::Speech;+ assert_eq!(names(&bin), ["Voice 1.wav"]);+ // A marquee on the Speech shelf walks the Speech shelf.+ let caught = bin.band(&project, 3, (0, 2), (0, 0), false);+ assert_eq!(caught.len(), 1);+ assert!(caught.contains("s1"));+ // Rows are minted for it like any other, so a drag can name it.+ bin.assign_rows(&project);+ assert_eq!(bin.by_row(&project, 5).expect("row 5").id, "s1");+ }+#[test]fn a_click_toggles_only_when_additive() {let mut bin = MediaBin::default();diff --git a/src/crates/concat/src/panes/speech.rs b/src/crates/concat/src/panes/speech.rsindex 7e346d20..dd91f2ed 100644--- a/src/crates/concat/src/panes/speech.rs+++ b/src/crates/concat/src/panes/speech.rs@@ -13,7 +13,7 @@ use std::sync::Arc;use concat_host::media::{self, MediaSummary};use concat_project::Command;-use concat_project::model::ClipKind;+use concat_project::model::{ClipKind, MediaOrigin};use concat_speech::tts::{CHATTERBOX_CLONE, Family, Reference, VoiceInfo, family_of, is_clone};use slint::SharedString;@@ -137,9 +137,11 @@ impl SpeechPane {self.running = false;match *result {Ok(summary) => {- let created = studio.apply(Command::AddMedia {- item: summary.to_new_media(),- });+ // Marked as read aloud: the bin shelves it under+ // Generated › Speech, apart from the imports.+ let mut item = summary.to_new_media();+ item.origin = Some(MediaOrigin::Speech);+ let created = studio.apply(Command::AddMedia { item });let media_id = created.or_else(|| {studio.project()diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rsindex 08230730..6f4e4478 100644--- a/src/crates/concat/src/studio.rs+++ b/src/crates/concat/src/studio.rs@@ -6403,25 +6403,24 @@ impl Studio {);// The bin.+ // The Media shelves count the imports; what the editor made is+ // counted on its own shelf under Generated. See MediaBin::shows.let items = &self.project().media;sync(&models.media, self.media.rows(self));- editor.set_media_count_all(items.len() as i32);- editor.set_media_count_video(+ let imported = |kind: Option<model::MediaKind>| {items.iter()- .filter(|item| item.kind == model::MediaKind::Video)- .count() as i32,- );- editor.set_media_count_audio(- items- .iter()- .filter(|item| item.kind == model::MediaKind::Audio)- .count() as i32,- );- editor.set_media_count_images(+ .filter(|item| item.origin.is_none() && kind.is_none_or(|kind| item.kind == kind))+ .count() as i32+ };+ editor.set_media_count_all(imported(None));+ editor.set_media_count_video(imported(Some(model::MediaKind::Video)));+ editor.set_media_count_audio(imported(Some(model::MediaKind::Audio)));+ editor.set_media_count_images(imported(Some(model::MediaKind::Image)));+ editor.set_media_count_speech(items.iter()- .filter(|item| item.kind == model::MediaKind::Image)+ .filter(|item| item.origin == Some(model::MediaOrigin::Speech)).count() as i32,);editor.set_media_selected_count(self.media.selected.len() as i32);diff --git a/src/crates/concat/ui/editor.slint b/src/crates/concat/ui/editor.slintindex 92b4108c..5d1a4db0 100644--- a/src/crates/concat/ui/editor.slint+++ b/src/crates/concat/ui/editor.slint@@ -70,6 +70,7 @@ export global Editor {in-out property <int> media-count-video;in-out property <int> media-count-audio;in-out property <int> media-count-images;+ in-out property <int> media-count-speech;in-out property <int> media-selected-count;in-out property <bool> importing;diff --git a/src/crates/concat/ui/workspace/media-pane.slint b/src/crates/concat/ui/workspace/media-pane.slintindex ed62bd99..13d56c24 100644--- a/src/crates/concat/ui/workspace/media-pane.slint+++ b/src/crates/concat/ui/workspace/media-pane.slint@@ -20,9 +20,10 @@ import { Wave } from "../primitives/wave.slint";export enum MediaKind { video, audio, image }/// What the sidebar has narrowed the bin to. `all` is not "no filter": it is-/// the row that is highlighted when every kind is on, which is why it is a-/// value here and not the absence of one.-export enum MediaFilter { all, video, audio, images }+/// the row that is highlighted when every import is on, which is why it is a+/// value here and not the absence of one. `speech` is the Generated group's+/// shelf: what the editor read aloud, which the Media rows leave out.+export enum MediaFilter { all, video, audio, images, speech }/// One look a title can be given, as the Text page's Presets shelf shows/// it: enough of the style to draw the name in it. Published by Rust from@@ -1356,6 +1357,8 @@ export component MediaPane inherits Rectangle {in property <int> count-video;in property <int> count-audio;in property <int> count-images;+ /// What the editor made, by origin; not in `count-all`.+ in property <int> count-speech;/// how many of the whole bin are selected, not how many of `items` arein property <int> selected-count;in property <bool> importing;@@ -1422,6 +1425,7 @@ export component MediaPane inherits Rectangle {property <int> tab;property <bool> categories-open: true;+ property <bool> generated-open: true;property <bool> text-open: true;/// 0 = Titles, 1 = Presetsproperty <int> text-category;@@ -1805,6 +1809,25 @@ export component MediaPane inherits Rectangle {current: root.filter == MediaFilter.images;clicked => { root.narrow(MediaFilter.images); }}++ // What the editor made rather than the user+ // imported, one shelf per origin. A voice read+ // aloud is here and not under Audio, so the sound+ // the user brought stays tellable from the sound+ // the app wrote.+ CategoryHeading {+ height: 26px;+ title: I18n.t("Generated");+ open: root.generated-open;+ toggled => { root.generated-open = !root.generated-open; }+ }+ if root.generated-open: CategoryRow {+ height: 24px;+ label: I18n.t("Speech");+ count: root.count-speech;+ current: root.filter == MediaFilter.speech;+ clicked => { root.narrow(MediaFilter.speech); }+ }}if root.tab == 1: VerticalLayout {@@ -2026,7 +2049,9 @@ export component MediaPane inherits Rectangle {if root.tab == 0 && root.items.length == 0: Empty {glyph: Glyph.import;- text: root.count-all > 0+ text: root.filter == MediaFilter.speech+ ? I18n.t("Nothing read aloud yet. Text to speech puts its voice here.")+ : root.count-all > 0? I18n.t("Nothing of that kind in this project."): "Drop video and audio files anywhere in the window to import them.";}diff --git a/src/crates/concat/ui/workspace/seat.slint b/src/crates/concat/ui/workspace/seat.slintindex a6413e0b..33ca262e 100644--- a/src/crates/concat/ui/workspace/seat.slint+++ b/src/crates/concat/ui/workspace/seat.slint@@ -97,6 +97,7 @@ export component Seat inherits Rectangle {count-video: Editor.media-count-video;count-audio: Editor.media-count-audio;count-images: Editor.media-count-images;+ count-speech: Editor.media-count-speech;selected-count: Editor.media-selected-count;importing: Editor.importing;