MantisBT - VCMI
View Issue Details
0001634VCMISound, music, videospublic2013-12-27 12:202022-12-17 14:06
Ivan 
Ivan 
normalminoralways
closedfixed 
0.94 
1.next 
0001634: Music should not restart in some cases
In some cases music should not restart but resume from position on which it paused last time.

Music should resume:
- Towns
- Terrain tracks
- AI themes

Music should restart
- Main menu / campaigns menu
- Battles

(please check if I missed any other music groups)
No tags attached.
related to 0001978resolved Ivan Music should not restart or pause if player changed to other town of same type 
related to 0002207resolved Ivan Music stops on town switching 
Issue History
2013-12-27 12:20IvanNew Issue
2013-12-27 12:20IvanAssigned To => Ivan
2013-12-27 12:20IvanStatusnew => assigned
2013-12-27 12:21IvanNote Added: 0004209
2014-11-24 16:15SXXRelationship addedrelated to 0001978
2015-12-14 10:07SXXRelationship addedrelated to 0002207
2016-01-06 05:22SXXNote Added: 0006248
2016-01-06 05:24SXXNote Edited: 0006248bug_revision_view_page.php?bugnote_id=6248#r3093
2016-01-06 07:43SXXNote Edited: 0006248bug_revision_view_page.php?bugnote_id=6248#r3094
2016-01-06 07:46SXXNote Edited: 0006248bug_revision_view_page.php?bugnote_id=6248#r3095
2022-12-17 14:06IvanAssigned ToIvan =>
2022-12-17 14:06IvanNote Added: 0008386
2022-12-17 14:06IvanStatusassigned => closed
2022-12-17 14:06IvanAssigned To => Ivan
2022-12-17 14:06IvanResolutionopen => fixed
2022-12-17 14:06IvanFixed in Version => 1.next

Notes
(0004209)
Ivan   
2013-12-27 12:21   
Needs some investigation in SDL_Mixer API - currently implementing straightforward approach may be too memory-heavy - right now vcmi keeps whole music file in memory. And keeping all paused tracks in memory would use huge amount of memory.
(0006248)
SXX   
2016-01-06 05:22   
(edited on: 2016-01-06 07:46)
More details on this issue.

SDL_mixer do stream "Music" (but not effects) by default, but in VCMI file loading is implemented via CResourceHandler that load whole file in memory. So we probably need to rework it somehow so SDL_mixer mechanisms works and then store every "MusicEntry" in memory so they always stopped/resume on correct positions.

PS: I posted it because SDL_mixer documentation doesn't clearly state that streaming is used for music while confirmation of this can be found on mailing list and in code too (I almost sure it's does streaming :-p).

So before I find out about streaming support I think to implement some function to save music position and restart from it next time, but considering SDL doesn't use tons of memory on it's own it's better to rework playback instead.

(0008386)
Ivan   
2022-12-17 14:06   
Fixed in 1.1