S
saverain
//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
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