LineBudget.h header

#include <ew/core/branching/LineBudget.h>

Namespace ew::core::branching

LineBudget struct

struct ew::core::branching::LineBudget

What one line is allowed to cost: how many characters it may run to, and how long it may take to say.

A line that does not fit the box or blows the voice-over budget is a production problem found late – in QA, or in the booth, long after the scene was signed off. No narrative tool enforces a budget while the line is being written, which is precisely why the problem is always found by somebody else.

Members

ew::core::foundation::ContentId ew::core::branching::LineBudget::speakerId

The speaker this applies to, or null for the project-wide default.

Per speaker because the constraint usually is: the character whose lines appear in a fixed UI box has a limit the narrator does not, and one project-wide number would either be too tight everywhere or too loose where it mattered.

int ew::core::branching::LineBudget::maxCharacters = 0

The most characters a line may run to; 0 means no limit.

double ew::core::branching::LineBudget::maxSeconds = 0.0

The longest a line may take to say, in seconds; 0 means no limit.

Estimated from the words and LineBudgets::wordsPerMinute rather than measured, because the line is being budgeted long before anybody records it – which is the whole point.

bool operator==(const LineBudget &, const LineBudget &)=default

Budgets compare equal when every field matches.

LineBudgets struct

struct ew::core::branching::LineBudgets

The project's line budgets, and the reading rate the duration ones are estimated at.

Members

int ew::core::branching::LineBudgets::wordsPerMinute = 150

How fast a line is assumed to be spoken, in words per minute.

150 is the usual conversational figure and the default here. Configurable because a hard-boiled narrator and a panicking soldier are not read at the same rate, and a studio that has measured its own cast should be able to say so.

std::vector<LineBudget> ew::core::branching::LineBudgets::budgets

The budgets themselves: at most one with a null speaker (the default), and at most one per speaker.

bool operator==(const LineBudgets &, const LineBudgets &)=default

Registries compare equal when every field matches.

Functions

double ew::core::branching::estimatedSpeechSeconds(const QString &text, int wordsPerMinute)

How long text is estimated to take to say at wordsPerMinute, in seconds.

Words rather than characters, because reading rate is a property of words: "antidisestablishment" and "a" take very different times per character and about the same time per word. Whitespace- separated, which is wrong for languages that do not space their words – and deliberately not papered over with a guess, because a duration budget on a language this cannot count is better absent than wrong. Returns 0 for empty text or a rate of zero.