crates/veilvoice-gui/src/studio.rs
veilvoice-gui · 2845 lines · read the source here · or on GitHub
The Recording Studio and the Recording Browser.
Two tabs, one vault
The Studio records; the Browser is what is in the vault afterwards. They are one module because they are one vault, and a vault opened in two places is two chances to get the unlocking wrong.
Roadmap item 130: this is also where veiling as it runs happens
Live scramble was a tab of its own, and it did not need to be. The Studio has always recorded through the same veilvoice_audio::LiveSession that tab ran, with the same engine and the same routing, so the two screens were one act performed in two rooms: pick the devices over there, come here, press record.
Two sessions was the part that was actually wrong. Veiling on one tab and recording on the other opened the same microphone twice, and on the platforms that allow that at all the second stream gets a copy of the input nobody asked for. Studio::start_session is the only starter now, and a test reads this crate's source and fails if a second one appears.
The voice half of the tab is drawn by the window rather than here, because the device lists and the engine settings belong to the window. What lives in this module is the session those controls drive, and everything about the vault.
The voice half works with the vault shut. Veiling a call has never needed a recording vault, and making somebody set one up before they could disguise their voice on a call would be a worse program than the one that had two tabs.
The vault needs both passphrases, and asks for both here
veilvoice_crypto::studio::StudioKey is derived from the app lock and the at-rest passphrase, and from neither alone. That is the whole point of it: a laptop stolen while VeilVoice is unlocked opens nothing, because the at-rest passphrase was never typed.
So this tab asks for both, every time, rather than reaching into whatever the rest of the application happens to be holding. That is a deliberate inconvenience:
- The app-lock secret is only kept for the session when
Sealing::AppLock(crate::security::Sealing::AppLock) is chosen. Reading it when it happens to be there, and prompting when it is not, would make the vault's strength depend on an unrelated setting, and nobody would know which they had. - Prompting for both, always, is the only version of this whose security is the same on every run.
Neither passphrase is stored. Both typing buffers are wiped the moment the key is derived, and the derived key lives in page-locked memory for as long as the vault is open. Locking the window closes the vault.
What is recorded is what comes out, unless it was asked to be otherwise
The Studio records through veilvoice_audio::LiveSession::start_recording, which is the same path the command line uses, so the samples that reach the recorder are the veiled ones. That is the default and it is what Keep::Veiled means.
Roadmap item 131 adds the other two. The microphone can be kept as well, or instead, and the reasoning for allowing it at all is on Keep: refusing would not stop somebody who needs the real recording, it would move them to a phone on the table, which is a plaintext file on a device with none of this. What matters is that it is asked for rather than arrived at.
So it is a choice made before the button, never remembered between runs, reset when the window locks, and stated in the same words the plaintext path uses. The default is the safe one, and every path that has not been asked for the microphone passes None where it would go.
Each recording is assembled inside a veilvoice_crypto::Secret and handed straight to the vault to be sealed. Neither is ever a plain file, not even briefly: an unveiled take is a recording of a real voice, and it is sealed exactly as strongly as a veiled one.
In plain words
Record here, and what you record is kept locked up. Opening the cupboard needs both of your passwords at once, every time, which is what makes it worth having.
What gets recorded is the disguised voice. You can ask for your real one as well, or instead, and the screen tells you what that means before you start: anybody who can open the cupboard can then hear who was talking.
WHAT THIS FILE CONTAINS
2845 lines defining 71 functions (37 public), 17 types and 0 constants. Everything below is read out of the source, so it cannot disagree with the code.
The types it owns.
enum Phaseline 128 · What the Studio is doing.enum Wholine 143 · Who is speaking into a session.struct Setupline 163 · What a live session was started with.enum Runningline 181 · The session the Studio has open, and there is at most one.struct RoomGuestline 194 · One guest in a room: the name their take is filed under, and the microphone they speak into.enum Whoseline 262 · Whose voice one recording of a take is.struct GuestTakeline 299 · What is being kept for one guest while a room take runs.enum Readingline 321 · What a running session last reported about itself.struct Studioline 335 · The Studio and the Browser.enum Keepline 2334 · Which side of the engine a take keeps.enum Renderline 2402 · What a take is to be turned into.enum ExportWorkline 2410 · One export, ready to run on a worker.enum Actline 2484 · Something a browser row asked for.struct Openedline 2581 · An opened vault, with everything the panel needs to draw it.struct DecoyRoundline 2613 · What one round of decoy making came back with.enum Toneline 2687 · How a message about an export reads, without saying in what colour.struct ExportJobline 2715 · Everything one export needs, taken at the moment the folder was chosen.
What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.
RoomGuest::calledline 208 · What to call this guest in slot slot, filling in a blank name.Studio::is_openline 480 · Whether the vault is open.Studio::is_veilingline 500 · Whether the veiled voice is going out.Studio::wants_a_roomline 505 · Whether the form is set to a room.Studio::want_a_roomline 515 · Switch the form between one microphone and a room.Studio::room_guestsline 523 · Who is in the room, in the order they were added.Studio::room_guest_mutline 528 · One guest, to be edited by the controls that draw them.Studio::add_guestline 536 · Add a guest, up to veilvoice_audio::MAX_GUESTS.Studio::remove_guestline 543 · Take a guest out of the room.Studio::guest_levelsline 553 · The smoothed bars for the room, one pair per guest.Studio::levelsline 564 · The smoothed levels, for the monitor strip and for this tab.Studio::troubleline 574 · What the audio path last reported about itself, and whether it is new.Studio::intrudersline 581 · The programs that took the microphone while this take has been running.Studio::note_microphone_holdersline 596 · Record which programs are holding the microphone right now.Studio::tickline 613 · Read the session's counters, once a frame, and move the levels on.
reachescatch_a_fault,is_recording,stop_veiling,finish_take,counted_interruptions,store_take,take_name,lengthStudio::start_veilingline 754 · Start veiling, keeping nothing.
reachesstart_session,sharing_a_microphoneStudio::start_roomline 775 · Roadmap item 147.
reachesstart_session,sharing_a_microphoneStudio::closeline 804 · Shut the vault and forget the key.
reachesstop_veiling,finish_take,is_recording,counted_interruptions,store_take,take_name,lengthStudio::tabline 1602 · The take half of the Recording Studio tab.
reachesis_previewing,keep_form,length,phase,poll_decoys,poll_unlock,say,shut_panel,start_take,stop_take,take_form,is_recordingStudio::browserline 1740 · The Recording Browser tab.
reachesapply,counted,decoy_panel,length,made_on,poll_decoys,poll_unlock,say,shut_panel,size,start_export,playKeep::wants_veiledline 2346 · Whether the veiled voice is kept.Keep::wants_plainline 2354 · Whether the real voice is kept.Keep::labelline 2359 · What this is called where it is chosen.Keep::costline 2373 · What it costs, in the words the plaintext path uses.cannot_captureline 2804 · Say, before anything is pressed, that this build cannot capture.
WHAT CALLS WHAT
The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one. 22 of 71 functions are drawn; the diagram is bounded at 22 so it stays readable.
The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
n_into_secret["into_secret<br/>line 106"]
n_default_dir["default_dir<br/>line 122"]
n_sharing_a_microphone["sharing_a_microphone<br/>line 232"]
n_take_name["take_name<br/>line 278"]
n_is_recording["Studio::is_recording<br/>line 492"]
n_is_previewing["Studio::is_previewing<br/>line 559"]
n_tick(["Studio::tick<br/>line 613"])
n_catch_a_fault["Studio::catch_a_fault<br/>line 705"]
n_phase["Studio::phase<br/>line 741"]
n_start_veiling(["Studio::start_veiling<br/>line 754"])
n_start_room(["Studio::start_room<br/>line 775"])
n_stop_veiling["Studio::stop_veiling<br/>line 786"]
n_close(["Studio::close<br/>line 804"])
n_start_unlock["Studio::start_unlock<br/>line 855"]
n_tab(["Studio::tab<br/>line 1602"])
n_browser(["Studio::browser<br/>line 1740"])
n_counted_interruptions["counted_interruptions<br/>line 2505"]
n_counted_decoys["counted_decoys<br/>line 2514"]
n_counted["counted<br/>line 2523"]
n_made_on["made_on<br/>line 2536"]
n_length["length<br/>line 2828"]
n_size["size<br/>line 2834"]
n_browser --> n_counted
n_browser --> n_length
n_browser --> n_made_on
n_browser --> n_size
n_catch_a_fault --> n_is_recording
n_catch_a_fault --> n_stop_veiling
n_close --> n_stop_veiling
n_phase --> n_is_recording
n_start_unlock --> n_default_dir
n_start_unlock --> n_into_secret
n_stop_veiling --> n_is_recording
n_tab --> n_is_previewing
n_tab --> n_length
n_tab --> n_phase
n_tick --> n_catch_a_fault
n_tick --> n_is_recording
click n_into_secret href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L106" "open the source"
click n_default_dir href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L122" "open the source"
click n_sharing_a_microphone href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L232" "open the source"
click n_take_name href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L278" "open the source"
click n_is_recording href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L492" "open the source"
click n_is_previewing href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L559" "open the source"
click n_tick href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L613" "open the source"
click n_catch_a_fault href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L705" "open the source"
click n_phase href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L741" "open the source"
click n_start_veiling href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L754" "open the source"
click n_start_room href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L775" "open the source"
click n_stop_veiling href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L786" "open the source"
click n_close href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L804" "open the source"
click n_start_unlock href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L855" "open the source"
click n_tab href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L1602" "open the source"
click n_browser href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L1740" "open the source"
click n_counted_interruptions href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L2505" "open the source"
click n_counted_decoys href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L2514" "open the source"
click n_counted href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L2523" "open the source"
click n_made_on href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L2536" "open the source"
click n_length href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L2828" "open the source"
click n_size href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-gui/src/studio.rs#L2834" "open the source"
classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
class n_tick,n_start_veiling,n_start_room,n_close,n_tab,n_browser entry
classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
class n_default_dir,n_sharing_a_microphone,n_take_name,n_is_recording,n_is_previewing,n_stop_veiling,n_counted_interruptions,n_counted_decoys,n_counted,n_made_on,n_length,n_size api
classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
class n_into_secret,n_catch_a_fault,n_phase,n_start_unlock helper
subgraph chart_key ["Key"]
direction LR
key_entry["entry: a way in: public, and nothing in this file calls it"]
key_api["api: public, and also used inside this file"]
key_helper["helper: private to this file"]
end
class key_entry entry
class key_api api
class key_helper helper
This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.
ITEMS
| Item | Line | Documentation |
|---|---|---|
into_secret fn | 106 | Move a typed passphrase into page-locked storage and wipe the buffer. |
default_dir pub fn | 122 | Where the vaults live: beside the lock file, in this platform's config directory. |
Phase enum | 128 | What the Studio is doing. |
Who enum | 143 | Who is speaking into a session. |
Setup struct | 163 | What a live session was started with. |
Running enum | 181 | The session the Studio has open, and there is at most one. |
RoomGuest pub struct | 194 | One guest in a room: the name their take is filed under, and the microphone they speak into. |
RoomGuest::called pub fn | 208 | What to call this guest in slot slot, filling in a blank name. |
sharing_a_microphone pub fn | 232 | Which guests are sharing a microphone, and the sentence to say about it. |
Whose pub enum | 262 | Whose voice one recording of a take is. |
take_name pub fn | 278 | What one recording of a take is called in the vault. |
GuestTake struct | 299 | What is being kept for one guest while a room take runs. |
Reading pub enum | 321 | What a running session last reported about itself. |
Studio pub struct | 335 | The Studio and the Browser. |
Studio::is_open pub fn | 480 | Whether the vault is open. |
Studio::is_recording pub fn | 492 | Whether a take is being kept. |
Studio::is_veiling pub fn | 500 | Whether the veiled voice is going out. |
Studio::wants_a_room pub fn | 505 | Whether the form is set to a room. |
Studio::want_a_room pub fn | 515 | Switch the form between one microphone and a room. |
Studio::room_guests pub fn | 523 | Who is in the room, in the order they were added. |
Studio::room_guest_mut pub fn | 528 | One guest, to be edited by the controls that draw them. |
Studio::add_guest pub fn | 536 | Add a guest, up to veilvoice_audio::MAX_GUESTS. |
Studio::remove_guest pub fn | 543 | Take a guest out of the room. |
Studio::guest_levels pub fn | 553 | The smoothed bars for the room, one pair per guest. |
Studio::is_previewing pub fn | 559 | Whether what is going out is a preview to this machine's own output rather than to the chosen one. |
Studio::levels pub fn | 564 | The smoothed levels, for the monitor strip and for this tab. |
Studio::trouble pub fn | 574 | What the audio path last reported about itself, and whether it is new. |
Studio::intruders pub fn | 581 | The programs that took the microphone while this take has been running. |
Studio::note_microphone_holders pub fn | 596 | Record which programs are holding the microphone right now. |
Studio::tick pub fn | 613 | Read the session's counters, once a frame, and move the levels on. |
Studio::catch_a_fault fn | 705 | Roadmap item 145. |
Studio::phase fn | 741 | What phase the take half of the tab is in. |
Studio::start_veiling pub fn | 754 | Start veiling, keeping nothing. |
Studio::start_room pub fn | 775 | Roadmap item 147. |
Studio::stop_veiling pub fn | 786 | Stop the audio. |
Studio::close pub fn | 804 | Shut the vault and forget the key. |
Studio::start_unlock fn | 855 | Start deriving the key from both entries and opening the vault. |
Studio::poll_unlock fn | 882 | Collect a finished unlock. |
Studio::start_decoys fn | 925 | Start making count decoys beside the open vault, on a thread. |
Studio::poll_decoys fn | 946 | Collect a finished round of decoys. |
Studio::start_take fn | 993 | Start recording into the vault's holding area. |
Studio::start_session fn | 1019 | Start, or restart, the live session setup describes. |
Studio::stop_take fn | 1183 | Stop keeping, seal what was captured, and carry on veiling. |
Studio::finish_take fn | 1195 | Stop recording and seal what was captured into the vault. |
Studio::store_take fn | 1312 | Seal one recorder's audio into the vault under name. |
Studio::play fn | 1381 | Play a take, straight out of the vault and out of locked memory. |
Studio::start_export fn | 1440 | Start turning a take into a page, a video, or both, in into. |
Studio::export_work fn | 1474 | The work one export is, taken from what is on screen now. |
Studio::export fn | 1516 | Export here and now, for tests only. |
Studio::write_page fn | 1538 | The player page, its subtitles, and the drawing they sit in. |
Studio::refresh fn | 1580 | Re-read the listing from the vault. |
Studio::tab pub fn | 1602 | The take half of the Recording Studio tab. |
Studio::browser pub fn | 1740 | The Recording Browser tab. |
Studio::decoy_panel fn | 2066 | The decoy panel, under the listing. |
Studio::shut_panel fn | 2095 | The panel shown while the vault is shut, in both tabs. |
Studio::take_form fn | 2170 | The name field for the next take. |
Studio::keep_form fn | 2201 | Which side of the engine to keep, asked before anything starts. |
Studio::say fn | 2231 | Show the last message, if there is one. |
Studio::apply fn | 2242 | Carry out a row action. |
Keep pub enum | 2334 | Which side of the engine a take keeps. |
Keep::wants_veiled pub fn | 2346 | Whether the veiled voice is kept. |
Keep::wants_plain pub fn | 2354 | Whether the real voice is kept. |
Keep::label pub fn | 2359 | What this is called where it is chosen. |
Keep::cost pub fn | 2373 | What it costs, in the words the plaintext path uses. |
Render pub enum | 2402 | What a take is to be turned into. |
ExportWork enum | 2410 | One export, ready to run on a worker. |
ExportWork::run fn | 2419 | Do it, and say what happened. |
wav_shape fn | 2441 | The sample rate and frame count a canonical WAV header states. |
plan_for fn | 2465 | A one-speaker plan spanning a take. |
Act enum | 2484 | Something a browser row asked for. |
counted_interruptions pub fn | 2505 | "one interruption" or "three interruptions". |
counted_decoys pub fn | 2514 | "One decoy" or "four decoys", so the interface does not say "1 decoys". |
counted pub fn | 2523 | "One recording" or "four recordings", so the interface does not say "1 recordings". |
made_on pub fn | 2536 | A Unix time as a date somebody reads. |
pcm16 fn | 2560 | Sixteen-bit PCM from a WAV, as the waveform drawer wants it. |
safe_stem fn | 2575 | A file name built from what somebody called a recording. |
Opened struct | 2581 | An opened vault, with everything the panel needs to draw it. |
open_vault fn | 2592 | Derive the key and open the vault, on a worker. |
DecoyRound struct | 2613 | What one round of decoy making came back with. |
DecoyShape type | 2626 | The shape a decoy is built to, named here so the signatures read. |
make_decoys_now fn | 2634 | Make count decoys in parent, then read the folder again. |
measure_folder fn | 2671 | How much room is free where the vaults are, and how many are there. |
Tone enum | 2687 | How a message about an export reads, without saying in what colour. |
Tone::colour fn | 2701 | The colour for this tone, from the palette that is active now. |
ExportJob struct | 2715 | Everything one export needs, taken at the moment the folder was chosen. |
export_now fn | 2737 | Write the player page, and the audio and captions beside it. |
cannot_capture pub fn | 2804 | Say, before anything is pressed, that this build cannot capture. |
length pub fn | 2828 | A length in seconds, as m:ss, for somewhere a person reads. |
size pub fn | 2834 | A size in bytes, rounded to something a person can compare. |