005
20.07.2005, 08:06 Uhr
~chri_aut
Gast
|
also i hab das jetzt mal so gebastelt:
C++: |
int _tmain(int argc, _TCHAR* argv[]) { const int NUMPTS = 44100 * 5; // 5 Sekunden int sampleRate = 44100; short int waveIn[NUMPTS]; // 'short int' is a 16-bit type; I request 16-bit samples below // for 8-bit capture, you'd use 'unsigned char' or 'BYTE' 8-bit types
HWAVEIN hWaveIn; WAVEHDR WaveInHdr; // Specify recording parameters WAVEFORMATEX pFormat; pFormat.wFormatTag=WAVE_FORMAT_PCM; // simple, uncompressed format pFormat.nChannels=2; // 1=mono, 2=stereo pFormat.nSamplesPerSec=sampleRate; // 44100 pFormat.nAvgBytesPerSec=sampleRate*2; // = nSamplesPerSec * n.Channels * wBitsPerSample/8 pFormat.nBlockAlign=2; // = n.Channels * wBitsPerSample/8 pFormat.wBitsPerSample=16; // 16 for high quality, 8 for telephone-grade pFormat.cbSize=0;
waveInOpen(&hWaveIn, WAVE_MAPPER,&pFormat,0L, 0L, WAVE_FORMAT_DIRECT);
// Set up and prepare header for input WaveInHdr.lpData = (LPSTR)waveIn; WaveInHdr.dwBufferLength = NUMPTS/**2*/; WaveInHdr.dwBytesRecorded=0; WaveInHdr.dwUser = 0L; WaveInHdr.dwFlags = 0L; WaveInHdr.dwLoops = 0L; waveInPrepareHeader(hWaveIn, &WaveInHdr, sizeof(WAVEHDR));
// Insert a wave input buffer waveInAddBuffer(hWaveIn, &WaveInHdr, sizeof(WAVEHDR));
printf("Sinus_1KHz.wav\n"); GetWaveVolumePercent(true); SetWaveVolumePercent(25.0,true); GetWaveVolumePercent(false); SetWaveVolumePercent(25.0,false);
printf("Aufnahme\n"); PlaySound(TEXT("sinus_1KHz.wav"), NULL, SND_FILENAME); waveInStart(hWaveIn); // Warten bis Aufnahme fertig do {} while (waveInUnprepareHeader(hWaveIn, &WaveInHdr, sizeof(WAVEHDR))==WAVERR_STILLPLAYING);
waveInClose(hWaveIn); printf("Aufnahme fertig\n");
return 0; }
|
das dürfte ja soweit funktionieren, aber wo stehen jetzt die Daten meiner Aufnahme? In einer bestimmten struct oder wie funktioniert das genau??? |