• <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)

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品亚洲日本波多野结衣| 精品久久人人妻人人做精品| 久久久久高潮综合影院| 久久精品国产日本波多野结衣| 狠狠色婷婷久久综合频道日韩| 精品久久久久久久久中文字幕| 香蕉久久永久视频| 久久久无码人妻精品无码| 久久青青草原精品国产不卡| 日产精品久久久一区二区| 亚洲国产精品热久久| 香蕉久久夜色精品升级完成| 国内精品久久久久久久coent| 亚洲精品乱码久久久久久中文字幕| 99久久亚洲综合精品成人| 色播久久人人爽人人爽人人片AV| 91精品国产高清久久久久久91| 亚洲综合久久夜AV | 97久久精品人人澡人人爽| 久久亚洲精品成人av无码网站| 青草久久久国产线免观| 欧美777精品久久久久网| 久久久久久久久久久久中文字幕 | 日韩精品无码久久久久久| 18岁日韩内射颜射午夜久久成人| 久久婷婷五月综合色高清| 久久久午夜精品福利内容| 欧洲国产伦久久久久久久| 国产精品热久久毛片| 久久成人精品视频| 精品久久久久久中文字幕人妻最新| 人妻无码精品久久亚瑟影视 | 三级片免费观看久久| 97超级碰碰碰碰久久久久| 久久久国产精品福利免费| 国产精品久久久天天影视| 精品久久久噜噜噜久久久| 久久久久久久97| 久久久久夜夜夜精品国产| 99久久免费国产精品| 久久天天躁狠狠躁夜夜2020|