Пример #1
0
/// The DuplicateSoundBuffer method creates a new secondary buffer that shares the original buffer's memory.
/// pDSBufferOriginal - Address of the IDirectSoundBuffer or IDirectSoundBuffer8 interface of the buffer to duplicate.
/// ppDSBufferDuplicate - Address of a variable that receives the IDirectSoundBuffer interface pointer for the new buffer.
HRESULT __stdcall MyDirectSound::DuplicateSoundBuffer(THIS_ __in LPDIRECTSOUNDBUFFER pDSBufferOriginal, __deref_out LPDIRECTSOUNDBUFFER *ppDSBufferDuplicate)
{
#if 0//USE_SOUND_BUFFER_PROXY
	IDirectSoundBuffer* pDSBufferDuplicate = NULL;
	V_RET(m_pDSound->DuplicateSoundBuffer(pDSBufferOriginal, pDSBufferDuplicate));

	const int soundBufferId = m_nextSoundBufferId++;
	MyDirectSoundBuffer* pOriginal = static_cast< MyDirectSoundBuffer* >( pDSBufferOriginal );
	MyDirectSoundBuffer* pDuplicate = new MyDirectSoundBuffer( pcDSBufferDesc, pDSBuffer, this, soundBufferId );
	M_TRACE("DuplicateSoundBuffer(): %d -> %d (%d bytes)\n", soundBufferId, pOriginal->dwBufferBytes);
	return DS_OK;
#else
	M_TRACE_FREQUENT_FUNCTION;
	return m_pDSound->DuplicateSoundBuffer(pDSBufferOriginal, ppDSBufferDuplicate);
#endif
}
Пример #2
0
bool GLWidget::OnResize( WPARAM wParam, LPARAM lParam )
{
	V_RET( this->MakeCurrent() );

	int width = LOWORD(lParam);
	int height = HIWORD(lParam);

	glViewport( 0, 0, width, height );

	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	int right = width/2;
	int left = -right;
	int bottom = height/2;
	int top = - bottom;
	glOrtho( left, right, bottom, top, -100, 100 );

	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();	
	
	return false;
}
Пример #3
0
/// The CreateSoundBuffer method creates a sound buffer object to manage audio samples. 
HRESULT __stdcall MyDirectSound::CreateSoundBuffer(THIS_ __in LPCDSBUFFERDESC pcDSBufferDesc, __deref_out LPDIRECTSOUNDBUFFER *ppDSBuffer, __null LPUNKNOWN pUnkOuter)
{
	M_ASSERT(pUnkOuter == NULL);
	// dwBufferBytes - Size of the new buffer, in bytes.
	// This value must be 0 when creating a buffer with the DSBCAPS_PRIMARYBUFFER flag.
	// For secondary buffers, the minimum and maximum sizes allowed are specified by DSBSIZE_MIN and DSBSIZE_MAX, defined in Dsound.h.
	const int soundBufferId = m_nextSoundBufferId++;
	M_TRACE("CreateSoundBuffer(): id = %d, dwBufferBytes = %d\n", soundBufferId, pcDSBufferDesc->dwBufferBytes);

#if USE_SOUND_BUFFER_PROXY

	IDirectSoundBuffer* pDSBuffer = NULL;
	V_RET(m_pDSound->CreateSoundBuffer(pcDSBufferDesc, &pDSBuffer, pUnkOuter));

	*ppDSBuffer = new MyDirectSoundBuffer( pcDSBufferDesc, pDSBuffer, this, soundBufferId );
	return DS_OK;

#else

	return m_pDSound->CreateSoundBuffer(pcDSBufferDesc, ppDSBuffer, pUnkOuter);

#endif
}