• <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)論排行榜

            久久国产精品免费一区二区三区| 国产午夜福利精品久久| 亚洲精品国精品久久99热一| 久久久久久亚洲精品成人| 久久久久国产精品| 久久天天躁狠狠躁夜夜2020一| 97精品久久天干天天天按摩 | 国内精品久久久久影院老司 | 91久久精品电影| 久久受www免费人成_看片中文| 国产精品无码久久久久久| 久久久精品视频免费观看| 久久久久亚洲精品中文字幕| 一本综合久久国产二区| 久久经典免费视频| 久久er国产精品免费观看2| 日韩va亚洲va欧美va久久| 久久超碰97人人做人人爱| 久久国产视频99电影| 青青国产成人久久91网| 亚洲AV无一区二区三区久久| 亚洲精品视频久久久| 久久久久久久国产免费看| 亚洲狠狠久久综合一区77777 | 精品久久久久久国产牛牛app| 国产偷久久久精品专区| 久久夜色撩人精品国产| 精品国产热久久久福利| 国产精品99久久久久久猫咪| 久久国产精品-国产精品| 久久99国产精品尤物| 精品久久一区二区| 99久久99这里只有免费费精品| 少妇人妻综合久久中文字幕| 一级做a爰片久久毛片毛片| 性做久久久久久免费观看| 亚洲精品高清一二区久久| 久久乐国产综合亚洲精品| 国产成人精品三上悠亚久久| 日韩久久久久久中文人妻 | 国产精品99久久久久久猫咪|