More fixes for dsound playing code and a bit for spectrum rendering

Originally committed to SVN as r732.
This commit is contained in:
Niels Martin Hansen 2007-01-07 04:52:33 +00:00
parent 9babda0720
commit a88feab986
2 changed files with 11 additions and 13 deletions

View file

@ -534,18 +534,14 @@ void AudioDisplay::DrawSpectrum(wxDC &finaldc,bool weak) {
spectrumDisplay = new wxBitmap(imgobj); spectrumDisplay = new wxBitmap(imgobj);
} }
if (hasSel && selStartCap < selEndCap && if (hasSel && selStartCap < selEndCap && !spectrumDisplaySelected) {
((selStartCap > Position && selStartCap < Position+w) || // There is a visible selection and we don't have a rendered one
(selEndCap > Position && selEndCap < Position+w) || // This should be done regardless whether we're "weak" or not
(selStartCap < Position && selEndCap > Position+w)) && // Assume a few things were already set up when things were first rendered though
!spectrumDisplaySelected) { unsigned char *img = (unsigned char *)malloc(h*w*3);
// There is a visible selection and we don't have a rendered one spectrumRenderer->RenderRange(Position*samples, (Position+w)*samples, true, img, 0, w, w, h);
// This should be done regardless whether we're "weak" or not wxImage imgobj(w, h, img, false);
// Assume a few things were already set up when things were first rendered though spectrumDisplaySelected = new wxBitmap(imgobj);
unsigned char *img = (unsigned char *)malloc(h*w*3);
spectrumRenderer->RenderRange(Position*samples, (Position+w)*samples, true, img, 0, w, w, h);
wxImage imgobj(w, h, img, false);
spectrumDisplaySelected = new wxBitmap(imgobj);
} }
// Draw // Draw

View file

@ -295,8 +295,10 @@ void DirectSoundPlayer::Stop(bool timerToo) {
offset = 0; offset = 0;
// Close event handle // Close event handle
if (notificationEvent) if (notificationEvent) {
CloseHandle(notificationEvent); CloseHandle(notificationEvent);
notificationEvent = 0;
}
// Stop timer // Stop timer
if (timerToo && displayTimer) { if (timerToo && displayTimer) {