使用OpenAL将声音输出到7.1的特定通道



all。我有一个项目,我需要通过X-Fi声音增强器卡与a/V接收器接口。A/V接收器连接到7.1扬声器系统。我想知道从开始到结束的方式,分别访问7.1通道中的每一个,这样我就可以在模拟器中指导飞机驾驶舱信息。我正在使用OpenAL,并用C编写这段代码。我已经开发了一些代码,我认为应该可以做到这一点,但我在其他6个扬声器上获得了音频。下面是我已经编写的一些代码的示例。我希望有人能在这里帮助我。

谢谢,文森特`{ALuint NorthWestSource;ALint播放状态;

switch (event)
{
    case EVENT_COMMIT:
        //Load user selected .wav file into the buffer that is initialized here, "InitBuf".
        LoadDotWavFile();        
        //Generate a source, attach buffer to source, set source position, and play sound.
        alGenSources(NumOfSources, &NorthWestSource);      
        ErrorCheck();
        //Attach the buffer that contains the .wav file's data to the source. 
        alSourcei(NorthWestSource, AL_BUFFER, WavFileDataBuffer);
        ErrorCheck();
        //Set source's position, velocity, and orientation/direction.
        alSourcefv(NorthWestSource, AL_POSITION, SourcePosition);
        ErrorCheck();
        alSourcefv(NorthWestSource, AL_VELOCITY, SourceVelocity);
        ErrorCheck();
        alSourcefv(NorthWestSource, AL_DIRECTION, SourceDirectionNorthWest);
        ErrorCheck();
        alSourcei(NorthWestSource, AL_SOURCE_RELATIVE, AL_TRUE);
        ErrorCheck();
        alSourcei(NorthWestSource, AL_CONE_INNER_ANGLE, 180);
        ErrorCheck();
        alSourcei(NorthWestSource, AL_CONE_OUTER_ANGLE, 270);
        ErrorCheck();
        SetCtrlVal(panelHandle, PANEL_SOURCEISSET, 1);
        //Play the user selected file by playing the sources.
        alSourcePlay(NorthWestSource);
        ErrorCheck();
        //Check that the .wav file has finished playing and if so clean things up.
        do
        {
            alGetSourcei(NorthWestSource, AL_SOURCE_STATE, &PlayStatus);
            if(PlayStatus != AL_PLAYING)
            {
                printf("File done playing. n");
            }//End do-while if statement
        }
        while(PlayStatus == AL_PLAYING);
        //Clean things up more before exiting out of this audio projection.
        alDeleteSources(NumOfSources, &NorthWestSource);
        ErrorCheck();
        alDeleteBuffers(NumOfBuffers, &WavFileDataBuffer);
        ErrorCheck();
        SetCtrlVal(panelHandle, PANEL_SOURCEISSET, 0);
        //alDeleteBuffers(NumOfBuffers, 
        break;
}
return 0;

}`

我遇到了同样的问题。我想给左耳或右耳播放一个音调。到目前为止,我找到的唯一方法是用声音产生一个立体声缓冲区(7.1缓冲区),然后用零覆盖另一个频道(…其他7个频道)上的信息,然后在听众面前从一个源播放。

这是我的变通方法。我知道它很笨拙。但是,如果你想留在openAL中,避免直接使用ALSA(适用于Linux)或CoreAudio(适用于Mac)进行编程,我没有找到更好的方法。

更直接地回答你的问题:不,似乎没有一种直接的说法(正如我所希望的):"3号发言人说‘你好,世界’!所有其他发言人都保持沉默。"

干杯,

farid

最新更新