From f40400d162fef039aef39f550eb83e80ba716c6a Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 18 Jul 2008 15:22:50 +0000 Subject: [PATCH] changed number of frames per callback which seems to fix distorted sound git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1338 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/core/audio/audio_sdl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/audio/audio_sdl.cpp b/src/core/audio/audio_sdl.cpp index ae4f2dbab..8d14c0480 100644 --- a/src/core/audio/audio_sdl.cpp +++ b/src/core/audio/audio_sdl.cpp @@ -67,7 +67,7 @@ audioSDL::audioSDL( bool & _success_ful, mixer * _mixer ) : // of system, so we don't have // to convert the buffers m_audioHandle.channels = channels(); - m_audioHandle.samples = getMixer()->framesPerPeriod(); + m_audioHandle.samples = qMax( 1024, getMixer()->framesPerPeriod()*2 ); m_audioHandle.callback = sdlAudioCallback; m_audioHandle.userdata = this; @@ -198,7 +198,7 @@ void audioSDL::sdlAudioCallback( Uint8 * _buf, int _len ) (int_sample_t *)m_convertedBuf, m_convertEndian ); } - int min_len = tMin( _len, m_convertedBuf_size + const int min_len = tMin( _len, m_convertedBuf_size - m_convertedBuf_pos ); memcpy( _buf, m_convertedBuf + m_convertedBuf_pos, min_len ); _buf += min_len;