您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DXTRACE_ERR函数代码示例

51自学网 2021-06-01 20:24:48
  C++
这篇教程C++ DXTRACE_ERR函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DXTRACE_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ DXTRACE_ERR函数的具体用法?C++ DXTRACE_ERR怎么用?C++ DXTRACE_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DXTRACE_ERR函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: OnOpenSoundFile

//.........这里部分代码省略.........    {        // Too many channels in wave.  Sound must be mono when using DSBCAPS_CTRL3D        SetDlgItemText( hDlg, IDC_STATUS, TEXT("Wave file must be mono for 3D control.") );        SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );        return;    }    if( pwfx->wFormatTag != WAVE_FORMAT_PCM )    {        // Sound must be PCM when using DSBCAPS_CTRL3D        SetDlgItemText( hDlg, IDC_STATUS, TEXT("Wave file must be PCM for 3D control.") );        SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );        return;    }    // Get the software DirectSound3D emulation algorithm to use    // Ask the user for this sample, so display the algorithm dialog box.    nResult = (int)DialogBox( NULL, MAKEINTRESOURCE(IDD_3D_ALGORITHM),                               NULL, AlgorithmDlgProc );    switch( nResult )    {    case -1: // User canceled dialog box        SetDlgItemText( hDlg, IDC_STATUS, TEXT("Load aborted.") );        SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );        return;    case 0: // User selected DS3DALG_NO_VIRTUALIZATION          guid3DAlgorithm = DS3DALG_NO_VIRTUALIZATION;        break;    case 1: // User selected DS3DALG_HRTF_FULL          guid3DAlgorithm = DS3DALG_HRTF_FULL;        break;    case 2: // User selected DS3DALG_HRTF_LIGHT        guid3DAlgorithm = DS3DALG_HRTF_LIGHT;        break;    }    // Load the wave file into a DirectSound buffer    hr = g_pSoundManager->Create( &g_pSound, strFileName, DSBCAPS_CTRL3D, guid3DAlgorithm );      if( FAILED( hr ) || hr == DS_NO_VIRTUALIZATION )    {        DXTRACE_ERR_NOMSGBOX( TEXT("Create"), hr );        if( DS_NO_VIRTUALIZATION == hr )        {            MessageBox( hDlg, "The 3D virtualization algorithm requested is not supported under this "                        "operating system.  It is available only on Windows 2000, Windows ME, and Windows 98 with WDM "                        "drivers and beyond.  Creating buffer with no virtualization.",                         "DirectSound Sample", MB_OK );        }        // Unknown error, but not a critical failure, so just update the status        SetDlgItemText( hDlg, IDC_FILENAME, TEXT("Could not create sound buffer.") );        return;     }    // Get the 3D buffer from the secondary buffer    if( FAILED( hr = g_pSound->Get3DBufferInterface( 0, &g_pDS3DBuffer ) ) )    {        DXTRACE_ERR( TEXT("Get3DBufferInterface"), hr );        SetDlgItemText( hDlg, IDC_STATUS, TEXT("Could not get 3D buffer.") );        SetDlgItemText( hDlg, IDC_FILENAME, TEXT("") );        return;    }    // Get the 3D buffer parameters    g_dsBufferParams.dwSize = sizeof(DS3DBUFFER);    g_pDS3DBuffer->GetAllParameters( &g_dsBufferParams );    // Set new 3D buffer parameters    g_dsBufferParams.dwMode = DS3DMODE_HEADRELATIVE;    g_pDS3DBuffer->SetAllParameters( &g_dsBufferParams, DS3D_IMMEDIATE );    DSBCAPS dsbcaps;    ZeroMemory( &dsbcaps, sizeof(DSBCAPS) );    dsbcaps.dwSize = sizeof(DSBCAPS);    LPDIRECTSOUNDBUFFER pDSB = g_pSound->GetBuffer( 0 );    pDSB->GetCaps( &dsbcaps );    if( ( dsbcaps.dwFlags & DSBCAPS_LOCHARDWARE ) != 0 )        SetDlgItemText( hDlg, IDC_STATUS, TEXT("File loaded using hardware mixing.") );    else        SetDlgItemText( hDlg, IDC_STATUS, TEXT("File loaded using software mixing.") );    // Update the UI controls to show the sound as the file is loaded    SetDlgItemText( hDlg, IDC_FILENAME, strFileName );    EnablePlayUI( hDlg, TRUE );    g_bAllowMovementTimer = TRUE;    // Remember the path for next time    strcpy( strPath, strFileName );    char* strLastSlash = strrchr( strPath, '//' );    strLastSlash[0] = '/0';    // Set the slider positions    SetSlidersPos( hDlg, 0.0f, 0.0f, ORBIT_MAX_RADIUS, ORBIT_MAX_RADIUS*2.0f );    OnSliderChanged( hDlg );}
开发者ID:grakidov,项目名称:Render3D,代码行数:101,


