Solved

Using WaveOutWrite and low level wave stuff

Posted on 1997-02-13
1
573 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
ID: 1299070

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 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

12 Experts available now in Live!

Get 1:1 Help Now