A_IsPlayingSound and S_GetMSLength
Moderator: GZDoom Developers
A_IsPlayingSound and S_GetMSLength
This originally came from a QZDoom submission. Pull request
I don't know if anything needs to be done to "secure" this on the ZScript side, to be honest I am not very experienced with ZScript scopes and what needs to go where. I would prefer this to be deterministic-compliant.
I don't know if anything needs to be done to "secure" this on the ZScript side, to be honest I am not very experienced with ZScript scopes and what needs to go where. I would prefer this to be deterministic-compliant.
Re: A_IsPlayingSound and S_GetMSLength
A bit unrelated to changes themselves. Can this be squashed to a single commit?
Diffing, blaming, bisecting fix-for-fix-for-... style history is a painful process.
IMHO it's OK for long-term feature branches but not for simple stuff.
Can't say for everyone of course, to me this is just a complication out of nowhere.
Diffing, blaming, bisecting fix-for-fix-for-... style history is a painful process.
IMHO it's OK for long-term feature branches but not for simple stuff.
Can't say for everyone of course, to me this is just a complication out of nowhere.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_IsPlayingSound and S_GetMSLength
What's the point of having A_IsPlayingSound when it actually cannot be used due to being UI scope?
Personally I'd rather leave this function out for now, I have no idea how this can be used with C/S networking like in Zandronum.
Personally I'd rather leave this function out for now, I have no idea how this can be used with C/S networking like in Zandronum.
Re: A_IsPlayingSound and S_GetMSLength
It wouldn't even work in a C/S setting unless it was strictly client-side and sounds were done purely there.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: A_IsPlayingSound and S_GetMSLength
Hello, I'm the one who submitted this. Initially, I wanted to add A_IsPlayingSound because I had no idea S_GetMSLength was available. So that half of this submission can go away.
Re: A_IsPlayingSound and S_GetMSLength
Removed A_IsPlayingSound and left S_GetMSLength.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_IsPlayingSound and S_GetMSLength
That's precisely what I thought. It is definitely better to have an opaque interface to the sound system that handles this stuff internally. That's why I changed all sound calls in the existing action functions to A_PlaySound when I scriptified it and any further additions should probably be done as new flags to that function.Rachael wrote:It wouldn't even work in a C/S setting unless it was strictly client-side and sounds were done purely there.
- Major Cooke
- Posts: 8176
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: A_IsPlayingSound and S_GetMSLength
So how does S_GetLength work?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49073
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_IsPlayingSound and S_GetMSLength
It returns the sounds length in milliseconds. Where you go from there is up to you.
- Marisa the Magician
- Posts: 3886
- Joined: Fri Feb 08, 2008 9:15 am
- Preferred Pronouns: She/Her
- Operating System Version (Optional): (btw I use) Arch
- Graphics Processor: nVidia with Vulkan support
- Location: Vigo, Galicia
- Contact:
Re: A_IsPlayingSound and S_GetMSLength
The only problem with the function is that it doesn't account for pitch shift, so you'd have to calculate the "longest" possible length when using random shift yourself.
Of course that problem doesn't exist if the sound you want to use doesn't have pitch shift.
Oh and also, for random sounds it returns the length of longest sound among them already.
The main use case I wanted this for was to have a moving actor destroy itself once it has finished playing sound.
Of course that problem doesn't exist if the sound you want to use doesn't have pitch shift.
Oh and also, for random sounds it returns the length of longest sound among them already.
The main use case I wanted this for was to have a moving actor destroy itself once it has finished playing sound.