Page 1 of 1

Sample Playback And Volume

Posted: Tue Nov 26, 2024 6:02 pm
by oceanarts
Lifted this from the docs:

Code: Select all

Function p_PlaySound()

	local smpdata = {}
	slen = 8
	For k = 0 To 30
	For i = 0 To (slen\2)-1
		smpdata[k*slen+i] = -128
		smpdata[k*slen+i+(slen\2)] = 127
	Next
	Next
	CreateSample(1, smpdata, 6982)
	SetVolume(1, "50%"); NOT WORKING
	PlaySample(1)
EndFunction
But the default volume almost blew my eardrums, so I wanted to adjust it. But it doesn't work here.
Also, anyone else having problems playing the first defined sample if it's an .iff?

Re: Sample Playback And Volume

Posted: Tue Nov 26, 2024 11:05 pm
by Flinx
oceanarts wrote: Tue Nov 26, 2024 6:02 pm But the default volume almost blew my eardrums
Maybe you shouldn't try with a square wave signal?
But the SetVolume() works for me, I set it to 10%, and it is quieter (tested on Windows).

Re: Sample Playback And Volume

Posted: Wed Nov 27, 2024 10:33 am
by oceanarts
Flinx wrote: Tue Nov 26, 2024 11:05 pm
oceanarts wrote: Tue Nov 26, 2024 6:02 pm But the default volume almost blew my eardrums
Maybe you shouldn't try with a square wave signal?
But the SetVolume() works for me, I set it to 10%, and it is quieter (tested on Windows).
Haha! Maybe. :lol:

It only seems to mangle the sound here (Linux).