Sample Playback And Volume

Find quick help here to get you started with Hollywood
Post Reply
oceanarts
Posts: 111
Joined: Mon May 27, 2024 10:42 pm

Sample Playback And Volume

Post 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?
Development System : Imac G5, MorphOs 3.19
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Sample Playback And Volume

Post 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).
oceanarts
Posts: 111
Joined: Mon May 27, 2024 10:42 pm

Re: Sample Playback And Volume

Post 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).
Development System : Imac G5, MorphOs 3.19
Post Reply