mirror of https://github.com/odrling/Aegisub
AssKaraoke can safely take a const AssDialogue*
This commit is contained in:
parent
68781a95b2
commit
f0a5abad01
|
@ -39,11 +39,11 @@ std::string AssKaraoke::Syllable::GetText(bool k_tag) const {
|
|||
return ret;
|
||||
}
|
||||
|
||||
AssKaraoke::AssKaraoke(AssDialogue *line, bool auto_split, bool normalize) {
|
||||
AssKaraoke::AssKaraoke(const AssDialogue *line, bool auto_split, bool normalize) {
|
||||
if (line) SetLine(line, auto_split, normalize);
|
||||
}
|
||||
|
||||
void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
|
||||
void AssKaraoke::SetLine(const AssDialogue *line, bool auto_split, bool normalize) {
|
||||
syls.clear();
|
||||
Syllable syl;
|
||||
syl.start_time = line->Start;
|
||||
|
@ -87,7 +87,7 @@ void AssKaraoke::SetLine(AssDialogue *line, bool auto_split, bool normalize) {
|
|||
AnnounceSyllablesChanged();
|
||||
}
|
||||
|
||||
void AssKaraoke::ParseSyllables(AssDialogue *line, Syllable &syl) {
|
||||
void AssKaraoke::ParseSyllables(const AssDialogue *line, Syllable &syl) {
|
||||
for (auto& block : line->ParseTags()) {
|
||||
std::string text = block->GetText();
|
||||
|
||||
|
|
|
@ -46,17 +46,17 @@ private:
|
|||
bool no_announce = false;
|
||||
|
||||
agi::signal::Signal<> AnnounceSyllablesChanged;
|
||||
void ParseSyllables(AssDialogue *line, Syllable &syl);
|
||||
void ParseSyllables(const AssDialogue *line, Syllable &syl);
|
||||
|
||||
public:
|
||||
/// Constructor
|
||||
/// @param line Initial line
|
||||
/// @param auto_split Should the line automatically be split on spaces if there are no k tags?
|
||||
/// @param normalize Should the total duration of the syllables be forced to equal the line duration?
|
||||
AssKaraoke(AssDialogue *line = nullptr, bool auto_split = false, bool normalize = true);
|
||||
AssKaraoke(const AssDialogue *line = nullptr, bool auto_split = false, bool normalize = true);
|
||||
|
||||
/// Parse a dialogue line
|
||||
void SetLine(AssDialogue *line, bool auto_split = false, bool normalize = true);
|
||||
void SetLine(const AssDialogue *line, bool auto_split = false, bool normalize = true);
|
||||
|
||||
/// Add a split before character pos in syllable syl_idx
|
||||
void AddSplit(size_t syl_idx, size_t pos);
|
||||
|
|
Loading…
Reference in New Issue