|
What error are you getting when you are compiling it? Also which version of VC++ are you using? The zip file have all the source code in it, i mean the whole workspace.
Saneesh
|
|
|
|
|
i'm using visual studio 6 enterprise.. when i was opening your project, the compile button (!) is disable.. so i can't compiled the project.
is there any problem with my vc++ version?
|
|
|
|
|
This is for VC 7.0 version. I have one for VC 6.0 and is uploaded to CodeProject but is not showing up. If you have VC 7.0, you can compile it. Otherwise,send me your email id and i will email you the code.
Saneesh
|
|
|
|
|
This is my email : indray2j@yahoo.com.
thanks for help me out ^^
|
|
|
|
|
Hi Saneesh.., Can you send me that code to imsrinath.408@gmail.com.
|
|
|
|
|
The output wave file generated from your sample code can't run on Vista.
I can't tell the difference from the raw data, please check for me.
|
|
|
|
|
Is it playing on XP / Win2K? I never tested it on Vista and i dont have Vista.
Saneesh
|
|
|
|
|
Yes, works on xp and 2000.
I notice that your Chunk Data Size is 18, files could played on Vista is 16.
How could I change this? looks this effect the compression method.
|
|
|
|
|
It doesn't play on Vista with WMPlayer but does with iTunes. I would also be interested in a fix. Thanks.
|
|
|
|
|
I am looking forward to your update.
|
|
|
|
|
Hi,
I have checked it in XP it self and the size of WAVEFORMATEX is 18 (not 16).
typedef struct tWAVEFORMATEX
{
WORD wFormatTag; /* format type */
WORD nChannels; /* number of channels (i.e. mono, stereo...) */
DWORD nSamplesPerSec; /* sample rate */
DWORD nAvgBytesPerSec; /* for buffer estimation */
WORD nBlockAlign; /* block size of data */
WORD wBitsPerSample; /* number of bits per sample of mono data */
WORD cbSize; /* the count in bytes of the size of */
/* extra information (after cbSize) */
} WAVEFORMATEX, *PWAVEFORMATEX, NEAR *NPWAVEFORMATEX, FAR *LPWAVEFORMATEX;
The sum of size of the member variables make them to 18. This is for
"m_stckOut.cksize = sizeof(m_stWFEX);". May be on Vista they have some kind of different format. Can you make sure we are talking about the same line of code.
Saneesh
|
|
|
|
|
I've fixed the problem by changing the tWAVEFORMATEX.cbSize to 0,
maybe you can tell me the reason. I am not good at audio field.
|
|
|
|
|
I checked the MSDN and found that it can be set to 0 for if no extra information is needed. So you are good to go with this code change. See below:
cbSize
Specifies the size, in bytes, of extra format information appended to the end of the WAVEFORMATEX structure. This information can be used by non-PCM formats to store extra attributes for the wFormatTag. If no extra information is required by the wFormatTag, this member must be set to zero. For WAVE_FORMAT_PCM formats, this member is ignored.
Thanks for pointing it out. May be only in Vista the OS part is doing the strict checking. Thats why it is working in all the other platforms.
Saneesh
|
|
|
|
|
I see, thanks for your concern.
|
|
|
|
|
Hi
I have integrated this code into my VC++ 6.0 audio app.
I am having trouble with populating the format combobox to list all the audio formats you can record in. Basically it only shows the first item in the list i.e. 11.025kHz, mono, 8 bit.
Can you share any light on this subject?
Any help will be appreciated.
Thanks
chris_mezzanine
|
|
|
|
|
It seems like your device driver is not supporting those. Can you try with a different sound card?
Saneesh
|
|
|
|
|
Hi
Thanks for the reply but I have fixed it now.
Cheers
chris_mezzanine
|
|
|
|
|
Hello Saneesh,
I tried but could not run this program on visual studio v6.0?
Is there anything dat can help because your program suits the best for me so far.
Thank you.
|
|
|
|
|
Hi..please see the last message in messages section in the article. If it is some thing different, let me know. Basically, if its the #define error, just use them as follows
/* defines for dwFormat field of WAVEINCAPS and WAVEOUTCAPS */
#define WAVE_INVALIDFORMAT 0x00000000 /* invalid format */
#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_44M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
#define WAVE_FORMAT_44S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_44M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
#define WAVE_FORMAT_44S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_48M08 0x00001000 /* 48 kHz, Mono, 8-bit */
#define WAVE_FORMAT_48S08 0x00002000 /* 48 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_48M16 0x00004000 /* 48 kHz, Mono, 16-bit */
#define WAVE_FORMAT_48S16 0x00008000 /* 48 kHz, Stereo, 16-bit */
#define WAVE_FORMAT_96M08 0x00010000 /* 96 kHz, Mono, 8-bit */
#define WAVE_FORMAT_96S08 0x00020000 /* 96 kHz, Stereo, 8-bit */
#define WAVE_FORMAT_96M16 0x00040000 /* 96 kHz, Mono, 16-bit */
#define WAVE_FORMAT_96S16 0x00080000 /* 96 kHz, Stereo, 16-bit */
Saneesh
|
|
|
|
|
Hello., Saneesh
I converted code to vc6 using prjconverter.exe then i used the above code in my header file still i am getting 3 errors, those are listed below.
////////////////////////////////////////////////////////////////////////////////////
Compiling...
SoundRec.cpp
SoundRecDlg.cpp
C:\0_Srinath_\downloads\SoundRec_3\SoundRec\SoundRecDlg.cpp(192) : error C2039: 'Trim' : is not a member of 'CString'
D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(368) : see declaration of 'CString'
C:\0_Srinath_\downloads\SoundRec_3\SoundRec\SoundRecDlg.cpp(198) : error C2039: 'Trim' : is not a member of 'CString'
D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(368) : see declaration of 'CString'
C:\0_Srinath_\downloads\SoundRec_3\SoundRec\SoundRecDlg.cpp(387) : error C2660: 'CFileDialog::CFileDialog' : function does not take 7 parameters
Generating Code...
Error executing cl.exe.
SoundRec.exe - 3 error(s), 0 warning(s)
//////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
Hi Saneesh..is it possible for the recorded audio to be in raw pcm instead of .wav?
I'm doin a project to get an audio output of 8k 16bit raw pcm file.
Thank you...anyone pls?
|
|
|
|
|
Yes it is possible. You can either use ACM (Audio Compression Manager) to convert it after recording (provided you have the codec) or in the WAVEFORMATEX structure it self, you can change it.
Good luck
Saneesh
Saneesh
|
|
|
|
|
Hi,
I've some questions. Can I play sound direct from WaveIn buffers to WaveOut from one soundcard to another? This is a real time process? I'd like to create a pipe grabbing audio from one sound card and playing on another one. It sounds logical to me. This is correct or there's another way to do that?
Thanks in advance,
Leonardo Baracat
lbaracat@gmail.com
|
|
|
|
|
Hi,
Yes you can do it. Open waveInOpen for the Input card and waveOutOpen for output card. Add say 10 buffers so that nothing will be lost. Inside the callback function, once u get the data, write it to the other device. It is simple as that.
Mail me if u have more doubts..
Saneesh
Saneesh
|
|
|
|
|
Hi,
I have the same question, and I used your suggestion. But, some questions happened.
the sound of record(A sound card) and play (B sound card) can't synchronize.
The interval between out and input sound are increase acording program's running timg.
Are there more suggestions about it?
Thanks in advance~!
Burgers.
|
|
|
|