• <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上的說(shuō)明:
            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對(duì)象。
             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 閱讀(926) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): C++

            公告

            Using C++

            導(dǎo)航

            統(tǒng)計(jì)

            留言簿(73)

            隨筆分類(lèi)(513)

            積分與排名

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            曰曰摸天天摸人人看久久久| 午夜精品久久久久成人| 国内精品久久久久伊人av| 国产精品久久久久天天影视| 18岁日韩内射颜射午夜久久成人| 欧美亚洲另类久久综合婷婷| 久久久久亚洲AV无码麻豆| 国产精品99久久精品爆乳| 亚洲色欲久久久综合网| 久久久亚洲精品蜜桃臀| 久久99精品久久久久子伦| 色青青草原桃花久久综合| 夜夜亚洲天天久久| 久久人爽人人爽人人片AV| 亚洲精品午夜国产va久久| 99久久精品免费国产大片| 久久久久亚洲av无码专区 | 99久久国产热无码精品免费 | 久久福利青草精品资源站| 亚洲午夜无码AV毛片久久| 97久久精品人人做人人爽| 久久精品国产99久久无毒不卡 | 久久99精品久久久久久噜噜| 97久久久精品综合88久久| 天堂久久天堂AV色综合| 精品综合久久久久久97| 99久久综合国产精品免费| 久久婷婷色香五月综合激情| 国内精品久久久久久中文字幕 | 久久综合狠狠综合久久| 久久夜色精品国产亚洲| 久久亚洲日韩看片无码| 久久久久高潮综合影院| 无码AV中文字幕久久专区| 久久亚洲AV成人无码电影| 无码AV中文字幕久久专区| 久久久久成人精品无码中文字幕 | 天天综合久久一二三区| 大香伊人久久精品一区二区| 亚洲午夜久久久影院伊人| 亚洲AV无码久久精品色欲|