2006-02-24 04:48:15 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
2006-09-14 00:02:31 +00:00
|
|
|
#define USE_WINDOWS_DWORD
|
2006-02-24 04:48:15 +00:00
|
|
|
#if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0400
|
|
|
|
#undef _WIN32_WINNT
|
|
|
|
#endif
|
|
|
|
#ifndef _WIN32_WINNT
|
|
|
|
#define _WIN32_WINNT 0x0400
|
|
|
|
#endif
|
|
|
|
#include <windows.h>
|
|
|
|
#include <mmsystem.h>
|
|
|
|
#else
|
|
|
|
#include <SDL.h>
|
|
|
|
#define FALSE 0
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
#include <fmod.h>
|
|
|
|
#include "tempfiles.h"
|
|
|
|
#include "oplsynth/opl_mus_player.h"
|
|
|
|
#include "c_cvars.h"
|
|
|
|
#include "mus2midi.h"
|
|
|
|
#include "i_sound.h"
|
|
|
|
|
|
|
|
void I_InitMusicWin32 ();
|
|
|
|
void I_ShutdownMusicWin32 ();
|
|
|
|
|
|
|
|
extern float relative_volume;
|
|
|
|
|
|
|
|
// The base music class. Everything is derived from this --------------------
|
|
|
|
|
|
|
|
class MusInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MusInfo () : m_Status(STATE_Stopped) {}
|
|
|
|
virtual ~MusInfo ();
|
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
|
|
|
virtual void MusicVolumeChanged(); // snd_musicvolume changed
|
|
|
|
virtual void TimidityVolumeChanged(); // timidity_mastervolume changed
|
2006-02-24 04:48:15 +00:00
|
|
|
virtual void Play (bool looping) = 0;
|
|
|
|
virtual void Pause () = 0;
|
|
|
|
virtual void Resume () = 0;
|
|
|
|
virtual void Stop () = 0;
|
|
|
|
virtual bool IsPlaying () = 0;
|
|
|
|
virtual bool IsMIDI () const = 0;
|
|
|
|
virtual bool IsValid () const = 0;
|
|
|
|
virtual bool SetPosition (int order);
|
2008-03-05 03:10:31 +00:00
|
|
|
virtual void Update();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
enum EState
|
|
|
|
{
|
|
|
|
STATE_Stopped,
|
|
|
|
STATE_Playing,
|
|
|
|
STATE_Paused
|
|
|
|
} m_Status;
|
|
|
|
bool m_Looping;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
2008-03-04 06:36:23 +00:00
|
|
|
|
2008-03-07 00:43:05 +00:00
|
|
|
// A device that provides a WinMM-like MIDI streaming interface -------------
|
|
|
|
|
|
|
|
class MIDIDevice
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MIDIDevice();
|
|
|
|
virtual ~MIDIDevice();
|
|
|
|
|
|
|
|
virtual int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata) = 0;
|
|
|
|
virtual void Close() = 0;
|
|
|
|
virtual bool IsOpen() const = 0;
|
|
|
|
virtual int GetTechnology() const = 0;
|
|
|
|
virtual int SetTempo(int tempo) = 0;
|
|
|
|
virtual int SetTimeDiv(int timediv) = 0;
|
|
|
|
virtual int StreamOut(MIDIHDR *data) = 0;
|
|
|
|
virtual int Resume() = 0;
|
|
|
|
virtual void Stop() = 0;
|
|
|
|
virtual int PrepareHeader(MIDIHDR *data) = 0;
|
|
|
|
virtual int UnprepareHeader(MIDIHDR *data) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// WinMM implementation of a MIDI output device -----------------------------
|
|
|
|
|
|
|
|
class WinMIDIDevice : public MIDIDevice
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WinMIDIDevice(int dev_id);
|
|
|
|
~WinMIDIDevice();
|
|
|
|
int Open(void (*callback)(unsigned int, void *, DWORD, DWORD), void *userdata);
|
|
|
|
void Close();
|
|
|
|
bool IsOpen() const;
|
|
|
|
int GetTechnology() const;
|
|
|
|
int SetTempo(int tempo);
|
|
|
|
int SetTimeDiv(int timediv);
|
|
|
|
int StreamOut(MIDIHDR *data);
|
|
|
|
int Resume();
|
|
|
|
void Stop();
|
|
|
|
int PrepareHeader(MIDIHDR *data);
|
|
|
|
int UnprepareHeader(MIDIHDR *data);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static void CALLBACK CallbackFunc(HMIDIOUT, UINT, DWORD_PTR, DWORD, DWORD);
|
|
|
|
|
|
|
|
HMIDISTRM MidiOut;
|
|
|
|
UINT DeviceID;
|
|
|
|
DWORD SavedVolume;
|
|
|
|
bool VolumeWorks;
|
|
|
|
|
|
|
|
void (*Callback)(unsigned int, void *, DWORD, DWORD);
|
|
|
|
void *CallbackData;
|
|
|
|
};
|
|
|
|
|
2008-03-05 03:10:31 +00:00
|
|
|
// Base class for streaming MUS and MIDI files ------------------------------
|
2008-03-04 06:36:23 +00:00
|
|
|
|
2008-03-07 00:43:05 +00:00
|
|
|
|
2008-03-05 03:10:31 +00:00
|
|
|
class MIDIStreamer : public MusInfo
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-03-05 03:10:31 +00:00
|
|
|
MIDIStreamer();
|
|
|
|
~MIDIStreamer();
|
|
|
|
|
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
|
|
|
void MusicVolumeChanged();
|
2008-03-05 03:10:31 +00:00
|
|
|
void Play(bool looping);
|
|
|
|
void Pause();
|
|
|
|
void Resume();
|
|
|
|
void Stop();
|
|
|
|
bool IsPlaying();
|
|
|
|
bool IsMIDI() const;
|
|
|
|
bool IsValid() const;
|
|
|
|
void Update();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static DWORD WINAPI PlayerProc (LPVOID lpParameter);
|
2008-03-07 00:43:05 +00:00
|
|
|
static void Callback(UINT uMsg, void *userdata, DWORD dwParam1, DWORD dwParam2);
|
2008-03-05 03:10:31 +00:00
|
|
|
DWORD PlayerLoop();
|
2006-02-24 04:48:15 +00:00
|
|
|
void OutputVolume (DWORD volume);
|
2008-03-04 06:36:23 +00:00
|
|
|
int FillBuffer(int buffer_num, int max_events, DWORD max_time);
|
2008-03-05 03:10:31 +00:00
|
|
|
bool ServiceEvent();
|
|
|
|
int VolumeControllerChange(int channel, int volume);
|
|
|
|
|
|
|
|
// Virtuals for subclasses to override
|
2008-03-07 00:43:05 +00:00
|
|
|
virtual void CheckCaps();
|
2008-03-05 03:10:31 +00:00
|
|
|
virtual void DoInitialSetup() = 0;
|
|
|
|
virtual void DoRestart() = 0;
|
|
|
|
virtual bool CheckDone() = 0;
|
|
|
|
virtual DWORD *MakeEvents(DWORD *events, DWORD *max_event_p, DWORD max_time) = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
enum
|
|
|
|
{
|
2008-03-04 06:36:23 +00:00
|
|
|
MAX_EVENTS = 128
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-03-04 06:36:23 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
SONG_MORE,
|
|
|
|
SONG_DONE,
|
|
|
|
SONG_ERROR
|
|
|
|
};
|
|
|
|
|
2008-03-07 00:43:05 +00:00
|
|
|
MIDIDevice *MIDI;
|
2008-03-05 03:10:31 +00:00
|
|
|
HANDLE PlayerThread;
|
|
|
|
HANDLE ExitEvent;
|
|
|
|
HANDLE BufferDoneEvent;
|
2008-03-07 00:43:05 +00:00
|
|
|
|
2008-03-05 03:10:31 +00:00
|
|
|
DWORD Events[2][MAX_EVENTS*3];
|
2008-03-04 06:36:23 +00:00
|
|
|
MIDIHDR Buffer[2];
|
|
|
|
int BufferNum;
|
|
|
|
int EndQueued;
|
|
|
|
bool VolumeChanged;
|
|
|
|
bool Restarting;
|
2008-03-05 03:10:31 +00:00
|
|
|
bool InitialPlayback;
|
2008-03-04 06:36:23 +00:00
|
|
|
DWORD NewVolume;
|
2008-03-05 03:10:31 +00:00
|
|
|
int Division;
|
|
|
|
int Tempo;
|
|
|
|
int InitialTempo;
|
|
|
|
BYTE ChannelVolumes[16];
|
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
|
|
|
DWORD Volume;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
2008-03-05 03:10:31 +00:00
|
|
|
// MUS file played with a MIDI stream ---------------------------------------
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-05 03:10:31 +00:00
|
|
|
class MUSSong2 : public MIDIStreamer
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
public:
|
2008-03-05 03:10:31 +00:00
|
|
|
MUSSong2 (FILE *file, char *musiccache, int length);
|
|
|
|
~MUSSong2 ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-05 03:10:31 +00:00
|
|
|
protected:
|
|
|
|
void DoInitialSetup();
|
|
|
|
void DoRestart();
|
|
|
|
bool CheckDone();
|
|
|
|
DWORD *MakeEvents(DWORD *events, DWORD *max_events_p, DWORD max_time);
|
|
|
|
|
|
|
|
MUSHeader *MusHeader;
|
|
|
|
BYTE *MusBuffer;
|
|
|
|
BYTE LastVelocity[16];
|
|
|
|
size_t MusP, MaxMusP;
|
|
|
|
};
|
|
|
|
|
|
|
|
// MIDI file played with a MIDI stream --------------------------------------
|
|
|
|
|
|
|
|
class MIDISong2 : public MIDIStreamer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MIDISong2 (FILE *file, char *musiccache, int length);
|
|
|
|
~MIDISong2 ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
2008-03-07 00:43:05 +00:00
|
|
|
void CheckCaps();
|
2008-03-05 03:10:31 +00:00
|
|
|
void DoInitialSetup();
|
|
|
|
void DoRestart();
|
|
|
|
bool CheckDone();
|
|
|
|
DWORD *MakeEvents(DWORD *events, DWORD *max_events_p, DWORD max_time);
|
|
|
|
|
2006-09-14 00:02:31 +00:00
|
|
|
struct TrackInfo;
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
void ProcessInitialMetaEvents ();
|
2008-03-05 03:10:31 +00:00
|
|
|
DWORD *SendCommand (DWORD *event, TrackInfo *track, DWORD delay);
|
2006-02-24 04:48:15 +00:00
|
|
|
TrackInfo *FindNextDue ();
|
2008-03-05 03:10:31 +00:00
|
|
|
void SetTempo(int new_tempo);
|
2006-09-14 00:02:31 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
BYTE *MusHeader;
|
|
|
|
TrackInfo *Tracks;
|
|
|
|
TrackInfo *TrackDue;
|
|
|
|
int NumTracks;
|
|
|
|
int Format;
|
|
|
|
WORD DesignationMask;
|
|
|
|
};
|
2008-03-05 03:10:31 +00:00
|
|
|
|
|
|
|
#endif /* _WIN32 */
|
2006-02-24 04:48:15 +00:00
|
|
|
|
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
|
|
|
// Anything supported by FMOD out of the box --------------------------------
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class StreamSong : public MusInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
StreamSong (const char *file, int offset, int length);
|
|
|
|
~StreamSong ();
|
|
|
|
void Play (bool looping);
|
|
|
|
void Pause ();
|
|
|
|
void Resume ();
|
|
|
|
void Stop ();
|
|
|
|
bool IsPlaying ();
|
|
|
|
bool IsMIDI () const { return false; }
|
|
|
|
bool IsValid () const { return m_Stream != NULL; }
|
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
|
|
|
bool SetPosition (int order);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
StreamSong () : m_Stream(NULL), m_LastPos(0) {}
|
|
|
|
|
|
|
|
SoundStream *m_Stream;
|
|
|
|
int m_LastPos;
|
|
|
|
};
|
|
|
|
|
|
|
|
// MIDI file played with Timidity and possibly streamed through FMOD --------
|
|
|
|
|
|
|
|
class TimiditySong : public StreamSong
|
|
|
|
{
|
|
|
|
public:
|
2006-04-14 12:58:52 +00:00
|
|
|
TimiditySong (FILE *file, char * musiccache, int length);
|
2006-02-24 04:48:15 +00:00
|
|
|
~TimiditySong ();
|
|
|
|
void Play (bool looping);
|
|
|
|
void Stop ();
|
|
|
|
bool IsPlaying ();
|
2006-04-09 19:34:35 +00:00
|
|
|
bool IsValid () const { return CommandLine.Len() > 0; }
|
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
|
|
|
void TimidityVolumeChanged();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void PrepTimidity ();
|
|
|
|
bool LaunchTimidity ();
|
|
|
|
|
|
|
|
FTempFileName DiskName;
|
|
|
|
#ifdef _WIN32
|
|
|
|
HANDLE ReadWavePipe;
|
|
|
|
HANDLE WriteWavePipe;
|
|
|
|
HANDLE KillerEvent;
|
|
|
|
HANDLE ChildProcess;
|
|
|
|
bool Validated;
|
|
|
|
bool ValidateTimidity ();
|
|
|
|
#else // _WIN32
|
|
|
|
int WavePipe[2];
|
|
|
|
pid_t ChildProcess;
|
|
|
|
#endif
|
2006-05-03 22:45:01 +00:00
|
|
|
FString CommandLine;
|
2006-04-09 19:34:35 +00:00
|
|
|
size_t LoopPos;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static bool FillStream (SoundStream *stream, void *buff, int len, void *userdata);
|
|
|
|
#ifdef _WIN32
|
|
|
|
static const char EventName[];
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
// MUS file played by a software OPL2 synth and streamed through FMOD -------
|
|
|
|
|
|
|
|
class OPLMUSSong : public StreamSong
|
|
|
|
{
|
|
|
|
public:
|
2006-04-14 12:58:52 +00:00
|
|
|
OPLMUSSong (FILE *file, char * musiccache, int length);
|
2006-02-24 04:48:15 +00:00
|
|
|
~OPLMUSSong ();
|
|
|
|
void Play (bool looping);
|
|
|
|
bool IsPlaying ();
|
|
|
|
bool IsValid () const;
|
|
|
|
void ResetChips ();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static bool FillStream (SoundStream *stream, void *buff, int len, void *userdata);
|
|
|
|
|
|
|
|
OPLmusicBlock *Music;
|
|
|
|
};
|
|
|
|
|
|
|
|
// CD track/disk played through the multimedia system -----------------------
|
|
|
|
|
|
|
|
class CDSong : public MusInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CDSong (int track, int id);
|
|
|
|
~CDSong ();
|
|
|
|
void Play (bool looping);
|
|
|
|
void Pause ();
|
|
|
|
void Resume ();
|
|
|
|
void Stop ();
|
|
|
|
bool IsPlaying ();
|
|
|
|
bool IsMIDI () const { return false; }
|
|
|
|
bool IsValid () const { return m_Inited; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
CDSong () : m_Inited(false) {}
|
|
|
|
|
|
|
|
int m_Track;
|
|
|
|
bool m_Inited;
|
|
|
|
};
|
|
|
|
|
|
|
|
// CD track on a specific disk played through the multimedia system ---------
|
|
|
|
|
|
|
|
class CDDAFile : public CDSong
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CDDAFile (FILE *file, int length);
|
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
extern MusInfo *currSong;
|
|
|
|
extern int nomusic;
|
|
|
|
|
|
|
|
EXTERN_CVAR (Float, snd_musicvolume)
|
|
|
|
EXTERN_CVAR (Bool, opl_enable)
|