2006-01-27 01:48:59 +01:00
|
|
|
// Copyright (c) 2005, Rodrigo Braz Monteiro, Niels Martin Hansen
|
2006-01-16 22:02:54 +01:00
|
|
|
// 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
2006-01-16 22:02:54 +01:00
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// $Id$
|
|
|
|
|
|
|
|
/// @file audio_box.cpp
|
|
|
|
/// @brief The entire audio area in the main UI, containing display and related toolbars
|
|
|
|
/// @ingroup audio_ui
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2009-01-04 07:31:48 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
2009-09-10 15:06:40 +02:00
|
|
|
#ifndef AGI_PRE
|
2006-01-16 22:02:54 +01:00
|
|
|
#include <math.h>
|
2009-09-10 15:06:40 +02:00
|
|
|
|
|
|
|
#include <wx/statline.h>
|
|
|
|
#include <wx/tglbtn.h>
|
2009-09-11 00:48:29 +02:00
|
|
|
#include <wx/laywin.h> // Keep this last so wxSW_3D is set.
|
2009-09-10 15:06:40 +02:00
|
|
|
#endif
|
|
|
|
|
2010-06-09 01:21:39 +02:00
|
|
|
#include <libaegisub/log.h>
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "audio_box.h"
|
2011-01-18 00:54:05 +01:00
|
|
|
#include "audio_controller.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "audio_display.h"
|
|
|
|
#include "audio_karaoke.h"
|
2010-12-08 04:36:10 +01:00
|
|
|
#include "audio_timing.h"
|
2011-01-18 00:54:05 +01:00
|
|
|
#include "command/command.h"
|
|
|
|
#include "include/aegisub/context.h"
|
2009-09-10 15:06:40 +02:00
|
|
|
#include "libresrc/libresrc.h"
|
2010-05-21 03:13:36 +02:00
|
|
|
#include "main.h"
|
2006-01-16 22:02:54 +01:00
|
|
|
#include "toggle_bitmap.h"
|
2011-07-15 06:04:13 +02:00
|
|
|
#include "selection_controller.h"
|
2007-06-30 22:59:32 +02:00
|
|
|
#include "tooltip_manager.h"
|
2011-01-18 00:54:05 +01:00
|
|
|
#include "utils.h"
|
2009-07-25 18:15:13 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
enum AudioBoxControlIDs {
|
|
|
|
Audio_Scrollbar = 1600,
|
|
|
|
Audio_Horizontal_Zoom,
|
|
|
|
Audio_Vertical_Zoom,
|
|
|
|
Audio_Volume,
|
|
|
|
Audio_Button_Karaoke,
|
|
|
|
Audio_Button_Goto,
|
|
|
|
|
|
|
|
Audio_Button_Join, /// Karaoke -> Enter join mode.
|
|
|
|
Audio_Button_Split, /// Karaoke -> Enter split mode.
|
|
|
|
Audio_Button_Accept, /// Karaoke -> Split/Join mode -> Accept.
|
2011-01-18 00:54:05 +01:00
|
|
|
Audio_Button_Cancel /// Karaoke -> Split/Join mode -> Cancel.
|
2010-12-08 04:36:10 +01:00
|
|
|
};
|
|
|
|
|
2011-01-18 00:54:05 +01:00
|
|
|
static void add_button(wxWindow *parent, wxSizer *sizer, int border, const char *command) {
|
|
|
|
cmd::Command *c = cmd::get(command);
|
|
|
|
wxBitmapButton *btn = new wxBitmapButton(parent, cmd::id(command), *c->Icon(16));
|
|
|
|
ToolTipManager::Bind(btn, c->StrHelp(), "Audio", command);
|
|
|
|
sizer->Add(btn, 0, wxRIGHT, border);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_option(wxWindow *parent, wxSizer *sizer, int border, const char *command, const char *option) {
|
|
|
|
cmd::Command *c = cmd::get(command);
|
|
|
|
ToggleBitmap *btn = new ToggleBitmap(parent, cmd::id(command), *c->Icon(16), wxSize(20, -1));
|
|
|
|
ToolTipManager::Bind(btn, c->StrHelp(), "Audio", command);
|
|
|
|
btn->SetValue(OPT_GET(option)->GetBool());
|
|
|
|
sizer->Add(btn, 0, wxRIGHT | wxALIGN_CENTER | wxEXPAND, border);
|
|
|
|
}
|
2010-12-08 04:36:10 +01:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @brief Constructor
|
|
|
|
/// @param parent
|
|
|
|
///
|
2011-01-18 00:54:05 +01:00
|
|
|
AudioBox::AudioBox(wxWindow *parent, agi::Context *context)
|
|
|
|
: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxBORDER_RAISED)
|
|
|
|
, audioDisplay(new AudioDisplay(this, context->audioController))
|
|
|
|
, controller(context->audioController)
|
|
|
|
, timing_controller_dialogue(CreateDialogueTimingController(controller, context->selectionController, context->ass))
|
|
|
|
, context(context)
|
|
|
|
, karaokeMode(false)
|
2006-01-16 22:02:54 +01:00
|
|
|
{
|
2007-04-04 02:52:50 +02:00
|
|
|
// Zoom
|
2010-12-08 04:36:10 +01:00
|
|
|
HorizontalZoom = new wxSlider(this,Audio_Horizontal_Zoom,0,-50,30,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_BOTH);
|
2006-01-16 22:02:54 +01:00
|
|
|
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
|
2007-09-22 02:53:05 +02:00
|
|
|
VerticalZoom = new wxSlider(this,Audio_Vertical_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_BOTH|wxSL_INVERSE);
|
2006-02-21 01:55:16 +01:00
|
|
|
VerticalZoom->SetToolTip(_("Vertical zoom"));
|
2007-09-22 02:53:05 +02:00
|
|
|
VolumeBar = new wxSlider(this,Audio_Volume,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_BOTH|wxSL_INVERSE);
|
2006-02-21 01:55:16 +01:00
|
|
|
VolumeBar->SetToolTip(_("Audio Volume"));
|
2010-05-21 03:13:36 +02:00
|
|
|
bool link = OPT_GET("Audio/Link")->GetBool();
|
2007-01-05 19:27:15 +01:00
|
|
|
if (link) {
|
|
|
|
VolumeBar->SetValue(VerticalZoom->GetValue());
|
|
|
|
VolumeBar->Enable(false);
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2006-02-21 01:55:16 +01:00
|
|
|
// VertVol sider
|
|
|
|
wxSizer *VertVol = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
VertVol->Add(VerticalZoom,1,wxEXPAND,0);
|
|
|
|
VertVol->Add(VolumeBar,1,wxEXPAND,0);
|
2008-01-22 21:36:07 +01:00
|
|
|
wxSizer *VertVolArea = new wxBoxSizer(wxVERTICAL);
|
2006-02-21 01:55:16 +01:00
|
|
|
VertVolArea->Add(VertVol,1,wxEXPAND,0);
|
2011-01-18 00:54:05 +01:00
|
|
|
|
|
|
|
add_option(this, VertVolArea, 0, "audio/opt/vertical_link", "Audio/Link");
|
|
|
|
OPT_SUB("Audio/Link", bind(&AudioBox::OnVerticalLink, this, std::tr1::placeholders::_1));
|
2006-02-21 01:55:16 +01:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Top sizer
|
2011-01-18 00:54:05 +01:00
|
|
|
wxSizer *TopSizer = new wxBoxSizer(wxHORIZONTAL);
|
2010-12-08 04:36:10 +01:00
|
|
|
TopSizer->Add(audioDisplay,1,wxEXPAND,0);
|
2006-01-16 22:02:54 +01:00
|
|
|
TopSizer->Add(HorizontalZoom,0,wxEXPAND,0);
|
2006-02-21 01:55:16 +01:00
|
|
|
TopSizer->Add(VertVolArea,0,wxEXPAND,0);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
// Buttons sizer
|
|
|
|
wxSizer *ButtonSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-01-18 00:54:05 +01:00
|
|
|
add_button(this, ButtonSizer, 0, "time/prev");
|
|
|
|
add_button(this, ButtonSizer, 0, "time/next");
|
|
|
|
add_button(this, ButtonSizer, 0, "audio/play/selection");
|
|
|
|
add_button(this, ButtonSizer, 10, "audio/stop");
|
|
|
|
|
|
|
|
add_button(this, ButtonSizer, 0, "audio/play/selection/before");
|
|
|
|
add_button(this, ButtonSizer, 0, "audio/play/selection/after");
|
|
|
|
add_button(this, ButtonSizer, 0, "audio/play/selection/begin");
|
|
|
|
add_button(this, ButtonSizer, 0, "audio/play/selection/end");
|
|
|
|
add_button(this, ButtonSizer, 10, "audio/play/to_end");
|
|
|
|
|
|
|
|
add_button(this, ButtonSizer, 0, "time/lead/in");
|
|
|
|
add_button(this, ButtonSizer, 10, "time/lead/out");
|
|
|
|
|
|
|
|
add_button(this, ButtonSizer, 0, "audio/commit");
|
|
|
|
wxButton *temp = new wxBitmapButton(this,Audio_Button_Goto,GETIMAGE(button_audio_goto_16));
|
2006-01-16 22:02:54 +01:00
|
|
|
temp->SetToolTip(_("Go to selection"));
|
|
|
|
ButtonSizer->Add(temp,0,wxRIGHT,10);
|
|
|
|
|
2011-01-18 00:54:05 +01:00
|
|
|
add_option(this, ButtonSizer, 0, "audio/opt/autocommit", "Audio/Auto/Commit");
|
|
|
|
add_option(this, ButtonSizer, 0, "audio/opt/autonext", "Audio/Next Line on Commit");
|
|
|
|
add_option(this, ButtonSizer, 10, "audio/opt/autoscroll", "Audio/Auto/Scroll");
|
2010-12-08 04:36:10 +01:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
ButtonSizer->AddStretchSpacer(1);
|
|
|
|
|
2011-01-18 00:54:05 +01:00
|
|
|
KaraokeButton = new wxBitmapToggleButton(this,Audio_Button_Karaoke,GETIMAGE(kara_mode_16));
|
2010-12-08 04:36:10 +01:00
|
|
|
KaraokeButton->SetToolTip(_("Toggle karaoke mode"));
|
|
|
|
ButtonSizer->Add(KaraokeButton,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Karaoke sizer
|
2009-08-14 05:11:34 +02:00
|
|
|
karaokeSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
|
|
|
|
JoinSplitSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-01-18 00:54:05 +01:00
|
|
|
JoinButton = new wxBitmapButton(this,Audio_Button_Join,GETIMAGE(kara_join_16));
|
2009-08-14 05:11:34 +02:00
|
|
|
JoinButton->SetToolTip(_("Join selected syllables"));
|
2011-01-18 00:54:05 +01:00
|
|
|
SplitButton = new wxBitmapButton(this,Audio_Button_Split,GETIMAGE(kara_split_16));
|
2009-08-14 05:11:34 +02:00
|
|
|
SplitButton->SetToolTip(_("Enter split-mode"));
|
|
|
|
JoinSplitSizer->Add(JoinButton,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
JoinSplitSizer->Add(SplitButton,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
|
|
|
|
CancelAcceptSizer = new wxBoxSizer(wxHORIZONTAL);
|
2011-01-18 00:54:05 +01:00
|
|
|
CancelButton = new wxBitmapButton(this,Audio_Button_Cancel,GETIMAGE(kara_split_accept_16));
|
2009-08-14 06:57:32 +02:00
|
|
|
CancelButton->SetToolTip(_("Commit splits and leave split-mode"));
|
2011-01-18 00:54:05 +01:00
|
|
|
AcceptButton = new wxBitmapButton(this,Audio_Button_Accept,GETIMAGE(kara_split_cancel_16));
|
2009-08-14 06:57:32 +02:00
|
|
|
AcceptButton->SetToolTip(_("Discard all splits and leave split-mode"));
|
2009-08-14 05:11:34 +02:00
|
|
|
CancelAcceptSizer->Add(CancelButton,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
CancelAcceptSizer->Add(AcceptButton,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
|
|
|
|
karaokeSizer->Add(JoinSplitSizer,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
karaokeSizer->Add(CancelAcceptSizer,0,wxRIGHT|wxEXPAND,0);
|
|
|
|
|
|
|
|
audioKaraoke = new AudioKaraoke(this);
|
|
|
|
audioKaraoke->box = this;
|
|
|
|
audioKaraoke->display = audioDisplay;
|
2006-01-16 22:02:54 +01:00
|
|
|
karaokeSizer->Add(audioKaraoke,1,wxEXPAND,0);
|
2009-08-14 05:11:34 +02:00
|
|
|
|
2006-01-16 22:02:54 +01:00
|
|
|
// Main sizer
|
2011-01-18 00:54:05 +01:00
|
|
|
wxBoxSizer *MainSizer = new wxBoxSizer(wxVERTICAL);
|
2010-12-08 04:36:10 +01:00
|
|
|
MainSizer->Add(TopSizer,1,wxEXPAND|wxALL,3);
|
|
|
|
MainSizer->Add(ButtonSizer,0,wxEXPAND|wxBOTTOM|wxLEFT|wxRIGHT,3);
|
|
|
|
MainSizer->Add(karaokeSizer,0,wxEXPAND|wxBOTTOM|wxLEFT|wxRIGHT,3);
|
|
|
|
MainSizer->AddSpacer(3);
|
2006-01-16 22:02:54 +01:00
|
|
|
SetSizer(MainSizer);
|
2009-08-14 05:11:34 +02:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
SetKaraokeButtons(); // Decide which one to show or hide.
|
2010-12-08 09:09:16 +01:00
|
|
|
|
2010-12-08 04:36:10 +01:00
|
|
|
controller->SetTimingController(timing_controller_dialogue);
|
2006-01-16 22:02:54 +01:00
|
|
|
|
2011-01-18 00:54:05 +01:00
|
|
|
Bind(wxEVT_COMMAND_BUTTON_CLICKED, &AudioBox::OnCommand, this);
|
|
|
|
Bind(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, &AudioBox::OnCommand, this);
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Destructor
|
|
|
|
///
|
2010-12-08 04:36:10 +01:00
|
|
|
AudioBox::~AudioBox()
|
|
|
|
{
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(AudioBox,wxPanel)
|
|
|
|
EVT_COMMAND_SCROLL(Audio_Horizontal_Zoom, AudioBox::OnHorizontalZoom)
|
|
|
|
EVT_COMMAND_SCROLL(Audio_Vertical_Zoom, AudioBox::OnVerticalZoom)
|
2006-02-21 01:55:16 +01:00
|
|
|
EVT_COMMAND_SCROLL(Audio_Volume, AudioBox::OnVolume)
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
EVT_BUTTON(Audio_Button_Goto, AudioBox::OnGoto)
|
|
|
|
EVT_BUTTON(Audio_Button_Join,AudioBox::OnJoin)
|
2007-06-23 01:28:28 +02:00
|
|
|
EVT_BUTTON(Audio_Button_Split,AudioBox::OnSplit)
|
2009-08-14 05:11:34 +02:00
|
|
|
EVT_BUTTON(Audio_Button_Cancel,AudioBox::OnCancel)
|
|
|
|
EVT_BUTTON(Audio_Button_Accept,AudioBox::OnAccept)
|
2006-01-16 22:02:54 +01:00
|
|
|
|
|
|
|
EVT_TOGGLEBUTTON(Audio_Button_Karaoke, AudioBox::OnKaraoke)
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2011-01-18 00:54:05 +01:00
|
|
|
void AudioBox::OnCommand(wxCommandEvent &event) {
|
|
|
|
if (event.GetId() < Audio_Scrollbar) {
|
|
|
|
cmd::call(context, event.GetId());
|
|
|
|
audioDisplay->SetFocus();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
}
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Horizontal zoom bar changed
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AudioBox::OnHorizontalZoom(wxScrollEvent &event) {
|
2010-12-08 04:36:10 +01:00
|
|
|
// Negate the value, we want zoom out to be on bottom and zoom in on top,
|
|
|
|
// but the control doesn't want negative on bottom and positive on top.
|
|
|
|
audioDisplay->SetZoomLevel(-event.GetPosition());
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AudioBox::OnVerticalZoom(wxScrollEvent &event) {
|
2011-01-18 00:54:05 +01:00
|
|
|
int pos = mid(1, event.GetPosition(), 100);
|
|
|
|
double value = pow(pos / 50.0, 3);
|
2010-12-08 04:36:10 +01:00
|
|
|
audioDisplay->SetAmplitudeScale(value);
|
2011-01-18 00:54:05 +01:00
|
|
|
if (!VolumeBar->IsEnabled()) {
|
2006-02-21 01:55:16 +01:00
|
|
|
VolumeBar->SetValue(pos);
|
2011-01-18 00:54:05 +01:00
|
|
|
controller->SetVolume(value);
|
2006-02-21 01:55:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void AudioBox::OnVolume(wxScrollEvent &event) {
|
2011-01-18 00:54:05 +01:00
|
|
|
int pos = mid(1, event.GetPosition(), 100);
|
|
|
|
controller->SetVolume(pow(pos / 50.0, 3));
|
2006-02-21 01:55:16 +01:00
|
|
|
}
|
|
|
|
|
2011-01-18 00:54:05 +01:00
|
|
|
void AudioBox::OnVerticalLink(agi::OptionValue const& opt) {
|
|
|
|
if (opt.GetBool()) {
|
|
|
|
int pos = mid(1, VerticalZoom->GetValue(), 100);
|
|
|
|
double value = pow(pos / 50.0, 3);
|
2010-12-08 04:36:10 +01:00
|
|
|
controller->SetVolume(value);
|
2006-02-21 01:55:16 +01:00
|
|
|
VolumeBar->SetValue(pos);
|
|
|
|
}
|
2011-01-18 00:54:05 +01:00
|
|
|
VolumeBar->Enable(!opt.GetBool());
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void AudioBox::OnKaraoke(wxCommandEvent &event) {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "OnKaraoke";
|
2006-01-16 22:02:54 +01:00
|
|
|
audioDisplay->SetFocus();
|
|
|
|
if (karaokeMode) {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "karaoke enabled, disabling";
|
2006-01-27 01:48:59 +01:00
|
|
|
if (audioKaraoke->splitting) {
|
2007-07-03 20:28:08 +02:00
|
|
|
audioKaraoke->EndSplit(false);
|
2006-01-27 01:48:59 +01:00
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
karaokeMode = false;
|
|
|
|
audioKaraoke->enabled = false;
|
2010-12-08 04:36:10 +01:00
|
|
|
/// @todo Replace this with changing timing controller
|
|
|
|
//audioDisplay->SetDialogue();
|
2006-01-16 22:02:54 +01:00
|
|
|
audioKaraoke->Refresh(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "karaoke disabled, enabling";
|
2006-01-16 22:02:54 +01:00
|
|
|
karaokeMode = true;
|
|
|
|
audioKaraoke->enabled = true;
|
2010-12-08 04:36:10 +01:00
|
|
|
/// @todo Replace this with changing timing controller
|
|
|
|
//audioDisplay->SetDialogue();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
2009-08-14 05:11:34 +02:00
|
|
|
|
2007-08-15 22:41:57 +02:00
|
|
|
SetKaraokeButtons();
|
2007-06-20 04:18:55 +02:00
|
|
|
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "returning";
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Sets karaoke buttons
|
|
|
|
///
|
2007-06-23 01:28:28 +02:00
|
|
|
void AudioBox::SetKaraokeButtons() {
|
|
|
|
// What to enable
|
|
|
|
bool join,split;
|
|
|
|
join = audioKaraoke->enabled && (audioKaraoke->splitting || audioKaraoke->selectionCount>=2);
|
|
|
|
split = audioKaraoke->enabled;
|
|
|
|
|
2007-08-16 00:33:38 +02:00
|
|
|
// If we set focus here, the audio display will continually steal the focus
|
|
|
|
// when navigating via the grid and karaoke is enabled. So don't.
|
|
|
|
//audioDisplay->SetFocus();
|
|
|
|
|
2007-06-23 01:28:28 +02:00
|
|
|
JoinButton->Enable(join);
|
2006-01-16 22:02:54 +01:00
|
|
|
SplitButton->Enable(split);
|
2010-12-08 04:36:10 +01:00
|
|
|
|
|
|
|
karaokeSizer->Show(CancelAcceptSizer, audioKaraoke->splitting);
|
|
|
|
karaokeSizer->Show(JoinSplitSizer, !audioKaraoke->splitting);
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2009-08-14 05:11:34 +02:00
|
|
|
/// @brief Join button in karaoke mode
|
|
|
|
/// @param event wxEvent
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AudioBox::OnJoin(wxCommandEvent &event) {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "join";
|
2006-01-16 22:02:54 +01:00
|
|
|
audioDisplay->SetFocus();
|
2009-08-14 05:11:34 +02:00
|
|
|
audioKaraoke->Join();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2009-08-14 05:11:34 +02:00
|
|
|
/// @brief Split button in karaoke mode
|
|
|
|
/// @param event wxEvent
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AudioBox::OnSplit(wxCommandEvent &event) {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "split";
|
2006-01-16 22:02:54 +01:00
|
|
|
audioDisplay->SetFocus();
|
2011-01-18 00:54:05 +01:00
|
|
|
audioKaraoke->BeginSplit();
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|
|
|
|
|
2009-08-14 05:11:34 +02:00
|
|
|
/// @brief Cancel join/split in karaoke mode.
|
|
|
|
/// @param event wxEvent
|
|
|
|
///
|
|
|
|
void AudioBox::OnCancel(wxCommandEvent &event) {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "cancel";
|
2009-08-14 05:11:34 +02:00
|
|
|
audioDisplay->SetFocus();
|
|
|
|
audioKaraoke->EndSplit(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @brief Accept join/split button in karaoke mode.
|
|
|
|
/// @param event wxEvent
|
|
|
|
///
|
|
|
|
void AudioBox::OnAccept(wxCommandEvent &event) {
|
2010-06-09 01:21:39 +02:00
|
|
|
LOG_D("audio/box") << "accept";
|
2009-08-14 05:11:34 +02:00
|
|
|
audioDisplay->SetFocus();
|
|
|
|
audioKaraoke->EndSplit(false);
|
|
|
|
}
|
2006-01-16 22:02:54 +01:00
|
|
|
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
|
|
|
/// @brief Goto button
|
|
|
|
/// @param event
|
|
|
|
///
|
2006-01-16 22:02:54 +01:00
|
|
|
void AudioBox::OnGoto(wxCommandEvent &event) {
|
|
|
|
audioDisplay->SetFocus();
|
2010-12-08 04:36:10 +01:00
|
|
|
if (controller->GetTimingController())
|
|
|
|
audioDisplay->ScrollSampleRangeInView(controller->GetTimingController()->GetIdealVisibleSampleRange());
|
2006-01-16 22:02:54 +01:00
|
|
|
}
|