Commit Graph

40 Commits

Author SHA1 Message Date
Randy Heit 81e21b0688 - Renamed music_midi_midiout.cpp to music_smf_midiout.cpp.
- Moved MIDI precaching logic into MIDIStreamer so that SMF and HMI files can both use the
  same implementation.
- Added a player for HMI midi files.

SVN r2675 (trunk)
2010-09-02 23:17:58 +00:00
Randy Heit 6f82db47b8 - Merge the shared code for the softsynths into a common base class.
SVN r2560 (trunk)
2010-08-20 04:21:53 +00:00
Randy Heit eafb0ab7cf - Expose more FluidSynth settings through these cvars:
* fluid_samplerate
  * fluid_threads
  * fluid_reverb_roomsize
  * fluid_reverb_damping
  * fluid_reverb_width
  * fluid_reverb_level
  * fluid_chorus_voices
  * fluid_chorus_level
  * fluid_chorus_speed
  * fluid_chorus_depth
  * fluid_chorus_type

SVN r2559 (trunk)
2010-08-19 23:11:16 +00:00
Randy Heit a68e9c8fa6 - Added a dlopen() version of on-demand FluidSynth loading and exposed it
to CMake through the DYN_FLUIDSYNTH option.



SVN r2558 (trunk)
2010-08-19 20:46:19 +00:00
Randy Heit f389cd8b0f - Add on-demand loading for fluidsynth.dll. This also lets you build with FluidSynth support
without actually having the FluidSynth development files installed.

SVN r2557 (trunk)
2010-08-19 16:49:43 +00:00
Randy Heit 1fa4bbf69c - Added FluidSynth support as snd_mididevice -5. Only tested with Linux. I will have
to try compiling it myself on Windows to see if it's really that slow or if
  Ubuntu just ships an unoptimized version, because performance is pretty pathetic
  when compared to the other options. (I understand that it's a complete SoundFont2
  renderer, so it is understandably slower than something like TiMidity++, but still.
  Does it really need to be around 10x slower? I played with the chorus, reverb, and
  interpolation settings, and none of them seemed to make much difference in
  performance.)



SVN r2545 (trunk)
2010-08-15 19:54:59 +00:00
Randy Heit 503b934938 - Added better error messages for MIDI playback failure than just "MIDI playback failure".
SVN r2383 (trunk)
2010-06-20 04:41:23 +00:00
Randy Heit 5300572b88 - Moved USE_WINDOWS_DWORD definition out of music_gme.cpp and into i_musicinterns.h.
SVN r1632 (trunk)
2009-06-04 00:58:42 +00:00
Randy Heit a8de4fc2da - Fixed compilation of i_keyboard.cpp with MinGW, because w32api still doesn't have
everything that was new for XP.
- Swapped snes_spc out for the full Game Music Emu library.

SVN r1631 (trunk)
2009-06-03 03:05:02 +00:00
Christoph Oelckers a908834a11 - added some default definitions for constants that may miss in some headers.
- replaced __va_copy with va_copy per Chris's suggestion.
- replaced #include <malloc.h> with #include <stdlib.h> where possible.


SVN r1524 (trunk)
2009-04-07 07:06:07 +00:00
Randy Heit 9f21b22cc5 - Fixed spurious warnings on 32-bit VC++ debug builds.
- Made the subsong (order) number a proper parameter to MusInfo::Play()
  instead of requiring a separate SetPosition() call to do it.



SVN r1104 (trunk)
2008-08-03 03:54:48 +00:00
Randy Heit 01f59fa85f - Added an alternate module replay engine that uses foo_dumb's replayer, a
heavily customized version of DUMB (Dynamic Universal Music Bibliotheque).
  It has been slightly modified by me:
  * Added support for Ogg Vorbis-compressed samples in XM files ala FMOD.
  * Removed excessive mallocs from the replay core.
  * Rerolled the loops in resample.c. Unrolling them made the object file
    ~250k large while providing little benefit. Even at ~100k, I think it's
    still larger than it ought to be, but I'll live with it for now.
  Other than that, it's essentially the same thing you'd hear in foobar2000,
  minus some subsong detection features. Release builds of the library look
  like they might even be slightly faster than FMOD, which is a plus.
- Fixed: Timidity::font_add() did not release the file reader it created.
- Fixed: The SF2 loader did not free the sample headers in its destructor.


SVN r995 (trunk)
2008-05-29 23:33:07 +00:00
Randy Heit c86d7e0afd - Fixed: FString::StripRight() stripped the final character of the string if
there were no designated characters to strip at the end of it.
- Added support for Shoutcast/Icecast playlists.
- Added an error message when a playlist could not be opened.
- Added support for PLS format playlists, in addition to M3U.
- Changed FPlayList to use an array of FStrings.
- Fixed: Playlists required every song to be specified by an absolute path.


SVN r951 (trunk)
2008-04-30 05:36:24 +00:00
Randy Heit effe9427fd - Added the writewave command to write the internal TiMidity's output to a
wave file.
- Changed the default channel velocity for MUS files from 64 to 100 to
  better match apparent MIDI practice. (Would like to know what this is
  supposed to be.)
- Changed the mus2midi channel assignments to match the internal player's.
- Fixed: apply_envelope_to_amp() should clamp the mix levels to 0.


SVN r926 (trunk)
2008-04-19 21:36:53 +00:00
Randy Heit f6866df0e6 - Made the maximum number of TiMidity voices configurable through the
timidity_voices cvar.
- Added stats lines for the OPL and Timidity MIDI devices.
- Completely changed the way TiMidity volume calculations are done. It
  should now be extremely close to the output a real GUS would produce with
  its official MIDI player (excepting where TiMidity normalizes sample
  volumes). The new equations more closely match what is specified by the DLS
  and SF2 specs (but not quite), so I presume it's also more musically
  correct than what TiMidity (and TiMidity++) do.


SVN r925 (trunk)
2008-04-19 05:57:09 +00:00
Christoph Oelckers 96b72f2e33 - Changed the internal Timidity player so that it uses timidity_mastervolume
because it has the same sound volume issues as the external one.
- Replaced use of stdio in Timidity with FileReader and added the option to read
  from the lump directory. If the main config file is inside the lump directory
  it will assume that everything else is as well. If it is a real file it will be
  assumed that the rest is real files as well.
- Fixed: None of the error returns in Timidity::read_config_file closed the file being read.


SVN r906 (trunk)
2008-04-12 21:36:10 +00:00
Randy Heit b340f9c762 - Removed some GCC warnings.
- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp.
- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW
  failed compiling the new MIDI code.
- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char
  pointers, since "" is a constant.
- Fixed: parsecontext.h was missing a newline at the end of the file.


SVN r904 (trunk)
2008-04-12 05:33:20 +00:00
Randy Heit 0d18580ff0 - Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In
particular, this meant that every channel was almost certainly in mono mode,
  which can sound pretty bad if the song isn't meant to be played that way.
- Added bank numbers to the MIDI precaching for Timidity, since I guess I do
  need to care about banks, if even the Duke MIDIs use various banks.
- Fixed: snd_midiprecache only exists in Win32 builds, so gameconfigfile.cpp
  shouldn't unconditionally link against it.
- Fixed: pre_resample() was still disabled, and it left two samples at the end
  of the new wave data uninitialized.


SVN r903 (trunk)
2008-04-12 05:04:37 +00:00
Randy Heit 10c0d67b78 - Changed the MIDIStreamer to send the all notes off controller to each
channel when restarting the song, rather than emitting a single note off
  event which only has a 1 in 127 chance of being for a note that's playing
  on that channel. Then I decided it would probably be a good idea to reset
  all the controllers as well.
- Increasing the size of the internal Timidity stream buffer from 1/14 sec
  (copied from the OPL player) improved its sound dramatically, so apparently
  Timidity has issues with short stream buffers. It's now at 1/2 sec in
  length. However, there seems to be something weird going on with
  corazonazul_ff6boss.mid near the beginning where it stops and immediately
  restarts a guitar on the exact same note.
- Added a new sound debugging cvar: snd_drawoutput, which can show various
  oscilloscopes and spectrums.
- Internal TiMidity now plays music.
- Changed the progdir global variable into an FString.

SVN r900 (trunk)
2008-04-11 04:59:23 +00:00
Randy Heit 68e4b3d946 - Reimplemented snd_midiprecache, now for MIDI as well as MUS, and
defaulting to false.


SVN r895 (trunk)
2008-04-09 03:55:04 +00:00
Randy Heit 3a5afd1418 - Added support for dumping from RAW/DRO/IMF files, so now anything that
can be played as OPL can also be dumped.
- Removed the opl_enable cvar, since OPL playback is now selectable as just
  another MIDI device.
- Added support for DRO playback and dual-chip RAW playback.
- Removed MUS support from OPLMUSSong, since using the OPLMIDIDevice with
  MUSSong2 works just as well. There are still lots of leftover bits in
  the class that should probably be removed at some point, too.
- Added dual-chip dumping support for the RAW format.
- Added DosBox Raw OPL (.DRO) dumping support. For whatever reason,
  in_adlib calculates the song length for this format wrong, even though
  the exact length is stored right in the header. (But in_adlib seems buggy
  in general; too bad it's the only Windows version of Adplug that seems to
  exist.)
- Rewrote the OPL dumper to work with MIDI as well as MUS.


SVN r872 (trunk)
2008-04-03 02:31:39 +00:00
Randy Heit f23e9df084 - Fixed: OPLMIDIDevice sent the wrong pitch wheel value to the player code.
Missimp.mid sounds a lot better now, though still a little off.
- Fixed: MIDI files that had ticks with nothing but meta-events did not play
  properly. (fixes sonic3_finalboss.mid)


SVN r868 (trunk)
2008-03-30 02:51:34 +00:00
Randy Heit 930de248fd - Applied Const's Makefile.linux changes.
- Made the OPL MIDI synth available from Linux.



SVN r866 (trunk)
2008-03-30 00:04:09 +00:00
Randy Heit cd70087ed5 - Moved sound sample rate, buffer size, and buffer count to the
advanced sound options menu. Removed opl_enable from the menu.
- Added OPL synth as MIDI device -3. Since this is based on the MUS player
  code, it only supports those events and controllers supported by MUS.
  Some of Duke's MIDIs sound awful, but I think that may be more because
  it's using different instruments... There's a thread in the MIDI streamer
  class that could be taken out for Linux, since it doesn't need to deal
  with the Windows Multimedia API, but for now, this is still Windows-only.


SVN r864 (trunk)
2008-03-29 05:01:38 +00:00
Randy Heit 938ae1767b - Did some restructuring of the OPL code in preparation for turning it
into a general MIDI player.
- Fixed: Passing false for a stream callback did not stop the stream.
- Removed opl_frequency, since the only time the emulation sounds good is
  when it plays at the exact frequency of a real chip.
- Music no longer plays at all when snd_musicvolume is 0.
- Bumped up snd_sfxvolume and snd_musicvolume default values.

SVN r862 (trunk)
2008-03-28 03:19:18 +00:00
Randy Heit 8d0c48bf81 - The garbage collector is now run one last time just before exiting the game.
- Removed movie volume from the sound menu and renamed some of the other
  options to give the MIDI device name more room to display itself.
- Moved the midi device selection into the main sound menu.
- Added FMOD as MIDI device -1, to replace the MIDI mapper. This is still the
  default device. By default, it uses exactly the same DLS instruments as the
  Microsoft GS Wavetable Synth. If you have another set DLS level 1 patch set
  you want to use, set the snd_midipatchfile cvar to specify where it should
  load the instruments from.
- Changed the ProduceMIDI function to store its output into a TArray<BYTE>.
  An overloaded version wraps around it to continue to supply file-writing
  support for external Timidity++ usage.
- Added an FMOD credits banner to comply with their non-commercial license.
- Reimplemented the snd_buffersize cvar for the FMOD Ex sound system. Rather
  than a time in ms, this is now the length in samples of the DSP buffer.
  Also added the snd_buffercount cvar to offer complete control over the
  call to FMOD::System::setDSPBufferSize(). Note that with any snd_samplerate
  below about 44kHz, you will need to set snd_buffersize to avoid long
  latencies.
- Reimplemented the snd_output cvar for the FMOD Ex sound system.
- Changed snd_samplerate default to 0. This now means to use the default
  sample rate.
- Made snd_output, snd_output_format, snd_speakermode, snd_resampler, and
  snd_hrtf available through the menu.
