// Begin playing audio from the specified stream bool MHIContext::BeginAudio(const QString &stream, int tag) { LOG(VB_MHEG, LOG_INFO, QString("[mhi] BeginAudio %1 %2").arg(stream).arg(tag)); int chan = GetChannelIndex(stream); if (chan < 0) return false; if (chan != m_currentStream) { // We have to tune to the channel where the audio is to be found. // Because the audio and video are both components of an MHEG stream // they will both be on the same channel. m_currentStream = chan; m_audioTag = tag; return TuneTo(chan, kTuneKeepChnl|kTuneQuietly|kTuneKeepApp); } if (tag < 0) return true; // Leave it at the default. else if (m_parent->GetNVP()) return m_parent->GetNVP()->SetAudioByComponentTag(tag); else return false; }
static void InitHrtfPanning(ALCdevice *device) { static const enum Channel CubeChannels[MAX_OUTPUT_CHANNELS] = { UpperFrontLeft, UpperFrontRight, UpperBackLeft, UpperBackRight, LowerFrontLeft, LowerFrontRight, LowerBackLeft, LowerBackRight, InvalidChannel, InvalidChannel, InvalidChannel, InvalidChannel, InvalidChannel, InvalidChannel, InvalidChannel, InvalidChannel }; static const ChannelMap Cube8Cfg[8] = { { UpperFrontLeft, { 0.176776695f, 0.072168784f, 0.072168784f, 0.072168784f } }, { UpperFrontRight, { 0.176776695f, 0.072168784f, -0.072168784f, 0.072168784f } }, { UpperBackLeft, { 0.176776695f, -0.072168784f, 0.072168784f, 0.072168784f } }, { UpperBackRight, { 0.176776695f, -0.072168784f, -0.072168784f, 0.072168784f } }, { LowerFrontLeft, { 0.176776695f, 0.072168784f, 0.072168784f, -0.072168784f } }, { LowerFrontRight, { 0.176776695f, 0.072168784f, -0.072168784f, -0.072168784f } }, { LowerBackLeft, { 0.176776695f, -0.072168784f, 0.072168784f, -0.072168784f } }, { LowerBackRight, { 0.176776695f, -0.072168784f, -0.072168784f, -0.072168784f } }, }; static const struct { enum Channel Channel; ALfloat Angle; ALfloat Elevation; } CubeInfo[8] = { { UpperFrontLeft, DEG2RAD( -45.0f), DEG2RAD( 45.0f) }, { UpperFrontRight, DEG2RAD( 45.0f), DEG2RAD( 45.0f) }, { UpperBackLeft, DEG2RAD(-135.0f), DEG2RAD( 45.0f) }, { UpperBackRight, DEG2RAD( 135.0f), DEG2RAD( 45.0f) }, { LowerFrontLeft, DEG2RAD( -45.0f), DEG2RAD(-45.0f) }, { LowerFrontRight, DEG2RAD( 45.0f), DEG2RAD(-45.0f) }, { LowerBackLeft, DEG2RAD(-135.0f), DEG2RAD(-45.0f) }, { LowerBackRight, DEG2RAD( 135.0f), DEG2RAD(-45.0f) }, }; const ChannelMap *chanmap = Cube8Cfg; size_t count = COUNTOF(Cube8Cfg); ALuint i; SetChannelMap(CubeChannels, device->Dry.Ambi.Coeffs, chanmap, count, &device->Dry.NumChannels, AL_TRUE); device->Dry.CoeffCount = 4; memcpy(&device->FOAOut.Ambi, &device->Dry.Ambi, sizeof(device->FOAOut.Ambi)); device->FOAOut.CoeffCount = device->Dry.CoeffCount; for(i = 0;i < device->Dry.NumChannels;i++) { int chan = GetChannelIndex(CubeChannels, CubeInfo[i].Channel); GetLerpedHrtfCoeffs(device->Hrtf, CubeInfo[i].Elevation, CubeInfo[i].Angle, 1.0f, 0.0f, device->Hrtf_Params[chan].Coeffs, device->Hrtf_Params[chan].Delay); } }
// Begin displaying video from the specified stream bool MHIContext::BeginVideo(const QString &stream, int tag) { LOG(VB_MHEG, LOG_INFO, QString("[mhi] BeginVideo %1 %2").arg(stream).arg(tag)); int chan = GetChannelIndex(stream); if (chan < 0) return false; if (chan != m_currentStream) { // We have to tune to the channel where the video is to be found. m_currentStream = chan; m_videoTag = tag; return TuneTo(chan, kTuneKeepChnl|kTuneQuietly|kTuneKeepApp); } if (tag < 0) return true; // Leave it at the default. else if (m_parent->GetNVP()) return m_parent->GetNVP()->SetVideoByComponentTag(tag); return false; }