2006-02-24 04:48:15 +00:00
|
|
|
#ifndef FMODSOUND_H
|
|
|
|
#define FMODSOUND_H
|
|
|
|
|
|
|
|
#include "i_sound.h"
|
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
|
|
|
#include "fmod_wrap.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class FMODSoundRenderer : public SoundRenderer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FMODSoundRenderer ();
|
|
|
|
~FMODSoundRenderer ();
|
|
|
|
bool IsValid ();
|
|
|
|
|
|
|
|
void SetSfxVolume (float volume);
|
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 SetMusicVolume (float volume);
|
2006-02-24 04:48:15 +00:00
|
|
|
void LoadSound (sfxinfo_t *sfx);
|
|
|
|
void UnloadSound (sfxinfo_t *sfx);
|
2008-03-21 05:13:59 +00:00
|
|
|
unsigned int GetMSLength(sfxinfo_t *sfx);
|
2008-04-11 04:59:23 +00:00
|
|
|
float GetOutputRate();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-21 05:13:59 +00:00
|
|
|
// Streaming sounds.
|
2006-02-24 04:48:15 +00:00
|
|
|
SoundStream *CreateStream (SoundStreamCallback callback, int buffsamples, int flags, int samplerate, void *userdata);
|
|
|
|
SoundStream *OpenStream (const char *filename, int flags, int offset, int length);
|
|
|
|
long PlayStream (SoundStream *stream, int volume);
|
|
|
|
void StopStream (SoundStream *stream);
|
|
|
|
|
2008-03-21 05:13:59 +00:00
|
|
|
// Starts a sound.
|
2008-03-25 04:42:26 +00:00
|
|
|
FSoundChan *StartSound (sfxinfo_t *sfx, float vol, int pitch, int chanflags);
|
2008-06-15 02:25:09 +00:00
|
|
|
FSoundChan *StartSound3D (sfxinfo_t *sfx, float vol, float distscale, int pitch, int priority, float pos[3], float vel[3], sector_t *sector, int channum, int chanflags);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Stops a sound channel.
|
2008-03-21 05:13:59 +00:00
|
|
|
void StopSound (FSoundChan *chan);
|
2007-02-14 20:18:22 +00:00
|
|
|
|
2006-05-21 02:10:16 +00:00
|
|
|
// Pauses or resumes all sound effect channels.
|
|
|
|
void SetSfxPaused (bool paused);
|
|
|
|
|
2008-05-31 02:18:09 +00:00
|
|
|
void SetInactive (bool inactive);
|
|
|
|
|
2008-03-21 05:13:59 +00:00
|
|
|
// Updates the position of a sound channel.
|
|
|
|
void UpdateSoundParams3D (FSoundChan *chan, float pos[3], float vel[3]);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// For use by I_PlayMovie
|
|
|
|
void MovieDisableSound ();
|
|
|
|
void MovieResumeSound ();
|
|
|
|
|
2008-03-21 05:13:59 +00:00
|
|
|
void UpdateListener ();
|
|
|
|
void UpdateSounds ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
void PrintStatus ();
|
|
|
|
void PrintDriversList ();
|
2006-09-14 00:02:31 +00:00
|
|
|
FString GatherStats ();
|
2008-05-29 23:33:07 +00:00
|
|
|
short *DecodeSample(int outlen, const void *coded, int sizebytes, ECodecType type);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-04-11 04:59:23 +00:00
|
|
|
void DrawWaveDebug(int mode);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
private:
|
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 SFXPaused;
|
2008-03-21 05:13:59 +00:00
|
|
|
bool InitSuccess;
|
2008-04-19 22:47:54 +00:00
|
|
|
unsigned int DSPClockLo;
|
|
|
|
unsigned int DSPClockHi;
|
|
|
|
int OutputRate;
|
2008-03-21 05:13:59 +00:00
|
|
|
|
|
|
|
static FMOD_RESULT F_CALLBACK ChannelEndCallback
|
|
|
|
(FMOD_CHANNEL *channel, FMOD_CHANNEL_CALLBACKTYPE type, int cmd, unsigned int data1, unsigned int data2);
|
2008-03-22 03:33:41 +00:00
|
|
|
static float F_CALLBACK RolloffCallback(FMOD_CHANNEL *channel, float distance);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-25 04:42:26 +00:00
|
|
|
FSoundChan *CommonChannelSetup(FMOD::Channel *chan) const;
|
2008-06-15 02:25:09 +00:00
|
|
|
FMOD_MODE SetChanHeadSettings(FMOD::Channel *chan, sfxinfo_t *sfx, float pos[3], int channum, int chanflags, sector_t *sec, FMOD_MODE oldmode) const;
|
2006-02-24 04:48:15 +00:00
|
|
|
void DoLoad (void **slot, sfxinfo_t *sfx);
|
|
|
|
void getsfx (sfxinfo_t *sfx);
|
|
|
|
|
|
|
|
bool Init ();
|
|
|
|
void Shutdown ();
|
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 DumpDriverCaps(FMOD_CAPS caps, int minfrequency, int maxfrequency);
|
|
|
|
|
2008-04-11 04:59:23 +00:00
|
|
|
int DrawChannelGroupOutput(FMOD::ChannelGroup *group, float *wavearray, int width, int height, int y, int mode);
|
|
|
|
int DrawSystemOutput(float *wavearray, int width, int height, int y, int mode);
|
|
|
|
|
|
|
|
int DrawChannelGroupWaveData(FMOD::ChannelGroup *group, float *wavearray, int width, int height, int y, bool skip);
|
|
|
|
int DrawSystemWaveData(float *wavearray, int width, int height, int y, bool skip);
|
|
|
|
void DrawWave(float *wavearray, int x, int y, int width, int height);
|
|
|
|
|
|
|
|
int DrawChannelGroupSpectrum(FMOD::ChannelGroup *group, float *wavearray, int width, int height, int y, bool skip);
|
|
|
|
int DrawSystemSpectrum(float *wavearray, int width, int height, int y, bool skip);
|
|
|
|
void DrawSpectrum(float *spectrumarray, int x, int y, int width, int height);
|
|
|
|
|
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
|
|
|
FMOD::System *Sys;
|
|
|
|
FMOD::ChannelGroup *SfxGroup, *PausableSfx;
|
|
|
|
FMOD::ChannelGroup *MusicGroup;
|
2008-05-15 04:51:57 +00:00
|
|
|
FMOD::DSP *WaterLP, *WaterReverb;
|
|
|
|
FMOD::DSPConnection *SfxConnection;
|
2008-05-31 02:18:09 +00:00
|
|
|
FMOD::DSP *ChannelGroupTargetUnit;
|
2008-05-15 04:51:57 +00:00
|
|
|
float LastWaterLP;
|
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
|
|
|
|
|
|
|
// Just for snd_status display
|
|
|
|
int Driver_MinFrequency;
|
|
|
|
int Driver_MaxFrequency;
|
|
|
|
FMOD_CAPS Driver_Caps;
|
|
|
|
|
|
|
|
friend class FMODStreamCapsule;
|
2006-02-24 04:48:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|