From bd116bd2862db72f9055f210103a3f168c3d58d2 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Mon, 20 Feb 2006 23:54:15 +0000 Subject: [PATCH] Changing vertical zoom will now also change the playback volume Originally committed to SVN as r88. --- core/audio_box.cpp | 4 +--- core/audio_display.cpp | 1 + core/audio_provider.cpp | 6 +++++- core/audio_provider.h | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/audio_box.cpp b/core/audio_box.cpp index 68b204d8b..45f5b1eb1 100644 --- a/core/audio_box.cpp +++ b/core/audio_box.cpp @@ -63,11 +63,9 @@ wxPanel(parent,-1,wxDefaultPosition,wxDefaultSize,wxTAB_TRAVERSAL|wxBORDER_RAISE audioScroll = new wxScrollBar(this,Audio_Scrollbar); audioScroll->SetToolTip(_("Seek bar")); Sash = new wxSashWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN | wxSW_3DBORDER); - //Sash = new wxSashLayoutWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize); sashSizer = new wxBoxSizer(wxVERTICAL); audioDisplay = new AudioDisplay(Sash,display); sashSizer->Add(audioDisplay,1,wxEXPAND,0); - //sashSizer->SetSizeHints(Sash); Sash->SetSizer(sashSizer); Sash->SetSashVisible(wxSASH_BOTTOM,true); Sash->SetSashBorder(wxSASH_BOTTOM,true); @@ -77,7 +75,7 @@ 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")); + VerticalZoom->SetToolTip(_("Vertical zoom/Volume")); // Display sizer DisplaySizer = new wxBoxSizer(wxVERTICAL); diff --git a/core/audio_display.cpp b/core/audio_display.cpp index caacb3e88..4c946a729 100644 --- a/core/audio_display.cpp +++ b/core/audio_display.cpp @@ -729,6 +729,7 @@ void AudioDisplay::UpdateSamples() { void AudioDisplay::SetScale(float _scale) { if (scale == _scale) return; scale = _scale; + provider->volume = scale; UpdateImage(); } diff --git a/core/audio_provider.cpp b/core/audio_provider.cpp index a128c95f2..ccf3cc8ae 100644 --- a/core/audio_provider.cpp +++ b/core/audio_provider.cpp @@ -68,6 +68,7 @@ AudioProvider::AudioProvider(wxString _filename, AudioDisplay *_display) { raw = NULL; display = _display; blockcount = 0; + volume = 1.0f; filename = _filename; @@ -501,8 +502,11 @@ int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuf provider->softStop = true; } - // Fill rest with blank + // Set volume short *output = (short*) outputBuffer; + for (unsigned int i=0;ivolume),(1<<15)-1); + + // Fill rest with blank for (unsigned int i=avail;i