studio.rs

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 Phase line 128 · What the Studio is doing.
  • enum Who line 143 · Who is speaking into a session.
  • struct Setup line 163 · What a live session was started with.
  • enum Running line 181 · The session the Studio has open, and there is at most one.
  • struct RoomGuest line 194 · One guest in a room: the name their take is filed under, and the microphone they speak into.
  • enum Whose line 262 · Whose voice one recording of a take is.
  • struct GuestTake line 299 · What is being kept for one guest while a room take runs.
  • enum Reading line 321 · What a running session last reported about itself.
  • struct Studio line 335 · The Studio and the Browser.
  • enum Keep line 2334 · Which side of the engine a take keeps.
  • enum Render line 2402 · What a take is to be turned into.
  • enum ExportWork line 2410 · One export, ready to run on a worker.
  • enum Act line 2484 · Something a browser row asked for.
  • struct Opened line 2581 · An opened vault, with everything the panel needs to draw it.
  • struct DecoyRound line 2613 · What one round of decoy making came back with.
  • enum Tone line 2687 · How a message about an export reads, without saying in what colour.
  • struct ExportJob line 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::called line 208 · What to call this guest in slot slot, filling in a blank name.
  • Studio::is_open line 480 · Whether the vault is open.
  • Studio::is_veiling line 500 · Whether the veiled voice is going out.
  • Studio::wants_a_room line 505 · Whether the form is set to a room.
  • Studio::want_a_room line 515 · Switch the form between one microphone and a room.
  • Studio::room_guests line 523 · Who is in the room, in the order they were added.
  • Studio::room_guest_mut line 528 · One guest, to be edited by the controls that draw them.
  • Studio::add_guest line 536 · Add a guest, up to veilvoice_audio::MAX_GUESTS.
  • Studio::remove_guest line 543 · Take a guest out of the room.
  • Studio::guest_levels line 553 · The smoothed bars for the room, one pair per guest.
  • Studio::levels line 564 · The smoothed levels, for the monitor strip and for this tab.
  • Studio::trouble line 574 · What the audio path last reported about itself, and whether it is new.
  • Studio::intruders line 581 · The programs that took the microphone while this take has been running.
  • Studio::note_microphone_holders line 596 · Record which programs are holding the microphone right now.
  • Studio::tick line 613 · Read the session's counters, once a frame, and move the levels on.
    reaches catch_a_fault, is_recording, stop_veiling, finish_take, counted_interruptions, store_take, take_name, length
  • Studio::start_veiling line 754 · Start veiling, keeping nothing.
    reaches start_session, sharing_a_microphone
  • Studio::start_room line 775 · Roadmap item 147.
    reaches start_session, sharing_a_microphone
  • Studio::close line 804 · Shut the vault and forget the key.
    reaches stop_veiling, finish_take, is_recording, counted_interruptions, store_take, take_name, length
  • Studio::tab line 1602 · The take half of the Recording Studio tab.
    reaches is_previewing, keep_form, length, phase, poll_decoys, poll_unlock, say, shut_panel, start_take, stop_take, take_form, is_recording
  • Studio::browser line 1740 · The Recording Browser tab.
    reaches apply, counted, decoy_panel, length, made_on, poll_decoys, poll_unlock, say, shut_panel, size, start_export, play
  • Keep::wants_veiled line 2346 · Whether the veiled voice is kept.
  • Keep::wants_plain line 2354 · Whether the real voice is kept.
  • Keep::label line 2359 · What this is called where it is chosen.
  • Keep::cost line 2373 · What it costs, in the words the plaintext path uses.
  • cannot_capture line 2804 · Say, before anything is pressed, that this build cannot capture.

WHAT CALLS WHAT

into_secret line 106 default_dir line 122 sharing_a_microphone line 232 take_name line 278 Studio::is_recording line 492 Studio::is_previewing line 559 Studio::tick line 613 Studio::catch_a_fault line 705 Studio::phase line 741 Studio::start_veiling line 754 Studio::start_room line 775 Studio::stop_veiling line 786 Studio::close line 804 Studio::start_unlock line 855 Studio::tab line 1602 Studio::browser line 1740 counted_interruptions line 2505 counted_decoys line 2514 counted line 2523 made_on line 2536 length line 2828 size line 2834 entry: a way in: public, and nothing in this file calls it api: public, and also used inside this file helper: private to this file dashed: a call that goes back up, or across a wrapped rank 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 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

