//WaveIn.h
MMRESULT IsFormatSupported(LPWAVEFORMATEX pwfx, UINT uDeviceID)
{
return waveInOpen (
NULL, // ptr can be NULL for query
uDeviceID, // The device identifier
pwfx, // Defines the requested
// format.
NULL, // No callback
NULL, // No instance data
WAVE_FORMAT_QUERY); // Query only, do not open.
}
//WaveIn.cpp
#include "stdafx.h"
#include "WaveIn.h"
int main()
{
UINT wReturn;
WAVEFORMATEX pcmWaveFormat;
pcmWaveFormat.wFormatTag = WAVE_FORMAT_PCM;
pcmWaveFormat.nChannels = 1;
pcmWaveFormat.nSamplesPerSec = 44100L;
pcmWaveFormat.nAvgBytesPerSec = 88200L;
pcmWaveFormat.nBlockAlign = 2;
pcmWaveFormat.wBitsPerSample = 16;
pcmWaveFormat.cbSize = 0;
waveInOpen (
NULL, // ptr can be NULL for query
WAVE_MAPPER, // The device identifier
pwfx, // Defines the requested
// format.
NULL, // No callback
NULL, // No instance data
WAVE_FORMAT_QUERY); // Query only, do not open.
}
// See if format is supported by any device in the system.
wReturn = IsFormatSupported(&pcmWaveFormat, WAVE_MAPPER);
// Report results.
if (wReturn == MMSYSERR_NOERROR)
MessageBox(NULL, "44.1 kHz 16-bit stereo is supported.",
"", MB_ICONINFORMATION);
else if (wReturn == WAVERR_BADFORMAT)
MessageBox(NULL, "44.1 kHz 16-bit stereo NOT supported.",
"", MB_ICONINFORMATION);
else
MessageBox(NULL, "Error opening waveform device.",
"Error", MB_ICONEXCLAMATION);
}
I get these errors along with others
e:\Amp\Tabs\WaveIn.cpp(29): error C2065: 'pcmWaveFormat' : undeclared
identifier
e:\Amp\Tabs\WaveIn.cpp(29): error C2501: 'wReturn' : missing
storage-class or type specifiers
e:\Amp\Tabs\WaveIn.cpp(20): error C2065: 'pwfx' : undeclared identifier
Hi, new to the group, I'm trying to check to see if a waveformatex
format is supported by my sound card. Everything seems to be working
except for the waveInOpen struct. Any suggestions about the pwfx or
uDeviceDriver or anything? Thanks 4 9064
saverain wrote: //WaveIn.h MMRESULT IsFormatSupported(LPWAVEFORMATEX pwfx, UINT uDeviceID) { return waveInOpen ( NULL, // ptr can be NULL for query uDeviceID, // The device identifier pwfx, // Defines the requested // format. NULL, // No callback NULL, // No instance data WAVE_FORMAT_QUERY); // Query only, do not open. }
//WaveIn.cpp #include "stdafx.h" #include "WaveIn.h"
int main() { UINT wReturn; WAVEFORMATEX pcmWaveFormat;
pcmWaveFormat.wFormatTag = WAVE_FORMAT_PCM; pcmWaveFormat.nChannels = 1; pcmWaveFormat.nSamplesPerSec = 44100L; pcmWaveFormat.nAvgBytesPerSec = 88200L; pcmWaveFormat.nBlockAlign = 2; pcmWaveFormat.wBitsPerSample = 16; pcmWaveFormat.cbSize = 0;
waveInOpen ( NULL, // ptr can be NULL for query WAVE_MAPPER, // The device identifier pwfx, // Defines the requested // format. NULL, // No callback NULL, // No instance data WAVE_FORMAT_QUERY); // Query only, do not open. }
^^^
I believe this curly brace is what screws you up. It closes the 'main'
function and the following statements are placed _outside_ of any function,
which is not what you wanted. // See if format is supported by any device in the system.
wReturn = IsFormatSupported(&pcmWaveFormat, WAVE_MAPPER);
// Report results.
if (wReturn == MMSYSERR_NOERROR) MessageBox(NULL, "44.1 kHz 16-bit stereo is supported.", "", MB_ICONINFORMATION); else if (wReturn == WAVERR_BADFORMAT) MessageBox(NULL, "44.1 kHz 16-bit stereo NOT supported.", "", MB_ICONINFORMATION); else MessageBox(NULL, "Error opening waveform device.", "Error", MB_ICONEXCLAMATION); }
I get these errors along with others
e:\Amp\Tabs\WaveIn.cpp(29): error C2065: 'pcmWaveFormat' : undeclared identifier e:\Amp\Tabs\WaveIn.cpp(29): error C2501: 'wReturn' : missing storage-class or type specifiers e:\Amp\Tabs\WaveIn.cpp(20): error C2065: 'pwfx' : undeclared identifier
Hi, new to the group, I'm trying to check to see if a waveformatex format is supported by my sound card. Everything seems to be working except for the waveInOpen struct. Any suggestions about the pwfx or uDeviceDriver or anything? Thanks
See above
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Thanks now the only error I have is
e:\Amp\Tabs\WaveIn.cpp(20): error C2065: 'pwfx' : undeclared identifier
I believe this points to the pcmwaveformat but not shure.
saverain wrote: Thanks now the only error I have is e:\Amp\Tabs\WaveIn.cpp(20): error C2065: 'pwfx' : undeclared identifier
I believe this points to the pcmwaveformat but not shure.
Undeclared identifier usually is either scoping issue or the result of
a typo. You've got to be able to take care of those on your own.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
maybe try to erase definition of WAVEFORMATEX value. create the pointer
LPWAVEFORMATEX pwfx.
this:
pcmWaveFormat.wFormatTag = WAVE_FORMAT_PCM;
(...) You can do the same with pwfx->wFormatTag and so on.
Then function IsFormatSupported() call with pwfx.
Maybe this will help.
Greets,
V This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Fred Loud |
last post by:
I'm having a problem calling waveInOpen from a VB.NET application, every time
I call it I get a return value of 11 which is MMSYSERR_INVALPARAM.
I can call waveInGetNumDevs and waveInGetDevCaps...
|
by: Mark Reed |
last post by:
Hi all,
I am trying to learn a little about programming (I know next to nothing
so far) and have found some code which hides the toolbars. However, this bit
of code is a little too effective and...
|
by: Dixie |
last post by:
Can I set the Format property in a date/time field in code?
Can I set the Input Mask in a date/time field in code?
Can I set the Format of a Yes/No field to Checkbox in code?
I am working on...
|
by: Timothy Shih |
last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I
wrote a simple function which takes in 2 buffers (one a byte buffer, one a
char buffer) and copies the contents of the byte...
|
by: Ja |
last post by:
Hello,
I'm capturing audio from the soundcard, using the waveInXXX calls. I'm
having no problem capturing a PCM stream. Yet, when I try to capture a GSM
compressed stream, I get a failure...
| |
by: Sakharam Phapale |
last post by:
Hi All,
I have written following code, but waveInOpen API call gives me error no 32.
Can anyone help me to solve this?
Public Delegate Function callback(ByVal hw As Integer, ByVal uMsg As...
|
by: jrumanek |
last post by:
Hallo,
I have a problem with function WaveInOpen.
The function gives ERROR CODE 11 - MMSYSERR_INVALPARAM.
Shall you help me please?
Any sugestion?
|
by: jrumanek |
last post by:
Hallo,
I have problem with function WaveInOpen . This function doesn't return
meesage MM_WIM_OPEN?
Shall YOU help me pleas?
Any suggestions?
Thank you!
|
by: wizche |
last post by:
Hi Everybody,
I'm trying to play a little with waveIn functions... My goal is to calculate if I'm listening a specified sin frequency or not.
For this reason I'm going down with the...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |