Thread: Windows Vista and my OpenAL project

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    162

    Windows Vista and my OpenAL project

    Instead of giving a long drawn out explanation, I'm going to ask a simple question, post the code for the application, and if anyone can give me an answer that's exact and a solution I will be very extremely happy.

    I'm tired of trying to figure it out because I really just want my app to work in Vista as it has everywhere else so I can keep teaching myself other things than why the god damn operating system is ........ing me off. Thanks. :-)

    In Windows XP or Winows 2003 this captures audio coming from winamp (well any audio from anything)... in Windows Vista it does not. (it grabs the microphone) Why?

    Less important than why is how do I get this simple example to do what I'd prefer, capture system audio. The same system did it with XP, I want the same system (as any other I've tested) to do the same now with Vista.

    I've tried looping the sound back from the output to the line_in in the back with a coord that has a 3.5mm jack on each end, that is not an ideal solution.

    I've tried using a virtual audio cable application, that is not ideal either, can't share my app.

    This is my simplified application, I've posted it before on here, it serves as an example with the exact components in question.

    (I've tried replacing NULL for openDevice with everything available, nothing gives system audio... I would like to use Vistas media api but I can't find a good working example of how to implement it.)

    -lglut32 -lglu32 -lopengl32 -lwinmm -lgdi32 -lopenal32

    Code:
    #include <AL/al.h>
    #include <AL/alc.h>
    #include <iostream>
    using namespace std;
    
    const int
     SRATE = 44100,
     SSIZE = 1024;
    
    ALCdevice *alDevice;
    ALbyte  alBuffer[SRATE/2];
    ALint  alSample;
    
    short dint = 0;
    
    int main(int argc, char *argv[])
    {
      alGetError();
     alDevice = alcCaptureOpenDevice(NULL, SRATE, AL_FORMAT_STEREO16, SSIZE);
     if (alGetError() != AL_NO_ERROR)
     {
      return 0;
     }
     alcCaptureStart(alDevice);
    
     while (true)
     {
      cout << "                                                        \r";
      // ... is there a better way to clear the first line? lol. :-)
    
      alcGetIntegerv(alDevice, ALC_CAPTURE_SAMPLES, (ALCsizei)sizeof(ALint), &alSample);
      alcCaptureSamples(alDevice, (ALCvoid *)alBuffer, alSample);
    
      dint = ((((int *)alBuffer)[0] >> 0) & 0xFFFF); // Left Channel
      cout << dint << "\t";
      dint = ((((int *)alBuffer)[0] >> 16) & 0xFFFF); // Right Channel
      cout << dint << "\r";
     }
    
     alcCaptureStop(alDevice);
     alcCaptureCloseDevice(alDevice);
    
     return EXIT_SUCCESS;
    }
    Last edited by simpleid; 08-17-2007 at 03:19 PM.

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Code:
    cout << "                                                        \r";
    Maybe
    Code:
    cout<<std::endl;
    Sorry I didn't answer the original question

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    no, what i did is done intentionally. the question i asked is the only thing that matters.
    and what you should have told me if you actually saw what i was trying to do is to use...

    Code:
    fflush(stdout);
    damn it i'm going to be annoyed if i have to spend the weekend figuring out Vista's API.
    Last edited by simpleid; 08-17-2007 at 05:52 PM.

  4. #4
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    ok never mind i got the vista sdk and just digging in to winmm and all that

  5. #5
    Registered User
    Join Date
    May 2007
    Posts
    41
    AFAIK the problem is not your code, neither the OS, neither OpenAL...
    every audio card (with WDM drivers) can record audio from only one source (Microphone, Line, Wave Mix, Midi Synth ecc.)

    You can select the source in the system mixer...
    You should select Master Mix, or Wave, or something similar...

Popular pages Recent additions subscribe to a feed