示例2: OnPlaySound

//-----------------------------------------------------------------------------// Name: OnPlaySound()// Desc: User hit the "Play" button//-----------------------------------------------------------------------------HRESULT OnPlaySound( HWND hDlg ) {    HRESULT                 hr;    DWORD                   dwCreationFlags;    DWORD                   dwResults;    LPDIRECTSOUNDBUFFER  pDSB = NULL;    LPDIRECTSOUNDBUFFER8 pDSB8 = NULL;    BOOL bLooped        = ( IsDlgButtonChecked( hDlg, IDC_LOOP_CHECK )     == BST_CHECKED );    // We would only use CTRLFX control on dsound buffer    dwCreationFlags = DSBCAPS_CTRLFX;    // Free any previous sound and FXs    SAFE_RELEASE( g_pIGargle );    SAFE_DELETE( g_pSound );    // Since the user can change the focus before the sound is played,     // we need to create the sound buffer every time the play button is pressed     // Load the wave file into a DirectSound buffer    if( FAILED( hr = g_pSoundManager->Create( &g_pSound, g_strWaveFileName, dwCreationFlags, GUID_NULL ) ) )    {        // Not a critical failure, so just update the status        DXTRACE_ERR_NOMSGBOX( TEXT("Create"), hr );        if( hr == DSERR_BUFFERTOOSMALL )        {            // DSERR_BUFFERTOOSMALL will be returned if the buffer is            // less than DSBSIZE_FX_MIN (100ms) and the buffer is created            // with DSBCAPS_CTRLFX.                                       SetDlgItemText( hDlg, IDC_STATUS, TEXT("Wave file is too short (less than 100ms) for effect processing.") );        }        else        {            SetDlgItemText( hDlg, IDC_STATUS, TEXT("Could not create sound buffer.") );        }                return S_FALSE;     }    // Query IDirectSoundBuffer8 interface    pDSB = g_pSound->GetBuffer( 0 );    if( FAILED( hr = pDSB->QueryInterface( IID_IDirectSoundBuffer8, (LPVOID*) &pDSB8 ) ) )        return DXTRACE_ERR( TEXT("QueryInterface"), hr );    // Set gargle effect on the IDirectSoundBuffer8    DSEFFECTDESC dsed;    ZeroMemory( &dsed, sizeof(DSEFFECTDESC) );    dsed.dwSize       = sizeof(DSEFFECTDESC);    dsed.dwFlags      = 0;    dsed.guidDSFXClass = GUID_DSFX_STANDARD_GARGLE;    if( FAILED( hr = pDSB8->SetFX( 1, &dsed, &dwResults ) ) )    {        // Not a critical failure, so just update the status        DXTRACE_ERR( TEXT("SetFX"), hr );        SetDlgItemText( hDlg, IDC_STATUS, TEXT("Could not set gargle effect.") );        return S_FALSE;    }    // Get gargle effect friendly interface    if( FAILED( hr = pDSB8->GetObjectInPath( GUID_DSFX_STANDARD_GARGLE, 0,                                              IID_IDirectSoundFXGargle,                                              (LPVOID*) &g_pIGargle ) ) )        return DXTRACE_ERR( TEXT("GetObjectInPath"), hr );    // Cleanup    SAFE_RELEASE( pDSB8 );    // Set the buffer options to what the sliders are set to    OnEffectChanged( hDlg );    // Play the sound    DWORD dwLooped = bLooped ? DSBPLAY_LOOPING : 0L;    if( FAILED( hr = g_pSound->Play( 0, dwLooped ) ) )        return DXTRACE_ERR( TEXT("Play"), hr );    // Update the UI controls to show the sound as playing    EnablePlayUI( hDlg, FALSE );    SetDlgItemText( hDlg, IDC_STATUS, TEXT("Sound playing.") );    return S_OK;}
开发者ID:grakidov,项目名称:Render3D,代码行数:88,


示例3: SAFE_DELETE_ARRAY

//-----------------------------------------------------------------------------// Name: CWaveFile::Open()// Desc: Opens a wave file for reading//-----------------------------------------------------------------------------HRESULT CWaveFile::Open( LPTSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags ){    HRESULT hr;    m_dwFlags = dwFlags;    m_bIsReadingFromMemory = FALSE;    if( m_dwFlags == WAVEFILE_READ )    {        if( strFileName == NULL )            return E_INVALIDARG;        SAFE_DELETE_ARRAY( m_pwfx );        m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF | MMIO_READ );        if( NULL == m_hmmio )        {            HRSRC   hResInfo;            HGLOBAL hResData;            DWORD   dwSize;            VOID*   pvRes;            // Loading it as a file failed, so try it as a resource            if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAVE") ) ) )            {                if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAV") ) ) )                    return DXTRACE_ERR( TEXT("FindResource"), E_FAIL );            }            if( NULL == ( hResData = LoadResource( NULL, hResInfo ) ) )                return DXTRACE_ERR( TEXT("LoadResource"), E_FAIL );            if( 0 == ( dwSize = SizeofResource( NULL, hResInfo ) ) )                 return DXTRACE_ERR( TEXT("SizeofResource"), E_FAIL );            if( NULL == ( pvRes = LockResource( hResData ) ) )                return DXTRACE_ERR( TEXT("LockResource"), E_FAIL );            m_pResourceBuffer = new CHAR[ dwSize ];            memcpy( m_pResourceBuffer, pvRes, dwSize );            MMIOINFO mmioInfo;            ZeroMemory( &mmioInfo, sizeof(mmioInfo) );            mmioInfo.fccIOProc = FOURCC_MEM;            mmioInfo.cchBuffer = dwSize;            mmioInfo.pchBuffer = (CHAR*) m_pResourceBuffer;            m_hmmio = mmioOpen( NULL, &mmioInfo, MMIO_ALLOCBUF | MMIO_READ );        }        if( FAILED( hr = ReadMMIO() ) )        {            // ReadMMIO will fail if its an not a wave file            mmioClose( m_hmmio, 0 );            return DXTRACE_ERR( TEXT("ReadMMIO"), hr );        }        if( FAILED( hr = ResetFile() ) )            return DXTRACE_ERR( TEXT("ResetFile"), hr );        // After the reset, the size of the wav file is m_ck.cksize so store it now        m_dwSize = m_ck.cksize;    }    else    {        m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF  |                                                   MMIO_READWRITE |                                                   MMIO_CREATE );        if( NULL == m_hmmio )            return DXTRACE_ERR( TEXT("mmioOpen"), E_FAIL );        if( FAILED( hr = WriteMMIO( pwfx ) ) )        {            mmioClose( m_hmmio, 0 );            return DXTRACE_ERR( TEXT("WriteMMIO"), hr );        }                                if( FAILED( hr = ResetFile() ) )            return DXTRACE_ERR( TEXT("ResetFile"), hr );    }    return hr;}
开发者ID:ChetRippo,项目名称:SuperSnapeBox,代码行数:87,


示例4: CopyMemory

//-----------------------------------------------------------------------------// Name: CWaveFile::Read()// Desc: Reads section of data from a wave file into pBuffer and returns //       how much read in pdwSizeRead, reading not more than dwSizeToRead.//       This uses m_ck to determine where to start reading from.  So //       subsequent calls will be continue where the last left off unless //       Reset() is called.//-----------------------------------------------------------------------------HRESULT CWaveFile::Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead ){    if( m_bIsReadingFromMemory )    {        if( m_pbDataCur == NULL )            return CO_E_NOTINITIALIZED;        if( pdwSizeRead != NULL )            *pdwSizeRead = 0;        if( (BYTE*)(m_pbDataCur + dwSizeToRead) >             (BYTE*)(m_pbData + m_ulDataSize) )        {            dwSizeToRead = m_ulDataSize - (DWORD)(m_pbDataCur - m_pbData);        }                CopyMemory( pBuffer, m_pbDataCur, dwSizeToRead );                if( pdwSizeRead != NULL )            *pdwSizeRead = dwSizeToRead;        return S_OK;    }    else     {        MMIOINFO mmioinfoIn; // current status of m_hmmio        if( m_hmmio == NULL )            return CO_E_NOTINITIALIZED;        if( pBuffer == NULL || pdwSizeRead == NULL )            return E_INVALIDARG;        if( pdwSizeRead != NULL )            *pdwSizeRead = 0;        if( 0 != mmioGetInfo( m_hmmio, &mmioinfoIn, 0 ) )            return DXTRACE_ERR( TEXT("mmioGetInfo"), E_FAIL );                        UINT cbDataIn = dwSizeToRead;        if( cbDataIn > m_ck.cksize )             cbDataIn = m_ck.cksize;               m_ck.cksize -= cbDataIn;            for( DWORD cT = 0; cT < cbDataIn; cT++ )        {            // Copy the bytes from the io to the buffer.            if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead )            {                if( 0 != mmioAdvance( m_hmmio, &mmioinfoIn, MMIO_READ ) )                    return DXTRACE_ERR( TEXT("mmioAdvance"), E_FAIL );                if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead )                    return DXTRACE_ERR( TEXT("mmioinfoIn.pchNext"), E_FAIL );            }            // Actual copy.            *((BYTE*)pBuffer+cT) = *((BYTE*)mmioinfoIn.pchNext);            mmioinfoIn.pchNext++;        }        if( 0 != mmioSetInfo( m_hmmio, &mmioinfoIn, 0 ) )            return DXTRACE_ERR( TEXT("mmioSetInfo"), E_FAIL );        if( pdwSizeRead != NULL )            *pdwSizeRead = cbDataIn;        return S_OK;    }}
开发者ID:ChetRippo,项目名称:SuperSnapeBox,代码行数:77,


示例5: warning

//-----------------------------------------------------------------------------// Name: CWaveFile::Read()// Desc: Reads section of data from a wave file into pBuffer and returns//       how much read in pdwSizeRead, reading not more than dwSizeToRead.//       This uses m_ck to determine where to start reading from.  So//       subsequent calls will be continue where the last left off unless//       Reset() is called.//-----------------------------------------------------------------------------HRESULT CWaveFile::Read( BYTE* pBuffer, DWORD dwSizeToRead, DWORD* pdwSizeRead ){    if( m_bIsReadingFromMemory )    {        if( m_pbDataCur == NULL )            return CO_E_NOTINITIALIZED;        if( pdwSizeRead != NULL )            *pdwSizeRead = 0;        if( (BYTE*)(m_pbDataCur + dwSizeToRead) >            (BYTE*)(m_pbData + m_ulDataSize) )        {            dwSizeToRead = m_ulDataSize - (DWORD)(m_pbDataCur - m_pbData);        }#pragma warning( disable: 4616 )    // disable warning about warning number '22104' being out of range#pragma warning( disable: 22104 )   // disable PREfast warning during static code analysis        CopyMemory( pBuffer, m_pbDataCur, dwSizeToRead );#pragma warning( default: 22104 )#pragma warning( default: 4616 )        if( pdwSizeRead != NULL )            *pdwSizeRead = dwSizeToRead;        return S_OK;    }    else    {        MMIOINFO mmioinfoIn; // current status of m_hmmio        if( m_hmmio == NULL )            return CO_E_NOTINITIALIZED;        if( pBuffer == NULL || pdwSizeRead == NULL )            return E_INVALIDARG;        *pdwSizeRead = 0;        if( 0 != mmioGetInfo( m_hmmio, &mmioinfoIn, 0 ) )            return DXTRACE_ERR( "mmioGetInfo", E_FAIL );        UINT cbDataIn = dwSizeToRead;        if( cbDataIn > m_ck.cksize )            cbDataIn = m_ck.cksize;        m_ck.cksize -= cbDataIn;        for( DWORD cT = 0; cT < cbDataIn; cT++ )        {            // Copy the bytes from the io to the buffer.            if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead )            {                if( 0 != mmioAdvance( m_hmmio, &mmioinfoIn, MMIO_READ ) )                    return DXTRACE_ERR( "mmioAdvance", E_FAIL );                if( mmioinfoIn.pchNext == mmioinfoIn.pchEndRead )                    return DXTRACE_ERR( "mmioinfoIn.pchNext", E_FAIL );            }            // Actual copy.            *((BYTE*)pBuffer+cT) = *((BYTE*)mmioinfoIn.pchNext);            mmioinfoIn.pchNext++;        }        if( 0 != mmioSetInfo( m_hmmio, &mmioinfoIn, 0 ) )            return DXTRACE_ERR( "mmioSetInfo", E_FAIL );        *pdwSizeRead = cbDataIn;        return S_OK;    }}
开发者ID:WhaleCurrent,项目名称:Projektet,代码行数:79,


