• <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文檔,才發(fā)現(xiàn)DirectSoundBuffer的Primary Buffer和Second Buffer還是有很大區(qū)別的,就像SetCurrentPosition函數(shù)不支持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.



                相應(yīng)代碼修改如下,用于建立新的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 閱讀(919) 評論(0)  編輯 收藏 引用 所屬分類: C++

            公告

            Using C++

            導(dǎo)航

            統(tǒng)計

            留言簿(73)

            隨筆分類(513)

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            亚洲国产成人精品女人久久久 | 精品久久久久久久| 中文字幕亚洲综合久久菠萝蜜| 久久国产精品久久| 久久电影网2021| 国产精品久久99| 亚洲成色999久久网站| 国产一区二区精品久久| 久久精品国产第一区二区三区| 国产精品久久久久久五月尺| 99久久精品免费看国产| 国产福利电影一区二区三区,免费久久久久久久精 | 久久精品卫校国产小美女| 怡红院日本一道日本久久 | 久久99精品国产99久久6男男| 欧美午夜精品久久久久免费视| 无码人妻精品一区二区三区久久久 | 精品一二三区久久aaa片| 久久www免费人成看片| 久久中文字幕人妻丝袜| 精品久久久无码21p发布| 久久亚洲AV成人出白浆无码国产| 国产午夜免费高清久久影院| 久久夜色精品国产网站| 久久青青草原国产精品免费| 88久久精品无码一区二区毛片 | 欧美午夜A∨大片久久| 99久久免费国产精品特黄| 伊人久久精品无码二区麻豆| 久久国产免费观看精品3| 久久99精品久久久久久9蜜桃 | 久久久久亚洲AV成人片| 99久久99这里只有免费的精品| 亚洲国产精久久久久久久| 亚洲国产成人精品女人久久久 | 日本福利片国产午夜久久| 久久久久女教师免费一区| 亚洲精品乱码久久久久久中文字幕 | 久久SE精品一区二区| 久久成人国产精品二三区| 亚洲国产精品无码久久九九|