Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows API
  4. WaveForm API

WaveForm API

Scheduled Pinned Locked Moved Windows API
debuggingjsonhelpquestion
1 Posts 1 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Bear
    wrote on last edited by
    #1

    I am trying to use the Waveform API to capture the digitized sound from the sound card. The issue I am having once I have a handle the sound card, actually receiving anything from it. Here is the pertinent code:

    while(h->running){
        //\*\*\* Start capture sound.
        memset(hWaveInHdr.lpData, '\\0', h->rate \* 2 \* sizeof(short));
        result = waveInStart(hWaveIn);
        if (result){
    

    #ifdef DEBUG
    fprintf(stderr, "Failed to start recording");
    #endif // DEBUG
    return;
    }
    //*** Wait until we have the data
    do{}while (waveInUnprepareHeader(hWaveIn, &hWaveInHdr, sizeof(WAVEHDR)) == WAVERR_STILLPLAYING);
    for(i = 0; i < hWaveInHdr.dwBytesRecorded; i++){
    ch = i % 2;
    PluginDevFifoPutW(h->channelData[ch], (sample16_t)hWaveInHdr.lpData[i]);
    if(PluginDevFifoFull(h->channelData[ch]) < h->channelData[ch]->level){
    ready = 0;
    }
    else{
    ready = 1;
    }
    }
    struct PluginDevEvent e = { 0 };
    PluginDevFifoPutE(h->parameterData[0], e);
    if(ready){
    h->callback(h->argument, PLUGINDEV_DATA, NULL);
    }
    }

    I seem to get one block of sound when I first start, but nothing after that. Any ideas what I am doing wrong? :confused:

    Thanks, Kevin (Bear)

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups