OpenAL 和 Vista:设备始终是“通用软件”

发布于 2024-08-29 23:24:39 字数 1479 浏览 7 评论 0原文

我正在编写游戏的音频部分,并且正在使用 OpenAL。我想使用一些扩展,但测试总是失败:

TRACE: AudioManager - Sound device: 'Generic Software'
TRACE: AudioManager - Enabling OpenAL extensions...
TRACE: AudioManager - Compressor support: NO
TRACE: AudioManager - Reverb support: YES
TRACE: AudioManager - Chorus support: NO
TRACE: AudioManager - Distortion support: NO
TRACE: AudioManager - Echo support: NO
TRACE: AudioManager - Flanger support: NO
TRACE: AudioManager - Frequency shifter support: NO
TRACE: AudioManager - Vocal morpher support: NO
TRACE: AudioManager - Pitch shifter support: NO
TRACE: AudioManager - Ring modulator support: NO
TRACE: AudioManager - AutoWAH support: NO
TRACE: AudioManager - Equalizer support: NO
TRACE: AudioManager - EAX Reverb support: YES

这是因为我只得到了通用软件驱动程序,它只支持混响和EAX混响。不仅在我的机器上,在其他机器上也是如此。

以下是我检测 OpenAL 要使用的驱动程序的方法:

ALchar device[256];
ZeroMemory(device, 256);
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"))
{
    strcpy_s(device, 256, alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER));
}
else if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
{
    strcpy_s(device, 256, alcGetString(NULL, ALC_DEVICE_SPECIFIER));
}

TRACE_AUDIOMANAGER("Sound device: '%s'", device);

g_System = alcOpenDevice(device);

根据规范,设备说明符应返回两个驱动程序:“通用硬件”和“通用软件”,并以 NULL 终止符分隔。

我的声卡是“NVIDIA High Definition Audio”设备,它使用 nvhda32v.sys 驱动程序(版本 1.0.0.63,于 2009 年 11 月 11 日更新)。

为什么 OpenAL 没有检测到我的硬件?

I'm writing the audio part of a game, and I'm using OpenAL. I want to use some extensions, but the tests always fail:

TRACE: AudioManager - Sound device: 'Generic Software'
TRACE: AudioManager - Enabling OpenAL extensions...
TRACE: AudioManager - Compressor support: NO
TRACE: AudioManager - Reverb support: YES
TRACE: AudioManager - Chorus support: NO
TRACE: AudioManager - Distortion support: NO
TRACE: AudioManager - Echo support: NO
TRACE: AudioManager - Flanger support: NO
TRACE: AudioManager - Frequency shifter support: NO
TRACE: AudioManager - Vocal morpher support: NO
TRACE: AudioManager - Pitch shifter support: NO
TRACE: AudioManager - Ring modulator support: NO
TRACE: AudioManager - AutoWAH support: NO
TRACE: AudioManager - Equalizer support: NO
TRACE: AudioManager - EAX Reverb support: YES

This is because I only get the Generic Software driver, which only supports reverb and EAX reverb. And not just on my machine, but others as well.

Here's how I detect the drivers for OpenAL to use:

ALchar device[256];
ZeroMemory(device, 256);
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"))
{
    strcpy_s(device, 256, alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER));
}
else if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
{
    strcpy_s(device, 256, alcGetString(NULL, ALC_DEVICE_SPECIFIER));
}

TRACE_AUDIOMANAGER("Sound device: '%s'", device);

g_System = alcOpenDevice(device);

According to the specification, the device specifier should return two drivers: 'Generic Hardware' and 'Generic Software', separated by a NULL terminator.

My sound card is an "NVIDIA High Definition Audio" device which is using the nvhda32v.sys driver (version 1.0.0.63, updated on 11-11-2009).

Why doesn't OpenAL detect my hardware?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

你曾走过我的故事 2024-09-05 23:24:39

OpenAL 应始终返回默认音频设备,除非您使用的是 Creative 声卡。这些扩展都是特定于 Creative 的。这与期望在 NVIDIA 显卡上获得英特尔特定的 OpenGL 扩展相同。

作为记录,以下是设置 OpenAL 的方法:

// create a default device
ALCdevice* device = alcOpenDevice("");
if (!device)
{
    LOG_ERROR("Could not create OpenAL device.");
    return false;
}

