Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old March 25, 2016, 05:28   #11
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Quote:
Originally Posted by takkaria View Post
I think it's cleaner to keep sound file and message colours in separate places as it makes it easier to introduce new sound sets without touching stuff that isn't related to them.
Indeed it was

Now we can define custom message/sound maps in the players pref files - it was just a happy side-effect of the implementation I had not even considered. But seriously, how neat is that
calris is offline   Reply With Quote
Old March 25, 2016, 06:04   #12
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,842
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by calris View Post
Looking forward to a in-depth review of this. A few 'nice' features:
- I'm using an AVL (balanced binary) tree to store sound and mapping information so there should be a lot less memory used by the sound sub system (EDIT: The old system loaded sounds multiple times - once for EVERY instance in the sound config)
- sounds are now defined in a .prf file chainloaded by pref.prf so now it's trivial to re-assign sounds (and even have sounds assigned per-class and per-character) in user preference files
- file extensions are not used in the sound.prf file - it is up to the platforms sound module to search add supported extensions
- SDL handles mp3 and ogg now. Adding new extensions is trivial (see supported_file_types[] in snd_sdl.c)
- Did I mention balanced trees? I'm sure there are lots of other places we can use them
- The only thing main.c now know about sound is to call init_sound()
Excellent - these are massive improvements. My questions for you are:
  • I want to have a good look at this - could you put this in a git branch and put it on github?
  • I assume this is Linux only at this point - will it break the other ports as is?
  • What assumptions does it make about what sound files are available?
  • What effect if any does this have on messages so far?
  • Why should I work out the answers to these questions myself when I can get you to tell me?
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old March 25, 2016, 06:35   #13
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Quote:
Originally Posted by Nick View Post
Excellent - these are massive improvements. My questions for you are:
  • I want to have a good look at this - could you put this in a git branch and put it on github?
  • I assume this is Linux only at this point - will it break the other ports as is?
  • What assumptions does it make about what sound files are available?
  • What effect if any does this have on messages so far?
  • Why should I work out the answers to these questions myself when I can get you to tell me?
Commit can be found here:

https://github.com/calris/angband/commits/sound-devel

EDIT: There are no assumptions - if the platform sound module can't load a sound file, it simply won't be played. It is up to the platform module to resolve sound names to files (typically by iterating through the sound name with known file extensions)

It's linux only - all other ports (AKAICT) define their own handling of sound.cfg in their respective main-xxx.c, so other ports SHOULDN'T be impacted at all. Creating architecture sound modules to hook into this new code is next on my hit list (should be trivial)

There is no effect on the messaging system at all
calris is offline   Reply With Quote
Old March 25, 2016, 10:26   #14
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
I've just pushed another patch into sound-devel

I realised that initialising sound _after_ loading pref files was going to prevent user prefs loaded afterward to not update the message<->sound map (and not load any new sounds)

So now, you can modify the sounds for messages on the fly.

I also introduced a pre-load sounds flag (which the old SDL module had, but could never be used due the the current parsing of module sub-options from main). I haven't hooked it into a command line option yet - I would like to resolve parsing sound options from main().

I think the best option is to make snd-sdl a module in it's own right (i.e. not a sub-module of sound-core) and ditch the '-s' switch (instead use -msnd-sdl) so then we could have something like:

angband -mx11 -- -n6 -msnd-sdl -- -pn -fogg

to run a 6 window x11 display, SDL sounds, no preloading of sounds (-pn), forcing loading of ogg files
calris is offline   Reply With Quote
Old March 25, 2016, 20:58   #15
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Hey, this is looking great.

Quote:
Originally Posted by calris View Post
I also introduced a pre-load sounds flag (which the old SDL module had, but could never be used due the the current parsing of module sub-options from main). I haven't hooked it into a command line option yet - I would like to resolve parsing sound options from main().

I think the best option is to make snd-sdl a module in it's own right (i.e. not a sub-module of sound-core) and ditch the '-s' switch (instead use -msnd-sdl) so then we could have something like:

angband -mx11 -- -n6 -msnd-sdl -- -pn -fogg

