Method: FMOD::ChannelControl#pan

Defined in:
lib/fmod/channel_control.rb

#pan(pan) ⇒ self

Sets the pan level, this is a helper to avoid setting the #matrix.

Mono sounds are panned from left to right using constant power panning (non-linear fade). This means when pan = 0.0, the balance for the sound in each speaker is 71% left and 71% right, not 50% left and 50% right. This gives (audibly) smoother pans.

Stereo sounds heave each left/right value faded up and down according to the specified pan position. This means when pan is 0.0, the balance for the sound in each speaker is 100% left and 100% right. When pan is -1.0, only the left channel of the stereo sound is audible, when pan is 1.0, only the right channel of the stereo sound is audible.

Parameters:

  • pan (Float)

    The desired pan level.

    • Minimum: -1.0 (left)

    • Maximum: 1.0 (right)

    • Default: 0.0 (center)

Returns:

  • (self)


748
749
750
751
# File 'lib/fmod/channel_control.rb', line 748

def pan(pan)
  FMOD.invoke(:ChannelGroup_SetPan, self, pan.clamp(-1.0, 1.0))
  self
end