Article View: borland.public.cppbuilder.multimedia
Article #716Is this proper usage? ACM?
From: David
Date: Sun, 08 Jun 2003 14:42
Date: Sun, 08 Jun 2003 14:42
61 lines
3120 bytes
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";
}
Technical Details
Message-ID:
<eji6ev0h9t9k2kecfmfm0ls0luk485rc3p@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d0fc,8d6d6d2b7964b6b0,start X-Google-Attributes: gid10d0fc,public X-Google-ArrivalTime: 2003-06-08 07:44:39 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newsfeed.news2me.com!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail From: David <supertec@mindspring.com> Newsgroups: borland.public.cppbuilder.multimedia Subject: Is this proper usage? ACM? Message-ID: <eji6ev0h9t9k2kecfmfm0ls0luk485rc3p@4ax.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 62 Date: Sun, 08 Jun 2003 14:42:22 GMT NNTP-Posting-Host: 66.32.118.214 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 1055083342 66.32.118.214 (Sun, 08 Jun 2003 07:42:22 PDT) NNTP-Posting-Date: Sun, 08 Jun 2003 07:42:22 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net