Separated volume on its own slider bar

Originally committed to SVN as r89.
This commit is contained in:
Rodrigo Braz Monteiro 2006-02-21 00:55:16 +00:00
parent bd116bd286
commit 6eae67a95e
8 changed files with 66 additions and 8 deletions

View file

@ -75,7 +75,12 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
HorizontalZoom = new wxSlider(this,Audio_Horizontal_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL);
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
VerticalZoom = new wxSlider(this,Audio_Vertical_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
VerticalZoom->SetToolTip(_("Vertical zoom/Volume"));
VerticalZoom->SetToolTip(_("Vertical zoom"));
VolumeBar = new wxSlider(this,Audio_Volume,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
VolumeBar->SetToolTip(_("Audio Volume"));
VerticalLink = new ToggleBitmap(this,Audio_Vertical_Link,wxBITMAP(toggle_audio_link));
VerticalLink->SetToolTip(_("Link vertical zoom and volxmlume sliders"));
VerticalLink->SetValue(Options.AsBool(_T("Audio Link")));
// Display sizer
DisplaySizer = new wxBoxSizer(wxVERTICAL);
@ -83,11 +88,19 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE
DisplaySizer->Add(Sash,0,wxEXPAND,0);
DisplaySizer->Add(audioScroll,0,wxEXPAND,0);
// VertVol sider
wxSizer *VertVol = new wxBoxSizer(wxHORIZONTAL);
wxSizer *VertVolArea = new wxBoxSizer(wxVERTICAL);
VertVol->Add(VerticalZoom,1,wxEXPAND,0);
VertVol->Add(VolumeBar,1,wxEXPAND,0);
VertVolArea->Add(VertVol,1,wxEXPAND,0);
VertVolArea->Add(VerticalLink,0,wxEXPAND,0);
// Top sizer
TopSizer = new wxBoxSizer(wxHORIZONTAL);
TopSizer->Add(DisplaySizer,1,wxEXPAND,0);
TopSizer->Add(HorizontalZoom,0,wxEXPAND,0);
TopSizer->Add(VerticalZoom,0,wxEXPAND,0);
TopSizer->Add(VertVolArea,0,wxEXPAND,0);
// Buttons sizer
wxSizer *ButtonSizer = new wxBoxSizer(wxHORIZONTAL);
@ -218,6 +231,7 @@ BEGIN_EVENT_TABLE(AudioBox,wxPanel)
EVT_COMMAND_SCROLL(Audio_Scrollbar, AudioBox::OnScrollbar)
EVT_COMMAND_SCROLL(Audio_Horizontal_Zoom, AudioBox::OnHorizontalZoom)
EVT_COMMAND_SCROLL(Audio_Vertical_Zoom, AudioBox::OnVerticalZoom)
EVT_COMMAND_SCROLL(Audio_Volume, AudioBox::OnVolume)
EVT_SASH_DRAGGED(Audio_Sash,AudioBox::OnSash)
EVT_BUTTON(Audio_Button_Play, AudioBox::OnPlaySelection)
@ -236,6 +250,7 @@ BEGIN_EVENT_TABLE(AudioBox,wxPanel)
EVT_BUTTON(Audio_Button_Leadin,AudioBox::OnLeadIn)
EVT_BUTTON(Audio_Button_Leadout,AudioBox::OnLeadOut)
EVT_TOGGLEBUTTON(Audio_Vertical_Link, AudioBox::OnVerticalLink)
EVT_TOGGLEBUTTON(Audio_Button_Karaoke, AudioBox::OnKaraoke)
EVT_TOGGLEBUTTON(Audio_Check_AutoGoto,AudioBox::OnAutoGoto)
EVT_TOGGLEBUTTON(Audio_Button_Split,AudioBox::OnSplit)
@ -265,7 +280,42 @@ void AudioBox::OnVerticalZoom(wxScrollEvent &event) {
int pos = event.GetPosition();
if (pos < 1) pos = 1;
if (pos > 100) pos = 100;
audioDisplay->SetScale(pow(float(pos)/50.0f,3));
float value = pow(float(pos)/50.0f,3);
audioDisplay->SetScale(value);
if (VerticalLink->GetValue()) {
audioDisplay->provider->volume = value;
VolumeBar->SetValue(pos);
}
}
//////////////////////
// Volume bar changed
void AudioBox::OnVolume(wxScrollEvent &event) {
if (!VerticalLink->GetValue()) {
int pos = event.GetPosition();
if (pos < 1) pos = 1;
if (pos > 100) pos = 100;
audioDisplay->provider->volume = pow(float(pos)/50.0f,3);
}
}
////////////////////////
// Bars linked/unlinked
void AudioBox::OnVerticalLink(wxCommandEvent &event) {
int pos = VerticalZoom->GetValue();
if (pos < 1) pos = 1;
if (pos > 100) pos = 100;
float value = pow(float(pos)/50.0f,3);
if (VerticalLink->GetValue()) {
audioDisplay->provider->volume = value;
VolumeBar->SetValue(pos);
}
VolumeBar->Enable(!VerticalLink->GetValue());
Options.SetBool(_T("Audio Link"),VerticalLink->GetValue());
Options.Save();
}

View file

@ -63,11 +63,13 @@ private:
wxScrollBar *audioScroll;
wxSlider *HorizontalZoom;
wxSlider *VerticalZoom;
wxSlider *VolumeBar;
wxSizer *MainSizer;
wxSizer *TopSizer;
wxSizer *sashSizer;
wxSizer *DisplaySizer;
wxSashWindow *Sash;
ToggleBitmap *VerticalLink;
wxToggleButton *SplitButton;
wxButton *JoinButton;
@ -79,6 +81,8 @@ private:
void OnScrollbar(wxScrollEvent &event);
void OnHorizontalZoom(wxScrollEvent &event);
void OnVerticalZoom(wxScrollEvent &event);
void OnVolume(wxScrollEvent &event);
void OnVerticalLink(wxCommandEvent &event);
void OnSash(wxSashEvent &event);
void OnPlaySelection(wxCommandEvent &event);
@ -129,7 +133,9 @@ enum {
Audio_Scrollbar = 1600,
Audio_Horizontal_Zoom,
Audio_Vertical_Zoom,
Audio_Volume,
Audio_Sash,
Audio_Vertical_Link,
Audio_Button_Play,
Audio_Button_Stop,

View file

@ -729,7 +729,6 @@ void AudioDisplay::UpdateSamples() {
void AudioDisplay::SetScale(float _scale) {
if (scale == _scale) return;
scale = _scale;
provider->volume = scale;
UpdateImage();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -36,6 +36,7 @@ Please visit http://aegisub.net to download latest version
- Audio timing will now apply to all selected lines, as well as active line (AMZ)
- Rows colliding with the currently active one will now be highlighted in grid (AMZ)
- Selected comments are now highlighted in a different color (AMZ)
- Added a volume slider bar to audio mode (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View file

@ -131,6 +131,7 @@ void OptionsManager::LoadDefaults() {
SetInt(_T("Audio Cache"),1);
SetInt(_T("Audio Sample Rate"),0);
SetText(_T("Audio Downmixer"),_T("ConvertToMono"));
SetBool(_T("Audio Link"),true);
SetBool(_T("Audio Autocommit"),false);
SetBool(_T("Audio Autoscroll"),true);
SetBool(_T("Audio SSA Mode"),false);

View file

@ -118,6 +118,7 @@ toggle_audio_autoscroll BITMAP "bitmaps/toggle_audio_autoscroll.bmp"
toggle_audio_autocommit BITMAP "bitmaps/toggle_audio_autocommit.bmp"
toggle_audio_ssa BITMAP "bitmaps/toggle_audio_ssa.bmp"
toggle_audio_spectrum BITMAP "bitmaps/toggle_audio_spectrum.bmp"
toggle_audio_link BITMAP "bitmaps/toggle_audio_link.bmp"
toggle_video_autoscroll BITMAP "bitmaps/toggle_video_autoscroll.bmp"
splash_01 BITMAP "bitmaps/splash_01.bmp"

View file

@ -70,11 +70,11 @@ VideoBox::VideoBox(wxPanel *parent) {
videoSlider->SetToolTip(_("Seek video."));
// Position
VideoPosition = new wxTextCtrl(videoPage,-1,_T(""),wxDefaultPosition,wxSize(125,20),wxTE_READONLY);
VideoPosition = new wxTextCtrl(videoPage,-1,_T(""),wxDefaultPosition,wxSize(110,20),wxTE_READONLY);
VideoPosition->SetToolTip(_("Current frame time and number."));
// Times of sub relative to video
VideoSubsPos = new wxTextCtrl(videoPage,-1,_T(""),wxDefaultPosition,wxSize(125,20),wxTE_READONLY);
VideoSubsPos = new wxTextCtrl(videoPage,-1,_T(""),wxDefaultPosition,wxSize(110,20),wxTE_READONLY);
VideoSubsPos->SetToolTip(_("Time of this frame relative to start and end of current subs."));
// Display
@ -96,10 +96,10 @@ VideoBox::VideoBox(wxPanel *parent) {
videoBottomSizer->Add(VideoPlayLineButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2);
videoBottomSizer->Add(VideoStopButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2);
videoBottomSizer->Add(AutoScroll,0,wxTOP|wxBOTTOM|wxALIGN_CENTER|wxEXPAND,2);
videoBottomSizer->Add(VideoTrackerMenuButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER|wxEXPAND,2);
videoBottomSizer->Add(VideoTrackerMenu2Button,0,wxTOP|wxBOTTOM|wxALIGN_CENTER|wxEXPAND,2);
videoBottomSizer->Add(VideoPosition,1,wxLEFT|wxALIGN_CENTER,5);
videoBottomSizer->Add(VideoSubsPos,1,wxALIGN_CENTER,0);
videoBottomSizer->Add(VideoTrackerMenuButton,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2);
videoBottomSizer->Add(VideoTrackerMenu2Button,0,wxTOP|wxBOTTOM|wxALIGN_CENTER,2);
VideoSizer = new wxBoxSizer(wxVERTICAL);
VideoSizer->Add(videoDisplay,0,wxEXPAND,0);
VideoSizer->Add(videoSliderSizer,0,wxEXPAND,0);