本文整理汇总了C++中LPDIRECTSOUND3DLISTENER::CommitDeferredSettings方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECTSOUND3DLISTENER::CommitDeferredSettings方法的具体用法?C++ LPDIRECTSOUND3DLISTENER::CommitDeferredSettings怎么用?C++ LPDIRECTSOUND3DLISTENER::CommitDeferredSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECTSOUND3DLISTENER
的用法示例。
在下文中一共展示了LPDIRECTSOUND3DLISTENER::CommitDeferredSettings方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Render
static void RLXAPI Render(void)
{
HRESULT hr;
if (g_lpDS3DListener)
{
hr = SYS_DXTRACE(g_lpDS3DListener->CommitDeferredSettings());
}
}
示例2: ds3d_update_listener
// ---------------------------------------------------------------------------------------
// ds3d_update_listener()
//
// returns: 0 => success
// -1 => failure
//
int ds3d_update_listener(vector *pos, vector *vel, matrix *orient)
{
HRESULT hr;
if (DS3D_inited == FALSE)
return 0;
if ( pDS3D_listener == NULL )
return -1;
// set the listener position
if ( pos != NULL ) {
hr = pDS3D_listener->SetPosition(pos->x, pos->y, pos->z, DS3D_DEFERRED);
}
// set the listener veclocity
if ( vel != NULL ) {
hr = pDS3D_listener->SetVelocity(vel->x, vel->y, vel->z, DS3D_DEFERRED);
}
if ( orient != NULL ) {
hr = pDS3D_listener->SetOrientation( orient->fvec.x, orient->fvec.y, orient->fvec.z,
orient->uvec.x, orient->uvec.y, orient->uvec.z,
DS3D_DEFERRED );
}
float rolloff_factor = 1.0f;
if (ds_using_a3d() == true) {
rolloff_factor = 3.0f; // A3D rolloff
} else {
rolloff_factor = 3.0f; // EAX rolloff
}
hr = pDS3D_listener->SetRolloffFactor( rolloff_factor, DS3D_DEFERRED );
hr = pDS3D_listener->SetDopplerFactor( 1.0f, DS3D_DEFERRED );
hr = pDS3D_listener->CommitDeferredSettings();
if ( hr != DS_OK ) {
nprintf(("SOUND","Error in pDS3D_listener->CommitDeferredSettings(): %s\n", get_DSERR_text(hr) ));
return -1;
}
return 0;
}
示例3: DS_Listener
//===========================================================================
// DS_Listener
// SFXLP_UNITS_PER_METER
// SFXLP_DOPPLER
// SFXLP_UPDATE
//===========================================================================
void DS_Listener(int property, float value)
{
if(!dsListener) return;
switch(property)
{
case SFXLP_UPDATE:
// Commit any deferred settings.
dsListener->CommitDeferredSettings();
EAXCommitDeferred();
break;
case SFXLP_UNITS_PER_METER:
dsListener->SetDistanceFactor(1/value, DS3D_IMMEDIATE);
break;
case SFXLP_DOPPLER:
dsListener->SetDopplerFactor(value, DS3D_IMMEDIATE);
break;
}
}
示例4: MainDlgProc
//-----------------------------------------------------------------------------
// Name: MainDlgProc()
// Desc: Handles dialog messages
//-----------------------------------------------------------------------------
INT_PTR CALLBACK MainDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
HRESULT hr;
switch( msg )
{
case WM_INITDIALOG:
OnInitDialog( hDlg );
break;
case WM_COMMAND:
switch( LOWORD(wParam) )
{
case IDC_SOUNDFILE:
OnOpenSoundFile( hDlg );
break;
case IDCANCEL:
EndDialog( hDlg, IDCANCEL );
break;
case IDC_PLAY:
if( FAILED( hr = OnPlaySound( hDlg ) ) )
{
DXTRACE_ERR( TEXT("OnPlaySound"), hr );
MessageBox( hDlg, "Error playing DirectSound buffer."
"Sample will now exit.", "DirectSound Sample",
MB_OK | MB_ICONERROR );
EndDialog( hDlg, IDABORT );
}
break;
case IDC_STOP:
if( g_pSound )
{
g_pSound->Stop();
g_pSound->Reset();
}
// Update the UI controls to show the sound as stopped
EnablePlayUI( hDlg, TRUE );
SetDlgItemText( hDlg, IDC_STATUS, TEXT("Sound stopped.") );
break;
case IDC_DEFER:
g_bDeferSettings = !g_bDeferSettings;
OnSliderChanged( hDlg );
break;
case IDC_APPLY:
// Call the IDirectSound3DListener::CommitDeferredSettings
// method to execute all of the deferred commands at once.
// This is many times more efficent than recomputing everything
// for every call.
if( g_pDSListener )
g_pDSListener->CommitDeferredSettings();
break;
default:
return FALSE; // Didn't handle message
}
break;
case WM_TIMER:
if( wParam == IDT_MOVEMENT_TIMER )
OnMovementTimer( hDlg );
break;
case WM_NOTIFY:
OnSliderChanged( hDlg );
break;
case WM_DESTROY:
// Cleanup everything
KillTimer( hDlg, 1 );
SAFE_RELEASE( g_pDSListener );
SAFE_RELEASE( g_pDS3DBuffer );
SAFE_DELETE( g_pSound );
SAFE_DELETE( g_pSoundManager );
break;
default:
return FALSE; // Didn't handle message
}
return TRUE; // Handled message
}