🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.multimedia
1 messages
1 total messages Started by David Sun, 08 Jun 2003 14:42
Is this proper usage? ACM?
#716
Author: David
Date: Sun, 08 Jun 2003 14:42
61 lines
3120 bytes
Below is an example I have been trying to use and add compressed
recoring to my application. I want to use an installed Codec (ACM).
Is this possible, or am I on a dead end?



MCIWndNew(m_hMCIWnd, "waveaudio");
MCI_WAVE_SET_PARMS set_parms;
set_parms.wFormatTag      = WAVE_FORMAT_UNKNOWN;
set_parms.nChannels       = 2;
set_parms.wBitsPerSample  = 16;
set_parms.nBlockAlign     =
(set_parms.nChannels*set_parms.wBitsPerSample)/8;
set_parms.nSamplesPerSec  = 8000;
set_parms.nAvgBytesPerSec = ((set_parms.wBitsPerSample) *
                                set_parms.nChannels *
                                set_parms.nSamplesPerSec)/8;

// now send the format changes with MCI_SET
int deviceID=MCIWndGetDeviceID(m_hMCIWnd);
int result = mciSendCommand( deviceID, MCI_SET,
                             MCI_WAIT
                           | MCI_WAVE_SET_FORMATTAG
                           | MCI_WAVE_SET_BITSPERSAMPLE
                           | MCI_WAVE_SET_CHANNELS
                           | MCI_WAVE_SET_SAMPLESPERSEC
                           | MCI_WAVE_SET_AVGBYTESPERSEC
                           | MCI_WAVE_SET_BLOCKALIGN,
                             (DWORD)(LPVOID)&set_parms);
if ( result ) // failed?
  {
  char buffer[100];
  mciGetErrorString(result, buffer, sizeof(buffer));
  MessageBox( NULL, buffer, "MCI_WAVE_SET_1", MB_OK);
  return;
  }
// now we can record at our audio setting
MCIWndRecord(m_hMCIWnd);

// set GUI buttons so we know we can stop
Button1->Enabled=false;
Button2->Enabled=true;
Label1->Caption="RECORDING";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
char file[260]="";
wsprintf(file,"aud%05d.wav",GetTickCount()%100000L); // random
filename

// now stop audio and save to disk
MCIWndStop(m_hMCIWnd);
MCIWndSave(m_hMCIWnd,file);
MCIWndClose(m_hMCIWnd);

// now set buttons so we know we can stop
Button1->Enabled=true;
Button2->Enabled=false;
Label1->Caption="IDLE";
}
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