From 72b3e5fa446566c11a128c0d4ad8761a58eb3f2c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 3 Jan 2004 02:49:19 +0000 Subject: [PATCH] hush spurious warning --- stepmania/src/arch/Sound/ALSA9Helpers.cpp | 6 ++++-- stepmania/src/arch/Sound/ALSA9Helpers.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/stepmania/src/arch/Sound/ALSA9Helpers.cpp b/stepmania/src/arch/Sound/ALSA9Helpers.cpp index 6f5be02eb8..3fdd41c08d 100644 --- a/stepmania/src/arch/Sound/ALSA9Helpers.cpp +++ b/stepmania/src/arch/Sound/ALSA9Helpers.cpp @@ -65,7 +65,7 @@ bool Alsa9Buf::SetHWParams() err = dsnd_pcm_hw_params_set_rate_near(pcm, hwparams, &rate, 0); ALSA_CHECK("dsnd_pcm_hw_params_set_rate_near"); - if( (int) rate != samplerate ) + if( samplerate_set_explicitly && (int) rate != samplerate ) LOG->Warn("Alsa9Buf::SetHWParams: Couldn't get %ihz (got %ihz instead)", samplerate, rate); snd_pcm_uframes_t buffersize = 1024*8; @@ -160,7 +160,8 @@ Alsa9Buf::Alsa9Buf( hw hardware, int channels_ ) samplerate = 44100; samplebits = 16; last_cursor_pos = 0; - + samplerate_set_explicitly = false; + /* Open the device. */ int err; // err = dsnd_pcm_open( &pcm, "dmix", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK ); @@ -333,6 +334,7 @@ void Alsa9Buf::Stop() void Alsa9Buf::SetSampleRate(int hz) { samplerate = hz; + samplerate_set_explicitly = true; SetHWParams(); diff --git a/stepmania/src/arch/Sound/ALSA9Helpers.h b/stepmania/src/arch/Sound/ALSA9Helpers.h index 0dcfa78d8e..d5a3194a8c 100644 --- a/stepmania/src/arch/Sound/ALSA9Helpers.h +++ b/stepmania/src/arch/Sound/ALSA9Helpers.h @@ -12,6 +12,7 @@ class Alsa9Buf private: int channels, samplerate, samplebits; int buffersize, last_cursor_pos; + bool samplerate_set_explicitly; snd_pcm_sframes_t total_frames; snd_pcm_uframes_t xfer_align;