Solved

Using WaveOutWrite and low level wave stuff

Posted on 1997-02-13
1
587 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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