示例6: CWaveFile

//-----------------------------------------------------------------------------// Name: CSoundManager::Create()// Desc: //-----------------------------------------------------------------------------HRESULT CSoundManager::Create( CSound** ppSound,                                LPTSTR strWaveFileName,                                DWORD dwCreationFlags,                                GUID guid3DAlgorithm,                               DWORD dwNumBuffers ){    HRESULT hr;    HRESULT hrRet = S_OK;    DWORD   i;    LPDIRECTSOUNDBUFFER* apDSBuffer     = NULL;    DWORD                dwDSBufferSize = NULL;    CWaveFile*           pWaveFile      = NULL;    if( m_pDS == NULL )        return CO_E_NOTINITIALIZED;    if( strWaveFileName == NULL || ppSound == NULL || dwNumBuffers < 1 )        return E_INVALIDARG;    apDSBuffer = new LPDIRECTSOUNDBUFFER[dwNumBuffers];    if( apDSBuffer == NULL )    {        hr = E_OUTOFMEMORY;        goto LFail;    }    pWaveFile = new CWaveFile();    if( pWaveFile == NULL )    {        hr = E_OUTOFMEMORY;        goto LFail;    }    pWaveFile->Open( strWaveFileName, NULL, WAVEFILE_READ );    if( pWaveFile->GetSize() == 0 )    {        // Wave is blank, so don't create it.        hr = E_FAIL;        goto LFail;    }    // Make the DirectSound buffer the same size as the wav file    dwDSBufferSize = pWaveFile->GetSize();    // Create the direct sound buffer, and only request the flags needed    // since each requires some overhead and limits if the buffer can     // be hardware accelerated    DSBUFFERDESC dsbd;    ZeroMemory( &dsbd, sizeof(DSBUFFERDESC) );    dsbd.dwSize          = sizeof(DSBUFFERDESC);    dsbd.dwFlags         = dwCreationFlags;    dsbd.dwBufferBytes   = dwDSBufferSize;    dsbd.guid3DAlgorithm = guid3DAlgorithm;    dsbd.lpwfxFormat     = pWaveFile->m_pwfx;        // DirectSound is only guarenteed to play PCM data.  Other    // formats may or may not work depending the sound card driver.    hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer[0], NULL );    // Be sure to return this error code if it occurs so the    // callers knows this happened.    if( hr == DS_NO_VIRTUALIZATION )        hrRet = DS_NO_VIRTUALIZATION;                if( FAILED(hr) )    {        // DSERR_BUFFERTOOSMALL will be returned if the buffer is        // less than DSBSIZE_FX_MIN and the buffer is created        // with DSBCAPS_CTRLFX.                // It might also fail if hardware buffer mixing was requested        // on a device that doesn't support it.        DXTRACE_ERR( TEXT("CreateSoundBuffer"), hr );                            goto LFail;    }    // Default to use DuplicateSoundBuffer() when created extra buffers since always     // create a buffer that uses the same memory however DuplicateSoundBuffer() will fail if     // DSBCAPS_CTRLFX is used, so use CreateSoundBuffer() instead in this case.    if( (dwCreationFlags & DSBCAPS_CTRLFX) == 0 )    {        for( i=1; i<dwNumBuffers; i++ )        {            if( FAILED( hr = m_pDS->DuplicateSoundBuffer( apDSBuffer[0], &apDSBuffer[i] ) ) )            {                DXTRACE_ERR( TEXT("DuplicateSoundBuffer"), hr );                goto LFail;            }        }    }    else    {        for( i=1; i<dwNumBuffers; i++ )        {            hr = m_pDS->CreateSoundBuffer( &dsbd, &apDSBuffer[i], NULL );//.........这里部分代码省略.........
开发者ID:ChetRippo,项目名称:SuperSnapeBox,代码行数:101,


示例7: Render

/*--------------------------------------------	画面の描画
C++ DYNAMIC_CAST函数代码示例
C++ DXCall函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。