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

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            精品久久一区二区| 久久强奷乱码老熟女网站| 久久91精品久久91综合| 久久精品国产亚洲麻豆| 久久久久亚洲AV成人网人人软件| 91精品国产高清久久久久久io| A级毛片无码久久精品免费| 欧美丰满熟妇BBB久久久| 99久久精品免费| 久久久久久精品免费看SSS| 狠狠久久亚洲欧美专区| 久久久国产亚洲精品| 岛国搬运www久久| 午夜久久久久久禁播电影| 国产国产成人久久精品| 国产偷久久久精品专区| 66精品综合久久久久久久| 三上悠亚久久精品| 99久久做夜夜爱天天做精品| 国产精品成人无码久久久久久| 久久久久久久久久久久久久| AAA级久久久精品无码区| 亚洲精品乱码久久久久久自慰| 国产精品免费久久久久久久久| 久久久久亚洲AV无码麻豆| 久久综合亚洲色一区二区三区| 国产免费久久久久久无码| 一本伊大人香蕉久久网手机| 久久久av波多野一区二区| 狠狠色婷婷久久综合频道日韩| 久久久久国产视频电影| 999久久久国产精品| 亚洲乱亚洲乱淫久久| 久久国产乱子伦精品免费强| 国产精品欧美久久久天天影视 | 亚洲中文字幕无码久久精品1| 久久亚洲欧洲国产综合| 欧美色综合久久久久久| 一级做a爰片久久毛片看看| 久久亚洲精品国产精品婷婷 | 国产精品美女久久久久av爽|