This commit is contained in:
jarod42 2004-06-25 16:04:14 +00:00
parent 43a340ee34
commit ba9ea2ec74
14 changed files with 378 additions and 375 deletions

View file

@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name cdaudio.c - cd audio */
/**@name cdaudio.c - cd audio */
//
// (c) Copyright 2003 by Nehal Mistry
// (c) Copyright 2003 by Nehal Mistry
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -26,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@ -55,35 +55,34 @@
#endif
/*----------------------------------------------------------------------------
-- Declaration
-- Declaration
----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
-- Variables
-- Variables
----------------------------------------------------------------------------*/
int CDTrack; /// Current cd track
int NumCDTracks; /// Number of tracks on the cd
int CDTrack; ///< Current cd track
int NumCDTracks; ///< Number of tracks on the cd
#if defined(USE_SDLCD)
static SDL_CD* CDRom; /// SDL cdrom device
static SDL_CD* CDRom; ///< SDL cdrom device
#elif defined(USE_CDDA)
int CDDrive; /// CDRom device
struct cdrom_tocentry CDtocentry[64]; /// TOC track header struct
static struct cdrom_tochdr CDchdr; /// TOC header struct
static struct cdrom_read_audio CDdata; /// struct for reading data
int CDDrive; ///< CDRom device
struct cdrom_tocentry CDtocentry[64]; ///< TOC track header struct
static struct cdrom_tochdr CDchdr; ///< TOC header struct
static struct cdrom_read_audio CDdata; ///< struct for reading data
#endif
CDModes CDMode; /// CD mode
CDModes CDMode; ///< CD mode
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
#if defined (USE_SDLCD)
/**
** FIXME: docu
** FIXME: docu
*/
static int InitCD(void)
{
@ -100,7 +99,7 @@ static int InitCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int PlayCDTrack(int track)
{
@ -109,7 +108,7 @@ int PlayCDTrack(int track)
}
/**
** FIXME: docu
** FIXME: docu
*/
void ResumeCD(void)
{
@ -120,7 +119,7 @@ void ResumeCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void PauseCD(void)
{
@ -130,7 +129,7 @@ void PauseCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int IsAudioTrack(int track)
{
@ -139,7 +138,7 @@ int IsAudioTrack(int track)
}
/**
** FIXME: docu
** FIXME: docu
*/
int IsCDPlaying(void)
{
@ -151,7 +150,7 @@ int IsCDPlaying(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int GetCDVolume(void)
{
@ -159,7 +158,7 @@ int GetCDVolume(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void SetCDVolume(int vol)
{
@ -167,7 +166,7 @@ void SetCDVolume(int vol)
}
/**
** FIXME: docu
** FIXME: docu
*/
void QuitCD(void)
{
@ -182,7 +181,7 @@ void QuitCD(void)
}
#elif defined(USE_LIBCDA)
/**
** FIXME: docu
** FIXME: docu
*/
static int InitCD(void)
{
@ -197,7 +196,7 @@ static int InitCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int PlayCDTrack(int track)
{
@ -206,7 +205,7 @@ int PlayCDTrack(int track)
}
/**
** FIXME: docu
** FIXME: docu
*/
void ResumeCD(void)
{
@ -214,7 +213,7 @@ void ResumeCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void PauseCD(void)
{
@ -224,7 +223,7 @@ void PauseCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int IsAudioTrack(int track)
{
@ -232,7 +231,7 @@ int IsAudioTrack(int track)
}
/**
** FIXME: docu
** FIXME: docu
*/
int IsCDPlaying(void)
{
@ -244,7 +243,7 @@ int IsCDPlaying(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int GetCDVolume(void)
{
@ -255,7 +254,7 @@ int GetCDVolume(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void SetCDVolume(int vol)
{
@ -263,7 +262,7 @@ void SetCDVolume(int vol)
}
/**
** FIXME: docu
** FIXME: docu
*/
void QuitCD(void)
{
@ -279,7 +278,7 @@ void QuitCD(void)
}
#elif defined(USE_CDDA)
/**
** FIXME: docu
** FIXME: docu
*/
static int InitCD(void)
{
@ -303,7 +302,7 @@ static int InitCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int PlayCDTrack(int track)
{
@ -317,7 +316,7 @@ int PlayCDTrack(int track)
}
/**
** FIXME: docu
** FIXME: docu
*/
void ResumeCD(void)
{
@ -325,7 +324,7 @@ void ResumeCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void PauseCD(void)
{
@ -335,7 +334,7 @@ void PauseCD(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int IsAudioTrack(track)
{
@ -343,7 +342,7 @@ int IsAudioTrack(track)
}
/**
** FIXME: docu
** FIXME: docu
*/
int IsCDPlaying(void)
{
@ -351,7 +350,7 @@ int IsCDPlaying(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
int GetCDVolume(void)
{
@ -359,7 +358,7 @@ int GetCDVolume(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void SetCDVolume(int vol)
{
@ -367,7 +366,7 @@ void SetCDVolume(int vol)
}
/**
** FIXME: docu
** FIXME: docu
*/
void QuitCD(void)
{
@ -376,9 +375,9 @@ void QuitCD(void)
#endif
/**
** Check cdrom.
** Check cdrom.
**
** Perodic called from the main loop.
** Perodic called from the main loop.
*/
int CDRomCheck(void* unused __attribute__ ((unused)))
{
@ -391,9 +390,9 @@ int CDRomCheck(void* unused __attribute__ ((unused)))
}
/*
** Play CDRom
** Play CDRom
**
** @param name name of play mode, CDModeAll, CDModeRandom, CDModeDefined
** @param name name of play mode, CDModeAll, CDModeRandom, CDModeDefined
*/
int PlayCDRom(int name)
{
@ -469,6 +468,6 @@ int PlayCDRom(int name)
}
#endif // } USE_CDAUDIO
#endif // } USE_CDAUDIO
//@}

View file

@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name cdda.c - cdda support */
/**@name cdda.c - cdda support */
//
// (c) Copyright 2002-2003 by Nehal Mistry
// (c) Copyright 2002-2003 by Nehal Mistry
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -26,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id: wav.c,v 1.7 2002/07/20 00:09:05 johns Exp $
// $Id: wav.c,v 1.7 2002/07/20 00:09:05 johns Exp $
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include "stratagus.h"
@ -46,31 +46,31 @@
#include "cdaudio.h"
/*----------------------------------------------------------------------------
-- Declarations
-- Declarations
----------------------------------------------------------------------------*/
typedef struct _cdda_data {
int PosInCd; // Offset on CD to read from
struct cdrom_read_audio Readdata; // Structure for IOCTL
char* PointerInBuffer; // Position in buffer
char* Buffer; // Buffer start
int PosInCd; ///< Offset on CD to read from
struct cdrom_read_audio Readdata; ///< Structure for IOCTL
char* PointerInBuffer; ///< Position in buffer
char* Buffer; ///< Buffer start
} CddaData;
#define FRAME_SIZE 2352
#define CDDA_BUFFER_SIZE (12 * FRAME_SIZE)
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
** Type member function to read from the cd
** Type member function to read from the cd
**
** @param sample Sample reading from
** @param buf Buffer to write data to
** @param len Length of the buffer
** @param sample Sample reading from
** @param buf Buffer to write data to
** @param len Length of the buffer
**
** @return Number of bytes read
** @return Number of bytes read
*/
static int CDRead(Sample* sample, void* buf, int len)
{
@ -112,9 +112,9 @@ static int CDRead(Sample* sample, void* buf, int len)
}
/**
** Type member function to free CDDA sample
** Type member function to free CDDA sample
**
** @param sample Sample to free
** @param sample Sample to free
*/
static void CDFree(Sample* sample)
{
@ -122,7 +122,7 @@ static void CDFree(Sample* sample)
}
/**
** CDDA object type structure.
** CDDA object type structure.
*/
static const SampleType CDStreamSampleType = {
CDRead,
@ -130,12 +130,12 @@ static const SampleType CDStreamSampleType = {
};
/**
** Load CD.
** Load CD.
**
** @param name Unused.
** @param flags Unused.
** @param name Unused.
** @param flags Unused.
**
** @return Returns the loaded sample.
** @return Returns the loaded sample.
**
*/
Sample* LoadCD(const char* name __attribute__((unused)),
@ -160,6 +160,6 @@ Sample* LoadCD(const char* name __attribute__((unused)),
return sample;
}
#endif // } USE_CDDA
#endif // } USE_CDDA
//@}

View file

@ -55,8 +55,8 @@
** Private flac data structure to handle flac streaming.
*/
typedef struct _flac_data_ {
FLAC__StreamDecoder* FlacStream; /// Decoder stream
CLFile* FlacFile; /// File handle
FLAC__StreamDecoder* FlacStream; ///< Decoder stream
CLFile* FlacFile; ///< File handle
} FlacData;
/*----------------------------------------------------------------------------
@ -317,7 +317,7 @@ Sample* LoadFlac(const char* name, int flags)
}
CLread(f, magic, sizeof(magic));
if (AccessLE32(magic) != 0x43614C66) { // "fLaC" in ASCII
if (AccessLE32(magic) != 0x43614C66) { // "fLaC" in ASCII
CLclose(f);
return NULL;
}

View file

@ -412,7 +412,7 @@ void cd_exit(void)
/* internal helpers */
#define startof(track) (MCI_MAKE_TMSF(track, 0, 0, 0))
#define startof(track) (MCI_MAKE_TMSF(track, 0, 0, 0))
static char* lengthof(int track)
{
@ -529,7 +529,7 @@ int cd_is_audio(int track)
void cd_get_volume(int *c0, int *c1)
{
if (c0) {
*c0 = 128; /* (shrug) */
*c0 = 128; /* (shrug) */
}
if (c1) {
*c1 = 128;

View file

@ -5,7 +5,7 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name mad.c - mp3 support with libmad */
@ -37,7 +37,7 @@
#include <stdio.h>
#include "stratagus.h"
#ifdef USE_MAD // {
#ifdef USE_MAD // {
#include <stdlib.h>
#include <string.h>
@ -57,14 +57,14 @@
** Private mp3 data structure to handle mp3 streaming.
*/
typedef struct _mp3_data_ {
struct mad_decoder MadDecoder; /// Mad decoder handle
CLFile* MadFile; /// File handle
unsigned char Buffer[MAD_INBUF_SIZE]; /// Input buffer
int BufferLen; /// Length of filled buffer
struct mad_decoder MadDecoder; ///< Mad decoder handle
CLFile* MadFile; ///< File handle
unsigned char Buffer[MAD_INBUF_SIZE]; ///< Input buffer
int BufferLen; ///< Length of filled buffer
} MadData;
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
@ -206,7 +206,7 @@ static int MadRead(Sample *sample, unsigned char* buf, int len)
Assert(0);
}
mad_synth_frame (synth, frame);
decoder->output_func(decoder->cb_data, &frame->header, &synth->pcm);
@ -335,7 +335,7 @@ static void Mp3FreeStream(Sample* sample)
mad_frame_finish(&data->MadDecoder.sync->frame);
mad_stream_finish(&data->MadDecoder.sync->stream);
// free(data->MadDecoder.sync);
// free(data->MadDecoder.sync);
mad_decoder_finish(&data->MadDecoder);
CLclose(data->MadFile);
@ -478,6 +478,6 @@ Sample* LoadMp3(const char* name, int flags)
return sample;
}
#endif // USE_MAD
#endif // USE_MAD
//@}

View file

@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name music.c - Background music support */
/**@name music.c - Background music support */
//
// (c) Copyright 2002-2004 by Lutz Sammer, Nehal Mistry
// (c) Copyright 2002-2004 by Lutz Sammer, Nehal Mistry
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -26,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@ -54,36 +54,36 @@
#include "cdaudio.h"
/*----------------------------------------------------------------------------
-- Declaration
-- Declaration
----------------------------------------------------------------------------*/
#define SoundFrequency 44100 // sample rate of dsp
#define SoundFrequency 44100 // sample rate of dsp
/*----------------------------------------------------------------------------
-- Variables
-- Variables
----------------------------------------------------------------------------*/
Sample* MusicSample; /// Music samples
Sample* MusicSample; ///< Music samples
char* CurrentMusicFile;
PlaySection* PlaySections; // Play Sections
int NumPlaySections; // Number of Play Sections
PlaySectionType CurrentPlaySection; // Current Play Section
PlaySection* PlaySections; ///< Play Sections
int NumPlaySections; ///< Number of Play Sections
PlaySectionType CurrentPlaySection; ///< Current Play Section
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
** Stop the current playing music.
** Stop the current playing music.
**
** @todo FIXME: Stop the CD-PLAYER.
** @todo FIXME: Stop the CD-PLAYER.
*/
void StopMusic(void)
{
if (PlayingMusic) {
PlayingMusic = 0; // Callback!
PlayingMusic = 0; // Callback!
if (MusicSample) {
#ifdef USE_SDL
SDL_LockAudio();
@ -99,7 +99,7 @@ void StopMusic(void)
}
/**
** FIXME: docu
** FIXME: docu
*/
void PlaySectionMusic(PlaySectionType section)
{
@ -190,15 +190,15 @@ void PlaySectionMusic(PlaySectionType section)
}
/**
** Play a music file.
** Play a music file.
**
** Currently supported are .mod, .it, .s3m, .wav, .xm.
** Optional .ogg, .mp3, .flac and cdrom.
** Currently supported are .mod, .it, .s3m, .wav, .xm.
** Optional .ogg, .mp3, .flac and cdrom.
**
** @param name Name of sound file, format is automatic detected.
** Names starting with ':' control the cdrom.
** @param name Name of sound file, format is automatic detected.
** Names starting with ':' control the cdrom.
**
** @return 1 if music is playing, 0 if not.
** @return 1 if music is playing, 0 if not.
*/
int PlayMusic(const char* name)
{
@ -241,12 +241,12 @@ int PlayMusic(const char* name)
#endif
#ifdef USE_MAD
if ((sample = LoadMp3(name, PlayAudioStream))) {
// if (sample->Channels != 2 || sample->SampleSize != 16
// || sample->Frequency != SoundFrequency) {
// DebugPrint("Not supported music format\n");
// SoundFree(sample);
// return;
// }
// if (sample->Channels != 2 || sample->SampleSize != 16
// || sample->Frequency != SoundFrequency) {
// DebugPrint("Not supported music format\n");
// SoundFree(sample);
// return;
// }
StopMusic();
MusicSample = sample;
PlayingMusic = 1;
@ -283,9 +283,9 @@ int PlayMusic(const char* name)
}
/**
** Play a sound file.
** Play a sound file.
**
** @param name Name of sound file
** @param name Name of sound file
*/
void PlaySoundFile(const char* name)
{

View file

@ -5,8 +5,8 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name ogg.c - ogg support */
//
@ -36,7 +36,7 @@
#include "stratagus.h"
#ifdef USE_OGG // {
#ifdef USE_OGG // {
#include <stdlib.h>
#include <stdio.h>
@ -68,7 +68,7 @@
** Private ogg data structure to handle ogg streaming.
*/
typedef struct _ogg_data_ {
OggVorbis_File VorbisFile; /// Vorbis file handle
OggVorbis_File VorbisFile; ///< Vorbis file handle
} OggData;
/*----------------------------------------------------------------------------
@ -194,7 +194,7 @@ static void OggStreamFree(Sample* sample)
}
/**
** Ogg stream type structure.
** Ogg stream type structure.
*/
static const SampleType OggStreamSampleType = {
OggStreamRead,
@ -266,7 +266,7 @@ Sample* LoadOgg(const char* name,int flags)
}
CLread(f, magic, sizeof(magic));
if (AccessLE32(magic) != 0x5367674F) { // "OggS" in ASCII
if (AccessLE32(magic) != 0x5367674F) { // "OggS" in ASCII
CLclose(f);
return NULL;
}
@ -305,7 +305,7 @@ Sample* LoadOgg(const char* name,int flags)
int i;
int n;
int bitstream;
total = ov_pcm_total(&data->VorbisFile, -1) * 2;
sample->Buffer = malloc(total);
@ -358,7 +358,7 @@ static size_t AVI_OGG_read(void* ptr, size_t size, size_t nmemb, void* user)
unsigned char* frame;
avi = user;
if (avi->AudioRemain) { // Bytes remaining
if (avi->AudioRemain) { // Bytes remaining
length = avi->AudioRemain;
if (length > nmemb * size) {
length = nmemb * size;
@ -384,11 +384,11 @@ static size_t AVI_OGG_read(void* ptr, size_t size, size_t nmemb, void* user)
}
/**
** OGG vorbis close callback.
** OGG vorbis close callback.
**
** @param user User argument.
** @param user User argument.
**
** @return Success status.
** @return Success status.
*/
static int AVI_OGG_close(void* user __attribute__((unused)))
{
@ -396,16 +396,16 @@ static int AVI_OGG_close(void* user __attribute__((unused)))
}
/**
** Play the ogg stream of an avi movie.
** Play the ogg stream of an avi movie.
**
** @param avi Avi file handle
** @param avi Avi file handle
*/
void PlayAviOgg(AviFile* avi)
{
Sample* sample;
OggData* data;
vorbis_info* info;
static const ov_callbacks vc = { AVI_OGG_read, OGG_seek, AVI_OGG_close, NULL };
static const ov_callbacks vc = { AVI_OGG_read, OGG_seek, AVI_OGG_close, NULL };
data = malloc(sizeof(OggData));
@ -437,6 +437,6 @@ void PlayAviOgg(AviFile* avi)
PlayingMusic = 1;
}
#endif // USE_OGG
#endif // USE_OGG
//@}

View file

@ -31,7 +31,7 @@
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include <string.h>

View file

@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name sdl_audio.c - SDL hardware support */
/**@name sdl_audio.c - SDL hardware support */
//
// (c) Copyright 2002-2003 by Lutz Sammer and Fabrice Rossi
// (c) Copyright 2002-2003 by Lutz Sammer and Fabrice Rossi
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -26,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@ -41,7 +41,7 @@
#include "sound_server.h"
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/// FIXME: move function to here.
@ -49,14 +49,14 @@ extern void FillAudio(void* udata __attribute__((unused)), Uint8* stream,
int len);
/**
** Initialize sound card hardware part with SDL.
** Initialize sound card hardware part with SDL.
**
** @param dev Device name ("/dev/dsp").
** @param freq Sample frequenz (44100,22050,11025 hz).
** @param size Sampe size (8bit, 16bit)
** @param wait Flag, if true wait for sound device to open.
** @param dev Device name ("/dev/dsp").
** @param freq Sample frequenz (44100,22050,11025 hz).
** @param size Sampe size (8bit, 16bit)
** @param wait Flag, if true wait for sound device to open.
**
** @return True if failure, false if everything ok.
** @return True if failure, false if everything ok.
*/
int InitSdlSound(const char* dev __attribute__((unused)), int freq,
int size, int wait __attribute__((unused)))

View file

@ -60,13 +60,13 @@
-- Variables
----------------------------------------------------------------------------*/
int SoundOff; /// True quiet, sound turned off
int MusicOff; /// Music turned off
int SoundOff; ///< True quiet, sound turned off
int MusicOff; ///< Music turned off
/**
** Various sounds used in game.
** Various sounds used in game.
**
** FIXME: @todo support more races. Must remove static config.
** FIXME: @todo support more races. Must remove static config.
*/
GameSound GameSounds
#ifndef laterUSE_CCL
@ -77,10 +77,10 @@ GameSound GameSounds
{ "click", NULL },
{ "transport docking", NULL },
{ "building construction", NULL },
{ { "basic human voices work complete", NULL },
{ { "basic human voices work complete", NULL },
{ "basic orc voices work complete", NULL },
},
{ { "rescue (human) UNUSED", NULL },
{ { "rescue (human) UNUSED", NULL },
{ "rescue (orc) UNUSED", NULL },
},
}
@ -88,20 +88,20 @@ GameSound GameSounds
;
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
** Helper function: insert a sound request in the server side sound FIFO.
** Helper function: insert a sound request in the server side sound FIFO.
**
** @param unit Pointer to unit.
** @param id Unit identifier, for pointer reuse detection.
** @param power How loud to play the sound.
** @param sound FIXME: docu
** @param fight FIXME: docu
** @param selection FIXME: docu
** @param volume FIXME: docu
** @param stereo FIXME: docu
** @param unit Pointer to unit.
** @param id Unit identifier, for pointer reuse detection.
** @param power How loud to play the sound.
** @param sound FIXME: docu
** @param fight FIXME: docu
** @param selection FIXME: docu
** @param volume FIXME: docu
** @param stereo FIXME: docu
*/
static void InsertSoundRequest(const Unit* unit, unsigned id,
unsigned short power, SoundId sound, unsigned char fight,
@ -135,14 +135,14 @@ static void InsertSoundRequest(const Unit* unit, unsigned id,
}
/**
** Maps a UnitVoiceGroup to a SoundId.
** Maps a UnitVoiceGroup to a SoundId.
**
** @param unit Sound initiator
** @param voice Type of sound wanted
** @param unit Sound initiator
** @param voice Type of sound wanted
**
** @return Sound identifier
** @return Sound identifier
**
** @todo FIXME: The work completed sounds only supports two races.
** @todo FIXME: The work completed sounds only supports two races.
*/
static SoundId ChooseUnitVoiceSoundId(const Unit* unit, UnitVoiceGroup voice)
{
@ -174,12 +174,12 @@ static SoundId ChooseUnitVoiceSoundId(const Unit* unit, UnitVoiceGroup voice)
}
/**
** Ask to the sound server to play a sound attached to an unit. The
** sound server may discard the sound if needed (e.g., when the same
** unit is already speaking).
** Ask to the sound server to play a sound attached to an unit. The
** sound server may discard the sound if needed (e.g., when the same
** unit is already speaking).
**
** @param unit Sound initiator, unit speaking
** @param voice Type of sound wanted (Ready,Die,Yes,...)
** @param unit Sound initiator, unit speaking
** @param voice Type of sound wanted (Ready,Die,Yes,...)
*/
void PlayUnitSound(const Unit* unit, UnitVoiceGroup voice)
{
@ -200,10 +200,10 @@ void PlayUnitSound(const Unit* unit, UnitVoiceGroup voice)
}
/**
** Ask the sound server to play a sound for a missile.
** Ask the sound server to play a sound for a missile.
**
** @param missile Sound initiator, missile exploding
** @param sound Sound to be generated
** @param missile Sound initiator, missile exploding
** @param sound Sound to be generated
*/
void PlayMissileSound(const Missile* missile, SoundId sound)
{
@ -223,7 +223,7 @@ void PlayMissileSound(const Missile* missile, SoundId sound)
}
/**
** FIXME: docu
** FIXME: docu
*/
void PlayGameSound(SoundId sound, unsigned char volume)
{
@ -231,11 +231,11 @@ void PlayGameSound(SoundId sound, unsigned char volume)
}
/**
** Ask to the sound server to set the global volume of the sound.
** Ask to the sound server to set the global volume of the sound.
**
** @param volume the sound volume (positive number) 0-255
** @param volume the sound volume (positive number) 0-255
**
** @see MaxVolume
** @see MaxVolume
*/
void SetGlobalVolume(int volume)
{
@ -252,11 +252,11 @@ void SetGlobalVolume(int volume)
}
/**
** Ask to the sound server to set the volume of the music.
** Ask to the sound server to set the volume of the music.
**
** @param volume the music volume (positive number) 0-255
** @param volume the music volume (positive number) 0-255
**
** @see MaxVolume
** @see MaxVolume
*/
void SetMusicVolume(int volume)
{
@ -274,13 +274,13 @@ void SetMusicVolume(int volume)
}
/**
** Lookup the sound id's for the game sounds.
** Lookup the sound id's for the game sounds.
*/
void InitSoundClient(void)
{
int i;
if (SoundFildes == -1) { // No sound enabled
if (SoundFildes == -1) { // No sound enabled
return;
}
// let's map game sounds, look if already setup in ccl.

View file

@ -5,27 +5,27 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name sound_id.c - The sound id. */
/**@name sound_id.c - The sound id. */
//
// (c) Copyright 1998-2003 by Lutz Sammer and Fabrice Rossi
// (c) Copyright 1998-2003 by Lutz Sammer and Fabrice Rossi
//
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation; only version 2 of the License.
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation; only version 2 of the License.
//
// Stratagus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Stratagus is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@ -45,31 +45,31 @@
#include "util.h"
/*----------------------------------------------------------------------------
-- Variables
-- Variables
----------------------------------------------------------------------------*/
#ifdef DOXYGEN // no real code, only for document
#ifdef DOXYGEN // no real code, only for document
/**
** hash table used to store the mapping between sound name and sound id
** hash table used to store the mapping between sound name and sound id
*/
static int SoundIdHash[61];
#else
/**
** hash table used to store the mapping between sound name and sound id
** hash table used to store the mapping between sound name and sound id
*/
static hashtable(int, 61) SoundIdHash;
#endif
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
** Display the sound name hash table.
** Display the sound name hash table.
*/
void DisplaySoundHashTable(void)
{
@ -89,11 +89,11 @@ void DisplaySoundHashTable(void)
}
/**
** Add a new mapping (sound name to sound id) in the hash table
** Create a new mapping between a name and an already valid sound id.
** Add a new mapping (sound name to sound id) in the hash table
** Create a new mapping between a name and an already valid sound id.
**
** @param name Name of the sound (now freed by caller!).
** @param id Sound identifier.
** @param name Name of the sound (now freed by caller!).
** @param id Sound identifier.
*/
void MapSound(const char* name, const SoundId id)
{
@ -101,11 +101,11 @@ void MapSound(const char* name, const SoundId id)
}
/**
** Maps a sound name to its id
** Maps a sound name to its id
**
** @param name Sound name.
** @param name Sound name.
**
** @return Sound idenfier for this name.
** @return Sound idenfier for this name.
*/
SoundId SoundIdForName(const char* name)
{
@ -121,16 +121,16 @@ SoundId SoundIdForName(const char* name)
}
/**
** Ask the sound server to register a sound and store the mapping
** between its name and its id.
** Register a sound group (or an unique sound if nb==1) and get the
** corresponding sound id.
** Ask the sound server to register a sound and store the mapping
** between its name and its id.
** Register a sound group (or an unique sound if nb==1) and get the
** corresponding sound id.
**
** @param name name of this sound group (Freed by caller).
** @param file list of sound file names
** @param nb number of sounds
** @param name name of this sound group (Freed by caller).
** @param file list of sound file names
** @param nb number of sounds
**
** @return the sound id of the created group
** @return the sound id of the created group
*/
SoundId MakeSound(const char* name, const char* file[], int nb)
{
@ -152,17 +152,17 @@ SoundId MakeSound(const char* name, const char* file[], int nb)
}
/**
** Ask the sound server to build a special sound group.
** Ask the sound server to build a special sound group.
**
** Register two sound groups together to make a special sound (for
** selection). Return the corresponding id after registering it under a
** given name.
** Register two sound groups together to make a special sound (for
** selection). Return the corresponding id after registering it under a
** given name.
**
** @param name the name of the group (handled by caller).
** @param first id of the first group
** @param second id of the second group
** @param name the name of the group (handled by caller).
** @param first id of the first group
** @param second id of the second group
**
** @return Registered sound identifier.
** @return Registered sound identifier.
*/
SoundId MakeSoundGroup(const char* name, SoundId first, SoundId second)
{

View file

@ -5,13 +5,13 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name sound_server.c - The sound server
/**@name sound_server.c - The sound server
** (hardware layer and so on) */
//
// (c) Copyright 1998-2004 by Lutz Sammer and Fabrice Rossi
// (c) Copyright 1998-2004 by Lutz Sammer and Fabrice Rossi
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -27,12 +27,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include <stdio.h>
@ -64,47 +64,47 @@
#include "util.h"
/*----------------------------------------------------------------------------
-- Defines
-- Defines
----------------------------------------------------------------------------*/
#define SoundDeviceName "/dev/dsp" /// dsp device
#define SoundDeviceName "/dev/dsp" ///< dsp device
/*----------------------------------------------------------------------------
-- Variables
-- Variables
----------------------------------------------------------------------------*/
int SoundFildes = -1; /// audio file descriptor
int PlayingMusic; /// flag true if playing music
int CallbackMusic; /// flag true callback ccl if stops
int WaitForSoundDevice; /// Block until sound device available
int SoundFildes = -1; ///< audio file descriptor
int PlayingMusic; ///< flag true if playing music
int CallbackMusic; ///< flag true callback ccl if stops
int WaitForSoundDevice; ///< Block until sound device available
#ifdef DEBUG
unsigned AllocatedSoundMemory; /// memory used by sound
unsigned AllocatedSoundMemory; ///< memory used by sound
#endif
int GlobalVolume = 128; /// global sound volume
int MusicVolume = 128; /// music volume
int GlobalVolume = 128; ///< global sound volume
int MusicVolume = 128; ///< music volume
int DistanceSilent; /// silent distance
int DistanceSilent; ///< silent distance
// the sound FIFO
SoundRequest SoundRequests[MAX_SOUND_REQUESTS];
int NextSoundRequestIn;
int NextSoundRequestOut;
int SoundThreadRunning; /// FIXME: docu
int SoundThreadRunning; ///< FIXME: docu
static int MusicTerminated;
SDL_mutex * MusicTerminatedMutex;
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
** Check if the playlist need to be advanced,
** and invoque music-stopped if necessary
** Check if the playlist need to be advanced,
** and invoque music-stopped if necessary
*/
void PlayListAdvance(void)
{
@ -161,7 +161,7 @@ static void MixMusicToStereo32(int* buffer, int size)
buffer[i] += buf[i] * MusicVolume / MaxVolume / 2;
}
if (n < len) { // End reached
if (n < len) { // End reached
PlayingMusic = 0;
SoundFree(MusicSample);
MusicSample = NULL;
@ -177,7 +177,7 @@ static void MixMusicToStereo32(int* buffer, int size)
}
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
@ -283,22 +283,22 @@ int NextFreeChannel;
** Selection handling
*/
typedef struct _selection_handling_ {
Origin Source; // origin of the sound
ServerSoundId Sound; // last sound played by this unit
unsigned char HowMany; // number of sound played in this group
Origin Source; // origin of the sound
ServerSoundId Sound; // last sound played by this unit
unsigned char HowMany; // number of sound played in this group
} SelectionHandling;
/// FIXME: docu
SelectionHandling SelectionHandler;
/**
** Source registration
** Source registration
*/
/// hash table used to store unit to channel mapping
// hash table used to store unit to channel mapping
//local hashtable(int, 61) UnitToChannel;
/**
** Distance to Volume Mapping
** Distance to Volume Mapping
*/
static int ViewPointOffset;
@ -366,27 +366,29 @@ static void RegisterSource(SoundRequest* sr, int channel)
/*
** Remove the source of a channel from the selection handling hash table.
*/
static void UnRegisterSource(int channel) {
static void UnRegisterSource(int channel)
{
int i;
i = channel;
}
/**
** Compute a suitable volume for something taking place at a given
** distance from the current view point.
** Compute a suitable volume for something taking place at a given
** distance from the current view point.
**
** @param d distance
** @param range range
** @param d distance
** @param range range
**
** @return volume for given distance (0..??)
** @return volume for given distance (0..??)
*/
static unsigned char VolumeForDistance(unsigned short d, unsigned char range) {
static unsigned char VolumeForDistance(unsigned short d, unsigned char range)
{
int d_tmp;
int range_tmp;
//FIXME: THIS IS SLOW!!!!!!!
if (d <= ViewPointOffset || range==INFINITE_SOUND_RANGE) {
if (d <= ViewPointOffset || range == INFINITE_SOUND_RANGE) {
return MaxVolume;
} else {
if (range) {
@ -408,7 +410,8 @@ static unsigned char VolumeForDistance(unsigned short d, unsigned char range) {
** Compute the volume associated with a request, either by clipping the Range
** parameter of this request, or by mapping this range to a volume.
*/
static unsigned char ComputeVolume(SoundRequest* sr) {
static unsigned char ComputeVolume(SoundRequest* sr)
{
if (sr->IsVolume) {
if (sr->Power > MaxVolume) {
return MaxVolume;
@ -424,7 +427,8 @@ static unsigned char ComputeVolume(SoundRequest* sr) {
/*
** "Randomly" choose a sample from a sound group.
*/
static Sample* SimpleChooseSample(ServerSoundId sound) {
static Sample* SimpleChooseSample(ServerSoundId sound)
{
if (sound->Number == ONE_SOUND) {
return sound->Sound.OneSound;
} else {
@ -536,7 +540,7 @@ static int FillOneChannel(SoundRequest* sr)
/**
** get orders from the fifo and put them into channels. This function takes
** care of registering sound sources.
//FIXME: is this the correct place to do this?
** FIXME @todo: is this the correct place to do this?
*/
static void FillChannels(int free_channels,int* discarded,int* started)
{
@ -572,12 +576,12 @@ static void FillChannels(int free_channels,int* discarded,int* started)
}
/**
** Mix channels to stereo 32 bit.
** Mix channels to stereo 32 bit.
**
** @param buffer Buffer for mixed samples.
** @param size Number of samples that fits into buffer.
** @param buffer Buffer for mixed samples.
** @param size Number of samples that fits into buffer.
**
** @return How many channels become free after mixing them.
** @return How many channels become free after mixing them.
*/
static int MixChannelsToStereo32(int* buffer,int size)
{
@ -608,11 +612,11 @@ static int MixChannelsToStereo32(int* buffer,int size)
}
/**
** Clip mix to output stereo 16 signed bit.
** Clip mix to output stereo 16 signed bit.
**
** @param mix signed 32 bit input.
** @param size number of samples in input.
** @param output clipped 16 signed bit output buffer.
** @param mix signed 32 bit input.
** @param size number of samples in input.
** @param output clipped 16 signed bit output buffer.
*/
static void ClipMixToStereo16(const int* mix, int size, short* output)
{
@ -633,17 +637,17 @@ static void ClipMixToStereo16(const int* mix, int size, short* output)
}
/*----------------------------------------------------------------------------
-- Other
-- Other
----------------------------------------------------------------------------*/
/**
** Load one sample
** Load one sample
**
** @param name File name of sample (short version).
** @param name File name of sample (short version).
**
** @return General sample loaded from file into memory.
** @return General sample loaded from file into memory.
**
** @todo Add streaming, cashing support.
** @todo Add streaming, cashing support.
*/
static Sample* LoadSample(const char* name)
{
@ -694,17 +698,17 @@ static Sample* LoadSample(const char* name)
}
/**
** Ask the sound server to register a sound (and currently to load it)
** and to return an unique identifier for it. The unique identifier is
** memory pointer of the server.
** Ask the sound server to register a sound (and currently to load it)
** and to return an unique identifier for it. The unique identifier is
** memory pointer of the server.
**
** @param files An array of wav files.
** @param number Number of files belonging together.
** @param files An array of wav files.
** @param number Number of files belonging together.
**
** @return the sound unique identifier
** @return the sound unique identifier
**
** @todo FIXME: Must handle the errors better.
** FIXME: Support for more sample files (ogg/flac/mp3).
** @todo FIXME: Must handle the errors better.
** FIXME: Support for more sample files (ogg/flac/mp3).
*/
SoundId RegisterSound(const char* files[], unsigned number)
{
@ -712,7 +716,7 @@ SoundId RegisterSound(const char* files[], unsigned number)
ServerSoundId id;
id = malloc(sizeof(*id));
if (number > 1) { // load a sound group
if (number > 1) { // load a sound group
id->Sound.OneGroup = malloc(sizeof(Sample*) * number);
for (i = 0; i < number; ++i) {
id->Sound.OneGroup[i] = LoadSample(files[i]);
@ -723,7 +727,7 @@ SoundId RegisterSound(const char* files[], unsigned number)
}
}
id->Number = number;
} else { // load an unique sound
} else { // load an unique sound
id->Sound.OneSound = LoadSample(files[0]);
if (!id->Sound.OneSound) {
free(id);
@ -736,12 +740,12 @@ SoundId RegisterSound(const char* files[], unsigned number)
}
/**
** Ask the sound server to put together two sounds to form a special sound.
** Ask the sound server to put together two sounds to form a special sound.
**
** @param first first part of the group
** @param second second part of the group
** @param first first part of the group
** @param second second part of the group
**
** @return the special sound unique identifier
** @return the special sound unique identifier
*/
SoundId RegisterTwoGroups(SoundId first, SoundId second)
{
@ -761,10 +765,10 @@ SoundId RegisterTwoGroups(SoundId first, SoundId second)
}
/**
** Ask the sound server to change the range of a sound.
** Ask the sound server to change the range of a sound.
**
** @param sound the id of the sound to modify.
** @param range the new range for this sound.
** @param sound the id of the sound to modify.
** @param range the new range for this sound.
*/
void SetSoundRange(SoundId sound, unsigned char range)
{
@ -774,11 +778,11 @@ void SetSoundRange(SoundId sound, unsigned char range)
}
/**
** Mix into buffer.
** Mix into buffer.
**
** @param buffer Buffer to be filled with samples. Buffer must be big
** enough.
** @param samples Number of samples.
** @param buffer Buffer to be filled with samples. Buffer must be big
** enough.
** @param samples Number of samples.
*/
void MixIntoBuffer(void* buffer, int samples)
{
@ -804,13 +808,13 @@ void MixIntoBuffer(void* buffer, int samples)
}
/**
** Fill buffer for the sound card.
** Fill buffer for the sound card.
**
** @see SDL_OpenAudio
** @see SDL_OpenAudio
**
** @param udata the pointer stored in userdata field of SDL_AudioSpec.
** @param stream pointer to buffer you want to fill with information.
** @param len is length of audio buffer in bytes.
** @param udata the pointer stored in userdata field of SDL_AudioSpec.
** @param stream pointer to buffer you want to fill with information.
** @param len is length of audio buffer in bytes.
*/
void FillAudio(void* udata __attribute__((unused)), Uint8* stream, int len)
{
@ -819,7 +823,7 @@ void FillAudio(void* udata __attribute__((unused)), Uint8* stream, int len)
}
/**
** Initialize sound card.
** Initialize sound card.
*/
int InitSound(void)
{
@ -829,15 +833,15 @@ int InitSound(void)
MusicTerminatedMutex = SDL_CreateMutex();
//
// Open sound device, 8bit samples, stereo.
// Open sound device, 8bit samples, stereo.
//
if (InitSdlSound(SoundDeviceName, 44100, 16,
WaitForSoundDevice)) {
return 1;
}
// ARI: The following must be done here to allow sound to work in
// pre-start menus!
// ARI: The following must be done here to allow sound to work in
// pre-start menus!
// initialize channels
for (dummy = 0; dummy < MaxChannels; ++dummy) {
Channels[dummy].Point = dummy + 1;
@ -851,7 +855,7 @@ int InitSound(void)
}
/**
** Initialize sound server structures (and thread)
** Initialize sound server structures (and thread)
*/
int InitSoundServer(void)
{
@ -868,7 +872,7 @@ int InitSoundServer(void)
}
/**
** Cleanup sound server.
** Cleanup sound server.
*/
void QuitSound(void)
{

View file

@ -4,13 +4,13 @@
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name unitsound.c - The unit sounds. */
/**@name unitsound.c - The unit sounds. */
//
// (c) Copyright 1999-2001,2003 by Fabrice Rossi and Jimmy Salmon
// (c) Copyright 1999-2001,2003 by Fabrice Rossi and Jimmy Salmon
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -26,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Include
-- Include
----------------------------------------------------------------------------*/
#include <stdio.h>
@ -51,87 +51,87 @@
#include "map.h"
/*----------------------------------------------------------------------------
-- Declarations
-- Declarations
----------------------------------------------------------------------------*/
/**
** Simple sound definition:
** There is only one sound/voice that could be used for this
** sound identifier.
** Simple sound definition:
** There is only one sound/voice that could be used for this
** sound identifier.
*/
typedef struct _simple_sound_ {
char* Name; /// name of the sound
char* File; /// corresponding sound file
char* Name; ///< name of the sound
char* File; ///< corresponding sound file
} SimpleSound;
/**
** Structure for remaping a sound to a new name.
** Structure for remaping a sound to a new name.
*/
typedef struct _sound_remap_ {
char* NewName; /// Name in unit-type definition
char* BaseName; /// Name used in sound definition
char* NewName; ///< Name in unit-type definition
char* BaseName; ///< Name used in sound definition
} SoundRemap;
#define MaxSimpleGroups 7 /// maximal number of sounds pro group
#define MaxSimpleGroups 7 ///< maximal number of sounds pro group
/**
** Sound group definition:
** There is a collection of sounds/voices that could be randomly
** be used fot this sound identifier.
** Sound group definition:
** There is a collection of sounds/voices that could be randomly
** be used fot this sound identifier.
*/
typedef struct _sound_group_ {
char* Name; /// name of the group
char* Sounds[MaxSimpleGroups]; /// list of sound files
char* Name; ///< name of the group
char* Sounds[MaxSimpleGroups]; ///< list of sound files
} SoundGroup;
/**
** Selection structure:
** Selection structure:
**
** Special sound structure currently used for the selection of an unit.
** For a special number of the uses the first group is used, after this
** the second groups is played.
** Special sound structure currently used for the selection of an unit.
** For a special number of the uses the first group is used, after this
** the second groups is played.
*/
typedef struct _selection_group_ {
char* Name; /// name of the selection sound
char* First; /// name of the sound
char* Second; /// name of the annoyed sound
char* Name; ///< name of the selection sound
char* First; ///< name of the sound
char* Second; ///< name of the annoyed sound
} SelectionGroup;
/*----------------------------------------------------------------------------
-- Variables
-- Variables
----------------------------------------------------------------------------*/
/**
** Simple sounds currently available.
** Simple sounds currently available.
*/
static SimpleSound* SimpleSounds;
/**
** Sound remaping currently available.
** Sound remaping currently available.
*/
static SoundRemap* SoundRemaps;
/**
** Sound-groups currently available
** Sound-groups currently available
*/
static SoundGroup* SoundGroups;
/**
** Selection-groups currently available
** Selection-groups currently available
*/
static SelectionGroup* SelectionGroups;
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
/**
** Computes the number of sounds in a sound group
** Computes the number of sounds in a sound group
**
** @param group list of file names
** @param group list of file names
**
** @return number of sounds in group
** @return number of sounds in group
*/
static int NbSoundsInGroup(char* const* const group)
{
@ -147,7 +147,7 @@ static int NbSoundsInGroup(char* const* const group)
/**
** Loads all simple sounds (listed in the SimpleSounds array).
** Loads all simple sounds (listed in the SimpleSounds array).
*/
static void LoadSimpleSounds(void)
{
@ -161,8 +161,8 @@ static void LoadSimpleSounds(void)
}
/**
** Loads all sound groups.
** Special groups are created.
** Loads all sound groups.
** Special groups are created.
*/
static void LoadSoundGroups(void)
{
@ -185,8 +185,8 @@ static void LoadSoundGroups(void)
}
/**
** Performs remaping listed in the Remaps array. Maps also critter
** sounds to their correct values.
** Performs remaping listed in the Remaps array. Maps also critter
** sounds to their correct values.
*/
static void RemapSounds(void)
{
@ -201,7 +201,7 @@ static void RemapSounds(void)
}
//
// Make some general sounds.
// Make some general sounds.
//
// FIXME: move to config CCL
MapSound("gold-mine-help", SoundIdForName("basic orc voices help 1"));
@ -235,7 +235,7 @@ static void RemapSounds(void)
}
/**
** Load all sounds for units.
** Load all sounds for units.
*/
void LoadUnitSounds(void)
{
@ -247,9 +247,9 @@ void LoadUnitSounds(void)
}
/**
** Map the sounds of all unit-types to the correct sound id.
** And overwrite the sound ranges. @todo the sound ranges should be
** configurable by user with CCL.
** Map the sounds of all unit-types to the correct sound id.
** And overwrite the sound ranges. @todo the sound ranges should be
** configurable by user with CCL.
*/
void MapUnitSounds(void)
{
@ -261,7 +261,7 @@ void MapUnitSounds(void)
SetSoundRange(SoundIdForName("tree chopping"), 32);
//
// Parse all units sounds.
// Parse all units sounds.
//
for (i = 0; i < NumUnitTypes; ++i) {
type = UnitTypes[i];

View file

@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name wav.c - wav support */
/**@name wav.c - wav support */
//
// (c) Copyright 2003-2004 by Lutz Sammer, Fabrice Rossi and Nehal Mistry
// (c) Copyright 2003-2004 by Lutz Sammer, Fabrice Rossi and Nehal Mistry
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@ -26,12 +26,12 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
//@{
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include "stratagus.h"
@ -54,8 +54,8 @@
** Private wav data structure to handle wav streaming.
*/
typedef struct _wav_data_ {
CLFile* WavFile; /// Wav file handle
int ChunkRem; /// Bytes remaining in chunk
CLFile* WavFile; ///< Wav file handle
int ChunkRem; ///< Bytes remaining in chunk
} WavData;
/*----------------------------------------------------------------------------
@ -67,7 +67,7 @@ static int WavStreamRead(Sample* sample, void* buf, int len)
WavData* data;
WavChunk chunk;
char* sndbuf;
int comp; // number of compressed bytes actually read
int comp; // number of compressed bytes actually read
int i;
int read;
int bufrem;
@ -173,7 +173,7 @@ static void WavFree(Sample* sample)
}
/**
** wav stream type structure.
** wav stream type structure.
*/
static const SampleType WavSampleType = {
WavRead,
@ -300,7 +300,7 @@ Sample* LoadWav(const char* name, int flags)
sample->Buffer = malloc(SOUND_BUFFER_SIZE);
sample->Type = &WavStreamSampleType;
} else {
int comp; // number of compressed bytes actually read
int comp; // number of compressed bytes actually read
int i;
int rem;
int read;