Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
// Copyright (c) 2005-2010, Niels Martin Hansen
|
|
|
|
// Copyright (c) 2005-2010, Rodrigo Braz Monteiro
|
|
|
|
// Copyright (c) 2010, Amar Takhar
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
|
2011-01-16 08:18:00 +01:00
|
|
|
#include "../ass_dialogue.h"
|
2014-05-23 15:34:52 +02:00
|
|
|
#include "../async_video_provider.h"
|
2011-09-30 22:41:56 +02:00
|
|
|
#include "../audio_box.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../audio_controller.h"
|
2011-09-28 21:44:07 +02:00
|
|
|
#include "../audio_karaoke.h"
|
2011-01-18 00:53:59 +01:00
|
|
|
#include "../audio_timing.h"
|
2015-01-01 04:41:56 +01:00
|
|
|
#include "../compat.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../include/aegisub/context.h"
|
2013-12-25 22:36:37 +01:00
|
|
|
#include "../libresrc/libresrc.h"
|
2013-01-07 02:50:09 +01:00
|
|
|
#include "../options.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "../project.h"
|
2011-07-15 06:05:22 +02:00
|
|
|
#include "../selection_controller.h"
|
2013-01-22 05:27:56 +01:00
|
|
|
#include "../utils.h"
|
2014-05-22 01:23:28 +02:00
|
|
|
#include "../video_controller.h"
|
2011-01-16 08:18:00 +01:00
|
|
|
|
2014-07-09 16:22:49 +02:00
|
|
|
#include <libaegisub/audio/provider.h>
|
2014-04-23 22:53:24 +02:00
|
|
|
#include <libaegisub/make_unique.h>
|
2014-05-22 01:23:28 +02:00
|
|
|
#include <libaegisub/io.h>
|
2013-06-08 06:19:40 +02:00
|
|
|
|
2011-07-15 06:05:01 +02:00
|
|
|
namespace {
|
|
|
|
using cmd::Command;
|
2011-07-15 06:05:22 +02:00
|
|
|
|
|
|
|
struct validate_audio_open : public Command {
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_VALIDATE)
|
2013-11-21 18:13:36 +01:00
|
|
|
bool Validate(const agi::Context *c) override {
|
2014-05-22 01:23:28 +02:00
|
|
|
return !!c->project->AudioProvider();
|
2011-07-15 06:05:22 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_close final : public validate_audio_open {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/close")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(close_audio_menu)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_MENU("&Close Audio")
|
|
|
|
STR_DISP("Close Audio")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Close the currently open audio file")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-05-22 01:23:28 +02:00
|
|
|
c->project->CloseAudio();
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-05-22 01:23:28 +02:00
|
|
|
struct audio_open final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/open")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(open_audio_menu)
|
2011-10-01 20:35:12 +02:00
|
|
|
STR_MENU("&Open Audio File...")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_DISP("Open Audio File")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Open an audio file")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2019-03-12 07:25:46 +01:00
|
|
|
auto str = from_wx(_("Audio Formats") + " (*.aac,*.ac3,*.ape,*.dts,*.eac3,*.flac,*.m4a,*.mka,*.mp3,*.mp4,*.ogg,*.opus,*.w64,*.wav,*.wma)|*.aac;*.ac3;*.ape;*.dts;*.eac3;*.flac;*.m4a;*.mka;*.mp3;*.mp4;*.ogg;*.opus;*.w64;*.wav;*.wma|"
|
2013-01-22 05:27:56 +01:00
|
|
|
+ _("Video Formats") + " (*.asf,*.avi,*.avs,*.d2v,*.m2ts,*.m4v,*.mkv,*.mov,*.mp4,*.mpeg,*.mpg,*.ogm,*.webm,*.wmv,*.ts)|*.asf;*.avi;*.avs;*.d2v;*.m2ts;*.m4v;*.mkv;*.mov;*.mp4;*.mpeg;*.mpg;*.ogm;*.webm;*.wmv;*.ts|"
|
2015-01-01 04:41:56 +01:00
|
|
|
+ _("All Files") + " (*.*)|*.*");
|
2013-01-22 05:27:56 +01:00
|
|
|
auto filename = OpenFileSelector(_("Open Audio File"), "Path/Last/Audio", "", "", str, c->parent);
|
2014-05-22 01:23:28 +02:00
|
|
|
if (!filename.empty())
|
|
|
|
c->project->LoadAudio(filename);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_open_blank final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/open/blank")
|
|
|
|
STR_MENU("Open 2h30 Blank Audio")
|
|
|
|
STR_DISP("Open 2h30 Blank Audio")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open a 150 minutes blank audio clip, for debugging")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-05-22 01:23:28 +02:00
|
|
|
c->project->LoadAudio("dummy-audio:silence?sr=44100&bd=16&ch=1&ln=396900000");
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_open_noise final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/open/noise")
|
|
|
|
STR_MENU("Open 2h30 Noise Audio")
|
|
|
|
STR_DISP("Open 2h30 Noise Audio")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open a 150 minutes noise-filled audio clip, for debugging")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-05-22 01:23:28 +02:00
|
|
|
c->project->LoadAudio("dummy-audio:noise?sr=44100&bd=16&ch=1&ln=396900000");
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-05-22 01:23:28 +02:00
|
|
|
struct audio_open_video final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/open/video")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(open_audio_from_video_menu)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_MENU("Open Audio from &Video")
|
|
|
|
STR_DISP("Open Audio from Video")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Open the audio from the current video file")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_VALIDATE)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool Validate(const agi::Context *c) override {
|
2014-05-23 15:34:52 +02:00
|
|
|
return c->project->VideoProvider() && c->project->VideoProvider()->HasAudio();
|
2011-07-15 06:05:22 +02:00
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-05-22 01:23:28 +02:00
|
|
|
c->project->LoadAudio(c->project->VideoName());
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_view_spectrum final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/view/spectrum")
|
2011-11-18 06:00:20 +01:00
|
|
|
STR_MENU("&Spectrum Display")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_DISP("Spectrum Display")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Display audio as a frequency-power spectrograph")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_RADIO)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-07-15 06:06:03 +02:00
|
|
|
return OPT_GET("Audio/Spectrum")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-01-16 08:15:24 +01:00
|
|
|
OPT_SET("Audio/Spectrum")->SetBool(true);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_view_waveform final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("audio/view/waveform")
|
2011-11-18 06:00:20 +01:00
|
|
|
STR_MENU("&Waveform Display")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_DISP("Waveform Display")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Display audio as a linear amplitude graph")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_RADIO)
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-07-15 06:06:03 +02:00
|
|
|
return !OPT_GET("Audio/Spectrum")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-01-16 08:15:24 +01:00
|
|
|
OPT_SET("Audio/Spectrum")->SetBool(false);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_save_clip final : public Command {
|
2011-01-16 08:18:00 +01:00
|
|
|
CMD_NAME("audio/save/clip")
|
|
|
|
STR_MENU("Create audio clip")
|
|
|
|
STR_DISP("Create audio clip")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Save an audio clip of the selected line")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_VALIDATE)
|
2011-01-16 08:18:00 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool Validate(const agi::Context *c) override {
|
2014-05-22 01:23:28 +02:00
|
|
|
return c->project->AudioProvider() && !c->selectionController->GetSelectedSet().empty();
|
2011-07-15 06:05:31 +02:00
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-03-25 01:15:14 +01:00
|
|
|
auto const& sel = c->selectionController->GetSelectedSet();
|
2012-10-11 18:38:55 +02:00
|
|
|
if (sel.empty()) return;
|
|
|
|
|
2014-05-22 01:23:28 +02:00
|
|
|
auto filename = SaveFileSelector(_("Save audio clip"), "", "", "wav", "", c->parent);
|
|
|
|
if (filename.empty()) return;
|
|
|
|
|
2014-07-06 16:28:58 +02:00
|
|
|
agi::Time start = INT_MAX, end = 0;
|
2012-11-04 04:53:03 +01:00
|
|
|
for (auto line : sel) {
|
|
|
|
start = std::min(start, line->Start);
|
|
|
|
end = std::max(end, line->End);
|
2011-01-16 08:18:00 +01:00
|
|
|
}
|
2012-10-11 18:38:55 +02:00
|
|
|
|
2015-07-28 21:02:41 +02:00
|
|
|
agi::SaveAudioClip(*c->project->AudioProvider(), filename, start, end);
|
2011-01-16 08:18:00 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_current_selection final : public validate_audio_open {
|
2012-05-23 05:38:44 +02:00
|
|
|
CMD_NAME("audio/play/current")
|
|
|
|
STR_MENU("Play current audio selection")
|
|
|
|
STR_DISP("Play current audio selection")
|
|
|
|
STR_HELP("Play the current audio selection, ignoring changes made while playing")
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-05-23 05:38:44 +02:00
|
|
|
c->videoController->Stop();
|
|
|
|
c->audioController->PlayRange(c->audioController->GetPrimaryPlaybackRange());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_current_line final : public validate_audio_open {
|
2012-10-05 01:15:45 +02:00
|
|
|
CMD_NAME("audio/play/line")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playline)
|
2012-10-05 01:15:45 +02:00
|
|
|
STR_MENU("Play current line")
|
|
|
|
STR_DISP("Play current line")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Play the audio for the current line")
|
2012-10-05 01:15:45 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-10-05 01:15:45 +02:00
|
|
|
c->videoController->Stop();
|
|
|
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
|
|
|
if (tc)
|
|
|
|
c->audioController->PlayRange(tc->GetActiveLineRange());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_selection final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/play/selection")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playsel)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Play audio selection")
|
|
|
|
STR_DISP("Play audio selection")
|
2012-05-23 05:38:44 +02:00
|
|
|
STR_HELP("Play audio until the end of the selection is reached")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-10-13 01:08:20 +02:00
|
|
|
c->videoController->Stop();
|
2011-01-18 00:53:59 +01:00
|
|
|
c->audioController->PlayPrimaryRange();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_toggle final : public validate_audio_open {
|
2012-04-27 21:07:42 +02:00
|
|
|
CMD_NAME("audio/play/toggle")
|
|
|
|
STR_MENU("Play audio selection or stop")
|
|
|
|
STR_DISP("Play audio selection or stop")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Play selection, or stop playback if it's already playing")
|
2012-04-27 21:07:42 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-04-27 21:07:42 +02:00
|
|
|
if (c->audioController->IsPlaying())
|
|
|
|
c->audioController->Stop();
|
|
|
|
else {
|
|
|
|
c->videoController->Stop();
|
|
|
|
c->audioController->PlayPrimaryRange();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_stop final : public Command {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/stop")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_stop)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Stop playing")
|
|
|
|
STR_DISP("Stop playing")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Stop audio and video playback")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_VALIDATE)
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool Validate(const agi::Context *c) override {
|
2011-07-15 06:05:22 +02:00
|
|
|
return c->audioController->IsPlaying();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-01-18 00:53:59 +01:00
|
|
|
c->audioController->Stop();
|
2012-10-01 19:28:04 +02:00
|
|
|
c->videoController->Stop();
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_before final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/play/selection/before")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playfivehbefore)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Play 500 ms before selection")
|
|
|
|
STR_DISP("Play 500 ms before selection")
|
|
|
|
STR_HELP("Play 500 ms before selection")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-10-13 01:08:20 +02:00
|
|
|
c->videoController->Stop();
|
2012-02-02 00:58:58 +01:00
|
|
|
int begin = c->audioController->GetPrimaryPlaybackRange().begin();
|
|
|
|
c->audioController->PlayRange(TimeRange(begin - 500, begin));
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_after final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/play/selection/after")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playfivehafter)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Play 500 ms after selection")
|
|
|
|
STR_DISP("Play 500 ms after selection")
|
|
|
|
STR_HELP("Play 500 ms after selection")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-10-13 01:08:20 +02:00
|
|
|
c->videoController->Stop();
|
2012-02-02 00:58:58 +01:00
|
|
|
int end = c->audioController->GetPrimaryPlaybackRange().end();
|
|
|
|
c->audioController->PlayRange(TimeRange(end, end + 500));
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_end final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/play/selection/end")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playlastfiveh)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Play last 500 ms of selection")
|
|
|
|
STR_DISP("Play last 500 ms of selection")
|
|
|
|
STR_HELP("Play last 500 ms of selection")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-10-13 01:08:20 +02:00
|
|
|
c->videoController->Stop();
|
2012-02-02 00:58:58 +01:00
|
|
|
TimeRange times(c->audioController->GetPrimaryPlaybackRange());
|
|
|
|
c->audioController->PlayToEndOfPrimary(times.end() - std::min(500, times.length()));
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_begin final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/play/selection/begin")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playfirstfiveh)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Play first 500 ms of selection")
|
|
|
|
STR_DISP("Play first 500 ms of selection")
|
|
|
|
STR_HELP("Play first 500 ms of selection")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-10-13 01:08:20 +02:00
|
|
|
c->videoController->Stop();
|
2012-02-02 00:58:58 +01:00
|
|
|
TimeRange times(c->audioController->GetPrimaryPlaybackRange());
|
|
|
|
c->audioController->PlayRange(TimeRange(
|
2011-10-01 20:35:37 +02:00
|
|
|
times.begin(),
|
2012-02-02 00:58:58 +01:00
|
|
|
times.begin() + std::min(500, times.length())));
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_play_to_end final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/play/to_end")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_playtoend)
|
2011-01-18 00:53:59 +01:00
|
|
|
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")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-10-13 01:08:20 +02:00
|
|
|
c->videoController->Stop();
|
2011-01-18 00:53:59 +01:00
|
|
|
c->audioController->PlayToEnd(c->audioController->GetPrimaryPlaybackRange().begin());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_commit final : public validate_audio_open {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/commit")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_audio_commit)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Commit")
|
|
|
|
STR_DISP("Commit")
|
2012-04-27 21:07:21 +02:00
|
|
|
STR_HELP("Commit any pending audio timing changes")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-12-29 16:12:36 +01:00
|
|
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
2012-04-27 21:07:07 +02:00
|
|
|
if (tc) {
|
|
|
|
tc->Commit();
|
|
|
|
if(OPT_GET("Audio/Next Line on Commit")->GetBool())
|
|
|
|
tc->Next(AudioTimingController::LINE);
|
|
|
|
}
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_commit_default final : public validate_audio_open {
|
2012-04-27 21:07:21 +02:00
|
|
|
CMD_NAME("audio/commit/default")
|
|
|
|
STR_MENU("Commit and use default timing for next line")
|
|
|
|
STR_DISP("Commit and use default timing for next line")
|
|
|
|
STR_HELP("Commit any pending audio timing changes and reset the next line's times to the default")
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-04-27 21:07:21 +02:00
|
|
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
|
|
|
if (tc) {
|
|
|
|
tc->Commit();
|
|
|
|
tc->Next(AudioTimingController::LINE_RESET_DEFAULT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_commit_next final : public validate_audio_open {
|
2012-04-27 21:07:15 +02:00
|
|
|
CMD_NAME("audio/commit/next")
|
|
|
|
STR_MENU("Commit and move to next line")
|
|
|
|
STR_DISP("Commit and move to next line")
|
2012-04-27 21:07:21 +02:00
|
|
|
STR_HELP("Commit any pending audio timing changes and move to the next line")
|
2012-04-27 21:07:15 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-04-27 21:07:15 +02:00
|
|
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
|
|
|
if (tc) {
|
|
|
|
tc->Commit();
|
|
|
|
tc->Next(AudioTimingController::LINE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_commit_stay final : public validate_audio_open {
|
2012-04-27 21:07:15 +02:00
|
|
|
CMD_NAME("audio/commit/stay")
|
|
|
|
STR_MENU("Commit and stay on current line")
|
|
|
|
STR_DISP("Commit and stay on current line")
|
2012-04-27 21:07:21 +02:00
|
|
|
STR_HELP("Commit any pending audio timing changes and stay on the current line")
|
2012-04-27 21:07:15 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-04-27 21:07:15 +02:00
|
|
|
AudioTimingController *tc = c->audioController->GetTimingController();
|
|
|
|
if (tc) tc->Commit();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_go_to final : public validate_audio_open {
|
2011-08-27 08:30:42 +02:00
|
|
|
CMD_NAME("audio/go_to")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(button_audio_goto)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Go to selection")
|
|
|
|
STR_DISP("Go to selection")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Scroll the audio display to center on the current audio selection")
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-09-30 22:41:56 +02:00
|
|
|
c->audioBox->ScrollToActiveLine();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_scroll_left final : public validate_audio_open {
|
2011-09-30 22:41:56 +02:00
|
|
|
CMD_NAME("audio/scroll/left")
|
|
|
|
STR_MENU("Scroll left")
|
|
|
|
STR_DISP("Scroll left")
|
|
|
|
STR_HELP("Scroll the audio display left")
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-09-30 22:41:56 +02:00
|
|
|
c->audioBox->ScrollAudioBy(-128);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_scroll_right final : public validate_audio_open {
|
2011-09-30 22:41:56 +02:00
|
|
|
CMD_NAME("audio/scroll/right")
|
|
|
|
STR_MENU("Scroll right")
|
|
|
|
STR_DISP("Scroll right")
|
|
|
|
STR_HELP("Scroll the audio display right")
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-09-30 22:41:56 +02:00
|
|
|
c->audioBox->ScrollAudioBy(128);
|
2011-01-18 00:53:59 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void toggle(const char *opt) {
|
|
|
|
OPT_SET(opt)->SetBool(!OPT_GET(opt)->GetBool());
|
|
|
|
}
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_autoscroll final : public Command {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/opt/autoscroll")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(toggle_audio_autoscroll)
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_MENU("Auto scroll audio display to selected line")
|
|
|
|
STR_DISP("Auto scroll audio display to selected line")
|
|
|
|
STR_HELP("Auto scroll audio display to selected line")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_TOGGLE)
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-07-15 06:06:03 +02:00
|
|
|
return OPT_GET("Audio/Auto/Scroll")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-01-18 00:53:59 +01:00
|
|
|
toggle("Audio/Auto/Scroll");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_autocommit final : public Command {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/opt/autocommit")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(toggle_audio_autocommit)
|
2011-01-18 00:53:59 +01:00
|
|
|
STR_MENU("Automatically commit all changes")
|
|
|
|
STR_DISP("Automatically commit all changes")
|
|
|
|
STR_HELP("Automatically commit all changes")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_TOGGLE)
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-07-15 06:06:03 +02:00
|
|
|
return OPT_GET("Audio/Auto/Commit")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-01-18 00:53:59 +01:00
|
|
|
toggle("Audio/Auto/Commit");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_autonext final : public Command {
|
2011-01-18 00:53:59 +01:00
|
|
|
CMD_NAME("audio/opt/autonext")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(toggle_audio_nextcommit)
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_MENU("Auto go to next line on commit")
|
|
|
|
STR_DISP("Auto go to next line on commit")
|
|
|
|
STR_HELP("Automatically go to next line on commit")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_TOGGLE)
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-07-15 06:06:03 +02:00
|
|
|
return OPT_GET("Audio/Next Line on Commit")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-01-18 00:53:59 +01:00
|
|
|
toggle("Audio/Next Line on Commit");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_toggle_spectrum final : public Command {
|
2011-08-27 08:30:42 +02:00
|
|
|
CMD_NAME("audio/opt/spectrum")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(toggle_audio_spectrum)
|
2011-08-27 08:30:42 +02:00
|
|
|
STR_MENU("Spectrum analyzer mode")
|
|
|
|
STR_DISP("Spectrum analyzer mode")
|
|
|
|
STR_HELP("Spectrum analyzer mode")
|
|
|
|
CMD_TYPE(COMMAND_TOGGLE)
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-08-27 08:30:42 +02:00
|
|
|
return OPT_GET("Audio/Spectrum")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-08-27 08:30:42 +02:00
|
|
|
toggle("Audio/Spectrum");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_vertical_link final : public Command {
|
2011-01-18 00:54:05 +01:00
|
|
|
CMD_NAME("audio/opt/vertical_link")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(toggle_audio_link)
|
2011-01-18 00:54:05 +01:00
|
|
|
STR_MENU("Link vertical zoom and volume sliders")
|
|
|
|
STR_DISP("Link vertical zoom and volume sliders")
|
|
|
|
STR_HELP("Link vertical zoom and volume sliders")
|
2011-07-15 06:05:56 +02:00
|
|
|
CMD_TYPE(COMMAND_TOGGLE)
|
2011-07-15 06:05:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *) override {
|
2011-07-15 06:06:03 +02:00
|
|
|
return OPT_GET("Audio/Link")->GetBool();
|
|
|
|
}
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *) override {
|
2011-01-18 00:54:05 +01:00
|
|
|
toggle("Audio/Link");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct audio_karaoke final : public Command {
|
2011-09-28 21:44:07 +02:00
|
|
|
CMD_NAME("audio/karaoke")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(kara_mode)
|
2011-09-28 21:44:07 +02:00
|
|
|
STR_MENU("Toggle karaoke mode")
|
|
|
|
STR_DISP("Toggle karaoke mode")
|
|
|
|
STR_HELP("Toggle karaoke mode")
|
|
|
|
CMD_TYPE(COMMAND_TOGGLE)
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
bool IsActive(const agi::Context *c) override {
|
2011-09-28 21:44:07 +02:00
|
|
|
return c->karaoke->IsEnabled();
|
|
|
|
}
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2011-09-28 21:44:07 +02:00
|
|
|
c->karaoke->SetEnabled(!c->karaoke->IsEnabled());
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
2011-07-15 06:05:01 +02:00
|
|
|
namespace cmd {
|
|
|
|
void init_audio() {
|
2014-04-23 22:53:24 +02:00
|
|
|
reg(agi::make_unique<audio_autocommit>());
|
|
|
|
reg(agi::make_unique<audio_autonext>());
|
|
|
|
reg(agi::make_unique<audio_autoscroll>());
|
|
|
|
reg(agi::make_unique<audio_close>());
|
|
|
|
reg(agi::make_unique<audio_commit>());
|
|
|
|
reg(agi::make_unique<audio_commit_default>());
|
|
|
|
reg(agi::make_unique<audio_commit_next>());
|
|
|
|
reg(agi::make_unique<audio_commit_stay>());
|
|
|
|
reg(agi::make_unique<audio_go_to>());
|
|
|
|
reg(agi::make_unique<audio_karaoke>());
|
|
|
|
reg(agi::make_unique<audio_open>());
|
|
|
|
reg(agi::make_unique<audio_open_blank>());
|
|
|
|
reg(agi::make_unique<audio_open_noise>());
|
|
|
|
reg(agi::make_unique<audio_open_video>());
|
|
|
|
reg(agi::make_unique<audio_play_after>());
|
|
|
|
reg(agi::make_unique<audio_play_before>());
|
|
|
|
reg(agi::make_unique<audio_play_begin>());
|
|
|
|
reg(agi::make_unique<audio_play_end>());
|
|
|
|
reg(agi::make_unique<audio_play_current_selection>());
|
|
|
|
reg(agi::make_unique<audio_play_current_line>());
|
|
|
|
reg(agi::make_unique<audio_play_selection>());
|
|
|
|
reg(agi::make_unique<audio_play_to_end>());
|
|
|
|
reg(agi::make_unique<audio_play_toggle>());
|
|
|
|
reg(agi::make_unique<audio_save_clip>());
|
|
|
|
reg(agi::make_unique<audio_scroll_left>());
|
|
|
|
reg(agi::make_unique<audio_scroll_right>());
|
|
|
|
reg(agi::make_unique<audio_stop>());
|
|
|
|
reg(agi::make_unique<audio_toggle_spectrum>());
|
|
|
|
reg(agi::make_unique<audio_vertical_link>());
|
|
|
|
reg(agi::make_unique<audio_view_spectrum>());
|
|
|
|
reg(agi::make_unique<audio_view_waveform>());
|
2011-07-15 06:05:01 +02:00
|
|
|
}
|
|
|
|
}
|