Page 1 of 1

Sound patch

Posted: 03 Feb 2012 13:31
by SummerBulb
Hi,

I would like to start working on a sound patch that will let the user choose a specific sound for each kind of information message received in the game. For example, a user will be able to choose a horn's sound for a "X's income las year wan negative" and the sound of coins for a new subsidy offer.

What should be my next steps towards achieving this goal?
where, in the code, should i start? (I've already downloaded the entire code and it compiles and runs successfully)
What kind of skill does this task require, apart, of course, of knowing c++?

Many thanks,
SummerBulb

Re: Sound patch

Posted: 03 Feb 2012 14:09
by planetmaker
Less of a skill than rather part of the task:

you'll need to identify those sounds which are part of the UI rather than related to game objects. The latter sounds should not become user-configurable other than by NewGRFs - otherwise that will clash quite badly.

Wrt implementation you might want to orient yourself on the implementation of hotkeys as a similar approach (with an ini file which relates sound to event) could be a good idea.

At least initially I'd not bother in *adding* new sounds. Extending the definition of sound sets might then be an entirely separate issue.

And I hope you didn't obtain the source as a tar bundle but rather used mercurial, svn or git :-). Write your patch for trunk, don't work on the source of release versions, if you aim for inclusion into the official repo.

Re: Sound patch

Posted: 05 Feb 2012 18:01
by SummerBulb
Hotkeys? Sound interesting.

I imagine having a configuration window where the user could set a hotkey for the listed actions.
That might be easier.

But you mentioned an ini file. Are talking only ini, or will the ini reflect in a UI window?

I've never before touch a project so big. Having to implement changes in this project makes my hands tremble at click of a key.

Any further thoughts regarding the kotkeys?

btw, no need to worry, i'm using SVN (yes, i should have used "checked out" instead of "downloaded :) )

Re: Sound patch

Posted: 05 Feb 2012 18:04
by Eddi
SummerBulb wrote: But you mentioned an ini file. Are talking only ini, or will the ini reflect in a UI window?
no, this will not automatically make an UI window. this is a planned feature for hotkeys, but nobody bothered to implement that yet.

Re: Sound patch

Posted: 05 Feb 2012 21:27
by SummerBulb
Eddi wrote: no, this will not automatically make an UI window.
well, of course we're not talking about automatic windows. such thinks will need to be designed and implemented. My question was merely if planetmaker see this patch as something you configure in an ini file only or also in a UI window (which will need to be created).

Where can i find more information regarding the hotkeys?

Re: Sound patch

Posted: 05 Feb 2012 21:56
by Alberth
Well, you need to store your settings at some point, and an ini file is the most obvious way for that. By doing that you automatically allow users to edit that file for configuring it :)

As a next step you could make a window for configuring it in-game. That has the added advantage that you don't have to worry about windows now.
At that time, it is also more clear which sounds you can actually change. That makes it easier to judge whether making a window for it is beneficial.

A good way to find things is either by reading the generated documentation (which is not complete), or to search through the source files for some keyword (for example a case-insensitive search on 'hot' gives me 52 source files). By reading the matched lines, you can get a good idea of which file is interesting. Otherwise just browse/read them all :) In time, you will understand which files are used for what.
Oh, and a third way is to read the filenames, "hotkeys.h" and "hotkeys.cpp" seems like what you may need :p