• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Codejie's C++ Space

            Using C++

            DSound的更新,以支持SetCurrentPosition功能

                查看了DirectSound的MSDN文檔,才發現DirectSoundBuffer的Primary Buffer和Second Buffer還是有很大區別的,就像SetCurrentPosition函數不支持Primary Buffer。
                這里是MSDN上的說明:
            IDirectSoundBuffer8::SetCurrentPosition

            IDirectSoundBuffer8::SetCurrentPosition

            The SetCurrentPosition method sets the position of the play cursor, which is the point at which the next byte of data is read from the buffer.

            HRESULT SetCurrentPosition(
            DWORD dwNewPosition
            );

            Parameters

            dwNewPosition
            Offset of the play cursor, in bytes, from the beginning of the buffer.

            Return Values

            If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:

            Return code
            DSERR_INVALIDCALL
            DSERR_INVALIDPARAM
            DSERR_PRIOLEVELNEEDED

            Remarks

            This method cannot be called on the primary buffer.

            If the buffer is playing, the cursor immediately moves to the new position and play continues from that point. If it is not playing, playback will begin from the new position the next time the Play method is called.



                相應代碼修改如下,用于建立新的DirectSoundBuffer8對象。
             1 int CDSoundObject::CreateDSoundBuffer()
             2 {
             3     IDirectSoundBuffer* psbuffer = NULL;
             4 
             5     DSBUFFERDESC desc;
             6     memset(&desc, 0sizeof(DSBUFFERDESC));
             7     desc.dwSize = sizeof(DSBUFFERDESC);
             8     desc.dwFlags = DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_LOCSOFTWARE;
             9     desc.dwBufferBytes = CDSoundObject::SIZE_DS_BUFFER;//header.data_size;
            10     desc.lpwfxFormat = &_fmtWave;
            11 
            12     if(_pDSBuffer != NULL)
            13         _pDSBuffer->Release();
            14 
            15     HRESULT hr = _pDS->CreateSoundBuffer(&desc, &psbuffer, NULL);
            16     if(hr != DS_OK)
            17         return -1;
            18     hr = psbuffer->QueryInterface(IID_IDirectSoundBuffer8, (void**)&_pDSBuffer);
            19     psbuffer->Release();
            20     if(hr != DS_OK)
            21         return -1;
            22 
            23     return 0;
            24 }


            posted on 2009-03-27 10:10 codejie 閱讀(925) 評論(0)  編輯 收藏 引用 所屬分類: C++

            公告

            Using C++

            導航

            統計

            留言簿(73)

            隨筆分類(513)

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            国产叼嘿久久精品久久| 久久中文字幕人妻丝袜| 久久亚洲私人国产精品vA| 色婷婷久久综合中文久久一本| 久久久国产精品网站| 国产巨作麻豆欧美亚洲综合久久| 久久亚洲精品中文字幕三区| 亚洲国产精品婷婷久久| 国产高清国内精品福利99久久| 久久精品国产91久久麻豆自制| 久久精品国产69国产精品亚洲| 国内精品久久久久国产盗摄| 久久久久香蕉视频| 欧美伊人久久大香线蕉综合 | 久久人人爽人人爽人人爽| 国产偷久久久精品专区| 久久久久国产精品熟女影院| 丰满少妇人妻久久久久久| 亚洲国产成人久久精品影视| 久久精品国产亚洲一区二区三区| 性做久久久久久久久| 久久久久久久97| 久久精品国产一区二区三区不卡| 无码任你躁久久久久久老妇App| 色偷偷久久一区二区三区| 欧美综合天天夜夜久久| 久久综合色区| 精品久久久久久无码中文字幕一区 | 久久综合久久综合久久综合| 久久精品国产亚洲Aⅴ香蕉| 亚洲中文精品久久久久久不卡| 亚洲国产精品久久久久网站| 久久久国产精华液| 久久精品中文字幕有码| 久久青青草原亚洲av无码app| 久久综合伊人77777| 丰满少妇高潮惨叫久久久| 一本色道久久综合| 国产真实乱对白精彩久久| 亚洲AV日韩精品久久久久| 人人狠狠综合88综合久久|