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 = new wxScrollBar(this,Audio_Scrollbar);
|
||||||
audioScroll->SetToolTip(_("Seek bar"));
|
audioScroll->SetToolTip(_("Seek bar"));
|
||||||
Sash = new wxSashWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN | wxSW_3DBORDER);
|
Sash = new wxSashWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize,wxCLIP_CHILDREN | wxSW_3DBORDER);
|
||||||
//Sash = new wxSashLayoutWindow(this,Audio_Sash,wxDefaultPosition,wxDefaultSize);
|
|
||||||
sashSizer = new wxBoxSizer(wxVERTICAL);
|
sashSizer = new wxBoxSizer(wxVERTICAL);
|
||||||
audioDisplay = new AudioDisplay(Sash,display);
|
audioDisplay = new AudioDisplay(Sash,display);
|
||||||
sashSizer->Add(audioDisplay,1,wxEXPAND,0);
|
sashSizer->Add(audioDisplay,1,wxEXPAND,0);
|
||||||
//sashSizer->SetSizeHints(Sash);
|
|
||||||
Sash->SetSizer(sashSizer);
|
Sash->SetSizer(sashSizer);
|
||||||
Sash->SetSashVisible(wxSASH_BOTTOM,true);
|
Sash->SetSashVisible(wxSASH_BOTTOM,true);
|
||||||
Sash->SetSashBorder(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 = new wxSlider(this,Audio_Horizontal_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL);
|
||||||
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
|
HorizontalZoom->SetToolTip(_("Horizontal zoom"));
|
||||||
VerticalZoom = new wxSlider(this,Audio_Vertical_Zoom,50,0,100,wxDefaultPosition,wxSize(-1,20),wxSL_VERTICAL|wxSL_INVERSE);
|
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
|
// Display sizer
|
||||||
DisplaySizer = new wxBoxSizer(wxVERTICAL);
|
DisplaySizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
|
@ -729,6 +729,7 @@ void AudioDisplay::UpdateSamples() {
|
||||||
void AudioDisplay::SetScale(float _scale) {
|
void AudioDisplay::SetScale(float _scale) {
|
||||||
if (scale == _scale) return;
|
if (scale == _scale) return;
|
||||||
scale = _scale;
|
scale = _scale;
|
||||||
|
provider->volume = scale;
|
||||||
UpdateImage();
|
UpdateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,7 @@ AudioProvider::AudioProvider(wxString _filename, AudioDisplay *_display) {
|
||||||
raw = NULL;
|
raw = NULL;
|
||||||
display = _display;
|
display = _display;
|
||||||
blockcount = 0;
|
blockcount = 0;
|
||||||
|
volume = 1.0f;
|
||||||
|
|
||||||
filename = _filename;
|
filename = _filename;
|
||||||
|
|
||||||
|
@ -501,8 +502,11 @@ int paCallback(void *inputBuffer, void *outputBuffer, unsigned long framesPerBuf
|
||||||
provider->softStop = true;
|
provider->softStop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill rest with blank
|
// Set volume
|
||||||
short *output = (short*) outputBuffer;
|
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;
|
for (unsigned int i=avail;i<framesPerBuffer;i++) output[i]=0;
|
||||||
|
|
||||||
// Set play position (and real one)
|
// Set play position (and real one)
|
||||||
|
|
|
@ -105,6 +105,7 @@ public:
|
||||||
bool softStop;
|
bool softStop;
|
||||||
bool playing;
|
bool playing;
|
||||||
bool spectrum;
|
bool spectrum;
|
||||||
|
float volume;
|
||||||
|
|
||||||
volatile __int64 playPos;
|
volatile __int64 playPos;
|
||||||
volatile __int64 startPos;
|
volatile __int64 startPos;
|
||||||
|
|
Loading…
Reference in a new issue