Sent via AllAPI.net
http://www.allapi.net/
Alex
CHW <hou...@hotmail.com> schrieb in im Newsbeitrag:
#ong5cV1AHA.1908@tkmsftngp02...
> Can you show some code?
> Alex
> CHW <hou...@hotmail.com> schrieb in im Newsbeitrag:
> #ong5cV1AHA.1908@tkmsftngp02...
> > I have a problem with the waveinopen function. The function returns the
> > MMRESULT_ERROR 11( "invalid Parameter passed "). The function runs under
> > Win NT but under WIN ME came the above errormessage. Thanks for help
Here is the codesequence which cause the problem
the cpp file
//---------------------------------------------------------------------------
#include <vcl.h>
#include <mmsystem>
#pragma hdrstop
#include "audioprob.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
hwnd = CreateWindow("banane", TEXT("hallo"), WS_OVERLAPPEDWINDOW,
// Fensterstil
CW_USEDEFAULT, // X-Position des
Fensters
CW_USEDEFAULT, // Y-Position des
Fensters
CW_USEDEFAULT, // Fensterbreite
CW_USEDEFAULT, // Fensterhöhe
NULL, // übergeordnetes
Fenster
NULL, // Menü
NULL, // Programm-Kopiezähler
(Programm-ID)
NULL) ;
// Audio-Gerät für die Aufnahme öffnen
waveform.wFormatTag = WAVE_FORMAT_PCM;
waveform.nChannels = 1 ;
waveform.nSamplesPerSec = 11025 ;
waveform.nAvgBytesPerSec = 11025 ;
waveform.nBlockAlign = 1 ;
waveform.wBitsPerSample = 8 ;
waveform.cbSize = 0 ;
FehlernummerAufnahme=waveInOpen (&hWaveIn, WAVE_MAPPER, &waveform,
(DWORD) hwnd, 0, CALLBACK_WINDOW);
labFehlermeldungAufnahme->Caption = FehlernummerAufnahme;
}
the headerfile
//---------------------------------------------------------------------------
#ifndef audioprobH
#define audioprobH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TLabel *labFehlermeldungAufnahme;
private: // User declarations
HWND hwnd;
UINT message;
LPARAM lParam;
BOOL bRecording, bPlaying, bReverse, bPaused,
bEnding, bTerminating ;
DWORD dwDataLength, dwRepetitions ;
HWAVEIN hWaveIn ;
HWAVEOUT hWaveOut ;
PBYTE pBuffer1, pBuffer2, pSaveBuffer, pNewBuffer ;
PWAVEHDR pWaveHdr1, pWaveHdr2 ;
WAVEFORMATEX waveform ;
unsigned int FehlernummerAufnahme, FehlernummerPlay ;
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Code looks ok, but I think the format defined in the waveformatex
structure might be rejected, as it is not a common format
(44.1kHz, 16-bit stereo).
Try calling waveInOpen with the WAVE_FORMAT_QUERY and
WAVE_FORMAT_DIRECT flags to test whether the format is
really supported by the hardware.
I think sometimes ACM (Audio Compression Manager) is used to
perform realtime conversion of audio formats, so waveInOpen
might fail in case no such converter is installed.
I also never used the WAVE_MAPPER flag.
Hope this helps
Alex
CHW <hou...@hotmail.com> wrote in message
news:uAeu$dj1AHA.1396@tkmsftngp05...
> Alexander Kienzle wrote:
>
>
> > Can you show some code?
>
> > Alex
>
> > CHW <hou...@hotmail.com> schrieb in im Newsbeitrag:
> > #ong5cV1AHA.1908@tkmsftngp02...
> > > I have a problem with the waveinopen function. The function returns
the
> > > MMRESULT_ERROR 11( "invalid Parameter passed "). The function runs
under
> > > Win NT but under WIN ME came the above errormessage. Thanks for help
>
> Here is the codesequence which cause the problem
>
> the cpp file
>
>
file://---------------------------------------------------------------------
------
>
> #include <vcl.h>
> #include <mmsystem>
> #pragma hdrstop
>
> #include "audioprob.h"
>
file://---------------------------------------------------------------------
------
> #pragma package(smart_init)
> #pragma resource "*.dfm"
> TForm1 *Form1;
>
file://---------------------------------------------------------------------
file://---------------------------------------------------------------------
------
>
> #ifndef audioprobH
> #define audioprobH
>
file://---------------------------------------------------------------------
------
> #include <Classes.hpp>
> #include <Controls.hpp>
> #include <StdCtrls.hpp>
> #include <Forms.hpp>
>
file://---------------------------------------------------------------------
------
> class TForm1 : public TForm
> {
> __published: // IDE-managed Components
> TLabel *labFehlermeldungAufnahme;
> private: // User declarations
>
> HWND hwnd;
> UINT message;
> LPARAM lParam;
>
> BOOL bRecording, bPlaying, bReverse, bPaused,
> bEnding, bTerminating ;
> DWORD dwDataLength, dwRepetitions ;
> HWAVEIN hWaveIn ;
> HWAVEOUT hWaveOut ;
> PBYTE pBuffer1, pBuffer2, pSaveBuffer, pNewBuffer ;
> PWAVEHDR pWaveHdr1, pWaveHdr2 ;
> WAVEFORMATEX waveform ;
>
> unsigned int FehlernummerAufnahme, FehlernummerPlay ;
> public: // User declarations
> __fastcall TForm1(TComponent* Owner);
> };
>
file://---------------------------------------------------------------------
------
> extern PACKAGE TForm1 *Form1;
>
file://---------------------------------------------------------------------
Christoph