mirror of https://github.com/odrling/Aegisub
Add "audio/play/line" command
This commit is contained in:
parent
2db488ee81
commit
44468fbd3d
|
@ -78,6 +78,13 @@ public:
|
|||
/// currently.
|
||||
virtual TimeRange GetPrimaryPlaybackRange() const = 0;
|
||||
|
||||
/// @brief Get the active line's time
|
||||
/// @return A time range
|
||||
///
|
||||
/// Get the time range which the active line would have if any pending
|
||||
/// modifications were committed.
|
||||
virtual TimeRange GetActiveLineRange() const = 0;
|
||||
|
||||
/// @brief Get all rendering style ranges
|
||||
/// @param[out] ranges Rendering ranges will be added to this
|
||||
virtual void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const = 0;
|
||||
|
|
|
@ -390,6 +390,7 @@ public:
|
|||
wxString GetWarningMessage() const;
|
||||
TimeRange GetIdealVisibleTimeRange() const;
|
||||
TimeRange GetPrimaryPlaybackRange() const;
|
||||
TimeRange GetActiveLineRange() const;
|
||||
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const;
|
||||
void GetLabels(TimeRange const& range, std::vector<AudioLabel> &out) const { }
|
||||
void Next(NextMode mode);
|
||||
|
@ -499,6 +500,11 @@ TimeRange AudioTimingControllerDialogue::GetPrimaryPlaybackRange() const
|
|||
return active_line;
|
||||
}
|
||||
|
||||
TimeRange AudioTimingControllerDialogue::GetActiveLineRange() const
|
||||
{
|
||||
return active_line;
|
||||
}
|
||||
|
||||
void AudioTimingControllerDialogue::GetRenderingStyles(AudioRenderingStyleRanges &ranges) const
|
||||
{
|
||||
active_line.GetStyleRange(&ranges);
|
||||
|
|
|
@ -124,6 +124,7 @@ public:
|
|||
TimeRange GetIdealVisibleTimeRange() const;
|
||||
void GetRenderingStyles(AudioRenderingStyleRanges &ranges) const;
|
||||
TimeRange GetPrimaryPlaybackRange() const;
|
||||
TimeRange GetActiveLineRange() const;
|
||||
void GetLabels(const TimeRange &range, std::vector<AudioLabel> &out_labels) const;
|
||||
void Next(NextMode mode);
|
||||
void Prev();
|
||||
|
@ -227,10 +228,14 @@ TimeRange AudioTimingControllerKaraoke::GetPrimaryPlaybackRange() const {
|
|||
cur_syl < markers.size() ? markers[cur_syl] : end_marker);
|
||||
}
|
||||
|
||||
TimeRange AudioTimingControllerKaraoke::GetIdealVisibleTimeRange() const {
|
||||
TimeRange AudioTimingControllerKaraoke::GetActiveLineRange() const {
|
||||
return TimeRange(start_marker, end_marker);
|
||||
}
|
||||
|
||||
TimeRange AudioTimingControllerKaraoke::GetIdealVisibleTimeRange() const {
|
||||
return GetActiveLineRange();
|
||||
}
|
||||
|
||||
void AudioTimingControllerKaraoke::GetMarkers(TimeRange const& range, AudioMarkerVector &out) const {
|
||||
size_t i;
|
||||
for (i = 0; i < markers.size() && markers[i] < range.begin(); ++i) ;
|
||||
|
|
|
@ -241,6 +241,21 @@ struct audio_play_current_selection : public validate_audio_open {
|
|||
}
|
||||
};
|
||||
|
||||
/// Play the current line
|
||||
struct audio_play_current_line : public validate_audio_open {
|
||||
CMD_NAME("audio/play/line")
|
||||
STR_MENU("Play current line")
|
||||
STR_DISP("Play current line")
|
||||
STR_HELP("Play current line")
|
||||
|
||||
void operator()(agi::Context *c) {
|
||||
c->videoController->Stop();
|
||||
AudioTimingController *tc = c->audioController->GetTimingController();
|
||||
if (tc)
|
||||
c->audioController->PlayRange(tc->GetActiveLineRange());
|
||||
}
|
||||
};
|
||||
|
||||
/// Play the current audio selection
|
||||
struct audio_play_selection : public validate_audio_open {
|
||||
CMD_NAME("audio/play/selection")
|
||||
|
@ -593,6 +608,7 @@ namespace cmd {
|
|||
reg(new audio_play_begin);
|
||||
reg(new audio_play_end);
|
||||
reg(new audio_play_current_selection);
|
||||
reg(new audio_play_current_line);
|
||||
reg(new audio_play_selection);
|
||||
reg(new audio_play_to_end);
|
||||
reg(new audio_play_toggle);
|
||||
|
|
|
@ -92,6 +92,7 @@ INSERT_ICON("audio/opt/autoscroll", toggle_audio_autoscroll)
|
|||
INSERT_ICON("audio/opt/spectrum", toggle_audio_spectrum)
|
||||
INSERT_ICON("audio/opt/vertical_link", toggle_audio_link)
|
||||
INSERT_ICON("audio/play/selection", button_playsel)
|
||||
INSERT_ICON("audio/play/line", button_playline)
|
||||
INSERT_ICON("audio/play/selection/after", button_playfivehafter)
|
||||
INSERT_ICON("audio/play/selection/before", button_playfivehbefore)
|
||||
INSERT_ICON("audio/play/selection/begin", button_playfirstfiveh)
|
||||
|
|
Loading…
Reference in New Issue