Commit Graph

200 Commits

Author SHA1 Message Date
Peter Nelson 733284cc16 Codechange: Return std::vector from GetMusicCatEntryData.
Return std::vector instead of pointer to array with manual memory management.
2024-05-11 02:10:41 +01:00
Peter Nelson 731d46beb5
Change: Don't include midi file processing in dedicated server build. (#12632) 2024-05-08 00:57:52 +01:00
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2024-04-10 23:17:13 +02:00
Peter Nelson 332cbca36e Codechange: Pass std::string_view from drivers instead of char *. 2024-04-10 22:02:04 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Peter Nelson de8a840db5
Codefix: Fully initialise `MidiFile::DataBlock` to avoid gcc warning. (#12240) 2024-03-09 17:01:39 +00:00
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 2024-02-02 22:29:28 +01:00
Peter Nelson 9cf47af490
Change: Invalidate music volume when restarting music playback on Windows. (#11836) 2024-01-19 17:01:36 +00:00
Rubidium e3f49ee7a0 Codechange: coding style fixes 2024-01-04 16:23:54 +01:00
Peter Nelson 4c6ccb5248
Change: Try stopping extmidi player with SIGINT first. (#11404)
This may give the player a chance to issue MIDI note-off commands.

The kill/waitpid cycle is also less aggressive, waiting 50ms each time.
2023-11-27 20:39:22 +00:00
Peter Nelson 08778094f4
Fix: extmidi did not move on to next song after playing ends. (#11469)
`song` is no longer a C-style string so cannot be cleared by writing a NUL char.
Use `.clear()` to properly clear a std::string.
2023-11-17 17:42:19 +00:00
Peter Nelson d4008850e3 Codechange: Ensure function opening `{` is on new line. 2023-11-09 20:15:38 +00:00
Rubidium c6411168d8 Cleanup: missing spaces before continuation * in some comments 2023-11-01 22:56:11 +01:00
Rubidium f16399f4c9 Codechange: replace x.size() > 0 with !x.empty() 2023-10-20 23:05:43 +02:00
Rubidium c9276c2959 Codechange: replace x.size() == 0 with x.empty() 2023-10-20 23:05:43 +02:00
frosch 6b586dddad Cleanup: TransmitNotesOff is only called with buffer==_buffer. 2023-09-19 22:49:59 +02:00
frosch b6c8f301be Codechange: Silence warnings about intentionally unused parameters. 2023-09-19 22:49:59 +02:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium 794b642b9a Codechange: use std::string/std::vector over stredup/strecpy/CallocT/free 2023-06-27 12:35:31 +02:00
PeterN fc2510e2ba
Codechange: Use std::vector for midifile's ByteBuffer. (#11019) 2023-06-16 17:04:46 +01:00
Owen Rudge 1a3d1bca59 Remove: OS/2 port 2023-06-16 14:29:14 +01:00
Rubidium 556b44713e Codechange: use std::string for midi filenames 2023-06-04 15:57:05 +02:00
PeterN d086f288cd
Codechange: Remove duplicated includes. (#10888)
These are now included by stdafx.h so don't need to be included again.
2023-05-29 14:29:00 +01:00
Rubidium 3323402aaa Codechange: rename smallvec_type to container_func and use only when needed 2023-05-20 16:53:10 +02:00
Peter Nelson 83f2ad500e Codechange: stdarg.h include not needed as cstdarg is included. 2023-05-17 10:14:41 +01:00
Rubidium 68ff3fd062 Change: include fmt.h C++ headers in stdafx.h
This to prevent compilation issues between runs with and without precompiled
headers. Also remove the headers from the rest of the code base as they are
not needed there anymore, although they do relatively little harm.
2023-05-08 16:49:23 +02:00
Rubidium 9fe853f7b5 Codechange: use fmt::format instead of vseprintf for midi command formatting 2023-04-26 18:46:17 +02:00
Rubidium 43c65a3fec Codechange: use std::string for base media filename/warning storage 2023-04-25 15:01:08 +02:00
Niels Martin Hansen 41c40f130b Fix: Original music playback rate was slightly too fast
Found a new tempo value experimentally. The new value gives a timing error of less than 0.01 second per minute.
2022-02-10 22:09:51 +01:00
Charles Pigott 1e529e1632
Fix: [Fluidsynth] Crash when debug output enabled (#9446) 2021-07-19 10:36:35 +01:00
rubidium42 eb6cdadc4d Codechange: replace IConsolePrintF with IConsolePrint and fmt formatting
Also make some strings more consistent with the rest of the console strings.
2021-06-13 15:25:31 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
milek7 886f5c104a Fix: Workarounds for BeMidi driver to work properly on Haiku 2021-05-24 08:56:18 +02:00
milek7 36bcd2956a Fix: Building on Haiku 2021-05-24 08:56:18 +02:00
Rubidium 79fc094c54 Cleanup: [Fluidsynth] Remove fluid_player_join
The function fluid_player_join in the library is broken beyond compare for the
usecases it was used for (see their #872). It does not wait until it is safe
to delete the player, so it is up to the end user to ensure that.

For OpenTTD we acquire a lock before fluid_synth_write_s16 and we acquire the
same lock in the stop function. So, only one of the functions can be doing its
thing, meaning we do not need to wait for the player to be stopped as it
cannot be doing anything as we prevent that by the lock.
2021-05-10 16:03:16 +02:00
rubidium42 a432009f06 Cleanup: [Fluidsynth] Comply better with the coding style 2021-05-05 16:03:34 +02:00
rubidium42 6bd7f8816d
Fix #9117, 04ce1f07: [Fluidsynth] Infinite wait when stopping song (#9181)
In FluidSynth 2.2.0 an extra state was added to denote stopping. To transition
from this state to a stopped state the rendering needs to be running. Since
04ce1f07 locking was added that skipped the rendering when something else held
a lock, so the state would never get to stopped and join would never return.
2021-05-03 16:40:19 +01:00
Loïc Guilloux 888389c28d
Codechange: Use std::string in console commands/aliases registration, and std::map instead our sorted linked list (#9057)
* Codechange: Use std::string in console commands and aliases registration

* Codechange: Use std::map to register console commands

* Codechange: Use std::map to register console aliases

* Cleanup: Remove now unused function
2021-04-24 15:19:57 +02:00
Ghislain Antony Vaillant e7cf589868 Fix: Honor default soundfont for FluidSynth
Debian now provides a default soundfont for FluidSynth via its alternatives system.

In short, FluidSynth is configured to look for `/usr/share/sounds/sf3/default-GM.sf3` as its default soundfont, and each soundfront package (FluidR3, OPL-3, MuseScore...) may provide or override this symlink. By default, FluidSynth is installed on Debian with the `TimGM6mb` soundfont by default due to its limited size.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=929185 for further details.
2021-04-07 12:30:04 +02:00
Ghislain Antony Vaillant 9725bd8dd0 Fix: Use FluidSynth default soundfont 2021-04-07 12:29:21 +02:00
Niels Martin Hansen e0561dbded Fix #8713: Change OTTD2FS and FS2OTTD to return string objects instead of static buffers 2021-04-07 09:31:47 +02:00
Milek7 33c5f984f5
Codechange: Use COINIT_MULTITHREADED in CoInitializeEx (#8938) 2021-04-04 07:40:56 +01:00
Niels Martin Hansen b427ddce88 Codechange: Switch to explicit wide strings 2021-02-23 11:25:39 +01:00
Niels Martin Hansen beeb9e0a1b Remove: [Win32] Last pretenses of being able to build for Windows 95 2021-02-23 11:25:39 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
Michael Lutz 65f65ad2ad Codechange: Convert some more FIO functions to take std::string. 2020-12-27 13:19:25 +01:00
Michael Lutz f3326d34e7 Codechange: Use std::string in FIO search path handling. 2020-12-27 13:19:25 +01:00
Charles Pigott 348c231e12 Codechange: Make codestyle for CMake files consistent for 'control' statements 2020-09-25 14:43:13 +01:00
TechGeekNZ 716c883737 Fix: Globally apply preprocessor directive coding style
Global; except for the 32-bit SSE blitter, which has some #DEFINEs
in not-very-nice places.
2020-07-03 09:08:46 +02:00
Patric Stout 4d04009d12 Codechange: remove #ifdef from .cpp files to exclude features
With CMake, these files are simply not compiled to start with.
2020-06-05 19:36:05 +02:00