/** * This function handles all "pan" input events * @param misc A string describing the desired pan action. * on Turn pan on * off Turn pan off * toogle Toogles pan mode * supertoggle Toggles pan mode and fullscreen * up Pan up * down Pan down * left Pan left * right Pan right * @todo feature: n,n Go that direction - +/- * @todo feature: ??? Go to particular point * @todo feature: ??? Go to waypoint (eg: next, named) */ void InputEvents::eventPan(const TCHAR *misc) { if (StringIsEqual(misc, _T("toggle")) || /* deprecated: */ StringIsEqual(misc, _T("supertoggle"))) TogglePan(); else if (StringIsEqual(misc, _T("on"))) SetPan(true); else if (StringIsEqual(misc, _T("off"))) SetPan(false); else if (StringIsEqual(misc, _T("up"))) if (IsHP31X()) // Scroll wheel on the HP31x series should zoom in pan mode sub_ScaleZoom(1); else sub_PanCursor(0, 1); else if (StringIsEqual(misc, _T("down"))) if (IsHP31X()) // Scroll wheel on the HP31x series should zoom in pan mode sub_ScaleZoom(-1); else sub_PanCursor(0, -1); else if (StringIsEqual(misc, _T("left"))) sub_PanCursor(1, 0); else if (StringIsEqual(misc, _T("right"))) sub_PanCursor(-1, 0); XCSoarInterface::SendMapSettings(true); }
status_t GameSoundBuffer::SetAttributes(gs_attribute * attributes, size_t attributeCount) { status_t error = B_OK; for (size_t i = 0; i < attributeCount; i++) { switch(attributes[i].attribute) { case B_GS_GAIN: error = SetGain(attributes[i].value, attributes[i].duration); break; case B_GS_PAN: error = SetPan(attributes[i].value, attributes[i].duration); break; case B_GS_LOOPING: fLooping = bool(attributes[i].value); break; default: break; } } return error; }
void InputEvents::TogglePan() { const GlueMapWindow *map_window = CommonInterface::main_window.ActivateMap(); if (map_window == NULL) return; SetPan(!map_window->IsPanning()); }
void InputEvents::LeavePan() { const GlueMapWindow *map_window = CommonInterface::main_window.GetMapIfActive(); if (map_window == NULL) return; SetPan(false); }
Channel::Channel() { resampler = 0; SetRate(1); SetVolume(SDL_MIX_MAXVOLUME); oldvolume = 0; SetPan(0.5f); done = true; stopping = false; stream = 0; }
int Pan::Set(char* mess, float value){ switch(FindMsg(mess)){ case 21: SetPan(value); return 1; default: return SndObj::Set(mess, value); } }
/*virtual*/ void SoundInstanceCommon::Tick3D() { DEBUGASSERT(GetSound()->GetIs3D()); const Sound3DListener* const pListener = Get3DListener(); DEVASSERT(pListener); Vector DirectionToSound; float DistanceToSound; float OneOverDistanceToSound; const Vector SoundLocation = GetLocation(); const Vector OffsetToSound = SoundLocation - pListener->GetLocation(); OffsetToSound.GetNormalized(DirectionToSound, DistanceToSound, OneOverDistanceToSound); const float FalloffRadius = m_Sound->GetFalloffDistance(); const float MinimumAttenuation = m_Sound->GetMinimumAttenuation(); DEVASSERT(FalloffRadius > 0.0f); // Set pan based on distance and direction. const float PanBias = m_Sound->GetBiasedPan(DistanceToSound); const float PanCosTheta = pListener->GetRight().Dot(DirectionToSound); // This is a little bit of fakery; further attenuate sounds behind the // listener. const float Surround = pListener->GetForward().Dot(DirectionToSound); float RearAttenuation = Saturate((-Surround * PanBias)); RearAttenuation = 1.0f - (RearAttenuation * m_Sound->GetRearAttenuation()); // Set attenuation based on distance and rear attenuation m_Attenuation = FalloffRadius / (FalloffRadius + DistanceToSound); m_Attenuation *= RearAttenuation; if (m_Attenuation >= MinimumAttenuation) { pListener->ModifyAttenuation(this, m_Attenuation); } if (m_Attenuation < MinimumAttenuation) { m_Attenuation = 0.0f; } else { // Don't bother setting the pan unless we'll hear it! const float PanPow = SignedPow(PanCosTheta, m_Sound->GetPanPower()); const float Pan = PanPow * PanBias; SetPan(Pan); } }
bool SetTrackAudioCommand::ApplyInner(const CommandContext & context, Track * t ) { static_cast<void>(context); auto wt = dynamic_cast<WaveTrack *>(t); auto pt = dynamic_cast<PlayableTrack *>(t); if( wt && bHasGain ) wt->SetGain(DB_TO_LINEAR(mGain)); if( wt && bHasPan ) wt->SetPan(mPan/100.0); // These ones don't make sense on the second channel of a stereo track. if( !bIsSecondChannel ){ if( pt && bHasSolo ) pt->SetSolo(bSolo); if( pt && bHasMute ) pt->SetMute(bMute); } return true; }
Channel::Channel() { SetRate(1); SetVolume(SDL_MIX_MAXVOLUME); SetPan(0.5f); }
AudioChannelImpl() { SetRate(1); SetVolume(SDL_MIX_MAXVOLUME); SetPan(0.5f); }