http://bugs.winehq.org/show_bug.cgi?id=16329
--- Comment #11 from Raymond superquad.vortex2@gmail.com 2010-08-18 01:13:23 --- (In reply to comment #10)
Does this post have anything to do with it?
http://www.winehq.org/pipermail/wine-devel/2006-September/051025.html
The point is the maximum size of the buffer of the alsa driver of most PCI sound cards is about 64K bytes and snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS) i.e. buffer size is a multiple of period size
The proposed patch does not work and I guess his sound card does not support 44100Hz since those dsound wav are 22050Hz in early day
bufffer size = 48000 , i.e. 48000 x 2 x 2 = 192,000bytes
- unsigned int buffer_time = 500000; - unsigned int period_time = 10000; - snd_pcm_uframes_t buffer_size; - snd_pcm_uframes_t period_size; + snd_pcm_uframes_t buffer_size = 48000; + snd_pcm_uframes_t period_size = 1024; int flags; int err=0; int dir=0; @@ -2561,15 +2559,16 @@ #define EXIT_ON_ERROR(f,e,txt) do \ wwo->format.Format.nChannels, getFormat(wwo->format.Format.wFormatTag));
- dir=0; - EXIT_ON_ERROR( snd_pcm_hw_params_set_buffer_time_near(pcm, hw_params, &buffer_time, &dir), MMSYSERR_INVALPARAM, "unable to set buffer time"); - dir=0; - EXIT_ON_ERROR( snd_pcm_hw_params_set_period_time_near(pcm, hw_params, &period_time, &dir), MMSYSERR_INVALPARAM, "unable to set period time"); + buffer_size = buffer_size / ( snd_pcm_format_physical_width(format) * wwo->format.Format.nChannels ); + snd_pcm_uframes_t buffer_size_old = buffer_size; + EXIT_ON_ERROR( snd_pcm_hw_params_set_buffer_size_near(pcm, hw_params, &buffer_size), MMSYSERR_INVALPARAM, "unable to set buffer size"); + dir=0; + EXIT_ON_ERROR( snd_pcm_hw_params_set_period_size_near(pcm, hw_params, &period_size, &dir), MMSYSERR_INVALPARAM, "unable to set period time"); + if(buffer_size != buffer_size_old) ERR("buffer_size:%i buffer_size_old:%i\n", (int)buffer_size, (int)buffer_size_old);