Changes between Initial Version and Version 1 of Ticket #1223
- Timestamp:
- Mar 19, 2012, 1:31:58 AM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #1223 – Description
initial v1 3 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 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 5 7 '''Details''' 6 8 7 Terminology: 'stack' (collection of tracks), 'track' (object linked to the 'target' sound to be played)9 Terminology: 'stack' (collection of 'tracks' on a 'queue'), 'track' (object linked to the 'target' sound to be played) 8 10 9 The sound system should support multiple stacks. A stack can be unlimited in size, or can have a limit. If a limit is set, when a new track is added and the limit of the stack is reached, that track is discarded.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 in order of first priority, then the order the track was added to the queue. 10 12 11 Stacks are worked through concurrently (multi-threaded?), playing through their tracks in order of priority. If a track has 'async' set to false, the stack waits until the tracks target finishes playing before it moves to the next track. If the track has 'async' set to true, the target starts playing, and the stack moves right onto the track, without waiting for the previous one to finish.13 A stack can be unlimited in size, or can have a limit. If a limit is set, when a new track is added and the limit of the stack is reached, 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). 12 14 13 '''TODO:''' Describe priorities, describe fade between tracks, describe gain adjustment on zooming, describe gain adjustment on distance from center screen 15 If a track has 'async' set to false, the stack waits until the tracks target finishes playing before popping the track off the queue and initiating the next track. If the track has 'async' set to true, the target starts playing, the stack pops the track right away, and moves onto the next track, without waiting for the previous one to finish. 16 17 '''TODO:''' Describe stack clearing, Describe fade between tracks, Describe gain adjustment on zooming, Describe gain adjustment on distance from center screen 14 18 15 19 '''Basic JSON representation''' … … 17 21 {{{ 18 22 { 19 " 1": {20 "limit": 5,23 "unit_actions": { 24 "limit": 10, 21 25 "tracks": [ 22 26 { "target": "chop.wav", "async": true }, 23 27 { "target": "mine.wav", "async": true }, 24 28 { "target": "chop.wav", "async": true }, 29 { "target": "chop.wav", "async": true }, 30 { "target": "mine.wav", "async": true } 25 31 ] 26 32 }, 27 "2": { 33 "ambient_noise": { 34 "limit": 20, 35 "tracks": [ 36 { "target": "tree_falls.wav", "async": true }, 37 { "target": "fish_splash.wav", "async": true } 38 { "target": "tree_falls.wav", "async": true }, 39 { "target": "tree_falls.wav", "async": true } 40 ] 41 }, 42 "music": { 28 43 "limit": null, 29 44 "tracks": [ 30 { "target": "peace1.wav", "async": false, "priority": 2 }, 31 { "target": "peace2.wav", "async": false, "priority": 2 }, 32 { "target": "war1.wav", "async": false, "priority": 1 } 45 { "target": "peace1.wav", "async": false, "priority": 2 }, # this would play second 46 { "target": "peace2.wav", "async": false, "priority": 2 }, # this would play third 47 { "target": "war1.wav", "async": false, "priority": 1 } # this would play first 33 48 ] 34 49 }