🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
4 messages
4 total messages Started by Jonathan Benedicto Wed, 11 May 2005 20:39
wave playback headers
#125
Author: Jonathan Benedicto
Date: Wed, 11 May 2005 20:39
14 lines
1364 bytes
I'm trying to use a vector of WAVEHDR's in my application, so that my 
app does not have to create a new wave header when it plays a buffer.

But, this always results in clicks in the audio. I know that the 
clicks are being made by the buffer system, because when I remove it, 
and create a new buffer for every time I need it, the clicks 
disappear.

Does anyone have any thoughts on how to stop this ?

-- 

Jonathan
 
Re: wave playback headers
#126
Author: Mark Jacobs
Date: Thu, 12 May 2005 08:10
24 lines
2044 bytes
Jonathan Benedicto wrote:
> I'm trying to use a vector of WAVEHDR's in my application, so that my 
> app does not have to create a new wave header when it plays a buffer.
> 
> But, this always results in clicks in the audio. I know that the 
> clicks are being made by the buffer system, because when I remove it, 
> and create a new buffer for every time I need it, the clicks 
> disappear.
> 
> Does anyone have any thoughts on how to stop this ?
> 
//---------------------------------------------------------------------------
void CALLBACK WaveInProc(HWAVEIN waveIn,UINT uMsg,DWORD dwInstance,DWORD
dwParam1,DWORD dwParam2)
{
   if (MainForm->clsing || dwParam1==0) return;
   if (uMsg==MM_WIM_DATA) MainForm->ProcessInput((WAVEHDR *)dwParam1);
}

It sounds like you are not checking whether the buffer is finished with, in 
your WaveInProc routine. That is why I put "if (uMsg==MM_WIM_DATA)" in my version.
-- 
Mark Jacobs
http://www.dkcomputing.co.uk
Re: wave playback headers
#129
Author: Mark Jacobs
Date: Thu, 12 May 2005 11:15
19 lines
1589 bytes
Sorry, you mean output not input. Here is what I use for clickless output :-

//---------------------------------------------------------------------------
void CALLBACK WaveOutProc(HWAVEOUT waveOut,UINT uMsg,DWORD dwInstance,DWORD 
dwParam1,DWORD dwParam2)
{
   if (dwParam1==0) return;
   WAVEHDR *mh=(WAVEHDR *)dwParam1;
   if (uMsg==MM_WOM_DONE)
   {
     waveOutUnprepareHeader(waveOut,mh,sizeof(WAVEHDR));
     mh->dwFlags=WHDR_DONE;
   }
}

HTH
-- 
Mark Jacobs
http://www.dkcomputing.co.uk
Re: wave playback headers
#130
Author: Jonathan Benedicto
Date: Thu, 12 May 2005 16:42
41 lines
2105 bytes
"Mark Jacobs" <http://www.jacobsm.com/mjmsg.htm?mj@critical> wrote in 
message news:42833a8a$1@newsgroups.borland.com...
> Sorry, you mean output not input. Here is what I use for clickless 
> output :-

That's what my code does do, and then when it needs a buffer to write 
to for playing, this is my code:

unsigned int j;
unsigned int BufferFilled = 0;
unsigned int PlaybackHeaderCount = PlaybackHeaders.size();
char *TempWaveBuffer;

LPWAVEHDR WaveHeader;
MMRESULT mmr;

for(i=0;i<PlaybackHeaderCount;++i)
{
 WaveHeader = PlaybackHeaders[i];
 if(WaveHeader->dwFlags == WHDR_DONE)
 {
  TempWaveBuffer = WaveHeader->lpData;
  ZeroMemory(WaveHeader, sizeof(WAVEHDR));
  WaveHeader->lpData = TempWaveBuffer;
  WaveHeader->dwFlags = 0;
  break;
 }
}

if(WaveHeader->dwFlags != WHDR_DONE)
{
 WaveHeader = new WAVEHDR;
 WaveHeader->lpData = new char[8192];
 WaveHeader->dwFlags = 0;

 PlaybackHeaders.push_back(WaveHeader);
}

And then I use the WaveHeader.

Jonathan
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads