Commit graph

207 commits

Author SHA1 Message Date
Charles Dang
2470984af3 Prepend 'SDL2/' to all SDL includes
This was needed to get the build working with vcpkg's version of SDL, where all the SDL files are
in their own SDL folder. However, our cmake config also has a note saying it was a deliberate choice
to move our SDL files *out* of their SDL2 folder due to certain distros (FreeBSD is mentioned) not
putting the files in said folder in the first place.
2019-07-22 15:35:55 +11:00
Jyrki Vesterinen
b023b818c7 Fix [music] ms_after= setting fade-out time of *previous* track
It's supposed to set the fade-out time of the track *itself*.

For this, play_music() needs to look at the track which is *being faded
out*, not the one that's *about to start playing*.
2019-04-18 22:15:28 +03:00
Celtic Minstrel
9cccfd73b0
Extend the image localization system to sounds and music (#3935)
Fixes #2987
2019-03-03 16:13:30 -05:00
Martin Hrubý (hrubymar10)
674fda85b7 Migrate links to https if available - Fwd c18537edc0
(cherry-picked from commit bc4d22dc72)
2018-10-07 03:23:36 +00:00
Iris Morelle
8763e2f2b1 sound: Halt sound sources that go inaudible instead of fading them out
Fixes #3280.

(cherry-picked from commit e46c05162f)
2018-10-07 03:22:54 +00:00
Jyrki Vesterinen
bcc914bfe8 Fix #2602: music doesn't change immediately on loading a save
This time I added an option to disable the feature to allow the currently
playing track to finish when changing the playlist. This allows more
fine-grained control of distinct use cases.

In wesnoth.cpp:do_gameloop(), I reversed the order of the title screen
music and default music because otherwise adding the default music would
enable play_once for the title screen music and prevent instant music
change when the player loads a save. I play title screen music with
immediate=yes, so it's still played first.

(cherry-picked from commit 91afbfd586)
2018-10-07 03:22:18 +00:00
Jyrki Vesterinen
de1bdba769 Revert "Fix #2602: music doesn't change immediately on loading a save"
This reverts commit 94b69e0281.

(cherry-picked from commit cafede479c)
2018-10-07 03:22:18 +00:00
Jyrki Vesterinen
097244559f Fix #2602: music doesn't change immediately on loading a save
(cherry-picked from commit 94b69e0281)
2018-10-07 03:22:16 +00:00
Charles Dang
45f871067f Use std::size_t everywhere instead of plain size_t
Excludes:
* spirit_po/
* xBRZ/

(cherry-picked from commit fc2a58f693)
2018-10-07 03:17:59 +00:00
Charles Dang
f23305f7e2 Formatting cleanup: T const& -> const T& 2018-01-23 01:26:23 +11:00
Gregory A Lundberg
b5f76eff79
Bump copyright to 2018 2018-01-19 00:02:20 -06:00
Charles Dang
d09ad24037 Used standard C++ fixed-width integer types instead of SDL-provided ones
More consistent this way. It's very unlikely the SDL defines would clash with the standard
C++ ones, even in SDL-related code.
2017-12-06 01:31:59 +11:00
Charles Dang
5d423ae66b Fixup a77c40f105
Since track_ok is used as a loop control, we need to return true if current_track is null
in order to break out, else we get stuck in an infinite loop.
2017-11-10 07:23:21 +11:00
Charles Dang
a77c40f105 Guard against even MORE nullptr dereference (should fix #2153 again) 2017-11-10 00:32:11 +11:00
Charles Dang
f6577886a7 Guard against more cases of nullptr dereferenceing (fixes #2182) 2017-11-09 09:01:59 +11:00
Alexander van Gessel
8ab8ff702c Fix further possible nullptr dereferences (Fixes #2161) 2017-11-07 00:49:15 +01:00
Alexander van Gessel
ee5a6e03f4 Check pointer before derefencing (fixes #2161)
current_track may be uninialized when this function is called at load-time
2017-11-02 21:52:25 +01:00
Alexander van Gessel
749646a75b Make get_current_track_index safer to use
This prevents problems like issue #1861.
2017-10-30 21:17:05 +01:00
gfgtdf
4e79aedb8d use unsyced rng for animation&sound stuff 2017-10-29 13:03:45 +01:00
Gregory A Lundberg
f7bea59fe9 Finish switch to MT19937 for randomness
Coverity has been complaining about using rand() as an insecure function. As we're using it, this function is not insecure; but is also not a very good RNG. We're using MT19937 in a system-independant manner. But some uses of rand() were never converted. This converts them.

This closes the following Coverity issues:

CID 1356297
CID 1356299
CID 1356303
CID 1356304
CID 1356306
CID 1356312
CID 1356314
CID 1380163
CID 1380173
CID 1380179
CID 1380191
CID 1380198
CID 1380201
CID 1380210
CID 1380214
CID 1380215
CID 1380219
CID 1380230
CID 1380241
2017-10-26 09:28:24 +11:00
Alexander van Gessel
d063aa077a Don't use invalid music indices. Fixes #1861 2017-10-20 17:31:09 +02:00
Alexander van Gessel
a9c5924eb7 Rename RWops static constructors 2017-09-21 11:16:28 +02:00
Alexander van Gessel
5f17e70741 Implement writing for RWops 2017-09-20 14:20:54 +02:00
Alexander van Gessel
af1e8f17d8 Wrap SDL_RWops* in a unique_ptr 2017-09-20 06:46:50 +03:00
Pentarctagon
ad5bbd4131 Create wesnoth.music_list.previous, along with the __cfg field for tracks (#1728) 2017-05-29 08:51:06 -04:00
Charles Dang
c8e1035a90 Another attempt to fix sound memleak 2017-05-08 06:40:32 +11:00
Charles Dang
ac2913bd62 Made use of std::list_remove_if 2017-05-08 06:18:31 +11:00
Charles Dang
14e22779ab Removed need for forward declaration of play_sound_internal 2017-05-08 06:10:59 +11:00
Charles Dang
23f4eab5db Reformat sound code 2017-05-08 06:05:39 +11:00
Charles Dang
7e67b7bba0 Revert "Don't play music config if music is disabled"
This reverts commit a3448e9908.
This was the incorrect fix and caused the wrong music to play if it was enabled after entering a scenario.
2017-05-07 21:42:23 +11:00
Charles Dang
a3448e9908 Don't play music config if music is disabled
This could possibly fix the memleak reported in #1020.
2017-05-07 21:24:13 +11:00
Charles Dang
e4f03fe459 Moved all preferences source files into a single folder 2017-05-04 11:04:19 +11:00
Celtic Minstrel
a694201c02 A few more improvements to the music API
- Handle all plausible cases of assigning into the playlist
- Allow changing the current track to an existing one on the playlist
- Allow getting playlist as a real array instead of an array-like proxy
  (Could be useful for storing it to a WML variable, for example)
2017-04-29 00:01:40 -04:00
Celtic Minstrel
c04456dec1 Store music tracks as shared_ptrs 2017-04-27 17:49:32 -04:00
Celtic Minstrel
eb0947c863 Some improvements to the new Lua music API
- Allow removing a track by index and fixup the "set track" interface
- Commit music changes only after event completes, not after any control=flow tag is executed
- Allow inserting a track into the middle of the playlist
- Allow assigning a config to an existing track to overwrite it
- Use std::find when checking for duplicate tracks
2017-04-27 17:09:16 -04:00
Celtic Minstrel
5b4dbe1c61 Port [volume] to Lua
This also fixes [volume] considering 100% to be an invalid volume.
2017-04-27 17:09:05 -04:00
Celtic Minstrel
6906ced4e7 Properly port [music] to Lua 2017-04-27 17:09:03 -04:00
Charles Dang
e1a579da51 Deployed std::map::emplace en-masse 2017-04-09 15:40:13 +11:00
Charles Dang
3b88044816 Minor fixup to 92d1a26caf 2017-04-09 15:06:47 +11:00
Charles Dang
92d1a26caf Attempt to fix memleak when quitting the game with music enabled (bug #25092) 2017-04-09 15:00:27 +11:00
Celtic Minstrel
b4dc11ce36 Belated 2017 copyright update 2017-03-19 10:05:38 -04:00
Charles Dang
e22c8967ee Cleaned up global.hpp includes 2016-12-17 15:21:04 +11:00
Charles Dang
4d48ed1319 Cleaned up util.hpp includes 2016-12-08 14:21:18 +11:00
Gregory A Lundberg
f23127e65a Remove LOW_MEM compile-time option
Per @Vultraz
2016-11-11 09:20:56 -06:00
Charles Dang
8c92a9ee8e Formatting cleanup: moved const qualifiers before type names 2016-10-31 01:04:18 +11:00
Jyrki Vesterinen
d4e6d0bf2b Fade out music on scenario start and on disabling it 2016-08-07 18:54:33 +03:00
Jyrki Vesterinen
31871daa71 Make it a preference whether music should be muted in background
No UI for the preference yet.
2016-06-30 13:07:16 +03:00
Jyrki Vesterinen
bf510e7886 Pause the music when the game loses focus 2016-06-30 12:58:18 +03:00
Celtic Minstrel
ca382018b7 BOOST_FOREACH -> range for 2016-04-02 09:38:29 -04:00
Celtic Minstrel
3ac7f8d970 NULL -> nullptr
A few cases of NULL were missed, since changing them led to errors
(Mainly instances where it was passed to a boost::function)
2016-03-31 00:42:38 -04:00