コード例 #1
0
/**
 * 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);
}
コード例 #2
0
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;	
}
コード例 #3
0
void
InputEvents::TogglePan()
{
  const GlueMapWindow *map_window = CommonInterface::main_window.ActivateMap();
  if (map_window == NULL)
    return;

  SetPan(!map_window->IsPanning());
}
コード例 #4
0
void
InputEvents::LeavePan()
{
  const GlueMapWindow *map_window =
    CommonInterface::main_window.GetMapIfActive();
  if (map_window == NULL)
    return;

  SetPan(false);
}
コード例 #5
0
ファイル: mixer.cpp プロジェクト: Achilleshiel/OpenRCT2
Channel::Channel()
{
	resampler = 0;
	SetRate(1);
	SetVolume(SDL_MIX_MAXVOLUME);
	oldvolume = 0;
	SetPan(0.5f);
	done = true;
	stopping = false;
	stream = 0;
}
コード例 #6
0
ファイル: Pan.cpp プロジェクト: alltom/taps
int
Pan::Set(char* mess, float value){

	switch(FindMsg(mess)){

	case 21:
	SetPan(value);
	return 1;

	default:
	return SndObj::Set(mess, value);

	}

}
コード例 #7
0
/*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);
  }
}
コード例 #8
0
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;
}
コード例 #9
0
ファイル: mixer.cpp プロジェクト: 1337Noob1337/OpenRCT2
Channel::Channel()
{
	SetRate(1);
	SetVolume(SDL_MIX_MAXVOLUME);
	SetPan(0.5f);
}
コード例 #10
0
ファイル: AudioChannel.cpp プロジェクト: CraigCraig/OpenRCT2
 AudioChannelImpl()
 {
     SetRate(1);
     SetVolume(SDL_MIX_MAXVOLUME);
     SetPan(0.5f);
 }