全部。我有一个项目需要通过 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;
}`