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

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            国产精品久久新婚兰兰| 国产精品久久久久9999| 2021国内久久精品| 人妻无码久久一区二区三区免费 | 精品久久久久久中文字幕| 亚洲∧v久久久无码精品| 亚洲国产精品久久66| 久久久无码精品午夜| 久久精品国产亚洲AV麻豆网站 | 日本三级久久网| 久久久久久午夜精品| www.久久精品| 无码八A片人妻少妇久久| 女人香蕉久久**毛片精品| 久久精品免费一区二区| 国产香蕉97碰碰久久人人| 精品国产乱码久久久久软件| 国内精品欧美久久精品| 日韩人妻无码一区二区三区久久| 精品久久久久久国产免费了| 国产Av激情久久无码天堂| 久久婷婷五月综合国产尤物app | 精品久久人人爽天天玩人人妻| 久久国产精品-国产精品| 久久精品一本到99热免费| 欧美国产成人久久精品| 成人午夜精品久久久久久久小说 | 伊人久久大香线蕉综合Av| 久久影视综合亚洲| 久久国产视频网| 国产精品无码久久四虎| 9久久9久久精品| 久久91亚洲人成电影网站| 久久婷婷五月综合色高清| 久久精品日日躁夜夜躁欧美| 狠狠色婷婷久久一区二区| 97精品依人久久久大香线蕉97| 2020久久精品亚洲热综合一本| 久久亚洲AV无码精品色午夜麻豆| 久久www免费人成看国产片| 国内精品久久久久久中文字幕|