亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? strmctxt.cpp

?? realtek562x系列驅動源碼。wince
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES.
//
/* 
** Copyright 2000-2003 Intel Corporation All Rights Reserved.
**
** Portions of the source code contained or described herein and all documents
** related to such source code (Material) are owned by Intel Corporation
** or its suppliers or licensors and is licensed by Microsoft Corporation for distribution.  
** Title to the Material remains with Intel Corporation or its suppliers and licensors. 
** Use of the Materials is subject to the terms of the Microsoft license agreement which accompanied the Materials.  
** No other license under any patent, copyright, trade secret or other intellectual
** property right is granted to or conferred upon you by disclosure or
** delivery of the Materials, either expressly, by implication, inducement,
** estoppel or otherwise 
** Some portion of the Materials may be copyrighted by Microsoft Corporation.
*/
#include "wavemain.h"

HRESULT StreamContext::Open(DeviceContext *pDeviceContext, LPWAVEOPENDESC lpWOD, DWORD dwFlags)
{
    m_RefCount = 1;
    m_pDeviceContext = pDeviceContext;
    m_pfnCallback = (DRVCALLBACK *)lpWOD->dwCallback;
    m_dwInstance  = lpWOD->dwInstance;
    m_hWave       = lpWOD->hWave;
    m_dwFlags     = dwFlags;
    m_bRunning    = FALSE;
    m_bForceSpeaker = FALSE;

    // If it's a PCMWAVEFORMAT struct, it's smaller than a WAVEFORMATEX struct (it doesn't have the cbSize field),
    // so don't copy too much or we risk a fault if the structure is located on the end of a page.
    // All other non-PCM wave formats share the WAVEFORMATEX base structure
    // Note: I don't keep around anything after the cbSize of the WAVEFORMATEX struct so that I don't need to
    // worry about allocating additional space. If we need to keep this info around in the future, we can either
    // allocate it dynamically here, or keep the information in any derived format-specific classes.
    DWORD dwSize;
    WAVEFORMATEX *pwfx = lpWOD->lpFormat;
    if (pwfx->wFormatTag == WAVE_FORMAT_PCM)
    {
        dwSize = sizeof(PCMWAVEFORMAT);
        m_WaveFormat.cbSize = 0;
    }
    else
    {
        dwSize = sizeof(WAVEFORMATEX);
    }

    memcpy(&m_WaveFormat,pwfx,dwSize);

    m_lpWaveHdrHead    = NULL;
    m_lpWaveHdrTail    = NULL;
    m_lpWaveHdrCurrent = NULL;
    m_lpCurrData       = NULL;
    m_lpCurrDataEnd    = NULL;
    m_dwByteCount      = 0;
    m_dwLoopCount = 0;

    m_SecondaryGainClass=0;
    SetGain(pDeviceContext->GetDefaultStreamGain()); // Set gain to default value

    // DEBUGMSG(1, (TEXT("Opening stream 0x%x\r\n"),this));

    // Add stream to list. This will start playback.
    pDeviceContext->NewStream(this);

    DoCallbackStreamOpened();

    return S_OK;
}

DWORD StreamContext::Close()
{
    if (StillPlaying())
    {
        return WAVERR_STILLPLAYING;
    }

    // Be sure to turn off speaker if we turned it on.
    ForceSpeaker(FALSE);

    // DEBUGMSG(1, (TEXT("Closing stream 0x%x\r\n"),this));
    DoCallbackStreamClosed();

    return MMSYSERR_NOERROR;
}

// Assumes lock is taken
LONG StreamContext::AddRef()
{
    LONG RefCount = ++m_RefCount;
//    DEBUGMSG(1, (TEXT("AddRef stream 0x%x, RefCount=%d\r\n"),this,RefCount));
    return RefCount;
}

// Assumes lock is taken
LONG StreamContext::Release()
{
    LONG RefCount = --m_RefCount;

//    DEBUGMSG(1, (TEXT("Releasing stream 0x%x, RefCount=%d\r\n"),this,RefCount));
    if (RefCount==0)
    {
        // DEBUGMSG(1, (TEXT("Deleting stream 0x%x\r\n"),this));
        // Only remove stream from list when all refcounts are gone.
        m_pDeviceContext->DeleteStream(this);
        delete this;
    }
    return RefCount;
}

DWORD StreamContext::QueueBuffer(LPWAVEHDR lpWaveHdr)
{
    if (!(lpWaveHdr->dwFlags & WHDR_PREPARED))
    {
        return WAVERR_UNPREPARED;
    }

    lpWaveHdr->dwFlags |= WHDR_INQUEUE;
    lpWaveHdr->dwFlags &= ~WHDR_DONE;
    lpWaveHdr->lpNext=NULL;
    lpWaveHdr->dwBytesRecorded=0;

    if (!m_lpWaveHdrHead)
    {
        m_lpWaveHdrHead = lpWaveHdr;
    }
    else
    {
        m_lpWaveHdrTail->lpNext=lpWaveHdr;
    }

    m_lpWaveHdrTail=lpWaveHdr;

    // Note: Even if head & tail are valid, current may be NULL if we're in the middle of
    // a loop and ran out of data. So, we need to check specifically against current to
    // decide if we need to initialize it.
    if (!m_lpWaveHdrCurrent)
    {
        m_lpWaveHdrCurrent = lpWaveHdr;
        m_lpCurrData    = (PBYTE)lpWaveHdr->lpData;
        m_lpCurrDataEnd = (PBYTE)lpWaveHdr->lpData + lpWaveHdr->dwBufferLength;
        if (lpWaveHdr->dwFlags & WHDR_BEGINLOOP)    // if this is the start of a loop block
        {
            m_dwLoopCount = lpWaveHdr->dwLoops;     // save # of loops
        }
    }

    if (m_bRunning)
    {
        m_pDeviceContext->StreamReadyToRender(this);
    }

    return MMSYSERR_NOERROR;
}

// Note: I've found that when we return used buffers, the wave manager may
// call back into the wave driver in the same thread context to close the stream when
// we return the last buffer.
// If it wasn't the last buffer, the close call will return MMSYSERR_STILLPLAYING.
// However, if it was the last buffer, the close will proceed, and the
// stream may be deleted out from under us. Note that a Lock won't help us here,
// since we're in the same thread which already owns the lock.
// The solution to this is the AddRef/Release use on the stream context, which keeps it
// around if we're acessing it, even if it's closed.

// Assumes lock is taken
PBYTE StreamContext::GetNextBuffer()
{
    LPWAVEHDR lpOldHdr;
    LPWAVEHDR lpNewHdr;
    LPSTR pNewBuf=NULL;

    // Get a pointer to the current buffer which is now done being processed
    lpOldHdr=m_lpWaveHdrCurrent;

    if (!lpOldHdr)
    {
        return NULL;
    }

    // Are we in a loop
    // Note: a loopcount of 1 means we're not really in a loop
    if (m_dwLoopCount>1)
    {
        // We're in a loop!
        if (lpOldHdr->dwFlags & WHDR_ENDLOOP)
        {
           // In loop, last buffer
            // If dwLoopCount was set to INFINITE, loop forever
            // (Note: this is not explicitly in the wave driver API spec)
            if (m_dwLoopCount!=INFINITE)
            {
           m_dwLoopCount--;                    // decrement loop count
            }
           lpNewHdr=m_lpWaveHdrHead;           // go back to start of loop
        }
        else
        {
           // In loop, intermediate buffer
           lpNewHdr=lpOldHdr->lpNext;          // just go to next buffer in loop block
        }

        lpOldHdr=NULL;
    }
    else
    {
        // Not in a loop; return old buffer and get new buffer
        lpNewHdr=lpOldHdr->lpNext;

        m_lpWaveHdrHead = lpNewHdr;           // reset list head
        if (!lpNewHdr)
        {
            m_lpWaveHdrTail=NULL;             // no new buffer, reset tail to NULL
        }
        else if (lpNewHdr->dwFlags & WHDR_BEGINLOOP)    // if new buffer is start of a loop block
        {
            m_dwLoopCount=lpNewHdr->dwLoops;  // save # of loops
        }
    }

    m_lpWaveHdrCurrent=lpNewHdr;              // save current buffer pointer

    if (lpNewHdr)
    {
        m_lpCurrData    = (PBYTE)lpNewHdr->lpData;  // reinitialize data pointer
        m_lpCurrDataEnd = m_lpCurrData + lpNewHdr->dwBufferLength;
    }
    else
    {
        m_lpCurrData  = NULL;
        m_lpCurrDataEnd = NULL;
    }

    // Return the old buffer
    // This may cause the stream to be destroyed, so make sure that any calls to this function
    // are within an AddRef/Release block
    if (lpOldHdr)
    {
        ReturnBuffer(lpOldHdr);
    }

    return m_lpCurrData;
}

