- Implement retrieving position

svn path=/trunk/; revision=41899
This commit is contained in:
Johannes Anderwald 2009-07-11 23:21:09 +00:00
parent dec6dd70e3
commit 85cde828b2
3 changed files with 47 additions and 2 deletions

View file

@ -121,7 +121,7 @@ MmeOpenWaveDevice(
if ( ! MMSUCCESS(Result) )
return TranslateInternalMmResult(Result);
Result = SetWaveDeviceFormat(SoundDeviceInstance, Format, sizeof(WAVEFORMATEX));
Result = SetWaveDeviceFormat(SoundDeviceInstance, DeviceId, Format, sizeof(WAVEFORMATEX));
if ( ! MMSUCCESS(Result) )
{
/* TODO: Destroy sound instance */
@ -204,3 +204,46 @@ MmeResetWavePlayback(
return StopStreaming(SoundDeviceInstance);
}
MMRESULT
MmeGetPosition(
IN MMDEVICE_TYPE DeviceType,
IN DWORD DeviceId,
IN DWORD PrivateHandle,
IN MMTIME* Time,
IN DWORD Size)
{
MMRESULT Result;
PSOUND_DEVICE_INSTANCE SoundDeviceInstance;
PSOUND_DEVICE SoundDevice;
PMMFUNCTION_TABLE FunctionTable;
VALIDATE_MMSYS_PARAMETER( PrivateHandle );
SoundDeviceInstance = (PSOUND_DEVICE_INSTANCE) PrivateHandle;
if ( ! IsValidSoundDeviceInstance(SoundDeviceInstance) )
return MMSYSERR_INVALHANDLE;
Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
if ( ! MMSUCCESS(Result) )
return TranslateInternalMmResult(Result);
if ( Size != sizeof(MMTIME) )
return MMSYSERR_INVALPARAM;
Result = GetSoundDeviceFunctionTable(SoundDevice, &FunctionTable);
if ( ! MMSUCCESS(Result) )
return TranslateInternalMmResult(Result);
if ( FunctionTable->GetPos == NULL )
{
/* This indicates bad practice, really! If you can open, why not close?! */
return MMSYSERR_NOTSUPPORTED;
}
/* Call the driver */
Result = FunctionTable->GetPos(SoundDeviceInstance, Time);
return Result;
}

View file

@ -53,6 +53,7 @@ QueryWaveDeviceFormatSupport(
MMRESULT
SetWaveDeviceFormat(
IN PSOUND_DEVICE_INSTANCE SoundDeviceInstance,
IN DWORD DeviceId,
IN LPWAVEFORMATEX Format,
IN DWORD FormatSize)
{
@ -87,5 +88,5 @@ SetWaveDeviceFormat(
if ( ! FunctionTable->SetWaveFormat )
return MMSYSERR_NOTSUPPORTED;
return FunctionTable->SetWaveFormat(SoundDeviceInstance, Format, FormatSize);
return FunctionTable->SetWaveFormat(SoundDeviceInstance, DeviceId, Format, FormatSize);
}

View file

@ -113,6 +113,7 @@ wodMessage(
case WODM_GETPOS :
{
Result = MmeGetPosition(WAVE_OUT_DEVICE_TYPE, DeviceId, PrivateHandle, (MMTIME*)Parameter1, Parameter2);
break;
}
}