- Split the HRTF effect selection into its own cvar: snd_hrtf.
- Removed 96000 Hz option from the menu. It's still available through the
  cvar, if desired.
- Fixed: If Windows sound init failed, retry with DirectSound. (Apparently,
  WASAPI doesn't work with more than two speakers and PCM-Float output at the
  same time.)
- Fixed: Area sounds only played from the front speakers once you got within
  the 2D panning area.


SVN r854 (trunk)
2008-03-26 04:27:07 +00:00
Randy Heit ce811319a7 - Fixed: If an object is flagged for euthanization while it's in the gray
list, it should just be ignored during the propagation stage.
- After sleeping on it and realizing what was really going in, I generalized
  the inventory fix from the 13th: The actor is flagged by Destroy(), then it
  is later inserted into the thinker list by DThinker::SerializeAll(). So
  rather than unlinking the skipped player from their inventory, just make
  sure any flagged thinkers aren't inserted into a list.
- Fixed: FCanvasTextureInfo::Viewpoint needed a read barrier, and the whole
  list should serve as a root.
- Reimplemented SPC playback as a custom codec for FMOD.
- Removed spc_frequency, because snes_spc only supports the SPC's native
  frequency of 32000 Hz.


SVN r806 (trunk)
2008-03-16 00:54:53 +00:00
Randy Heit 3bfcc5c09c - Removed lots of spc_* cvars that are no longer meaningful and changed
spc_amp from a x.4 fixed point number to a normal float.
- Switched SPC playback from the external SNESAPU.DLL to Blargg's LGPL
  snes_spc library. I've compiled it with the fast DSP rather than the
  highly accurate one, since I didn't notice a meaningful difference between
  the two in my limited testing. In short: SPC playback is now built in to
  ZDoom. You don't need to download anything extra to make it work, and it
  also works on Linux as well as Windows (though building with Linux is
  currently untested).
- Fixed: Stereo separation was calculated very wrongly when in 2D sound mode.


SVN r794 (trunk)
2008-03-11 22:17:57 +00:00
Christoph Oelckers 4576022c8d - fixed: The release build still linked to the old FMOD version.
- fixed: SPCSong only works for Win32 so its definition must be excluded for Linux.



SVN r790 (trunk)
2008-03-09 11:05:25 +00:00
Randy Heit 2b721975dd VERY IMPORTANT NOTE FOR ANYBODY BUILDING FROM THE TRUNK: This commit adds support
for FMOD Ex while at the same time removing support for FMOD 3. Be sure to update
your SDKs. GCC users, be sure to do a "make cleandep && make clean" before
building, or you will likely get inexplicable errors.

- Fixed: If you wanted to make cleandep with MinGW, you had to specifically
  specify Makefile.mingw as the makefile to use.
- Added a normalizer to the OPL synth. It helped bring up the volume a little,
  but not nearly as much as I would have liked.
- Removed MIDI Mapper references. It doesn't work with the stream API, and
  it doesn't really exist on NT kernels, either.
- Reworked music volume: Except for MIDI, all music volume is controlled
  through GSnd and not at the individual song level.
- Removed the mididevice global variable.
- Removed snd_midivolume. Now that all music uses a linear volume scale,
  there's no need for two separate music volume controls.
- Increased snd_samplerate default up to 48000.
- Added snd_format, defaulting to "PCM-16".
- Added snd_speakermode, defaulting to "Auto".
- Replaced snd_fpu with snd_resampler, defaulting to "Linear".
- Bumped the snd_channels default up from a pitiful 12 to 32.
- Changed snd_3d default to true. The new cvar snd_hw3d determines if
  hardware 3D support is used and default to false.
- Removed the libFLAC source, since FMOD Ex has native FLAC support.
- Removed the altsound code, since it was terribly gimped in comparison to
  the FMOD code. It's original purpose was to have been as a springboard for
  writing a non-FMOD sound system for Unix-y systems, but that never
  happened.
- Finished preliminary FMOD Ex support.


SVN r789 (trunk)
2008-03-09 03:13:49 +00:00
Randy Heit 68f726e422 - The full master volume SysEx is now always sent to the MIDI device, even if
it seems to have a working volume control.
- Renamed music_midi_stream.cpp to music_midi_base.cpp.
- Moved the WinMM MIDI code into a new container class.


