MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / SetVolume

Method SetVolume

engine/PoseidonOpenAL/WaveOAL.cpp:1552–1568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1550}
1551
1552void WaveOAL::ApplyPitch()
1553{
1554 // _pitchRatio is a pitch ratio (1.0 = native rate). Mimic 1.99
1555 // Wave8::SetFrequency exactly: map the ratio to the DirectSound
1556 // absolute-rate clamp [100, 100000] Hz against the sample's native
1557 // rate, not a naive [0.5, 2.0] ratio clamp — otherwise a low-RPM
1558 // engine sound is floored at 0.5x and vehicles jump straight to
1559 // "full rev" with no startup spin-up.
1560 if (_alSource && _state.frequency > 0 && _pitchRatio > 0.f)
1561 {
1562 alSourcef(_alSource, AL_PITCH, DX8::dsoundPitchRatio(_pitchRatio, _state.frequency));
1563 }
1564}
1565
1566void WaveOAL::SetVolume(float v, float freq, bool /*immediate*/)
1567{
1568 _volume = v;
1569
1570 // Remember the requested pitch so DoPlay re-applies it when the source
1571 // (re)starts — 1.99 stores _frequencySet and reapplies it on play

Callers 4

StartEAXPreviewMethod · 0.45
StartCategoryPreviewMethod · 0.45
StartDevicePreviewMethod · 0.45
ProcessPreviewMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected