Sound aufnehmen mit mci
-
Hi
Ich möchte audio aufnehmen, (was ich gerade höre). 10 sec, lang.
Doch leider funktioniert mein code nicht. bzw. habe ich nach 1h suche ein (leck) im kopf. Wo ist nur der Fehler???Die audio datei wird scheinbar aufgezeichnet und gespeichert und auch erstellt. Doch hören tut man halt nichts. ! Das ist mein Problem. Vieleicht gibts einer hier der mir helfen kann.
Hier der code ...
#include <windows.h> #include <Mmsystem.h> int main() { UINT wDeviceID; DWORD dwReturn; MCI_OPEN_PARMS mciOpenParms; MCI_RECORD_PARMS mciRecordParms; MCI_SAVE_PARMS mciSaveParms; MCI_PLAY_PARMS mciPlayParms; // Open a waveform-audio device with a new file for recording. mciOpenParms.lpstrDeviceType = "waveaudio"; mciOpenParms.lpstrElementName = ""; if (dwReturn = mciSendCommand(1, MCI_OPEN ,MCI_OPEN_ELEMENT | MCI_OPEN_TYPE,(DWORD_PTR) &mciOpenParms)) { // Failed to open device; don't close it, just return error. return (dwReturn); } // The device opened successfully; get the device ID. wDeviceID = mciOpenParms.wDeviceID; printf("Device id=%i",wDeviceID); // Begin recording and record for the specified number of // milliseconds. Wait for recording to complete before continuing. // Assume the default time format for the waveform-audio device // (milliseconds). mciRecordParms.dwTo = 10000; if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD ,MCI_TO | MCI_WAIT, (DWORD_PTR) &mciRecordParms)) { mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL); return (dwReturn); } // Play the recording and query user to save the file. mciPlayParms.dwFrom = 0; if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY ,MCI_FROM | MCI_WAIT, (DWORD_PTR) &mciPlayParms)) { mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL); return (dwReturn); } if (MessageBox(NULL ,"Do you want to save this recording?"," ", MB_YESNO) == IDNO) { mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL); return (0L); } // Save the recording to a file named TEMPFILE.WAV. Wait for // the operation to complete before continuing. mciSaveParms.lpfilename = "tempfile.wav"; if (dwReturn = mciSendCommand(wDeviceID, MCI_SAVE ,MCI_SAVE_FILE | MCI_WAIT, (DWORD_PTR) &mciSaveParms)) { mciSendCommand(wDeviceID, MCI_CLOSE, 0, (DWORD_PTR)NULL); return (dwReturn); } return (0L); return 0; }lowbyte
-
Hi
hat den keiner eine ahnung was es sein könnte ?
ich finde keinen fehler.
Ist vieleicht was mit einem kanal oder lautstärke der aufnahme ?
Das wäre das einzige was ich noch vermute.. Doch wie mache ich das.. Bzw. Hat wirklich keiner eine ahnung ? Bin am verzweifeln.dankeschon jetzt.
Lowbyte
-
Hi
Problem gelöst !
Ich habe im Bios das Mic deaktiviert, das war der grund warum ich nicht aufnehmen konnte. Warum das ein zusammenhang hat ist mir schleierhaft. Wohl weil es um den record geht .. weis auch nicht. Was sich da Lenovo und Co. gedacht haben. Oder bin ich jetzt falsch ?
lowbyte