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

            公告

            Using C++

            導(dǎo)航

            統(tǒng)計

            留言簿(73)

            隨筆分類(513)

            積分與排名

            最新評論

            閱讀排行榜

            評論排行榜

            久久噜噜久久久精品66| 亚洲AV无码久久精品成人 | 久久人与动人物a级毛片| 久久久久四虎国产精品| 亚洲日本va中文字幕久久| 四虎国产精品成人免费久久| 国产精久久一区二区三区| 精品久久人妻av中文字幕| 欧美牲交A欧牲交aⅴ久久| 国内精品久久久久久久亚洲| 亚洲AV无码成人网站久久精品大| 日韩美女18网站久久精品| 99热热久久这里只有精品68| 99久久久国产精品免费无卡顿| 久久丫精品国产亚洲av| 久久精品a亚洲国产v高清不卡| 亚洲精品乱码久久久久66| 伊人久久综合精品无码AV专区| 伊人色综合九久久天天蜜桃| 精品久久久久成人码免费动漫 | 久久久久四虎国产精品| 精品久久久久久亚洲| 久久久国产精品网站| 国产精品久久久久久久久免费| 久久精品国产亚洲网站| 亚洲国产二区三区久久| 久久精品国产一区二区三区 | 久久久久一区二区三区| 亚洲综合久久综合激情久久| 久久久国产精品| 国产精品乱码久久久久久软件 | 久久精品国产影库免费看| 久久er国产精品免费观看2| 99久久精品免费国产大片| 久久久久99精品成人片| 久久久久久国产a免费观看黄色大片 | 中文字幕日本人妻久久久免费 | 亚洲国产精品高清久久久| 国产精品美女久久久m| 久久久久久久综合日本| 久久亚洲日韩精品一区二区三区|