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);
}
if (hasSel && selStartCap < selEndCap &&
((selStartCap > Position && selStartCap < Position+w) ||
(selEndCap > Position && selEndCap < Position+w) ||
(selStartCap < Position && selEndCap > Position+w)) &&
!spectrumDisplaySelected) {
// There is a visible selection and we don't have a rendered one
// This should be done regardless whether we're "weak" or not
// Assume a few things were already set up when things were first rendered though
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);
if (hasSel && selStartCap < selEndCap && !spectrumDisplaySelected) {
// There is a visible selection and we don't have a rendered one
// This should be done regardless whether we're "weak" or not
// Assume a few things were already set up when things were first rendered though
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

View file

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