Skip to content

About

SA:MP ASI mod to control server audio stream volume

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AudioStreamVolume

English | Português

An ASI mod for SA:MP that lets you control the volume of audio streams played by the server (PlayAudioStreamForPlayer) with the /vl command, without touching the game's own sounds.

Compatibility

SA:MP version Status
0.3.7 R1 Tested, working
0.3.7 R3 / R4 Not tested
0.3.7 R2, R5, 0.3.DL Not supported

You need an ASI Loader installed (CLEO and SAMPFUNCS already include one).

Installation

  1. Download AudioStreamVolume.asi from Releases.
  2. Copy it to your GTA San Andreas folder, next to samp.exe.
  3. Join a server. The chat will show: [AudioStream] Active! Volume: 100% - use /vl (0-100)

AudioStreamVolume.ini is created automatically on first run.

Usage

Command Action
/vl 50 Sets the audio stream volume to 50%
/vl 0 Mutes the audio stream
/vl Shows the current volume

The final volume is the game's radio volume multiplied by the /vl percentage. 3D distance falloff and muting when the game window loses focus keep working as normal.

Configuration

[General]
; Idioma / Language: pt = Portugues, en = English
Language=en

[AudioStream]
; Volume dos audio streams do servidor (0-100). Tambem pode ser alterado com /vl
; Server audio stream volume (0-100). Can also be changed with /vl
Volume=100

[Log]
; 0 = desativado / disabled, 1 = ativado / enabled (AudioStreamVolume.log)
Enabled=0
  • Language: pt or en. If empty or invalid, the Windows language is used.
  • Volume: 0 to 100. Updated automatically when you use /vl.
  • Enabled: 1 writes AudioStreamVolume.log next to the .asi, which is useful for reporting problems.

You can edit the file with the game open; changes are applied within half a second.

How it works

SA:MP plays audio streams with BASS (bass.dll). Its stream thread runs a loop every 20 ms that calls BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, volume) with the game's radio volume, so any volume set from outside is overwritten right away.

The mod finds that loop in samp.dll memory by pattern (push 5; call ...; push 14h; call Sleep), follows the call to SA:MP's internal BASS thunk and redirects it to its own function. That function scales the value by the /vl percentage and then calls the real BASS_SetConfig. This is a single 5-byte patch, with no hooking library.

Credits

Development by Shazanxz - github.com/Shazanxz

License

All rights reserved. You may view the code and use the official release for personal play. Copying, modifying, rewriting, reusing, redistributing or selling any part of this project requires prior written permission from the author. See LICENSE and contact Shazanxz.

About

SA:MP ASI mod to control server audio stream volume

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages