Changes between Version 2 and Version 3 of Ticket #1223


Ignore:
Timestamp:
Mar 19, 2012, 11:11:45 PM (12 years ago)
Author:
Kieran P
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1223 – Description

    v2 v3  
    1 We need a new sound system, that works on Windows, Linux and Mac. Optionally also works on Android systems, so design with cross-device in mind (wrappers, apis etc), but focus on the operating systems first before mobile platforms.
    2 
    3 The new sound system needs support for music and sound clips, and should work on both the main menu and ingame. The same system should handle things like background music, button clicks, ambient noise etc.
    4 
    5 The implementation should be 100% C++ object oriented, but should have JS interfaces so that GUI events can trigger sounds (like button presses).
    6 
    7 '''Details'''
    8 
    9 Terminology: 'stack' (collection of 'tracks' on a 'queue'), 'track' (object linked to the 'target' sound to be played)
    10 
    11 The sound system should support multiple named stacks. A new track can be added to any named stack. Stacks are worked through concurrently (multi-threaded?), playing through their tracks first in order of priority, then the order the track was added to the queue.
    12 
    13 If a track of high priority comes into the stack, the current sound should fade out, and the priority one should fade in, then fade back to the one it was playing (requires the system have a 'pause' for tracks so that they can resume from the spot they were stopped, rather than restarting). More on track fading later.
    14 
    15 A stack can be unlimited in size, or can have a limit. Default is unlimited. If a limit is set, when a new track is added and the limit of the stack is reached and a track of lower priority doesn't exist to replace, the stack simply discards the track that was added. This prevent many async sounds piling up and running all at once (like 100 soldiers moving, which should not create a giant "KA-THUNK" when they move).
    16 
    17 If a stack has 'async' set to false, the stack waits until each tracks target finishes playing before popping the track off the queue and initiating the next track (useful for music). If the stack has 'async' set to true, the tracks target starts playing and the stack pops the track right away, and moves onto the next track. Default is async true.
    18 
    19 For music in particular, we don't want it stopping suddenly and starting the next one instantly. So if a track has a fadeIn value, this is the amount of milliseconds that a volume should go from 0% to 100%. If another track is playing, the same time is used to fadeOut the playing track. The default is no fading (for things like quick unit actions, button clicks, etc).
    20 
    21 '''TODO:''' Describe fade between tracks, Describe gain adjustment on zooming, Describe gain adjustment on distance from center screen
    22 
    23 '''Basic JSON representation'''
    24 
    25 {{{
    26 {
    27   "actions": {
    28     "limit": 10,
    29     "async": true,
    30     "tracks": [
    31       { "target": "chop.wav" },
    32       { "target": "mine.wav" },
    33       { "target": "chop.wav" },
    34       { "target": "chop.wav" },
    35       { "target": "mine.wav" }
    36     ]
    37   },
    38   "ambient": {
    39     "limit": 10,
    40     "async": true,
    41     "tracks": [
    42       { "target": "tree_falls.wav" },
    43       { "target": "fish_splash.wav" },
    44       { "target": "tree_falls.wav" },
    45       { "target": "tree_falls.wav" }
    46     ]
    47   },
    48   "music": {
    49     "limit": null,
    50     "async": false,
    51     "tracks": [
    52       { "target": "peace1.wav", "priority": 2, fadeIn: 1500 }, # this would play second
    53       { "target": "peace2.wav", "priority": 2, fadeIn: 1500 }, # this would play third
    54       { "target": "war1.wav", "priority": 1, fadeIn: 750 }    # this would play first
    55     ]
    56   }
    57 }
    58 }}}
     1See discussion around the new sound architecture at http://www.wildfiregames.com/forum/index.php?showtopic=15829