MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MxSetChannelVolume

Function MxSetChannelVolume

src/mixer.cpp:213–219  ·  view source on GitHub ↗

* Set volume and pan parameters for a sound. * @param mc MixerChannel to set * @param volume Volume level for sound, range is 0..16384 * @param pan Pan position for sound, range is 0..1 */

Source from the content-addressed store, hash-verified

211 * @param pan Pan position for sound, range is 0..1
212 */
213void MxSetChannelVolume(MixerChannel *mc, uint volume, float pan)
214{
215 /* Use sinusoidal pan to maintain overall sound power level regardless
216 * of position. */
217 mc->volume_left = (uint)(sin((1.0 - pan) * M_PI / 2.0) * volume);
218 mc->volume_right = (uint)(sin(pan * M_PI / 2.0) * volume);
219}
220
221
222void MxActivateChannel(MixerChannel *mc)

Callers 1

StartSoundFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected