2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2022-03-03 19:24:46 +00:00
|
|
|
// Copyright (C) 1999-2022 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file i_sound.h
|
2020-08-07 21:06:19 +00:00
|
|
|
/// \brief System interface, sound, music
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#ifndef __I_SOUND__
|
|
|
|
#define __I_SOUND__
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "sounds.h"
|
|
|
|
#include "command.h"
|
|
|
|
|
2018-08-18 21:17:53 +00:00
|
|
|
// copied from SDL mixer, plus GME
|
|
|
|
typedef enum {
|
2018-08-23 14:18:38 +00:00
|
|
|
MU_NONE,
|
|
|
|
MU_WAV,
|
|
|
|
MU_MOD,
|
|
|
|
MU_MID,
|
|
|
|
MU_OGG,
|
|
|
|
MU_MP3,
|
|
|
|
MU_FLAC,
|
2018-08-27 03:03:38 +00:00
|
|
|
MU_GME,
|
2019-08-04 11:03:57 +00:00
|
|
|
MU_MOD_EX, // libopenmpt
|
|
|
|
MU_MID_EX // Non-native MIDI
|
2018-08-18 21:17:53 +00:00
|
|
|
} musictype_t;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
/** \brief Sound subsystem runing and waiting
|
|
|
|
*/
|
|
|
|
extern UINT8 sound_started;
|
|
|
|
|
|
|
|
/** \brief info of samplerate
|
|
|
|
*/
|
|
|
|
extern consvar_t cv_samplerate;
|
|
|
|
//extern consvar_t cv_rndsoundpitch;
|
|
|
|
|
|
|
|
/** \brief The I_GetSfx function
|
|
|
|
|
|
|
|
\param sfx sfx to setup
|
|
|
|
|
|
|
|
\return data for sfx
|
|
|
|
*/
|
|
|
|
void *I_GetSfx(sfxinfo_t *sfx);
|
|
|
|
|
|
|
|
/** \brief The I_FreeSfx function
|
|
|
|
|
|
|
|
\param sfx sfx to be freed up
|
|
|
|
|
|
|
|
\return void
|
|
|
|
*/
|
|
|
|
void I_FreeSfx(sfxinfo_t *sfx);
|
|
|
|
|
|
|
|
/** \brief Init at program start...
|
|
|
|
*/
|
|
|
|
void I_StartupSound(void);
|
|
|
|
|
|
|
|
/** \brief ... shut down and relase at program termination.
|
|
|
|
*/
|
|
|
|
void I_ShutdownSound(void);
|
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/// ------------------------
|
|
|
|
/// SFX I/O
|
|
|
|
/// ------------------------
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
/** \brief Starts a sound in a particular sound channel.
|
|
|
|
\param id sfxid
|
|
|
|
\param vol volume for sound
|
|
|
|
\param sep left-right balancle
|
|
|
|
\param pitch not used
|
|
|
|
\param priority not used
|
|
|
|
|
|
|
|
\return sfx handle
|
|
|
|
*/
|
2018-10-13 22:01:11 +00:00
|
|
|
INT32 I_StartSound(sfxenum_t id, UINT8 vol, UINT8 sep, UINT8 pitch, UINT8 priority, INT32 channel);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
/** \brief Stops a sound channel.
|
|
|
|
|
|
|
|
\param handle stop sfx handle
|
|
|
|
|
|
|
|
\return void
|
|
|
|
*/
|
|
|
|
void I_StopSound(INT32 handle);
|
|
|
|
|
|
|
|
/** \brief Some digital sound drivers need this.
|
|
|
|
*/
|
|
|
|
void I_UpdateSound(void);
|
|
|
|
|
|
|
|
/** \brief Called by S_*() functions to see if a channel is still playing.
|
|
|
|
|
|
|
|
\param handle sfx handle
|
|
|
|
|
|
|
|
\return 0 if no longer playing, 1 if playing.
|
|
|
|
*/
|
|
|
|
boolean I_SoundIsPlaying(INT32 handle);
|
|
|
|
|
|
|
|
/** \brief Updates the sfx handle
|
|
|
|
|
|
|
|
\param handle sfx handle
|
|
|
|
\param vol volume
|
|
|
|
\param sep separation
|
|
|
|
\param pitch ptich
|
|
|
|
|
|
|
|
\return void
|
|
|
|
*/
|
|
|
|
void I_UpdateSoundParams(INT32 handle, UINT8 vol, UINT8 sep, UINT8 pitch);
|
|
|
|
|
|
|
|
/** \brief The I_SetSfxVolume function
|
|
|
|
|
|
|
|
\param volume volume to set at
|
|
|
|
|
|
|
|
\return void
|
|
|
|
*/
|
|
|
|
void I_SetSfxVolume(UINT8 volume);
|
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/// ------------------------
|
|
|
|
// MUSIC SYSTEM
|
|
|
|
/// ------------------------
|
2018-08-23 14:18:38 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
/** \brief Init the music systems
|
|
|
|
*/
|
|
|
|
void I_InitMusic(void);
|
|
|
|
|
|
|
|
/** \brief Shutdown the music systems
|
|
|
|
*/
|
|
|
|
void I_ShutdownMusic(void);
|
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/// ------------------------
|
|
|
|
// MUSIC PROPERTIES
|
|
|
|
/// ------------------------
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-24 01:07:39 +00:00
|
|
|
musictype_t I_SongType(void);
|
2018-08-21 10:22:35 +00:00
|
|
|
boolean I_SongPlaying(void);
|
|
|
|
boolean I_SongPaused(void);
|
2018-08-15 05:55:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/// ------------------------
|
|
|
|
// MUSIC EFFECTS
|
|
|
|
/// ------------------------
|
2018-08-18 21:17:53 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
boolean I_SetSongSpeed(float speed);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-24 01:07:39 +00:00
|
|
|
/// ------------------------
|
|
|
|
// MUSIC SEEKING
|
|
|
|
/// ------------------------
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-24 01:07:39 +00:00
|
|
|
UINT32 I_GetSongLength(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-24 01:07:39 +00:00
|
|
|
boolean I_SetSongLoopPoint(UINT32 looppoint);
|
|
|
|
UINT32 I_GetSongLoopPoint(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-24 01:07:39 +00:00
|
|
|
boolean I_SetSongPosition(UINT32 position);
|
|
|
|
UINT32 I_GetSongPosition(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/// ------------------------
|
|
|
|
// MUSIC PLAYBACK
|
|
|
|
/// ------------------------
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
/** \brief Registers a song handle to song data.
|
|
|
|
|
|
|
|
\param data pointer to song data
|
|
|
|
\param len len of data
|
|
|
|
|
|
|
|
\return song handle
|
|
|
|
|
|
|
|
\todo Remove this
|
|
|
|
*/
|
2018-08-23 13:36:51 +00:00
|
|
|
boolean I_LoadSong(char *data, size_t len);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/** \brief See ::I_LoadSong, then think backwards
|
|
|
|
|
|
|
|
\param handle song handle
|
|
|
|
|
|
|
|
\sa I_LoadSong
|
|
|
|
\todo remove midi handle
|
|
|
|
*/
|
|
|
|
void I_UnloadSong(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
/** \brief Called by anything that wishes to start music
|
|
|
|
|
|
|
|
\param handle Song handle
|
|
|
|
\param looping looping it if true
|
|
|
|
|
|
|
|
\return if true, it's playing the song
|
|
|
|
|
|
|
|
\todo pass music name, not handle
|
|
|
|
*/
|
2018-08-23 13:36:51 +00:00
|
|
|
boolean I_PlaySong(boolean looping);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
/** \brief Stops a song over 3 seconds
|
|
|
|
|
|
|
|
\param handle Song handle
|
|
|
|
\return void
|
|
|
|
|
|
|
|
/todo drop handle
|
|
|
|
*/
|
2018-08-23 13:02:14 +00:00
|
|
|
void I_StopSong(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/** \brief PAUSE game handling.
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
\param handle song handle
|
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
\return void
|
2014-03-15 16:59:03 +00:00
|
|
|
*/
|
2018-08-23 21:05:37 +00:00
|
|
|
void I_PauseSong(void);
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/** \brief RESUME game handling
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
\param handle song handle
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
\return void
|
2014-03-15 16:59:03 +00:00
|
|
|
*/
|
2018-08-23 21:05:37 +00:00
|
|
|
void I_ResumeSong(void);
|
2018-08-18 18:18:29 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
/** \brief The I_SetMusicVolume function
|
2018-08-19 00:19:44 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
\param volume volume to set at
|
2018-08-15 05:38:06 +00:00
|
|
|
|
2018-08-23 21:05:37 +00:00
|
|
|
\return void
|
|
|
|
*/
|
|
|
|
void I_SetMusicVolume(UINT8 volume);
|
2018-08-15 05:38:06 +00:00
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
boolean I_SetSongTrack(INT32 track);
|
|
|
|
|
2018-08-24 01:07:39 +00:00
|
|
|
/// ------------------------
|
|
|
|
/// MUSIC FADING
|
|
|
|
/// ------------------------
|
|
|
|
|
2018-08-19 13:38:57 +00:00
|
|
|
void I_SetInternalMusicVolume(UINT8 volume);
|
2018-08-21 10:22:35 +00:00
|
|
|
void I_StopFadingSong(void);
|
2018-08-24 12:20:09 +00:00
|
|
|
boolean I_FadeSongFromVolume(UINT8 target_volume, UINT8 source_volume, UINT32 ms, void (*callback)(void));
|
|
|
|
boolean I_FadeSong(UINT8 target_volume, UINT32 ms, void (*callback)(void));
|
2018-08-21 10:22:35 +00:00
|
|
|
boolean I_FadeOutStopSong(UINT32 ms);
|
2018-08-24 12:20:09 +00:00
|
|
|
boolean I_FadeInPlaySong(UINT32 ms, boolean looping);
|
2018-08-20 02:05:23 +00:00
|
|
|
|
2018-11-14 15:52:16 +00:00
|
|
|
#endif
|