Solved

Using WaveOutWrite and low level wave stuff

Posted on 1997-02-13
1
570 Views
Last Modified: 2013-12-04
I would like to see some examples using the low
level Wave stuff. Like WaveOutOpen and WaveOutWrite.
I am in the process of programming wave player using
double buffer methods. But how to implement that using
the Multimedia API I don't know.
0
Comment
Question by:kristjg
1 Comment
 
LVL 1

Accepted Solution

by:
xbwen earned 50 total points
Comment Utility

Hi, I used to write some code for play low lever wave, such as PlayWave:
UINT WINAPI PlayWave(LPHWAVEOUT lphWaveOut, UINT nDeviceID,                           HWND hWnd,
                     LPWAVEFORMAT lpFormat,
                     HPCSTR hpWaveData, DWORD dwWaveDataSize,
                     DWORD dwLoops, BOOL bDispErrMsg)
{
    ...
    ...
    HWAVEOUT hWaveOut = NULL;
    LPWAVEHDR lpWaveOutHdr = NULL;
    UINT nStatus;
   
    nStatus = ::waveOutOpen(&hWaveOut, nDeviceID, lpFormat,
                            (DWORD)(WORD)hWnd, NULL,
                             WAVE_ALLOWSYNC |                                                 CALLBACK_WINDOW);

    if ((lpWaveOutHdr = (LPWAVEHDR)
                         GlobalAllocPtr(GMEM_MOVEABLE |                                   GMEM_SHARE,                                                                                                                      (DWORD)sizeof(WAVEHDR))) != NULL)
    {
       lpWaveOutHdr->lpData = (LPSTR)hpWaveData;
       lpWaveOutHdr->dwBufferLength = dwWaveDataSize;
       lpWaveOutHdr->dwFlags = WHDR_BEGINLOOP | WHDR_ENDLOOP;                        
       lpWaveOutHdr->dwLoops = dwLoops;
           
       ::waveOutPrepareHeader(hWaveOut, lpWaveOutHdr,                                          sizeof(WAVEHDR));
           
        nStatus = ::waveOutWrite(hWaveOut, lpWaveOutHdr,                                          sizeof(WAVEHDR));
    }
    else
      nStatus = MMSYSERR_NOMEM;
   
    if (nStatus != 0)    // error
    {
        ...
    }
   
    if (lphWaveOut != NULL)
        *lphWaveOut = hWaveOut;
   
    return nStatus;
}
  You also can check with microsoft wavemix example in JumpStart
CD-ROM.
  bottom line, what's your platform?

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now