Jump to content
Eternal Lands Official Forums
Torg

Major NEW_SOUND update - EL gets a (complete?) sound system

Recommended Posts

NEW_SOUND is now considered BETA quality - It works, most of the time on Linux, Windows and Mac. \o/.

Thanks to Kibora and Florian for initially testing those systems. Thanks to them and all the others who have helped since!

 

There are several steps you need to take to experience this new sound system.

Firstly (for now), you need to be able to compile your own client enabling the OGG_VORBIS and NEW_SOUND defines. Keep in mind you also need to upgrade to the next version of Cal3d (search the forums for more info).

 

Roja will be producing some test clients for people unable to compile their own client in the next few days. Please just be patient.

 

Secondly, you need to download these packages to use it:

Most of the sounds for this config can be found in Erdie's full sound archive file: http://www.erdie.de/el/fullpack.tar. More info on his sounds in this thread.

The additional temporary sounds for my config can be found here: http://ian.grug.redirectme.net/el/new_sound4.zip

The config files: (right mouse click and select "Save File As...")

http://ian.grug.redirectme.net/el/sound_config.xml

http://ian.grug.redirectme.net/el/mapsfx_c1.xml

 

All files need to be installed into the /sounds/ sub-directory of your EL client directory.

 

Thirdly, you need to adjust your actor definition files to hear the actor (character/creature) sounds. I will re-host my updated sets when I get the time. If you don't wish to wait for actor sounds then download this pack and this pack and extract the actor defs. You can also look through this thread for the changes to the format (if I posted them, I don't remember now).

 

This package is being provided as a demonstration of what the system is capable, or will be capable of doing when complete. There are limited sounds included, they aren't at all tuned or balanced, and there is limited configuration. There may also be bugs.

 

If you download and use this, please report any bugs you find. However, I do ask that you check if a bug has been reported already. I will try to maintain a list of known and fixed bugs on this front page.

 

Warning! If you do not know what to do with this, do not ask outside of the Official NEW_SOUND Help thread. Also note that if you report a bug that is related to this package anywhere other than in -this- thread, or one related to you breaking your client install because of incorrectly using this package, then you may be banned from the forums (for being n00b and wasting the dev's time). Be careful and always backup your client.

You have been warned!

 

This is almost release ready. As you can see, lots of the features are already implemented and ready for testing. Some of the stuff planned is listed here. If you have ideas, feel free to contribute them to the discussion, but they may or may not be implemented.

 

Things marked (code) are code based things I am planning/fixing. Things marked (Roja) are content related so are her domain and responsibility. She has final say over what does and doesn't go into the client and will be coordinating the creation of sounds and configuration.

 

 

Completed features

(code) Done. Config set gain for each sound

(code) Done. Bug fixes

(code) Done. Fading in and out of streams (background and music) when moving in and out of areas

(code) Done. More bug fixes

(code) Done. Even more bug fixes

(code) Done. Background crowd sounds, increasing based on the number of actors

(code) Done. Reworking loading sounds to load sounds into buffers first, and sources only when needed

(code) Done, but with the occasional bug. Handle locking and unlocking the list of sources properly

(code) Done. Default background sounds and crowd effects for when nothing else is defined

(code) Done. Support for non-enhanced actor sounds (With the new config and sounds, go and fight a wolf)

(code) Done. Crazy amounts more bug fixes

(code) Done. Defaults per map (With the new config, VotD should have different defaults to the other maps)

(code) Done. Store sound id's rather than names when loading actor defs

(code) Done, but very basic. Walking sounds based on the map tile. Extended to support all creatures.

(code) Done. Inventory window sounds

(code) Done. Server connected and other login type errors

(code) Done, but optional as its experimental. Dulling down sounds when its raining hard.

(code) Done. Change particle sounds to map object sounds. Implemented as still particle sounds, but with a

check for existing sounds within the same area.

(code) Done. Handle stopping, but not unloading map object sounds (loaded on map load) correctly.

(code) Done. Walking sounds tile check in update_sound

(code) Done. Expanding "types" of sounds available and adjusting EL configuration to allow more flexibility

(code) Done. Individual volume controls for different types of sounds

(code) Done. Walking sounds based on creature size (config value)

(code) Done. Checking stats of sound card for available sources etc

(code) Done. Fading music up and down when entering or leaving a map

(code) Done. Fading backgrounds up when moving into area

(code) Done. Multiple overlapping background streams

(code) Done. Overlapping the default background and crowd sounds

(code) Done. Sharing sources between "instant" sounds and streamed sounds/music

(code) Done. Sounds for when you are effected by a spell (poison etc)

(code) Done. Client hud sounds (clicking on icons/buttons/closing windows etc)

(code) Done. Gain control for item/inventory sounds

(code) Done. "Death" sounds for player actors (non-enhanced actors can use the existing cal_die1&2 frames)

(code) Done. Review the searching for a free buffer code in ensure_sound_loaded

(code) Done. Missing files aren't handled nicely

(code) Done. Remove added sounds that time out because they haven't been played fast enough (2 secs?)

(code) Done. Add internal point maths to background sound

(code) Done. Parse configuration of background sounds and validate

(code) Done. Sounds triggered on text messages from the server (user configured)

(code) Done. Multiple sounds linked to a single action, played back randomly for variety

(code) Done. Occasionally triggered battle cry type sounds

(code) Done. Map change only removing map and looping sounds so teleports etc play out correctly

 

 

Todo list: - They might not all end up in the next release

(code) Config data stored dynamically in memory

(code) Final huge batch of bug fixes

 

Possible later additions:

(code) Review update_sound (possibly parse sounds_list instead of the sources directly)

(code) Multiple crowd sounds to make the sound bigger. Multiple crowd sounds are possible, but not coded based on crowd size

(code) User configurable sound card. Currently incomplete

(code) Fighting sounds not linked to swords etc in config, but checking both actors outfit for correct sounds at playback. This may slow the client down lots so I'll leave it for now.

(code) Sounds played at a slightly random time, to avoid the "fighting rap". This might be solved with just some nicer fighting sounds, and different lengths and variety

(code) Manufacturing window sounds. This might not be sensible, depending on the order and timing of server messages

(code) Door opening sound for actual doors only, not cave entrances, etc. This might not be possible depending on handling server response.

(code) Handling stereo sources correctly (limiting access to other sources when in use). I can't find much info on this yet

 

 

 

Known bugs:

- Crowd sounds don't react perfectly This is a very low priority as they are ok as they are

 

 

 

Fixed bugs:

- Low Alut version bug - Thanks florian

- My n00b brain processes, trying to explain all this - Thanks kibora

- Music / streams only starting to play. This was due to me passing the gain as an int, not float. - Thanks kibora

- Streams didn't fade out correctly.

- Static particles systems don't seem to work if you don't spawn next to them.

- Fountains don't seem to work at all.

- Teleport in sounds only work sometimes.

- Distances to and from static particle systems unbalanced.

- (This should be fixed with the most recent changes) Random seg fault in update sound when loading the client. Caused when the "currently playing buffer" is returned, but I assume the sound has actually finished and something wasn't updated correctly.

- SegAbrt/Fault when closing the client.

- Disabling sound, causes a Seg Fault (related to above).

- Changing sound options doesn't take effect until the individual sounds finish.

- Sometimes some of the Ogg files don't play.

- Sometimes some of the Ogg files get corrupt (or something) when playing and make horrible noises.

- Changing the options for music and sound on and off lots gets some settings out of sync.

- Not really a bug, but consolidated a *lot* of the streams code. Probably fixed a bunch of bugs in doing so... probably also created lots of new ones.

- Fixed the code to remove sounds when changing maps (again).

- Reduced the frequency of checks for background and crowd sounds (to reduce processor load).

- Fixed possible bugs with loading Ogg files that don't fit into the buffer.

- Fixed problems with gain

- Hopefully fixed the problem with Ogg Vorbis libs under Windows. If Dev-C++ causes problems, then we'll need to upgrade the libs to v1.2 (Joy).

- Background sounds stopping after being played once.

- Fades not working for crowd sounds (not the best algorithm for it, but it will do).

- Occasional crashes when closing the client due to streams trying to update (hopefully fixed... it didn't crash when I was testing the crowd sounds).

- Sound 0 trying to be played.

- "Your" actor sounds coming from odd places.

- Streams continue after being disconnected

- Issues with particles such as fireplaces overloading the system.

- Loaded_sound array gets corrupt and *will* crash the client frequently.

- Problems with stopping and unloading sounds correctly.

- Issues with map-walking in console, or anything where you move, but the camera isn't updated. All the sounds back up, just like the graphics used to. The generally will cause a mutex crash.

- Walking sounds are broken because of the hack to get the code stable again

- Initial volume of rain when changing maps is full

- Device is captured even with sound and music disabled

- 8 fireplaces and a teleport in Portland storage!*

- Starting/stopping sounds/music isn't clean anymore

- Some issues with locking and unlocking sounds (usually seen when fighting)

- Time_of_day flags for when sounds are/aren't played don't work correctly

- Fountains and waterfalls stop when moving away rather than fading out.

- Not starting pre-existing sounds correctly when sound is enabled

- Backgrounds not fading down anymore

- Sometimes walking sounds get "stuck"

- NEW_WEATHER rain sound starts prematurely - this is a bug in NEW_WEATHER.

- Clicking anywhere on the hud (not just the icons) produces the "Icon Click" sound.

- Dulling sounds when raining affects gain incorrectly sometimes. Seems to work ok now

- Overloading the loaded buffers is a nasty crash. The code is also a mess. Joy.

- Turning off sound (or closing the client) crashes the Windows client

- Client and inv/item sounds are faded with rain

- Windows and Mac clients suffer from streams getting stuck and repeating

- Sounds aren't cleaned up when disabled

- Buffer creation problems under Windows

- Rain sounds don't stop/fade when visuals do

 

 

 

* Particle effects are used multiple times and mixed alot to get effects, so hooking sounds to them isn't ness. the best method. The problem with using map objects, is they don't define if someone has lit a fire or not. It will take a little time. Eventually decided to put a check for sounds within the same area and only load 1.

 

 

.

Edited by Torg

Share this post


Link to post
Share on other sites

Well, it compiles w/o problems :pinch:

 

But I can't link it:

_alutGetError

_alutGetErrorString

I have 0ctane's OpenAL package which is OpenAL 1.0 iirc. Are those functions from OpenAL 1.1?

 

/EDIT

quick hack to fix this:

Index: sound.c
===================================================================
RCS file: /cvsroot/elc/elc/sound.c,v
retrieving revision 1.120
diff -u -d -p -r1.120 sound.c
--- sound.c	 7 Aug 2007 15:22:14 -0000	   1.120
+++ sound.c	 7 Aug 2007 17:01:23 -0000
@@ -2310,7 +2310,9 @@ int ensure_sample_loaded(int index)
					{
							// Couldn't load the file
	#ifdef ELC
+  #if defined alutGetErrorString && alutGetError
							LOG_ERROR("%s: %s", snd_buff_error, alutGetErrorString(alutGetError()));
+  #endif
	#else
	#ifdef  ALUT_WAV
							printf("ensure_sample_loaded : alutLoadWAVFile(%s) = %s\n",	 szPath, "NO SOUND DATA");

 

/EDIT2

:o

nice stereo effects :icon13:

the sounds definitely need some fine tuning, but wow :w00t:

Edited by Florian

Share this post


Link to post
Share on other sites

But I can't link it:

_alutGetError

_alutGetErrorString

I have 0ctane's OpenAL package which is OpenAL 1.0 iirc. Are those functions from OpenAL 1.1?

Those functions are from Alut, but I've no idea what version. Alut is way behind on Mac which is why some of us are trying to move to completely ogg format. This is a step in the right direction as we now have an ogg loader, and Roja is creating the sounds as oggs (there are however still some wav files in my test package).

 

Anyways, thanks. I've committed a slightly modified version of your code so it should compile and link under Mac now.

 

/EDIT2

:(

nice stereo effects :)

the sounds definitely need some fine tuning, but wow :D

Thanks. I didn't make any of the sounds, I just created a config system and code to load and play them.

Share this post


Link to post
Share on other sites

Your post is a little confusing. Should both NEW_SOUND and OGG_VORBIS be defined or only OGG_VORBIS?

 

Edit: Anyway compiled with OGG_VORBIS only and i don't hear anything on windows

Edited by kibora

Share this post


Link to post
Share on other sites

/EDIT: Oh... I just noticed what you got confused about. NO_SOUND should have been NO_MUSIC. There is no define called NO_SOUND. Thanks, I have fixed that now. Damn brain.

 

Your post is a little confusing. Should both NEW_SOUND and OGG_VORBIS be defined or only OGG_VORBIS?
You must compile your own client with NEW_SOUND and OGG_VORBIS in order to use this package.

Well I thought this bit was kinda obvious, but I guess the rest could confuse you a bit. Sorry about that. Simply, to test this code, yes you need both.

 

In a bit more detail...

- To hear the new sound stuff, you need to have NEW_SOUND defined.

- To hear Ogg files (and most of my package is Ogg files) you need OGG_VORBIS defined.

- You can use NEW_SOUND without OGG VORBIS, and all you will hear is the WAV sounds. The only part that doesn't support WAV sounds is streamed sounds (background and music).

 

NOTE! Compile option NO_MUSIC has been replaced by OGG_VORBIS (and is opposite). You must enable OGG_VORBIS to play music, and most of the new sound effects.

Basically if you perviously wanted to disable Ogg Vorbis support in the client you needed to use the NO_MUSIC define. However, given that the whole sound system is moving to Ogg, the define has been renamed so you need to define OGG_VORBIS in order to include the required libs etc.

 

The define's name was changed because NO_MUSIC doesn't really mean anything under this new system. Also, the idea behind NO_MUSIC was to disable Ogg support in the client, but given the Makefile structure the libs were still included, so you would manually need to remove those. With the new define, the Ogg libs are included in the same way some other features dynamically include extra libs. This is also the reason the define was reversed (OGG_VORBIS = !NO_MUSIC).

 

I guess this is now as clear as mud. Oh well.

 

/edit: Tidy'd it up a bit

Edited by Torg

Share this post


Link to post
Share on other sites

Oh my. I misread NO_SOUND to NEW_SOUND. Sorry

lol... that's ok. I miss typed NO_MUSIC to NO_SOUND which is where this whole thing started. An easy mistake. (Damn brain).

Share this post


Link to post
Share on other sites

The client crashes when it tryed to load the first ogg file (sound/fountain.ogg). It happens in load_ogg_file at

 

if (ov_open(file, oggFile, NULL, 0) < 0)

 

Any ideas?

 

Edit: Found this on the xiph.org site

 

WARNING for Windows developers: Do not use ov_open() in Windows applications; Windows linking places restrictions on passing FILE * handles successfully, and ov_open() runs afoul of these restrictions [a]. See the ov_open_callbacks() page for details on using ov_open_callbacks() instead.

 

Guess the code needs to be rewritten for windows

Edited by kibora

Share this post


Link to post
Share on other sites

Guess the code needs to be rewritten for windows

Great... :-S

 

Oh well, thanks for testing it. I'll have a look at it.

 

(Mumbles something about damn windows computer m/b blowing up and not being able to test anymore)

 

Unfortunatly, due to not being able to test under Windows at the moment, this is possibly going to be a long process.

 

 

/EDIT: That's interesting. Have you ever tried to listen to music under Windows? The music code uses ov_open() and I have never had any issues with crashing. Oh well.

 

/EDIT2: Just reread the comments you posted. "Windows linking places restrictions on passing FILE * handles successfully". The difference in my code, and the old code is that I am passing the file handle, which is quite possibly why this is a new issue. Damn.

 

/EDIT3: Reading the info on xiph.org I have no idea why it worked previously... but apprently the fix is very simple. We shall see. It will be in CVS soon.

Edited by Torg

Share this post


Link to post
Share on other sites

Here's a nice code i found. I'll test it when i get home

 

//similar to fread()

//will be called by ov_read()

size_t AL_SDL_RWops_read_func(void *ptr, size_t size, size_t nmemb, void *ctx)

{

return SDL_RWread((SDL_RWops *)ctx, ptr, size,nmemb);

}

//similar to fseek()

int AL_SDL_RWops_seek_func(void *ctx, ogg_int64_t offset, int whence)

{

return SDL_RWseek((SDL_RWops *)ctx, offset, whence);

}

//similar to fclose()

int AL_SDL_RWops_close_func(void *ctx)

{

return SDL_RWclose((SDL_RWops *)ctx);

}

//similar to ftell()

long AL_SDL_RWops_tell_func(void *ctx)

{

return SDL_RWtell((SDL_RWops *)ctx);

}

 

void AL_Helper_setcallbacks(ov_callbacks* ocb)

{

ocb->read_func = AL_SDL_RWops_read_func;

ocb->seek_func = AL_SDL_RWops_seek_func;

ocb->tell_func = AL_SDL_RWops_tell_func;

ocb->close_func = AL_SDL_RWops_close_func;

}

...

//In my setup section

///////////DO OGG STUFF

OggVorbis_File vf;

//...

ov_callbacks ocb;

SDL_RWops* rw;//for standard C IO routines this would be FILE* rw

 

//set function callbacks

AL_Helper_setcallbacks(&ocb);

//open ogg file

 

rw = SDL_RWFromFile(fn,"rb");//for standard C IO this would be fopen(fn,"rb");

if(NULL == rw){TRACE("ALStream::LoadOGG() - Could not open:%s",fn);return false;}

 

//load into library

if(ov_open_callbacks((void *)rw,&vf, NULL,0,ocb) < 0)

{

TRACE("ALStream::LoadOGG() - Could not oload:%s",fn);return false;

}

Share this post


Link to post
Share on other sites

Well I was personally hoping to use the built-in callback functions described on the xiph.org page.

ov_open_callbacks() is a safe substitute; specifically:
ov_open_callbacks(f, vf, initial, ibytes, OV_CALLBACKS_DEFAULT);

... provides exactly the same functionality as ov_open() but will always work correctly under Windows, regardless of linking setup details.

Unfortunatly OV_CALLBACKS_DEFAULT isn't defined under Linux even though I have the required headers included (I don't really want to know)... but if they work under Windows then it will spare a heap of trouble.

 

In short, try the CVS when you get the chance and if that doesn't solve the problem then we can look further.

Edited by Torg

Share this post


Link to post
Share on other sites
It worked :cry:

Yay! \o/

 

But you need to #include "vorbisfile.h" in sound.c :(

Eh?? What's that about?

 

vorbis/vorbisfile.h is included in sound.h... does it work if you #include <vorbis/vorbisfile.h> (just like in sound.h)? I think the localisation of the lib is probably something unique to your build system so I'd prefer to shy away from it and find a suitable generic.

Share this post


Link to post
Share on other sites

I believe you are using an old versino of vorbisfile.h. Actually there's no need to include vorbis.h in sound.c. Just get a new version and OV_CALLBACKS_DEFAULT is defined in vorbisfile.h as follows:

 

static ov_callbacks OV_CALLBACKS_DEFAULT = {

(size_t (*)(void *, size_t, size_t, void *)) fread,

(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,

(int (*)(void *)) fclose,

(long (*)(void *)) ftell

};

 

Edit: I downloaded libvorbis-1.2.0

Edited by kibora

Share this post


Link to post
Share on other sites
I believe you are using an old versino of vorbisfile.h. Actually there's no need to include vorbis.h in sound.c. Just get a new version and OV_CALLBACKS_DEFAULT is defined in vorbisfile.h as follows:

Yeah, the version under Debian Etch is 1.12, but I can use ov_open so it doesn't really matter. We just need to require people under Windows to have version 1.2 I guess.

 

That still doesn't explain why those files aren't included as they should be from sound.h.

Share this post


Link to post
Share on other sites

They are included but i was having an old version of them in my include/vorbis folder. When i put the 1.2 one it works without the include

Ahhhhhh!!! Right. So you had 2 different versions. Yeah, that's dangerous. ;-)

 

Glad to hear it works now.

Share this post


Link to post
Share on other sites

Found the reason for playing only a small part of the sounds. It's the gain.

 

If you remove alSourcef(*stream->source, AL_GAIN, stream->gain); from process_stream everything works fine :laugh:

Share this post


Link to post
Share on other sites

Found the reason for playing only a small part of the sounds. It's the gain.

 

If you remove alSourcef(*stream->source, AL_GAIN, stream->gain); from process_stream everything works fine :laugh:

Ahhh, cool. Thanks. The gain command there should work (and has been working for the last month), but when I removed all my comments before committing this initially I broke it somehow. At least that gives me an idea of where to look when I get home.

 

I reworked quite a bit of that last night as I noticed some logic problems around the gain, but nothing that should disable the sound... unless the gain was being stored or returned incorrectly, and hence being set to 0... hmmmm.

 

Anyways, with the way I reworked it, it will probably not be an issue. If it still is, then it should still be a fairly simple fix.

 

(I think its too early in the morning. I'm not sure that this makes all that much sense)

Share this post


Link to post
Share on other sites

I noticed that I could no longer see cloaks after using the new actor_defs files ... I only checked human_male.xml since.. I am.. but :

<snip>

 

<cape>

<mesh>./meshes/cape1_medium.cmf</mesh>

</cape>

<cape group="cape2">

<mesh>./meshes/cape2_medium.cmf</mesh>

</cape>

 

should have an extra 'm' on each 'medium'

 

cloaks are now visible again for me..

when I have a spare minute I will check the other files..

 

thanks for the great work..now if I could only get some quieter leather boots....

Share this post


Link to post
Share on other sites
I noticed that I could no longer see cloaks after using the new actor_defs files ...

That would be because of this:

Also, the actor defs in this package are from Roja's new models (see this thread), and should be used with that package. Feel free to copy the sound XML block into your own actor defs if you aren't using the new models.

Share this post


Link to post
Share on other sites
now if I could only get some quieter leather boots....

Ahuh! Quieter leather boots have now come to a client near you.

 

To wear them, compile with the latest CVS and add <gain>0.2</gain> (or other desired number) to the "walk" sound def in sound_config.xml. This can be configured for any sound defined in sound_config.xml.

 

There are also some other assorted bugs fixes done. Keep letting me know about them, and I'll keep trying to fix them. :-)

Share this post


Link to post
Share on other sites

I'm not very good with editing xmls. EL usually crashes after i do that :icon13: Any idea what program i could use? Notepad is not a good idea lol

 

BTW i don't hear sounds from fountains. Is that how it shoudl be

Share this post


Link to post
Share on other sites

I'm not very good with editing xmls. EL usually crashes after i do that :icon13: Any idea what program i could use? Notepad is not a good idea lol

 

BTW i don't hear sounds from fountains. Is that how it shoudl be

 

Use textpad. It's great for editting xmls. I use them to make/edit .def files for maps, as does Roja.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×