ItemLineDocumentation
into_secret fn106Move a typed passphrase into page-locked storage and wipe the buffer.
default_dir pub fn122Where the vaults live: beside the lock file, in this platform's config directory.
Phase enum128What the Studio is doing.
Who enum143Who is speaking into a session.
Setup struct163What a live session was started with.
Running enum181The session the Studio has open, and there is at most one.
RoomGuest pub struct194One guest in a room: the name their take is filed under, and the microphone they speak into.
RoomGuest::called pub fn208What to call this guest in slot slot, filling in a blank name.
sharing_a_microphone pub fn232Which guests are sharing a microphone, and the sentence to say about it.
Whose pub enum262Whose voice one recording of a take is.
take_name pub fn278What one recording of a take is called in the vault.
GuestTake struct299What is being kept for one guest while a room take runs.
Reading pub enum321What a running session last reported about itself.
Studio pub struct335The Studio and the Browser.
Studio::is_open pub fn480Whether the vault is open.
Studio::is_recording pub fn492Whether a take is being kept.
Studio::is_veiling pub fn500Whether the veiled voice is going out.
Studio::wants_a_room pub fn505Whether the form is set to a room.
Studio::want_a_room pub fn515Switch the form between one microphone and a room.
Studio::room_guests pub fn523Who is in the room, in the order they were added.
Studio::room_guest_mut pub fn528One guest, to be edited by the controls that draw them.
Studio::add_guest pub fn536Add a guest, up to veilvoice_audio::MAX_GUESTS.
Studio::remove_guest pub fn543Take a guest out of the room.
Studio::guest_levels pub fn553The smoothed bars for the room, one pair per guest.
Studio::is_previewing pub fn559Whether what is going out is a preview to this machine's own output rather than to the chosen one.
Studio::levels pub fn564The smoothed levels, for the monitor strip and for this tab.
Studio::trouble pub fn574What the audio path last reported about itself, and whether it is new.
Studio::intruders pub fn581The programs that took the microphone while this take has been running.
Studio::note_microphone_holders pub fn596Record which programs are holding the microphone right now.
Studio::tick pub fn613Read the session's counters, once a frame, and move the levels on.
Studio::catch_a_fault fn705Roadmap item 145.
Studio::phase fn741What phase the take half of the tab is in.
Studio::start_veiling pub fn754Start veiling, keeping nothing.
Studio::start_room pub fn775Roadmap item 147.
Studio::stop_veiling pub fn786Stop the audio.
Studio::close pub fn804Shut the vault and forget the key.
Studio::start_unlock fn855Start deriving the key from both entries and opening the vault.
Studio::poll_unlock fn882Collect a finished unlock.
Studio::start_decoys fn925Start making count decoys beside the open vault, on a thread.
Studio::poll_decoys fn946Collect a finished round of decoys.
Studio::start_take fn993Start recording into the vault's holding area.
Studio::start_session fn1019Start, or restart, the live session setup describes.
Studio::stop_take fn1183Stop keeping, seal what was captured, and carry on veiling.
Studio::finish_take fn1195Stop recording and seal what was captured into the vault.
Studio::store_take fn1312Seal one recorder's audio into the vault under name.
Studio::play fn1381Play a take, straight out of the vault and out of locked memory.
Studio::start_export fn1440Start turning a take into a page, a video, or both, in into.
Studio::export_work fn1474The work one export is, taken from what is on screen now.
Studio::export fn1516Export here and now, for tests only.
Studio::write_page fn1538The player page, its subtitles, and the drawing they sit in.
Studio::refresh fn1580Re-read the listing from the vault.
Studio::tab pub fn1602The take half of the Recording Studio tab.
Studio::browser pub fn1740The Recording Browser tab.
Studio::decoy_panel fn2066The decoy panel, under the listing.
Studio::shut_panel fn2095The panel shown while the vault is shut, in both tabs.
Studio::take_form fn2170The name field for the next take.
Studio::keep_form fn2201Which side of the engine to keep, asked before anything starts.
Studio::say fn2231Show the last message, if there is one.
Studio::apply fn2242Carry out a row action.
Keep pub enum2334Which side of the engine a take keeps.
Keep::wants_veiled pub fn2346Whether the veiled voice is kept.
Keep::wants_plain pub fn2354Whether the real voice is kept.
Keep::label pub fn2359What this is called where it is chosen.
Keep::cost pub fn2373What it costs, in the words the plaintext path uses.
Render pub enum2402What a take is to be turned into.
ExportWork enum2410One export, ready to run on a worker.
ExportWork::run fn2419Do it, and say what happened.
wav_shape fn2441The sample rate and frame count a canonical WAV header states.
plan_for fn2465A one-speaker plan spanning a take.
Act enum2484Something a browser row asked for.
counted_interruptions pub fn2505"one interruption" or "three interruptions".
counted_decoys pub fn2514"One decoy" or "four decoys", so the interface does not say "1 decoys".
counted pub fn2523"One recording" or "four recordings", so the interface does not say "1 recordings".
made_on pub fn2536A Unix time as a date somebody reads.
pcm16 fn2560Sixteen-bit PCM from a WAV, as the waveform drawer wants it.
safe_stem fn2575A file name built from what somebody called a recording.
Opened struct2581An opened vault, with everything the panel needs to draw it.
open_vault fn2592Derive the key and open the vault, on a worker.
DecoyRound struct2613What one round of decoy making came back with.
DecoyShape type2626The shape a decoy is built to, named here so the signatures read.
make_decoys_now fn2634Make count decoys in parent, then read the folder again.
measure_folder fn2671How much room is free where the vaults are, and how many are there.
Tone enum2687How a message about an export reads, without saying in what colour.
Tone::colour fn2701The colour for this tone, from the palette that is active now.
ExportJob struct2715Everything one export needs, taken at the moment the folder was chosen.
export_now fn2737Write the player page, and the audio and captions beside it.
cannot_capture pub fn2804Say, before anything is pressed, that this build cannot capture.
length pub fn2828A length in seconds, as m:ss, for somewhere a person reads.
size pub fn2834A size in bytes, rounded to something a person can compare.