//-----------------------------------------------------------------------------
//
//  $Logfile:: /Source/snd_sound.h                                            $
// $Revision:: 2                                                              $
//   $Author:: Burgermac                                                      $
//     $Date:: 12/27/00 7:04 PM                                               $
//
// Copyright (C) 1998 by Ritual Entertainment, Inc.
// All rights reserved.
//
// This source is may not be distributed and/or modified without
// expressly written permission by Ritual Entertainment, Inc.
//
// DESCRIPTION:
//

#ifndef __SND_SOUND_H__
#define __SND_SOUND_H__

#ifndef __QCOMMON_H__
#include "qcommon.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

struct sfx_s;

void S_Init (void);
void S_Shutdown (void);

// this is here for comatibility sake
// if origin is NULL, the sound will be dynamically sourced from the entity
#define S_StartSound( ORIGIN, ENTNUM, ENTCHANNEL, SFX, FVOL, ATTEN, TIMEOFS ) \
   S_StartSoundEx( (ORIGIN), (ENTNUM), (ENTCHANNEL), (SFX), (FVOL), (ATTEN), (TIMEOFS), 1.0f, 0.0f, 0, NULL, 0 )
void S_StartSoundEx (vec3_t origin, int entnum, int entchannel, struct sfx_s *sfx, float fvol,  float attenuation, float timeofs, float pitch, float fadetime, int pos, void * state, int flags);

void S_StartLocalSound (const char *s);

void S_RawSamples (int samples, int rate, int width, int channels, byte *data);

void S_StopAllSounds(void);
void S_Update (vec3_t origin, vec3_t v_forward, vec3_t v_right, vec3_t v_up);

void S_Activate (qboolean active);

void S_BeginRegistration (void);
struct sfx_s *S_RegisterSound (const char *sample);
void S_EndRegistration(qboolean status);

// the sound code makes callbacks to the client for entitiy position
// information, so entities can be dynamically re-spatialized
void CL_GetEntitySoundOrigin (int ent, vec3_t org);

qboolean S_SoundLength( const char *name, float * time );

//
// MUSIC Stuff
//
qboolean MUSIC_LoadSoundtrackFile ( const char * filename );
qboolean MUSIC_PlaySong ( const char * filename );
void MUSIC_RegisterSongs ( void );
void MUSIC_FreeSongs ( void );
void MUSIC_StopAllSongs( void );
qboolean MUSIC_Playing( void );
qboolean MUSIC_Loaded( void );
qboolean MUSIC_SongValid( const char * alias );

extern cvar_t * s_music;

#ifdef __USEA3D
extern qboolean snd_isa3d;
#endif

#ifdef __cplusplus
}
#endif

#endif