// context attributes, 2 zeros to terminate 
ALint attribs[6] = {
    0, 0
};

ALCcontext* context = alcCreateContext(device, attribs);
if (!context)
{
    LOG_ERROR("Could not create OpenAL context.");
    alcCloseDevice(device);
    return false;
}

if (!alcMakeContextCurrent(context))
{
    LOG_ERROR("Could not enable OpenAL context.");
    alcDestroyContext(context);
    alcCloseDevice(device);
    return false;
}

LOG_INFO("[OpenAL] Version: %s", alGetString(AL_VERSION));
LOG_INFO("[OpenAL] Vendor: %s", alGetString(AL_VENDOR));
LOG_INFO("[OpenAL] Renderer: %s", alGetString(AL_RENDERER));

OpenAL should always return the default audio device, unless you are using a Creative audio card. The extensions are all Creative-specific. It's the same as expecting to get Intel-specific OpenGL extension on an NVIDIA videocard.

For the record, here's how you set up OpenAL:

// create a default device
ALCdevice* device = alcOpenDevice("");
if (!device)
{
    LOG_ERROR("Could not create OpenAL device.");
    return false;
}

// context attributes, 2 zeros to terminate 
ALint attribs[6] = {
    0, 0
};

ALCcontext* context = alcCreateContext(device, attribs);
if (!context)
{
    LOG_ERROR("Could not create OpenAL context.");
    alcCloseDevice(device);
    return false;
}

if (!alcMakeContextCurrent(context))
{
    LOG_ERROR("Could not enable OpenAL context.");
    alcDestroyContext(context);
    alcCloseDevice(device);
    return false;
}

LOG_INFO("[OpenAL] Version: %s", alGetString(AL_VERSION));
LOG_INFO("[OpenAL] Vendor: %s", alGetString(AL_VENDOR));
LOG_INFO("[OpenAL] Renderer: %s", alGetString(AL_RENDERER));
我不在是我 2024-09-05 23:24:39

您确定要检查下一个字符串吗?因为 alcGetString(NULL, ALC_DEVICE_SPECIFIER) 返回字符串数组,请尝试如下操作:

char* devices = (char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
while(devices && *devices !=NULL)
{
    ALCdevice* device = alcOpenDevice(devices);
    ...
    ...
    devices += strlen(devices) + 1; //next device
}

are you sure you check the next string, because alcGetString(NULL, ALC_DEVICE_SPECIFIER) returns string array, try like this:

char* devices = (char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
while(devices && *devices !=NULL)
{
    ALCdevice* device = alcOpenDevice(devices);
    ...
    ...
    devices += strlen(devices) + 1; //next device
}
那支青花 2024-09-05 23:24:39

对于那些仍在寻找获取所有设备的方法的人//除了输出 - 仍然是通用的,适用于输入良好//

public:int* CHECK_DEVICES_IN(int MAX_DEVICES)
{ int 设备=0;
字符*设备[MAX_DEVICES];
int 检查=0;
while(设备<=MAX_DEVICES&&检查
}
检查++;
}
返回装置;
/*
返回的整数=0;
同时(返回

  public:ALchar* DEVICES_IN(int REQUIRED)
   { ALchar* result="0";
     ALchar* device=(ALchar*)alcGetString(NULL,ALC_CAPTURE_DEVICE_SPECIFIER);
     int POS=0;
     while(device && device!=NULL && strlen(device)>0 && POS<=REQUIRED)
      { if(POS==REQUIRED)
         { result=device; }
        device+=strlen(device)+1;
        POS++; 
      }
     return result;
   }

for those who are still looking for a way to get all devices //except output - stil generic, works for input well//

public:int* CHECK_DEVICES_IN(int MAX_DEVICES)
{ int devices=0;
char* device[MAX_DEVICES];
int checked=0;
while(devices<=MAX_DEVICES&&checked
}
checked++;
}
return devices;
/*
int returned=0;
while(returned

  public:ALchar* DEVICES_IN(int REQUIRED)
   { ALchar* result="0";
     ALchar* device=(ALchar*)alcGetString(NULL,ALC_CAPTURE_DEVICE_SPECIFIER);
     int POS=0;
     while(device && device!=NULL && strlen(device)>0 && POS<=REQUIRED)
      { if(POS==REQUIRED)
         { result=device; }
        device+=strlen(device)+1;
        POS++; 
      }
     return result;
   }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文