to run a 6 window x11 display, SDL sounds, no preloading of sounds (-pn), forcing loading of ogg files
I'm not sure if it makes sense to make the sound module a main module because that would mean having multiple main modules. Surely you can get the same sound option behaviour using -s as you can using -m?
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old March 25, 2016, 23:36   #16
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,842
Donated: $60
Nick will become famous soon enough
After considerable testing (mainly of my Linux system rather than your code, thank you pulseaudio) I can report the following:
  • I can hear sounds in Linux!
  • You need to add sound.prf to lib/customize/Makefile
  • My sound did not work with mp3s, I needed ogg - which I suspect will be the case for many people (but not those using Ubuntu, it seems)
  • I made .ogg versions of Dubtrain's sounds and manually copied them to my sound install directory - we need to decide what we're doing about that
  • I get the sounds just from running angband - no need for any commandline switch; I did use the --enable-sdl-mixer switch to configure
  • I haven't really come to terms with what the balanced trees are doing, but I'll look at that now
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old March 26, 2016, 02:09   #17
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Yes, sound can be a PITA in Linux depending on the distribution - mostly because each sound library needs it's out additional packages to support various formats

I think we need sounds in another git repo and have all the different formats we support in that repo (otherwise the main repo gets too big to to download for someone wanting to do a quick code hack when the probably already have the sound files in their angband install anyway). Install maintainers can still build installers with the sound files included so the user does not have to download an additional 'sound pack'

The AVL tree code I shamelessly stole from here:

http://piumarta.com/software/tree/tree-1.0/

I haven't dug into the code much either. I have implemented AVL tress in C++ before, so I have a good understanding of their mechanics. Basically, all operations (insert, find, delete) are O(LogN). Anywhere we currently used linked-list to store large amounts of data (especially when we are constantly adding and removing data) with a single search key can be replaced by a tree - they are much faster.
calris is offline   Reply With Quote
Old March 26, 2016, 03:20   #18
takkaria
Veteran
 
takkaria's Avatar
 
Join Date: Apr 2007
Posts: 1,936
Donated: $40
takkaria is on a distinguished road
Quote:
Originally Posted by calris View Post
Yes, sound can be a PITA in Linux depending on the distribution - mostly because each sound library needs it's out additional packages to support various formats

I think we need sounds in another git repo and have all the different formats we support in that repo (otherwise the main repo gets too big to to download for someone wanting to do a quick code hack when the probably already have the sound files in their angband install anyway). Install maintainers can still build installers with the sound files included so the user does not have to download an additional 'sound pack'
Looks like the best way to do this would be using the 'BFG': https://rtyley.github.io/bfg-repo-cleaner/ Since doing this will mess up any merges with code from before deletion, a good time to do this would be after all pull requests/active branches are merged.

I think if we put all the sounds in a separate repo we should also put the sound config in the lib/sounds directory too so that all sound-related stuff is in one place and we don't have dangling links. If we update the sounds we don't want to have to update two repositories.

Maybe if the plan is to alter git history to optimise for file storage, we could also make sure that all the PNG files in the repository are fully optimised and maybe even get rid of the BMP files in lib/xtra/graf from the pre-3.3 era. Just the 32x32 Gervais tileset in BMP form is bigger than all the mp3s combined.
__________________
takkaria whispers something about options. -more-
takkaria is offline   Reply With Quote
Old March 26, 2016, 04:26   #19
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,367
AnonymousHero is on a distinguished road
Quote:
Originally Posted by takkaria View Post
Looks like the best way to do this would be using the 'BFG': https://rtyley.github.io/bfg-repo-cleaner/ Since doing this will mess up any merges with code from before deletion, a good time to do this would be after all pull requests/active branches are merged.
For the love of all that's holy, don't do that. It's hugely disruptive to anyone who currently has a clone somewhere and you have absolutely no idea how many people do. You should only even be considering rewriting (published) history in extreme scenarios such as: Someone accidentally published the nuclear launch codes (and the codes themselves cannot easily be changed), or there's some kind of legal threat where removing files at the "master" revision is not acceptable to the other party.

Just use a separate repository + the "submodule" functionality of git. That would mean that fetching the sounds is a simple "git submodule init && git submodule update" command away.

(Btw, I'm not sure if you're already familiar with it, but the tool is probably named after the BFG 9000 from Doom. That should tell you something about when it's appropriate to use it.)
AnonymousHero is offline   Reply With Quote
Old March 26, 2016, 04:44   #20
calris
Adept
 
Join Date: Mar 2016
Posts: 194
calris is on a distinguished road
Good point. The horse has already bolted for mp3 files - unless we practically destroy the entire history of the repo it's always going to be a huge repo to clone. But at least we can stop it getting even more out of hand.
calris is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reworking the entire magic system (yay)! TricksterWolf Development 8 September 20, 2015 21:22
Mk build system? CJNyfalt Development 11 March 25, 2015 08:25
Resist system Jungle_Boy Development 65 August 30, 2011 04:10
Combat System Sirridan Development 9 July 14, 2009 08:11
RFC: Middle Earth map for Un in ASCII; is it readable? Bandobras Variants 13 November 25, 2007 04:15


All times are GMT +1. The time now is 01:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.