forked from mia/Aegisub
Add commands for most of the audio box buttons/hotkeys
Originally committed to SVN as r5232.
This commit is contained in:
parent
33d8dd2975
commit
f79c9e57a0
3 changed files with 262 additions and 51 deletions
|
@ -44,8 +44,10 @@
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
#include "../selection_controller.h"
|
||||||
#include "../ass_dialogue.h"
|
#include "../ass_dialogue.h"
|
||||||
#include "../audio_controller.h"
|
#include "../audio_controller.h"
|
||||||
|
#include "../audio_timing.h"
|
||||||
#include "../compat.h"
|
#include "../compat.h"
|
||||||
#include "../include/aegisub/context.h"
|
#include "../include/aegisub/context.h"
|
||||||
#include "../selection_controller.h"
|
#include "../selection_controller.h"
|
||||||
|
@ -156,7 +158,7 @@ struct audio_view_waveform : public Command {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Save the audio for the selected lines..
|
/// Save the audio for the selected lines.
|
||||||
struct audio_save_clip : public Command {
|
struct audio_save_clip : public Command {
|
||||||
CMD_NAME("audio/save/clip")
|
CMD_NAME("audio/save/clip")
|
||||||
STR_MENU("Create audio clip")
|
STR_MENU("Create audio clip")
|
||||||
|
@ -174,18 +176,184 @@ struct audio_save_clip : public Command {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Play the current audio selection
|
||||||
|
struct audio_play_selection : public Command {
|
||||||
|
CMD_NAME("audio/play/selection")
|
||||||
|
STR_MENU("Play audio selection")
|
||||||
|
STR_DISP("Play audio selection")
|
||||||
|
STR_HELP("Play selection")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->audioController->PlayPrimaryRange();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Stop playing audio
|
||||||
|
struct audio_stop : public Command {
|
||||||
|
CMD_NAME("audio/stop")
|
||||||
|
STR_MENU("Stop playing")
|
||||||
|
STR_DISP("Stop playing")
|
||||||
|
STR_HELP("Stop")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->audioController->Stop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Play 500 ms before the selected audio range
|
||||||
|
struct audio_play_before : public Command {
|
||||||
|
CMD_NAME("audio/play/selection/before")
|
||||||
|
STR_MENU("Play 500 ms before selection")
|
||||||
|
STR_DISP("Play 500 ms before selection")
|
||||||
|
STR_HELP("Play 500 ms before selection")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
SampleRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
|
c->audioController->PlayRange(SampleRange(
|
||||||
|
times.begin() - c->audioController->SamplesFromMilliseconds(500),
|
||||||
|
times.begin()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Play 500 ms after the selected audio range
|
||||||
|
struct audio_play_after : public Command {
|
||||||
|
CMD_NAME("audio/play/selection/after")
|
||||||
|
STR_MENU("Play 500 ms after selection")
|
||||||
|
STR_DISP("Play 500 ms after selection")
|
||||||
|
STR_HELP("Play 500 ms after selection")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
SampleRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
|
c->audioController->PlayRange(SampleRange(
|
||||||
|
times.end(),
|
||||||
|
times.end() + c->audioController->SamplesFromMilliseconds(500)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Play from the beginning of the audio range to the end of the file
|
||||||
|
struct audio_play_end : public Command {
|
||||||
|
CMD_NAME("audio/play/selection/end")
|
||||||
|
STR_MENU("Play last 500 ms of selection")
|
||||||
|
STR_DISP("Play last 500 ms of selection")
|
||||||
|
STR_HELP("Play last 500 ms of selection")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
SampleRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
|
c->audioController->PlayRange(SampleRange(
|
||||||
|
times.begin(),
|
||||||
|
times.begin() + std::min(
|
||||||
|
c->audioController->SamplesFromMilliseconds(500),
|
||||||
|
times.length())));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Play the first 500 ms of the audio range
|
||||||
|
struct audio_play_begin : public Command {
|
||||||
|
CMD_NAME("audio/play/selection/begin")
|
||||||
|
STR_MENU("Play first 500 ms of selection")
|
||||||
|
STR_DISP("Play first 500 ms of selection")
|
||||||
|
STR_HELP("Play first 500 ms of selection")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
SampleRange times(c->audioController->GetPrimaryPlaybackRange());
|
||||||
|
c->audioController->PlayRange(SampleRange(
|
||||||
|
times.end() - std::min(
|
||||||
|
c->audioController->SamplesFromMilliseconds(500),
|
||||||
|
times.length()),
|
||||||
|
times.end()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Play the last 500 ms of the audio range
|
||||||
|
struct audio_play_to_end : public Command {
|
||||||
|
CMD_NAME("audio/play/to_end")
|
||||||
|
STR_MENU("Play from selection start to end of file")
|
||||||
|
STR_DISP("Play from selection start to end of file")
|
||||||
|
STR_HELP("Play from selection start to end of file")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->audioController->PlayToEnd(c->audioController->GetPrimaryPlaybackRange().begin());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Commit any pending audio timing changes
|
||||||
|
/// @todo maybe move to time?
|
||||||
|
struct audio_commit : public Command {
|
||||||
|
CMD_NAME("audio/commit")
|
||||||
|
STR_MENU("Commit")
|
||||||
|
STR_DISP("Commit")
|
||||||
|
STR_HELP("Commit")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->audioController->GetTimingController()->Commit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Scroll the audio display to the current selection
|
||||||
|
struct audio_go_to : public Command {
|
||||||
|
CMD_NAME("audio/?")
|
||||||
|
STR_MENU("Go to selection")
|
||||||
|
STR_DISP("Go to selection")
|
||||||
|
STR_HELP("Go to selection")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
//if (c->audioController->GetTimingController())
|
||||||
|
//audioDisplay->ScrollSampleRangeInView(c->audioController->GetTimingController()->GetIdealVisibleSampleRange());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline void toggle(const char *opt) {
|
||||||
|
OPT_SET(opt)->SetBool(!OPT_GET(opt)->GetBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Toggle autoscrolling the audio display to the selected line when switch lines
|
||||||
|
struct audio_autoscroll : public Command {
|
||||||
|
CMD_NAME("audio/opt/autoscroll")
|
||||||
|
STR_MENU("Auto scrolls audio display to selected line")
|
||||||
|
STR_DISP("Auto scrolls audio display to selected line")
|
||||||
|
STR_HELP("Auto scrolls audio display to selected line")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
toggle("Audio/Auto/Scroll");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Toggle automatically committing changes made in the audio display
|
||||||
|
struct audio_autocommit : public Command {
|
||||||
|
CMD_NAME("audio/opt/autocommit")
|
||||||
|
STR_MENU("Automatically commit all changes")
|
||||||
|
STR_DISP("Automatically commit all changes")
|
||||||
|
STR_HELP("Automatically commit all changes")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
toggle("Audio/Auto/Commit");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Toggle automatically advancing to the next line after a commit
|
||||||
|
struct audio_autonext : public Command {
|
||||||
|
CMD_NAME("audio/opt/autonext")
|
||||||
|
STR_MENU("Auto goes to next line on commit")
|
||||||
|
STR_DISP("Auto goes to next line on commit")
|
||||||
|
STR_HELP("Auto goes to next line on commit")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
toggle("Audio/Next Line on Commit");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Init audio/ commands
|
/// Init audio/ commands
|
||||||
void init_audio(CommandManager *cm) {
|
void init_audio(CommandManager *cm) {
|
||||||
cm->reg(new audio_close());
|
cm->reg(new audio_autocommit);
|
||||||
cm->reg(new audio_open());
|
cm->reg(new audio_autonext);
|
||||||
cm->reg(new audio_open_blank());
|
cm->reg(new audio_autoscroll);
|
||||||
cm->reg(new audio_open_noise());
|
cm->reg(new audio_close);
|
||||||
cm->reg(new audio_open_video());
|
cm->reg(new audio_commit);
|
||||||
cm->reg(new audio_view_spectrum());
|
cm->reg(new audio_go_to);
|
||||||
cm->reg(new audio_view_waveform());
|
cm->reg(new audio_open);
|
||||||
cm->reg(new audio_save_clip());
|
cm->reg(new audio_open_blank);
|
||||||
|
cm->reg(new audio_open_noise);
|
||||||
|
cm->reg(new audio_open_video);
|
||||||
|
cm->reg(new audio_play_after);
|
||||||
|
cm->reg(new audio_play_before);
|
||||||
|
cm->reg(new audio_play_begin);
|
||||||
|
cm->reg(new audio_play_end);
|
||||||
|
cm->reg(new audio_play_selection);
|
||||||
|
cm->reg(new audio_play_to_end);
|
||||||
|
cm->reg(new audio_save_clip);
|
||||||
|
cm->reg(new audio_stop);
|
||||||
|
cm->reg(new audio_view_spectrum);
|
||||||
|
cm->reg(new audio_view_waveform);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cmd
|
} // namespace cmd
|
||||||
|
|
|
@ -44,12 +44,15 @@
|
||||||
|
|
||||||
#include "command.h"
|
#include "command.h"
|
||||||
|
|
||||||
|
#include "../selection_controller.h"
|
||||||
|
#include "../ass_dialogue.h"
|
||||||
|
#include "../ass_file.h"
|
||||||
|
#include "../audio_controller.h"
|
||||||
|
#include "../audio_timing.h"
|
||||||
|
#include "../dialog_shift_times.h"
|
||||||
#include "../include/aegisub/context.h"
|
#include "../include/aegisub/context.h"
|
||||||
#include "../subs_grid.h"
|
#include "../subs_grid.h"
|
||||||
#include "../video_context.h"
|
#include "../video_context.h"
|
||||||
#include "../ass_dialogue.h"
|
|
||||||
#include "../dialog_shift_times.h"
|
|
||||||
#include "../ass_file.h"
|
|
||||||
|
|
||||||
namespace cmd {
|
namespace cmd {
|
||||||
/// @defgroup cmd-time Time manipulation commands.
|
/// @defgroup cmd-time Time manipulation commands.
|
||||||
|
@ -230,6 +233,26 @@ struct time_snap_scene : public Command {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct time_add_lead_in : public Command {
|
||||||
|
CMD_NAME("time/lead/in")
|
||||||
|
STR_MENU("Add lead in")
|
||||||
|
STR_DISP("Add lead in")
|
||||||
|
STR_HELP("Add lead in")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
//audioDisplay->AddLead(true,false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct time_add_lead_out : public Command {
|
||||||
|
CMD_NAME("time/lead/out")
|
||||||
|
STR_MENU("Add lead out")
|
||||||
|
STR_DISP("Add lead out")
|
||||||
|
STR_HELP("Add lead out")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
//audioDisplay->AddLead(false,true);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Set start of selected subtitles to current video frame.
|
/// Set start of selected subtitles to current video frame.
|
||||||
struct time_snap_start_video : public Command {
|
struct time_snap_start_video : public Command {
|
||||||
|
@ -285,21 +308,53 @@ struct time_sort_style : public Command {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Switch to the next timeable thing (line or syllable)
|
||||||
|
struct time_next : public Command {
|
||||||
|
CMD_NAME("time/next")
|
||||||
|
STR_MENU("Next line")
|
||||||
|
STR_DISP("Next line")
|
||||||
|
STR_HELP("Next line")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->audioController->Stop();
|
||||||
|
if (c->audioController->GetTimingController())
|
||||||
|
c->audioController->GetTimingController()->Next();
|
||||||
|
c->audioController->PlayPrimaryRange();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Switch to the previous timeable thing (line or syllable)
|
||||||
|
struct time_prev : public Command {
|
||||||
|
CMD_NAME("time/prev")
|
||||||
|
STR_MENU("Previous line")
|
||||||
|
STR_DISP("Previous line")
|
||||||
|
STR_HELP("Previous line")
|
||||||
|
void operator()(agi::Context *c) {
|
||||||
|
c->audioController->Stop();
|
||||||
|
if (c->audioController->GetTimingController())
|
||||||
|
c->audioController->GetTimingController()->Prev();
|
||||||
|
c->audioController->PlayPrimaryRange();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
/// Init time/ commands.
|
/// Init time/ commands.
|
||||||
void init_time(CommandManager *cm) {
|
void init_time(CommandManager *cm) {
|
||||||
cm->reg(new time_continuous_end());
|
cm->reg(new time_add_lead_in);
|
||||||
cm->reg(new time_continuous_start());
|
cm->reg(new time_add_lead_out);
|
||||||
cm->reg(new time_frame_current());
|
cm->reg(new time_continuous_end);
|
||||||
cm->reg(new time_shift());
|
cm->reg(new time_continuous_start);
|
||||||
cm->reg(new time_snap_end_video());
|
cm->reg(new time_frame_current);
|
||||||
cm->reg(new time_snap_frame());
|
cm->reg(new time_next);
|
||||||
cm->reg(new time_snap_scene());
|
cm->reg(new time_prev);
|
||||||
cm->reg(new time_snap_start_video());
|
cm->reg(new time_shift);
|
||||||
cm->reg(new time_sort_end());
|
cm->reg(new time_snap_end_video);
|
||||||
cm->reg(new time_sort_start());
|
cm->reg(new time_snap_frame);
|
||||||
cm->reg(new time_sort_style());
|
cm->reg(new time_snap_scene);
|
||||||
|
cm->reg(new time_snap_start_video);
|
||||||
|
cm->reg(new time_sort_end);
|
||||||
|
cm->reg(new time_sort_start);
|
||||||
|
cm->reg(new time_sort_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cmd
|
} // namespace cmd
|
||||||
|
|
|
@ -344,7 +344,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
"Audio" : {
|
"Audio" : {
|
||||||
"audio play" : [
|
"audio/play/selection" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "Space",
|
"key" : "Space",
|
||||||
|
@ -356,70 +356,70 @@
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio play after selection end" : [
|
"audio/play/selection/after" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "W",
|
"key" : "W",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio play before selection begin" : [
|
"audio/play/selection/before" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "Q",
|
"key" : "Q",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio play toggle" : [
|
"audio/play/toggle" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "B",
|
"key" : "B",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio play selection begin" : [
|
"audio/play/selection/begin" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "E",
|
"key" : "E",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio play selection end" : [
|
"audio/play/selection/end" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "D",
|
"key" : "D",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio play to end" : [
|
"audio/play/to_end" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "T",
|
"key" : "T",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio scroll left" : [
|
"audio/scroll/left" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "A",
|
"key" : "A",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio scroll right" : [
|
"audio/scroll/right" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "F",
|
"key" : "F",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"audio stop" : [
|
"audio/stop" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "H",
|
"key" : "H",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commit" : [
|
"audio/commit" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "Enter",
|
"key" : "Enter",
|
||||||
|
@ -431,26 +431,14 @@
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commit and stay" : [
|
"time/lead/in" : [
|
||||||
{
|
|
||||||
"modifiers" : [ "Ctrl" ],
|
|
||||||
"key" : "Enter",
|
|
||||||
"enable" : true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"modifiers" : [],
|
|
||||||
"key" : "F8",
|
|
||||||
"enable" : true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"timing add lead in" : [
|
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "C",
|
"key" : "C",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timing add lead out" : [
|
"time/lead/out" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "V",
|
"key" : "V",
|
||||||
|
@ -485,7 +473,7 @@
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timing move to next item" : [
|
"time/next" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "X",
|
"key" : "X",
|
||||||
|
@ -497,7 +485,7 @@
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"timing move to prev item" : [
|
"time/prev" : [
|
||||||
{
|
{
|
||||||
"modifiers" : [],
|
"modifiers" : [],
|
||||||
"key" : "Z",
|
"key" : "Z",
|
||||||
|
@ -515,7 +503,7 @@
|
||||||
"key" : "KP_Multiply",
|
"key" : "KP_Multiply",
|
||||||
"enable" : true
|
"enable" : true
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
"Video" : {
|
"Video" : {
|
||||||
|
|
Loading…
Reference in a new issue