Commit graph

51 commits

Author SHA1 Message Date
Christoph Oelckers
cfe89ef6e6 - created a new zmusic library which will eventually contain all the music playback code.
Currently all it contains are the MIDI sources and the MIDI devices, the rest needs to be reworked first.
2019-09-28 18:32:25 +02:00
Christoph Oelckers
fc6eba0c26 - more dependency removal, this time from the MIDI devices. 2019-09-28 16:50:00 +02:00
Christoph Oelckers
123ed9d01d - moved the stream handling out of the MIDI device into the MIDIStreamer class.
This isn't the final location but this means that the device is merely a data provider, with the sole exception of the Win32 MIDI device whose unwieldy usage requirements unfortunately dictate much of the needed interface here.
2019-09-28 10:00:22 +02:00
Christoph Oelckers
61bc25d781 - WildMidi also done. 2019-09-28 00:10:39 +02:00
Christoph Oelckers
890db1fbf9 - Timidity++ done. 2019-09-27 22:19:00 +02:00
Christoph Oelckers
159b98ea88 - gave the Timidity error functions better names and hooked up the WildMidi version. 2019-09-26 17:22:54 +02:00
Christoph Oelckers
56e4c8f213 - handled the final piece where Timidity++ had a direct dependency on GZDoom - the error logging function.
This is npw a function pointer so that a simple stdout printout can be used as default, but allows to override it.
Also added the missing timidity_file.h header.
2019-09-23 14:14:32 +02:00
Christoph Oelckers
98329311b4 - moved the CVars out of the Timidity++ backend. 2019-09-23 13:58:16 +02:00
Christoph Oelckers
cf6d0c3127 - implemented an abstract sound font reader interface for Timidity++.
The only dependency left on the main GZDoom code are the CVars, which will be dealt with next.
2019-09-23 13:53:28 +02:00
Christoph Oelckers
2cf8cc47df - moved the instrument set maintenance out of the Timidity++ library into the player class.
This removes the dependency on the sound font manager from the low level library, reducing the direct dependencies to FileReader and SoundFontReader.
2019-09-23 11:27:57 +02:00
Christoph Oelckers
f6a91e1722 - moved the I_Error prototypes to doomerrors.h to avoid having to include the low level system header for this. 2019-01-31 19:38:04 +01:00
alexey.lysiuk
2ae8d39441 Removed all superfluous #include's
Automatically optimized by CLion IDE with manual corrections
2018-04-24 14:30:35 +03:00
Christoph Oelckers
3c3c2f03e8 The missing parts of last commit. 2018-03-26 20:44:25 +02:00
Christoph Oelckers
9b61ee9618 - fixed: The MIDI wave writer set the sample rate to save at too late.
This was done after the players had already been created. To ensure that everything gets set properly it is necessary to pass the desired sample rate to the device's constructor and let it make sure that a proper sample rate gets set.
2018-03-06 22:41:27 +01:00
Christoph Oelckers
4d4edcfbfb - fixed setup for Timidity++ playback frequency. 2018-03-06 19:52:29 +01:00
Christoph Oelckers
eb124f6160 - made the sound font loading a bit more error resistant.
- implemented a fallback both for sound font lookup and for MIDI device selection so that if some non-working combination is set up, the player will fall back to something that works.
2018-02-26 16:36:30 +01:00
Christoph Oelckers
47dbbeb65a Revert "- don't let the Timidity++ player directly access the CVARs."
This reverts commit 8f7a503561.

# Conflicts:
#	src/sound/timiditypp/playmidi.cpp

