Changing vertical zoom will now also change the playback volume
Originally committed to SVN as r88.
This commit is contained in:
parent
c31367c761
commit
bd116bd286
4 changed files with 8 additions and 4 deletions
|
@ -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);
|
||||
|
|
|
@ -729,6 +729,7 @@ void AudioDisplay::UpdateSamples() {
|
|||
void AudioDisplay::SetScale(float _scale) {
|
||||
if (scale == _scale) return;
|
||||
scale = _scale;
|
||||
provider->volume = scale;
|
||||
UpdateImage();
|
||||
}
|
||||
|
||||
|
|
|
@ -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;i<avail;i++) output[i] = MID(-(1<<15),int(output[i] * provider->volume),(1<<15)-1);
|
||||
|
||||
// Fill rest with blank
|
||||
for (unsigned int i=avail;i<framesPerBuffer;i++) output[i]=0;
|
||||
|
||||
// Set play position (and real one)
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
bool softStop;
|
||||
bool playing;
|
||||
bool spectrum;
|
||||
float volume;
|
||||
|
||||
volatile __int64 playPos;
|
||||
volatile __int64 startPos;
|
||||
|
|
Loading…
Reference in a new issue