• <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 閱讀(926) 評論(0)  編輯 收藏 引用 所屬分類: C++

            公告

            Using C++

            導(dǎo)航

            統(tǒng)計

            留言簿(73)

            隨筆分類(513)

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            一本久久a久久精品综合香蕉| 91麻精品国产91久久久久| 久久九九亚洲精品| 狠狠精品干练久久久无码中文字幕| 日韩一区二区久久久久久| 国产精品久久久久久久午夜片| 久久毛片一区二区| 国产精品久久久久…| 精品国产乱码久久久久久浪潮 | 久久久久亚洲爆乳少妇无 | 久久久久久国产精品无码超碰 | 精品久久久中文字幕人妻| 狠狠色丁香婷婷综合久久来 | 久久久久国产一区二区三区| 久久久久久亚洲Av无码精品专口| 久久精品国产精品国产精品污| 久久久久亚洲爆乳少妇无| 国产精品久久波多野结衣| 亚洲欧美久久久久9999| 91精品日韩人妻无码久久不卡| 久久人妻AV中文字幕| 欧美亚洲国产精品久久蜜芽| 人妻无码αv中文字幕久久 | 久久成人国产精品免费软件| 91久久精品国产免费直播| 久久久久亚洲AV无码永不| 亚洲午夜精品久久久久久app| 青青草原1769久久免费播放| 精品国产乱码久久久久久1区2区| 久久精品国产清自在天天线| A级毛片无码久久精品免费| 99久久中文字幕| 久久国产高清字幕中文| …久久精品99久久香蕉国产| 999久久久无码国产精品| 国内精品伊人久久久久av一坑| 奇米综合四色77777久久| 久久天堂AV综合合色蜜桃网| 熟妇人妻久久中文字幕| 亚洲一区中文字幕久久| 久久精品视频网|