Author: janderwald Date: Fri Jul 17 11:24:11 2009 New Revision: 41996
URL: http://svn.reactos.org/svn/reactos?rev=41996&view=rev Log: - Don't hardcode the sound kernel buffersize and maximum buffer count and make it possible to override it because kernel streaming pins have specific frame size requirements. - See KSALLOCATOR_FRAMING struct
Modified: trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c
Modified: trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy/... ============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/deviceinstance.c [iso-8859-1] Fri Jul 17 11:24:11 2009 @@ -13,6 +13,13 @@ #include <mmddk.h> #include <mmebuddy.h>
+/* + Restrain ourselves from flooding the kernel device! +*/ + +#define SOUND_KERNEL_BUFFER_COUNT 10 +#define SOUND_KERNEL_BUFFER_SIZE 16384 + MMRESULT AllocateSoundDeviceInstance( OUT PSOUND_DEVICE_INSTANCE* SoundDeviceInstance) @@ -26,6 +33,11 @@
if ( ! NewInstance ) return MMSYSERR_NOMEM; + + /* Use default frame size */ + NewInstance->FrameSize = SOUND_KERNEL_BUFFER_SIZE; + /* Use default buffer count */ + NewInstance->BufferCount = SOUND_KERNEL_BUFFER_COUNT;
/* Provide the caller with the new instance pointer */ *SoundDeviceInstance = NewInstance;
Modified: trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmebuddy/... ============================================================================== --- trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] (original) +++ trunk/reactos/lib/drivers/sound/mmebuddy/wave/streaming.c [iso-8859-1] Fri Jul 17 11:24:11 2009 @@ -17,14 +17,6 @@
/* - Restrain ourselves from flooding the kernel device! -*/ - -#define SOUND_KERNEL_BUFFER_COUNT 10 -#define SOUND_KERNEL_BUFFER_SIZE 16384 - - -/* DoWaveStreaming Check if there is streaming to be done, and if so, do it. */ @@ -52,7 +44,7 @@ SND_ASSERT( FunctionTable->CommitWaveBuffer );
/* No point in doing anything if no resources available to use */ - if ( SoundDeviceInstance->OutstandingBuffers >= SOUND_KERNEL_BUFFER_COUNT ) + if ( SoundDeviceInstance->OutstandingBuffers >= SoundDeviceInstance->BufferCount ) { SND_TRACE(L"DoWaveStreaming: No available buffers to stream with - doing nothing\n"); return; @@ -67,7 +59,7 @@ return; }
- while ( ( SoundDeviceInstance->OutstandingBuffers < SOUND_KERNEL_BUFFER_COUNT ) && + while ( ( SoundDeviceInstance->OutstandingBuffers < SoundDeviceInstance->BufferCount ) && ( Header ) ) { HeaderExtension = (PWAVEHDR_EXTENSION) Header->reserved; @@ -98,8 +90,8 @@ BytesRemaining = Header->dwBufferLength - HeaderExtension->BytesCommitted;
/* We can commit anything up to the buffer size limit */ - BytesToCommit = BytesRemaining > SOUND_KERNEL_BUFFER_SIZE ? - SOUND_KERNEL_BUFFER_SIZE : + BytesToCommit = BytesRemaining > SoundDeviceInstance->FrameSize ? + SoundDeviceInstance->FrameSize : BytesRemaining;
/* Should always have something to commit by this point */