DWORD StreamContext::BreakLoop()
{
    AddRef();

    if (m_dwLoopCount>0)
    {
        m_dwLoopCount = 0;

        LPWAVEHDR lpHdr;
        while (m_lpWaveHdrHead!=m_lpWaveHdrCurrent)
        {
            lpHdr = m_lpWaveHdrHead;
            m_lpWaveHdrHead = lpHdr->lpNext;
            if (m_lpWaveHdrHead==NULL)
            {
                m_lpWaveHdrTail=NULL;
            }
            ReturnBuffer(lpHdr);
        }
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩午夜电影av| 亚洲黄色免费网站| 日韩激情一区二区| 欧美亚洲高清一区二区三区不卡| 国产亚洲综合av| 国产精一区二区三区| 日韩欧美在线网站| 秋霞成人午夜伦在线观看| 欧美日韩高清不卡| 日韩精品视频网| 日韩欧美国产一区在线观看| 日韩综合在线视频| 欧美精品一区二区久久婷婷| 韩国av一区二区三区四区| 91视频免费看| 国产精品丝袜黑色高跟| 亚洲一级二级在线| 成人免费av资源| 欧美日韩免费观看一区二区三区| 亚洲精品自拍动漫在线| 亚洲免费在线观看| 97se亚洲国产综合自在线| 日韩欧美在线不卡| 蜜桃av一区二区在线观看| 99久久er热在这里只有精品15| 91精品国产色综合久久ai换脸 | 99国产精品久久久久久久久久| 欧美精品免费视频| 日日摸夜夜添夜夜添亚洲女人| 成人av网址在线| 国产精品久久久久一区二区三区 | 在线看不卡av| 亚洲精品视频在线| 日本丰满少妇一区二区三区| 欧美性色黄大片| 亚洲成人激情av| 欧美一级专区免费大片| 欧美精品一区二区三区高清aⅴ| 国产一区二区三区在线观看免费 | 五月天激情综合| 欧美一区二区免费视频| 久久超碰97中文字幕| 久久久亚洲精华液精华液精华液| 日本视频一区二区| 国产色产综合产在线视频| 99re视频精品| 日本成人在线网站| 国产精品国产三级国产aⅴ原创| 秋霞成人午夜伦在线观看| 精品免费国产二区三区| 国产乱码精品一区二区三| 91精品国产色综合久久| 99re6这里只有精品视频在线观看| 亚洲欧美精品午睡沙发| 欧美日韩色一区| 成人手机电影网| 亚洲午夜视频在线| 国产精品久久99| 精品欧美乱码久久久久久| 精品在线播放午夜| 一区二区激情视频| 欧美激情中文字幕| 久久综合色一综合色88| 欧美日韩三级一区| 欧美精品一区二区久久久| 色婷婷久久久久swag精品| 国产综合久久久久影院| 日本美女一区二区| 日日夜夜精品免费视频| 26uuu成人网一区二区三区| 欧美一区二区网站| 欧美三级资源在线| 91在线观看免费视频| 99久久99精品久久久久久| 91精品国产欧美一区二区成人| 国产精品人人做人人爽人人添| 国产拍欧美日韩视频二区| 欧美韩国日本不卡| 国产精品国产自产拍高清av王其| 国产精品一区二区三区网站| 麻豆成人免费电影| 亚洲国产激情av| 久久精品亚洲精品国产欧美| 国产午夜亚洲精品理论片色戒 | 亚洲欧美激情插| 亚洲电影第三页| 日本色综合中文字幕| 免费成人av资源网| 精品一区二区在线视频| 成人网在线播放| 在线免费观看日韩欧美| 69堂精品视频| 国产日韩三级在线| 国产成人午夜视频| 欧美日韩一级片网站| 欧美一区二区三级| 91精品国产色综合久久| 99国产一区二区三精品乱码| 在线不卡中文字幕| 精品噜噜噜噜久久久久久久久试看| 中文一区二区完整视频在线观看| 亚洲五月六月丁香激情| 麻豆一区二区99久久久久| 91麻豆国产福利在线观看| 欧美一区日韩一区| 日韩久久一区二区| 岛国精品在线观看| 不卡视频一二三四| 欧美xxx久久| 日韩国产在线一| 国产很黄免费观看久久| 69p69国产精品| 爽好久久久欧美精品| 91网站最新地址| 久久久久久影视| 久久精品国产亚洲高清剧情介绍 | 亚洲欧洲精品一区二区精品久久久| xnxx国产精品| 亚洲香蕉伊在人在线观| 不卡的电影网站| 国产a区久久久| 成人一区在线观看| 欧美激情一区二区| 亚洲观看高清完整版在线观看| 成人国产精品免费观看视频| av爱爱亚洲一区| 中文字幕欧美一区| 91影视在线播放| 国产精品动漫网站| 色综合色综合色综合| 日韩一区中文字幕| 色8久久精品久久久久久蜜| 一区二区三区影院| 欧美精品v国产精品v日韩精品 | av网站免费线看精品| 中文字幕在线观看不卡| 成人av免费在线播放| 日本一区免费视频| 欧美无砖砖区免费| 日本成人超碰在线观看| 欧美日韩免费一区二区三区视频| 亚洲成人av一区| av在线不卡电影| 亚洲国产日韩一级| 久久九九99视频| 亚洲图片一区二区| 国产高清在线精品| 亚洲日本一区二区| 一本在线高清不卡dvd| 午夜影院在线观看欧美| 精品盗摄一区二区三区| 91最新地址在线播放| 久久国产日韩欧美精品| 91黄视频在线| 狠狠久久亚洲欧美| 亚洲欧美激情一区二区| 精品国内二区三区| 国产日产欧美一区二区视频| 欧美日韩高清一区二区不卡| 丁香一区二区三区| 蜜桃视频第一区免费观看| 亚洲一区二区三区精品在线| 亚洲一区在线免费观看| 91精品免费在线| 图片区小说区区亚洲影院| 92国产精品观看| 国产精品996| 国产大片一区二区| 蜜臀av亚洲一区中文字幕| 三级在线观看一区二区| 亚洲精品你懂的| 夜夜揉揉日日人人青青一国产精品| 亚洲国产一区二区a毛片| 亚洲一区在线电影| 老司机精品视频一区二区三区| 美国三级日本三级久久99| 国产精品一区二区在线观看网站| 91美女在线观看| 日韩欧美国产一区二区三区| 国产日韩精品一区| 丝瓜av网站精品一区二区| 成人在线视频一区二区| 欧美日韩黄色影视| 欧美国产精品v| 青青青爽久久午夜综合久久午夜| av一本久道久久综合久久鬼色| 日韩欧美一区二区视频| 亚洲另类春色校园小说| 国产成人亚洲综合色影视| 欧美日韩精品二区第二页| 中文字幕亚洲欧美在线不卡| 久久不见久久见中文字幕免费| 在线中文字幕不卡| 综合在线观看色| 97久久精品人人做人人爽| 国产精品久久久久久福利一牛影视| 美国十次综合导航| 精品入口麻豆88视频| 麻豆91精品视频| 欧美一区二区三区在线看|