Something in here wasn't working as intended, and since it needs better synchronization let's redo it entirely.
2018-02-26 09:19:10 +01:00
Christoph Oelckers
2ac101fa51 - removed tmpfileplus, which was only used by the old Timidity++ player. 2018-02-24 23:01:55 +01:00
Christoph Oelckers
8f7a503561 - don't let the Timidity++ player directly access the CVARs.
This may cause problems because the player runs in a different thread than the input code.
Instead the play thread will now copy their values to local variables when it starts generating output.
2018-02-24 19:36:09 +01:00
Christoph Oelckers
2202a52840 - made the MIDI to WAVE dumper functional again, including the option of choosing the MIDI synth and sound font with which it should be rendered. 2018-02-24 18:19:27 +01:00
Christoph Oelckers
88f9f0982c - fixed Timidity++ playback. 2018-02-23 18:33:54 +01:00
Christoph Oelckers
4a179954b1 - removed Timidity_mastervolume CVAR. The reason why this was added got addressed at a lower level with the new code (i.e. the EXE's output was far too loud) and if there need to be adjustments to evening out the volume of the different MIDI synths it should be done in the data generation step, not as an added factor to the system volume of the track. 2018-02-23 17:27:36 +01:00
Christoph Oelckers
e84ec2978a - plugged the pending memory leaks. 2018-02-21 21:33:56 +01:00
Christoph Oelckers
5219916de5 - there's no need to drag the event time around, this really was just an artifact of Timidity's original implementation which is no longer in use.
- plugged a few memory leaks.
2018-02-21 21:11:31 +01:00
Christoph Oelckers
af705d1c59 - silenced a few pointless console messages generated by Timidity++. 2018-02-21 20:44:51 +01:00
Christoph Oelckers
af1de8ddc9 - removed volume testing output.
- final tweak to volume adjustment: Do this upon extraction for better results.

If this is done via the synth's parameters it will affect channel balance.
The given factor of 5 is necessary to roughly match the output of FluidSynth.
2018-02-21 20:12:37 +01:00
Christoph Oelckers
59352af486 - Volume tweaking. 2018-02-21 19:05:14 +01:00
Christoph Oelckers
e6bae25423 - Timidity++ is now fully integrated into the softsynth interface.
The only thing left to do is tweaking the volume of the output to match the one from the EXE.
2018-02-21 17:35:44 +01:00
Christoph Oelckers
445e9451cb - Added the long event handler for Timidity++.
This will be hard to test because there's basically no material out there using the features this implements.
2018-02-21 02:02:29 +01:00
Christoph Oelckers
4813eeeb85 - Timidity++ now plays ZDoom's event stream, although still through the Windows output module.
This also means that readmidi.cpp is no longer needed.
2018-02-21 01:29:39 +01:00
Christoph Oelckers
57967a1033 - safety commit. 2018-02-20 23:36:59 +01:00
Christoph Oelckers
cbcfea99cb - use the intended interface to pass some data to the player. 2018-02-20 21:52:45 +01:00
Christoph Oelckers
a8283ffdd6 - something can be heard.
This doesn't pipe the audio through OpenAL yet but the fundamentals for further progress are done.
2018-02-20 20:50:01 +01:00
Christoph Oelckers
d72b87f469 - skeleton of new player class for Timidity++ - not tested yet. 2018-02-20 01:23:56 +01:00
Christoph Oelckers
7cbcbe66c0 - sanitization of temporary file stuff for Timidity++.
* do not use the global temp directory. Instead create one in the AppData folder.
* removed lots of unneeded code from tmpfileplus.
* use C++ strings in there.
2017-12-02 17:33:43 +01:00
alexey.lysiuk
0e706bfecf Use tmpfileplus() instead of tempnam()
Finally get rid of security or deprecated warnings cause by tempnam() function usage
2017-11-07 11:50:07 +02:00
David Carlier
b871b1898d OpenBSD build fix.
- No timidity user defined parameters supported.
- Shared libraries versioning policy differs on OpenBSD.
2017-10-21 14:49:41 -04:00
Chris Robinson
666198dec8 Don't allow Timidity++ pipes less than 20ms
This prevents Timidity++ from playing externally, so it now always goes through
the sound system. Aside from the issues relating to controlling playback, that
functionality has been busted for who knows how long anyway since Open() always
tries to create a pipe and sound stream regardless of the calculated size.
2017-09-10 07:25:29 -04:00
Chris Robinson
49df5a7f16 Add a cvar for the timidity++ config file 2017-09-10 07:25:29 -04:00
Chris Robinson
8f8c2ef2ef Build Timidity++ args separately on non-Windows
Rather than building a command line that's going to be manually split into
individual arguments passed to execvp, build the individual arguments directly.
2017-09-10 07:25:29 -04:00
Chris Robinson
5b3fbfde6d Read all data from the Timidity++ pipe
For non-Windows systems, read() may be non-blocking and can return less than
the requested amount if the timidity process hasn't written enough audio yet.
2017-09-10 07:25:29 -04:00
David Carlier
8d8c353465 Attempty to free memory leaks. 2017-08-16 16:31:23 -04:00
alexey.lysiuk
eb52088487 Fixed compilation warnings reported by Clang
src/gl/scene/gl_sprite.cpp:685:34: warning: '&&' within '||' [-Wlogical-op-parentheses]
src/polyrenderer/scene/poly_sprite.cpp:297:34: warning: '&&' within '||' [-Wlogical-op-parentheses]
src/swrenderer/scene/r_opaque_pass.cpp:975:35: warning: '&&' within '||' [-Wlogical-op-parentheses]
src/sound/mididevices/music_timiditypp_mididevice.cpp:548:30: warning: comparison of integers of different signs: 'int' and 'size_t' (aka 'unsigned long') [-Wsign-compare]
2017-08-13 16:42:08 +03:00
Kevin Caccamo
7ff0040f30 Add a null pointer at the end of TimidityArgs
This actually got the execvp call working consistently for me; now I can listen to MIDI music in GZDoom again.
2017-07-31 11:05:28 -04:00
Kevin Caccamo
a4370a3529 Null-terminate strings 2017-07-31 11:05:28 -04:00
Kevin Caccamo
ff35620a09 Fix freeze when timidity_exe is not set to timidity's absolute path 2017-07-31 11:05:28 -04:00
Kevin Caccamo
18e76c978c Fix code style, and make some minor changes
Assume timidity is in the user's PATH if not the specified location
Also, get the error message for the execvp failure if it does fail
2017-07-31 11:05:28 -04:00
Kevin Caccamo
233fce7ef6 Initial attempt to make timidity work on Linux again
Add code to find the timidity executable, and split the command line into separate arguments by spaces.
For some reason, this doesn't work, although reverting 64e96c5f makes timidity work again.
2017-07-31 11:05:28 -04:00
David Carlier
64e96c5f46 OpenBSD support 2017-07-25 07:56:19 -04:00
Christoph Oelckers
fb12c58533 - restart the music if the OPL core or the config file for the softsynths is changed, except for the GUS synth, which loads all its data during engine startup and cannot swap it out.
- added arrays to the config to hold entries for the softsynths' config files. This is not active yet, but will later be used to give the user a list of config options instead of having to type it by hand.
2017-04-18 16:43:07 +02:00