Sound patch

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
SummerBulb
Engineer
Engineer
Posts: 24
Joined: 06 Feb 2010 22:12

Sound patch

Post 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
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Sound patch

Post 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.
SummerBulb
Engineer
Engineer
Posts: 24
Joined: 06 Feb 2010 22:12

Re: Sound patch

Post 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 :) )
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Sound patch

Post 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.
SummerBulb
Engineer
Engineer
Posts: 24
Joined: 06 Feb 2010 22:12

Re: Sound patch

Post 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?
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Sound patch

Post 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
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Argus and 7 guests