SVN r787 (trunk)
2008-03-07 00:43:05 +00:00
Randy Heit 68a8ea2189 - Moved the identical code between the MUS and MIDI streamers into a new base
class so they all the low-level details of MIDI streaming are kept in
  one place.
- Converted the SMF MIDI playback to use the same MIDI streams as MUS
  playback.
- Moved MUS playback back into its own thread so that it can continue
  uninterrupted if the main thread is too busy to service it in a timely
  manner.
- Fixed: The MEVT_* values are not defined shifted into their spot for a
  MIDIEVENT, so I need to do it myself.
- Fixed: Pausing a MUS and the changing snd_midivolume caused the paused
  notes to become audible.


SVN r784 (trunk)
2008-03-05 03:10:31 +00:00
Randy Heit 69cebb7e57 - Changed MUS playback to use MIDI streams, like it did during the early days
of ZDoom, except now the entire song isn't prebuffered in large chunks, so
  I can insert MIDI events into the playback with fairly low latency. This
  should offer more precise timing than the combination of low-level MIDI and
  WaitForSingleObject timeouts.


SVN r783 (trunk)
2008-03-04 06:36:23 +00:00
Randy Heit ef99d9c057 - Fixed: PTR_BounceTraverse only checked for projectiles that were too
high to pass through two-sided lines, but not ones that were too low.
- Fixed: SBARINFO couldn't detect the extreme death damage type for the
  player face animation.


SVN r782 (trunk)
2008-03-04 00:56:22 +00:00
Christoph Oelckers 2695a4360a - Forgot to add changes to i_musicinterns.h for last commit.
SVN r720 (trunk)
2008-01-27 18:09:06 +00:00
Randy Heit c412b42703 - Fixed: cycle_t was still a DWORD and not a QWORD under GCC.
- The stat meters now return an FString instead of sprintfing into a fixed
  output buffer.
- NOASM is now automatically defined when compiling for a non-x86 target.
- Some changes have been made to the integral types in doomtype.h:
  - For consistancy with the other integral types, byte is no longer a
    synonym for BYTE.
  - Most uses of BOOL have been change to the standard C++ bool type. Those
    that weren't were changed to INTBOOL to indicate they may contain values
    other than 0 or 1 but are still used as a boolean.
  - Compiler-provided types with explicit bit sizes are now used. In
    particular, DWORD is no longer a long so it will work with both 64-bit
    Windows and Linux.
  - Since some files need to include Windows headers, uint32 is a synonym
    for the non-Windows version of DWORD.
- Removed d_textur.h. The pic_t struct it defined was used nowhere, and that
  was all it contained.


SVN r326 (trunk)
2006-09-14 00:02:31 +00:00
Randy Heit ea3b76815d - Removed -bpal parameter. Blood's blood.pal is loaded from blood.rff, and
its tiles are loaded from the same directory.
- RFF files now load their entire directories into the lumplist.
- Added char * and const char * type coversions for FString, so FStrings can be
  freely passed to functions expecting C strings. (Except varargs functions,
  which still require manually fetching the C string out of it.)
- Renamed the name class to FName.
- Renamed the string class to FString to emphasize that it is not std::string.


SVN r74 (trunk)
2006-05-03 22:45:01 +00:00
Christoph Oelckers 07f35a7008 SVN r44 (trunk) 2006-04-14 12:58:52 +00:00
Randy Heit 16c085e146 - Fixed: The strupr() implementation in w_wad.cpp relied on compiler-dependant
behavior.
- Fixed fix: ParseActorProperties() still wasn't sending + or - to
  ActorFlagSetOrReset().
- Fixed: [GZ] An item without use state won't be removed when being picked up.
  The call to GoAwayAndDie is missing.
- Fixed: [GZ]  A_GiveInventory sets the amount to give to a value passed to
  this function. This is ok for everything except Health items. They should
  give their original amount multiplied with the passed parameter.
- Fixed: Potential buffer overrun when launching timidity.


SVN r21 (trunk)
2006-04-09 19:34:35 +00:00
Randy Heit cf11cbdb30 Directory restructuring to make it easier to version projects that don't build zdoom.exe.
SVN r4 (trunk)
2006-02-24 04:48:15 +00:00