CustomSounds Wish List

An area for discussing new ideas and additions to Oolite.

Moderators: winston, another_commander

User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Actually I think this is a code issue. Customsounds are played by fairly lazy code, and no check is later made to see if they're still playing when a 'cancel' effect happens.

I should change that.
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

For a “cancel” to work well and generally, stuff that needs to be cancelled should be moved to using OOSoundSource.
User avatar
aegidian
Master and Commander
Master and Commander
Posts: 1161
Joined: Thu May 20, 2004 10:46 pm
Location: London UK
Contact:

Post by aegidian »

Mmm. I was looking for an [OOSound stop] implementation but couldn't see how to code it using mixers etc.

Give an old man a pointer?
"The planet Rear is scourged by well-intentioned OXZs."

Oolite models and gear? click here!
User avatar
Draco_Caeles
Dangerous
Dangerous
Posts: 105
Joined: Sat Apr 15, 2006 11:40 pm
Location: North-west England

Post by Draco_Caeles »

Could you not just set the volume of a particular sound effect to zero, let it play out, then housekeep as necessary?

When I'm writing code, every SFX is an instance of a type (struct?) which just contains a pointer to the channel number of the SFX. In each refresh cycle that type list is iterated, and any channels which are no longer playing are cleared up.

Is that a possibility?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Draco_Caeles wrote:
Could you not just set the volume of a particular sound effect to zero, let it play out, then housekeep as necessary?
The thing here is separation of the sound itself, i.e. a series of samples, and an instance of that sound. For instance, an OXP could set several different events to use the same sound, in which case only one copy of that sound would be loaded. Also, an unlucky player might be hearing several weapon hits at once.

The old NSSound and FMOD sound implementations didn’t make this distinction. The new Mac sound code does; an OOSound represents the sample buffer, and an OOSoundSource represents an instance of a sound (with an associated position, although this isn’t currently used). The old way of doing things, by sending -play messages directly to an OOSound, works for legacy compatibility. To do much beyond that, such as stopping a given instance of a sound, requires explicit use of an OOSoundSource. When implemented, looping and individual volume control should be controlled through the OOSoundSource, too. (Actually, simple looping is implemented in OOSoundSource, but inelegantly.)

OOSoundSources are supported by the SDL sound code, but not very well. Fixing this shouldn’t be too hard. I really ought to do that; I’ll try to get the mac-SDL build working again.
User avatar
Draco_Caeles
Dangerous
Dangerous
Posts: 105
Joined: Sat Apr 15, 2006 11:40 pm
Location: North-west England

Post by Draco_Caeles »

Ahh, I see. Difference in the way languages handle sounds.

The one I use, each sample is loaded and given a handle. When you want to play that sound, you play it through a channel, which has its own handle. So you're clearing up behind the channel handle, not that actual sound handle. Each sound is loaded once but can be referenced many times at once.

I'll shut up now. :)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Not really about languages, but about terminology. The OOSoundSource can be thought of as a channel, although in actuality it dynamically grabs a mixer channel behind the scenes as necessary.
milinks
Deadly
Deadly
Posts: 164
Joined: Sun Jun 27, 2004 9:19 pm

Post by milinks »

Having another go at the source code today to increase the amount of sounds options, hopefully will be sending Giles, something that works tomorrow for him to look at.

Edit:

just a thought, ive put a customsound and screen notification for hyperspeed jump activated, to work alongside the mass-locked sound and notification. I'm going through the list on this post, but if people have thought of where they want a customsound or notification and havent put it on can you let me know so i can include it etc before i pass it to Giles to scrutinize please
milinks
Deadly
Deadly
Posts: 164
Joined: Sun Jun 27, 2004 9:19 pm

More CustomSounds

Post by milinks »

Ive tinkered some more this morning and added customsounds to all the GUI screens, jumpspeed on and a few others. The source compiles fine and there aren't any clashes with my butchering the source code :) so I'll just have to see what Giles thinks. If they pass the Giles test then I'll do some more. The Source that ive worked on is the latest, updated this morning before i messed about with it just for info
milinks
Deadly
Deadly
Posts: 164
Joined: Sun Jun 27, 2004 9:19 pm

Just a thought

Post by milinks »

Having completed the customsounds for the GUI screens, and other bits n pieces, such as pause and options etc, ive been looking at the Government system. Initially, a vey basic idea, of splitting down each of the government levels, such as democracy, anarchy etc, and writing a small script in the source which would allow events once each of the government levels is triggered, such as entering a system of a given government level. Dajts idea is the crux behind this, but obviously it has to be written into the source, which i'm looking at experimenting with. Does anyone have ideas in relation to this or advice as to how to go about it. (Giles, has enough to be getting on with, so this is mainly directed at others). I have no illusions as to my abilities, but i am, believe it or not quite enjoying looking through the source code, and how it is structured, call it practice for me :) and if something comes of it..well all the better.
User avatar
Rxke
Retired Assassin
Retired Assassin
Posts: 1760
Joined: Thu Aug 12, 2004 4:54 pm
Location: Belgium

Post by Rxke »

I encountered another hiccup (latest OXP with the extra mini-update)

Code: Select all

Refusing to load auto_on.ogg because its uncompressed size is over 4194304 bytes.
re: coding, nice to see you so enthousiastically attacking it, only moments ago, I sat back and thought "wow, milinks' oxp has really changed the atmosphere big time!"

re: coding and setting up an experimental branch, Winston's probably the coding-guru to talk to...
milinks
Deadly
Deadly
Posts: 164
Joined: Sun Jun 27, 2004 9:19 pm

Post by milinks »

Thanks for that Rxke. Yeah there are a few gliches with the customsounds.oxp in relation to the size of some, another issue is the way that i used keypresses to trigger sounds, such as space flight and auto docking etc. I wanted to give an example of how ambient music would be, and at the time there wasnt other ways to do it, other than making some of the sound files quite long, so that it gave the impression of ambient music, rather than being triggered by a given action such as auto on etc.

Ive added quite a lot of customsounds options to the code, and sent Giles a small sample of the source that i altered. I dont want to do loads of stuff, only to find that it isnt the way that Giles wants it to be done, or it impacts on other ideas etc. So i'm just waiting to see if Giles is ok with what ive done, and if so, then I'm gonna send Giles the full monty and then i can put up a well thought out OXP rather than just adding bits n pieces etc. This would mean that each individual sound file being smaller, avoiding the problems at the mo.
Post Reply