Skip to content

ChannelRange

Narta Xaymar Dirks edited this page Dec 2, 2026 · 1 revision

ChannelRange BlitzLLVM

ChannelRange:Void channel:Int32, near:Float32, far:Float32
Parameter Mode Type Default Description
channel In Int32 required A channel handle from EmitSound.
near In Float32 required Up to this distance, in units of the world, the sound plays at full volume. 0 starts the falloff at the source, as without a range.
far In Float32 required From this distance on, in units of the world, the sound is silent. 0 is no end: the sound falls off forever, as without a range. Otherwise it has to be past near.

Description

BlitzLLVM This command does not exist in the original Blitz products. BlitzLLVM adds it.

Gives one 3D sound a range: it plays at full volume up to the near distance, falls off between the two, and is silent from the far distance on. It can be called while the sound plays and is heard from the next update. This is a BlitzLLVM extension.

Differences

  • Between the two, the falloff curve of the channel (SetChannelFalloff) and the rolloff of the listener (ListenerRolloff) still decide how the volume falls: the curve starts at near instead of at the source, and is scaled so that it reaches silence exactly at far, so the sound fades out instead of cutting off. With a rolloff of 0 it fades linearly from near to far. ListenerDistance changes how many meters a unit is for the curve, not where the range ends.
  • A channel starts with the range of its sound (SoundRange); 0, 0 (the default) is no range. Distances below 0, or a far distance that is not past the near one, are a runtime error. A channel that is over is ignored, and so is a channel of PlaySound, which does not come from anywhere.
  • Sample of a source that moves away from 1 to 61 meters in two seconds with ChannelRange c, 5, 40 (doppler off, rolloff 1), recorded with tools/render_falloff_samples.py: range_new.ogg. Compare falloff_new.ogg without a range.

Examples

; A campfire that is loud up close and can't be heard past 40 units.
fire = EmitSound(crackle, campfire)
ChannelRange fire, 3, 40

Related Commands

ChannelDoppler BlitzLLVM, ChannelRadius BlitzLLVM, GetChannelDoppler BlitzLLVM, GetChannelFalloff BlitzLLVM, GetChannelRadius BlitzLLVM, GetChannelRangeFar BlitzLLVM, GetChannelRangeNear BlitzLLVM, SoundRange BlitzLLVM

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally