LineExtraction.h header
#include <ew/app/voice/LineExtraction.h>
Namespace ew::app::voice
Functions
std::vector< ew::core::voice::CastMember > ew::app::voice::deriveCast(const ew::core::branching::BranchScene &scene, const std::vector< ew::core::voice::CastMember > &existing)
The cast scene calls for: one entry per character who speaks a line in it.
Derived, not maintained. The graph already knows who says what, and a cast list kept beside it is a second copy that goes stale the first time a character is written out of a scene.
Entries already in existing are returned unchanged, so the actor, the contact and the voice note a producer typed survive every re-derivation – those are facts about a real person that no graph can recover. A character who speaks in scene and is not yet in existing arrives with only their entity id filled in, which is the row a producer casts. Characters in existing who no longer speak are dropped: a cast list that accumulated everyone ever written is not a cast list, and Edit > Undo is what recovers a cut made in error.
Order follows the scene's nodes, so the first character to speak heads the list.
std::vector< ew::core::voice::VoiceLine > ew::app::voice::extractBarkLines(const ew::core::branching::BarkCollection &collection)
Pulls the speakable lines out of collection, in the order the author arranged them.
A bark is a recorded line like any other: it ships in the game, an actor reads it, and a studio is booked against it. The only difference is that a bark has no graph position, so the line carries the BARK's id as its identity across edits (VoiceLine::sourceBarkId) rather than a node's – which is what lets mergeExtracted keep a take when the words are fixed.
A bark with nothing written in it yet is skipped, for the reason an empty node is: it is not a line to book studio time for.
std::vector< ew::core::voice::VoiceLine > ew::app::voice::extractLines(const ew::core::branching::BranchScene &scene)
Pulls the speakable lines out of scene, in reading order.
Only Line and Choice nodes carry text an actor reads. A Condition's text is the author's label for a fork the reader never sees, a Jump's is a note about where it goes, and a Hub's is a place-marker for where threads rejoin – sending any of those to a studio would have someone paid to read stage directions aloud.
Each extracted line carries the scene as its sourceId, so a director looking at a line list can be sent back to where it lives.
Speaker comes from the node, where an author set it (2.10). It is never guessed – not from the scene's title, and not from a name at the start of the text – because a wrong name on a recording sheet is worse than an empty column somebody fills in. A node whose speaker its author has not named yet extracts with a null one.
std::vector< ew::core::voice::VoiceLine > ew::app::voice::mergeExtracted(const std::vector< ew::core::voice::VoiceLine > &existing, const std::vector< ew::core::voice::VoiceLine > &extracted)
Merges extracted into existing, preserving takes already recorded.
Re-extracting must not throw away a recording day. Lines are matched by their text: a line whose wording is unchanged keeps every take against it, a genuinely new line arrives with none, and a line whose text was edited arrives as new – which is correct, because the recording that existed was made against wording that no longer exists.
Lines in existing that no longer appear are dropped, since a line cut from the story is not a line to record. Their takes go with them, and Edit > Undo is what a writer uses if the cut was a mistake – the alternative, keeping every line ever written, makes the list useless by the end of a project.