QuakeServer.Sounds (quake_server v0.1.0)

Copy Markdown View Source

A sound started on the server, as FTE starts one (SVQ1_StartSound, SV_StartSound): it goes to the players as a sound message (QuakeServer.Multicast) and to the server's events as {:sound, %{entity:, channel:, name:, volume:, attenuation:, origin:, pitch:}}.

server = QuakeServer.Sounds.start(server, entity, 1, "weapons/rocket1i.wav", 1.0, 1.0)

Without :origin, a brush entity's sound (solid 4 or 22) comes from the middle of its box and is sent reliably; another entity's comes from its origin under a QuakeWorld program and from the middle of its box otherwise. A reliable sound, or one with attenuation 0, goes to every player; others to the players that may hear origin. Flag 1 (CF_SV_RELIABLE) sends reliably, flag 256 (CF_SV_UNICAST) to msg_entity's player only. A sound not precached is sent reliably after a printed warning. Volume below 0 or above 1, or a channel outside 0 to 255, is printed and dropped; an empty name is dropped.

The message is <<6, flags::little-16, entity::little-signed-32, channel::little-16, volume, attenuation::little-float-32, pitch::little-float-32, timeofs::little-float-32, x, y, z (little-float-32), name, 0>>, pitch a playback rate with 0 meaning 1.

Summary

Functions

Start name from entity on channel at volume (0.0 to 1.0) with attenuation. Options: :pitch (a rate, 0 meaning 1), :flags, :timeofs (seconds into the sound), :origin (a fixed place).

Functions

start(server, entity, channel, name, volume, attenuation, opts \\ [])

@spec start(
  QuakeServer.Server.t(),
  integer(),
  integer(),
  String.t() | nil,
  number(),
  number(),
  keyword()
) :: QuakeServer.Server.t()

Start name from entity on channel at volume (0.0 to 1.0) with attenuation. Options: :pitch (a rate, 0 meaning 1), :flags, :timeofs (seconds into the sound), :origin (a fixed place).