Solved

Using WaveOutWrite and low level wave stuff

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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