Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 274 of file header.c.
Referenced by CompleteIO(), and StopStreamingInSoundThread().
{ PWAVEHDR PrevHdr = NULL, CurrHdr = NULL; PWAVEHDR_EXTENSION Extension; PSOUND_DEVICE SoundDevice; MMDEVICE_TYPE DeviceType; MMRESULT Result; SND_TRACE(L"BUFFER COMPLETE :)\n"); // TODO: Set header flags? // TODO: Call client // TODO: Streaming //DoWaveStreaming(SoundDeviceInstance); Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice); SND_ASSERT( MMSUCCESS(Result) ); Result = GetSoundDeviceType(SoundDevice, &DeviceType); SND_ASSERT( MMSUCCESS(Result) ); Extension = (PWAVEHDR_EXTENSION)Header->reserved; SND_ASSERT( Extension ); /* Remove the header from the queue, like so */ if ( SoundDeviceInstance->HeadWaveHeader == Header ) { SoundDeviceInstance->HeadWaveHeader = Header->lpNext; SND_TRACE(L"Dropping head node\n"); /* If nothing after the head, then there is no tail */ if ( Header->lpNext == NULL ) { SND_TRACE(L"Dropping tail node\n"); SoundDeviceInstance->TailWaveHeader = NULL; } } else { PrevHdr = NULL; CurrHdr = SoundDeviceInstance->HeadWaveHeader; SND_TRACE(L"Relinking nodes\n"); while ( CurrHdr != Header ) { PrevHdr = CurrHdr; CurrHdr = CurrHdr->lpNext; SND_ASSERT( CurrHdr ); } SND_ASSERT( PrevHdr ); PrevHdr->lpNext = CurrHdr->lpNext; /* If this is the tail node, update the tail */ if ( Header->lpNext == NULL ) { SND_TRACE(L"Updating tail node\n"); SoundDeviceInstance->TailWaveHeader = PrevHdr; } } /* Make sure we're not using this as the current buffer any more, either! */ /* if ( SoundDeviceInstance->CurrentWaveHeader == Header ) { SoundDeviceInstance->CurrentWaveHeader = Header->lpNext; } */ DUMP_WAVEHDR_QUEUE(SoundDeviceInstance); SND_TRACE(L"Returning buffer to client...\n"); /* Update the header */ Header->dwFlags &= ~WHDR_INQUEUE; Header->dwFlags |= WHDR_DONE; if ( DeviceType == WAVE_IN_DEVICE_TYPE ) { // FIXME: We won't be called on incomplete buffer! Header->dwBytesRecorded = Extension->BytesCompleted; } /* Safe to do this without thread protection, as we're done with the header */ NotifyMmeClient(SoundDeviceInstance, DeviceType == WAVE_OUT_DEVICE_TYPE ? WOM_DONE : WIM_DATA, (DWORD_PTR)Header); }