- 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

svn path=/trunk/; revision=41996
This commit is contained in:
Johannes Anderwald 2009-07-17 09:24:11 +00:00
parent 4e4807dd53
commit 3e07d5777f
2 changed files with 16 additions and 12 deletions

View file

@ -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)
@ -27,6 +34,11 @@ AllocateSoundDeviceInstance(
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;

View file

@ -16,14 +16,6 @@
#include <sndtypes.h>
/*
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 @@ DoWaveStreaming(
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 @@ DoWaveStreaming(
return;
}
while ( ( SoundDeviceInstance->OutstandingBuffers < SOUND_KERNEL_BUFFER_COUNT ) &&
while ( ( SoundDeviceInstance->OutstandingBuffers < SoundDeviceInstance->BufferCount ) &&
( Header ) )
{
HeaderExtension = (PWAVEHDR_EXTENSION) Header->reserved;
@ -98,8 +90,8 @@ DoWaveStreaming(
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 */