Audiosignale aufnehmen



  • Wie kann ich Audioinput von einem Mikrofon oder sowas speichern??
    MFG Desert Storm



  • Das kannst de mit mci machen, müsste.
    Hier mal nen Zitat aus dem Platform SDK:

    Recording with a Waveform-Audio Device
    The following example opens a waveform-audio device with a new file, records for the specified time, plays the recording, and prompts the user to save the recording if desired. It uses the mciSendCommand function.

    // Uses the MCI_OPEN, MCI_RECORD, and MCI_SAVE commands to record and
    // save a waveform-audio file. Returns 0L if successful; otherwise,
    // it returns an MCI error code.
    
    DWORD recordWAVEFile(DWORD dwMilliSeconds)
    {
        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(0, MCI_OPEN,
            MCI_OPEN_ELEMENT | MCI_OPEN_TYPE, 
            (DWORD)(LPVOID) &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;
    
        // 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 = dwMilliSeconds;
        if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD, 
            MCI_TO | MCI_WAIT, (DWORD)(LPVOID) &mciRecordParms))
        {
            mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
            return (dwReturn);
        }
    
        // Play the recording and query user to save the file.
        mciPlayParms.dwFrom = 0L;
        if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY,
            MCI_FROM | MCI_WAIT, (DWORD)(LPVOID) &mciPlayParms))
        {
            mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
            return (dwReturn);
        }
        if (MessageBox(hMainWnd, "Do you want to save this recording?",
            "", MB_YESNO) == IDNO)
        {
            mciSendCommand(wDeviceID, MCI_CLOSE, 0, 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)(LPVOID) &mciSaveParms))
        {
            mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
            return (dwReturn);
        }
    
        return (0L);
    }
    

    😞 Hoffe das hilft. Sonnst selber mal in der Platform SDK Dokumentation nachlesen oder deinen Freund www.google.de befragen.



  • Muss ich da noch was includen oder was anderes machen?? Weil der sagt wenn ich den Code compiliere das eine lokale Funktionsdifintion unzulässig ist. Oder am besten du schickst mir den Link mal wo du das Zitat her hast.



  • kann mir hier keiner helfen is wirklich sehr wichtig!!



  • das eine lokale Funktionsdifintion unzulässig ist.

    du solltest das copy&past nicht in ne andere funktion rein machen



  • Ich weiß nicht mehr ganz genau welche Include das sind, müssen aber alle für mci sein. Guck mal bei Google. Und halt die Funktionen über Assi einfügen und dann nur den Code kopieren, dann soltte es funzen. ist alles aus der Platform SDK Dokumentation. Das kann an sich bei Microsoft runterladen.


Anmelden zum Antworten