zoukankan      html  css  js  c++  java
  • temp--test audio micphone

    DWORD CALLBACK waveInProc(HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
    {
    SYZ_TRACE("waveInProc:: hWaveIn: point[%p] uMsg==[%d]", hWaveIn, uMsg);
    char errorChar[256];
    MMRESULT hr;
    //waveInGetErrorText(hr, errorChar, 256);
    //SYZ_TRACE("waveInGetErrorText :: hr[%d], ErrorText[%s]", hr, errorChar);
    if (uMsg == WIM_DATA)
    {
    WAVEHDR* pWaveHdr = (WAVEHDR*)dwParam1;//dwParam1指向WAVEHDR的地址
    wWaveRecord* pWaveRecord = (wWaveRecord*)dwInstance;
    SYZ_TRACE("WAVEHDR stuct data:
    lpData[%p], dwBufferLength[%d], dwBytesRecorded[%d], dwUser[%p], dwFlags[%d], dwLoops[%d], lpNext[%p], reserved[%p]",
    pWaveHdr->lpData, pWaveHdr->dwBufferLength, pWaveHdr->dwBytesRecorded, pWaveHdr->dwUser, pWaveHdr->dwFlags, pWaveHdr->dwLoops, pWaveHdr->lpNext, pWaveHdr->reserved);
    pWaveRecord->Lock();
    if (pWaveRecord->m_bRecording && pWaveHdr->dwBytesRecorded == MAX_BUFF_SOUNDSIZE)
    {
    SYZ_TRACE("befor call waveInUnprepareHeader");
    hr = waveInUnprepareHeader(hWaveIn, pWaveHdr, sizeof(WAVEHDR));
    SYZ_TRACE("waveInUnprepareHeader result [%d]", (hr== MMSYSERR_NOERROR));
    waveInGetErrorText(hr, errorChar, 256);
    SYZ_TRACE("waveInGetErrorText :: hr[%d], ErrorText[%s]", hr, errorChar);
    pWaveHdr->dwBytesRecorded = 0;
    pWaveHdr->dwFlags = 0;
    SYZ_TRACE("befor call waveInPrepareHeader");
    hr = waveInPrepareHeader(hWaveIn, pWaveHdr, sizeof(WAVEHDR));
    SYZ_TRACE("waveInPrepareHeader result [%d]", (hr == MMSYSERR_NOERROR));
    waveInGetErrorText(hr, errorChar, 256);
    SYZ_TRACE("waveInGetErrorText :: hr[%d], ErrorText[%s]", hr , errorChar);
    hr = waveInAddBuffer(hWaveIn, pWaveHdr, sizeof(WAVEHDR));
    SYZ_TRACE("waveInAddBuffer result [%d]", (hr == MMSYSERR_NOERROR));
    waveInGetErrorText(hr, errorChar, 256);
    SYZ_TRACE("waveInGetErrorText :: hr[%d], ErrorText[%s]", hr , errorChar);
    }
    else
    {
    //clear dirty data
    memset(pWaveHdr->lpData, 0, MAX_BUFF_SOUNDSIZE);
    }
    pWaveRecord->Unlock();
    }
    return 0;
    }

  • 相关阅读:
    Android高级控件(四)——VideoView 实现引导页播放视频欢迎效果,超级简单却十分的炫酷
    Android源代码文件夹结构说明
    IOS-Storyboard控制器切换之TabBar(3)
    若干排序算法简单汇总(一)
    Linux地址ping不通情况怎么办?
    pve三种操作方式
    Office Add-in 设计规范与最佳实践
    编辑您的代码
    持续集成
    人工智能到底能给我们带来什么?
  • 原文地址:https://www.cnblogs.com/hqu-ye/p/4660969.html
Copyright © 2011-2022 走看看