mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
*********************************************************
* 2006/04/26 * * Little Alien * * Developed in VS 2003 * ********************************************************* Source: - Soundmanager v1.1 added - Some changes for international versions git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@39 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
/*
|
||||
* ChangeLog:
|
||||
* 10.12.2005 Lesh ripped out everything that refers to MSS
|
||||
* 10.12.2005 Lesh added fmod.h
|
||||
*/
|
||||
#ifndef __JA2_SGP_ALL_H
|
||||
#define __JA2_SGP_ALL_H
|
||||
|
||||
#pragma message("GENERATED PCH FOR JA2 SGP PROJECT.")
|
||||
|
||||
//#ifndef INITGUID
|
||||
// #define INITGUID
|
||||
// #define INITGUID
|
||||
//#endif
|
||||
|
||||
|
||||
@@ -13,9 +18,9 @@
|
||||
#include "Button Sound Control.h"
|
||||
#include "Sound Control.h"
|
||||
#ifdef _JA2_RENDER_DIRTY
|
||||
#include "Font Control.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "utilities.h"
|
||||
#include "Font Control.h"
|
||||
#include "Render Dirty.h"
|
||||
#include "utilities.h"
|
||||
#endif
|
||||
#include "input.h"
|
||||
#include "memman.h"
|
||||
@@ -28,8 +33,8 @@
|
||||
#include <stdarg.h>
|
||||
#include "debug.h"
|
||||
#ifndef NO_ZLIB_COMPRESSION
|
||||
#include "zlib.h"
|
||||
#include "Compression.h"
|
||||
#include "zlib.h"
|
||||
#include "Compression.h"
|
||||
#endif
|
||||
#include "types.h"
|
||||
#include <stdlib.h>
|
||||
@@ -73,9 +78,9 @@
|
||||
#include <tchar.h>
|
||||
#include <assert.h>
|
||||
#include "Install.h"
|
||||
#include "GameSettings.h"
|
||||
#include "GameSettings.h"
|
||||
#ifdef _DEBUG
|
||||
#include <crtdbg.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
#include "mousesystem.h"
|
||||
#include "Mutex Manager.h"
|
||||
@@ -83,7 +88,7 @@
|
||||
#include <windowsx.h>
|
||||
#include "vobject_private.h"
|
||||
#include "shading.h"
|
||||
#include "mss.h"
|
||||
//#include "mss.h"
|
||||
#include "imgfmt.h"
|
||||
#include "timer.h"
|
||||
#include "renderworld.h"
|
||||
@@ -94,5 +99,8 @@
|
||||
#include "vsurface_private.h"
|
||||
#include "Timer Control.h"
|
||||
|
||||
// Lesh modifications
|
||||
#include "fmod.h"
|
||||
#include "fmod_errors.h"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -2748,15 +2748,18 @@
|
||||
<File
|
||||
RelativePath="FileMan.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\fmod.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\fmod_errors.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\Utils\Font Control.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="font.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="gameloop.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="himage.h">
|
||||
</File>
|
||||
@@ -2874,9 +2877,6 @@
|
||||
<File
|
||||
RelativePath="WCheck.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Winbart97.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="WinFont.h">
|
||||
</File>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
#ifndef _FMOD_ERRORS_H
|
||||
#define _FMOD_ERRORS_H
|
||||
|
||||
static char *FMOD_ErrorString(int errcode)
|
||||
{
|
||||
switch (errcode)
|
||||
{
|
||||
case FMOD_ERR_NONE: return "No errors";
|
||||
case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first.";
|
||||
case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called";
|
||||
case FMOD_ERR_PLAY: return "Playing the sound failed.";
|
||||
case FMOD_ERR_INIT: return "Error initializing output device.";
|
||||
case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused.";
|
||||
case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)";
|
||||
case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware.";
|
||||
case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer.";
|
||||
case FMOD_ERR_FILE_NOTFOUND: return "File not found";
|
||||
case FMOD_ERR_FILE_FORMAT: return "Unknown file format";
|
||||
case FMOD_ERR_FILE_BAD: return "Error loading file";
|
||||
case FMOD_ERR_MEMORY: return "Not enough memory ";
|
||||
case FMOD_ERR_VERSION: return "The version number of this file format is not supported";
|
||||
case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function";
|
||||
case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output.";
|
||||
case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel";
|
||||
case FMOD_ERR_RECORD: return "Recording not supported on this device";
|
||||
case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed";
|
||||
|
||||
default : return "Unknown error";
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
+417
-1840
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,8 @@
|
||||
#define __SOUNDMAN_
|
||||
|
||||
#include "types.h"
|
||||
#include "mss.h"
|
||||
#include "fmod.h"
|
||||
#include "fmod_errors.h"
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
@@ -10,91 +11,22 @@ extern "C" {
|
||||
#endif
|
||||
*/
|
||||
|
||||
// Sample status flags
|
||||
#define SAMPLE_ALLOCATED 0x00000001
|
||||
#define SAMPLE_LOCKED 0x00000002
|
||||
#define SAMPLE_RANDOM 0x00000004
|
||||
// Sample status flags
|
||||
#define SAMPLE_ALLOCATED 0x00000001
|
||||
#define SAMPLE_LOCKED 0x00000002
|
||||
#define SAMPLE_RANDOM 0x00000004
|
||||
#define SAMPLE_RANDOM_MANUAL 0x00000008
|
||||
#define SAMPLE_3D 0x00000010
|
||||
|
||||
|
||||
// Sound error values (they're all the same)
|
||||
#define NO_SAMPLE 0xffffffff
|
||||
#define SOUND_ERROR 0xffffffff
|
||||
#define NO_SAMPLE 0xffffffff
|
||||
#define SOUND_ERROR 0xffffffff
|
||||
|
||||
// Maximum allowable priority value
|
||||
#define PRIORITY_MAX 0xfffffffe
|
||||
#define PRIORITY_RANDOM PRIORITY_MAX-1
|
||||
#define PRIORITY_MAX 0xfffffffe
|
||||
#define PRIORITY_RANDOM PRIORITY_MAX-1
|
||||
|
||||
// Structure definition for 3D sound positional information used by
|
||||
// various other structs and functions
|
||||
typedef struct {
|
||||
FLOAT flX, flY, flZ;
|
||||
FLOAT flVelX, flVelY, flVelZ;
|
||||
FLOAT flFaceX, flFaceY, flFaceZ;
|
||||
FLOAT flUpX, flUpY, flUpZ;
|
||||
FLOAT flFalloffMin, flFalloffMax;
|
||||
UINT32 uiVolume;
|
||||
} SOUND3DPOS;
|
||||
|
||||
// Struct definition for sample slots in the cache
|
||||
// Holds the regular sample data, as well as the
|
||||
// data for the random samples
|
||||
|
||||
typedef struct {
|
||||
CHAR8 pName[128]; // Path to sample data
|
||||
UINT32 uiSize; // Size of sample data
|
||||
UINT32 uiSoundSize; // Playable sound size
|
||||
UINT32 uiFlags; // Status flags
|
||||
UINT32 uiSpeed; // Playback frequency
|
||||
BOOLEAN fStereo; // Stereo/Mono
|
||||
UINT8 ubBits; // 8/16 bits
|
||||
PTR pData; // pointer to sample data memory
|
||||
PTR pSoundStart; // pointer to start of sound data
|
||||
UINT32 uiCacheHits;
|
||||
|
||||
UINT32 uiTimeNext; // Random sound data
|
||||
UINT32 uiTimeMin, uiTimeMax;
|
||||
UINT32 uiSpeedMin, uiSpeedMax;
|
||||
UINT32 uiVolMin, uiVolMax;
|
||||
UINT32 uiPanMin, uiPanMax;
|
||||
UINT32 uiPriority;
|
||||
UINT32 uiInstances;
|
||||
UINT32 uiMaxInstances;
|
||||
|
||||
UINT32 uiAilWaveFormat; // AIL wave sample type
|
||||
UINT32 uiADPCMBlockSize; // Block size for compressed files
|
||||
|
||||
} SAMPLETAG;
|
||||
|
||||
// Structure definition for slots in the sound output
|
||||
// These are used for both the cached and double-buffered
|
||||
// streams
|
||||
typedef struct {
|
||||
SAMPLETAG *pSample;
|
||||
UINT32 uiSample;
|
||||
HSAMPLE hMSS;
|
||||
HSTREAM hMSSStream;
|
||||
H3DSAMPLE hM3D;
|
||||
UINT32 uiFlags;
|
||||
UINT32 uiSoundID;
|
||||
UINT32 uiPriority;
|
||||
void (*pCallback)(UINT8*, UINT32, UINT32, UINT32, void *);
|
||||
void *pData;
|
||||
void (*EOSCallback)(void *);
|
||||
void *pCallbackData;
|
||||
UINT32 uiTimeStamp;
|
||||
BOOLEAN fLooping;
|
||||
HWFILE hFile;
|
||||
BOOLEAN fMusic;
|
||||
BOOLEAN fStopAtZero;
|
||||
UINT32 uiFadeVolume;
|
||||
UINT32 uiFadeRate;
|
||||
UINT32 uiFadeTime;
|
||||
} SOUNDTAG;
|
||||
|
||||
// Structure definition for sound parameters being passed down to
|
||||
// the sample playing function
|
||||
// Structure definition for sound parameters being passed down to the sample playing function
|
||||
typedef struct {
|
||||
UINT32 uiSpeed;
|
||||
UINT32 uiPitchBend; // Random pitch bend range +/-
|
||||
@@ -102,27 +34,12 @@ typedef struct {
|
||||
UINT32 uiPan;
|
||||
UINT32 uiLoop;
|
||||
UINT32 uiPriority;
|
||||
void (*EOSCallback)(void *);
|
||||
void *pCallbackData;
|
||||
void (*EOSCallback)(void *);
|
||||
void *pCallbackData;
|
||||
} SOUNDPARMS;
|
||||
|
||||
// Structure definition for 3D sound parameters being passed down to
|
||||
// the sample playing function
|
||||
typedef struct {
|
||||
UINT32 uiSpeed;
|
||||
UINT32 uiPitchBend; // Random pitch bend range +/-
|
||||
UINT32 uiVolume; // volume at distance zero
|
||||
UINT32 uiLoop;
|
||||
UINT32 uiPriority;
|
||||
void (*EOSCallback)(void *);
|
||||
void *pCallbackData;
|
||||
|
||||
SOUND3DPOS Pos; // NOT optional, MUST be set
|
||||
} SOUND3DPARMS;
|
||||
|
||||
|
||||
// Structure definition for parameters to the random sample playing
|
||||
// function
|
||||
// Structure definition for parameters to the random sample playing function
|
||||
typedef struct {
|
||||
UINT32 uiTimeMin, uiTimeMax;
|
||||
UINT32 uiSpeedMin, uiSpeedMax;
|
||||
@@ -132,128 +49,52 @@ typedef struct {
|
||||
UINT32 uiMaxInstances;
|
||||
} RANDOMPARMS;
|
||||
|
||||
// Structure definition for parameters to the random 3D sample playing
|
||||
// function
|
||||
typedef struct {
|
||||
UINT32 uiTimeMin, uiTimeMax;
|
||||
UINT32 uiSpeedMin, uiSpeedMax;
|
||||
UINT32 uiVolMin, uiVolMax;
|
||||
UINT32 uiPriority;
|
||||
UINT32 uiMaxInstances;
|
||||
|
||||
SOUND3DPOS Pos; // NOT optional, MUST be set
|
||||
} RANDOM3DPARMS;
|
||||
|
||||
|
||||
enum e_EAXRoomTypes
|
||||
{
|
||||
EAXROOMTYPE_NONE=0,
|
||||
EAXROOMTYPE_SMALL_CAVE,
|
||||
EAXROOMTYPE_MEDIUM_CAVE,
|
||||
EAXROOMTYPE_LARGE_CAVE,
|
||||
EAXROOMTYPE_SMALL_ROOM,
|
||||
EAXROOMTYPE_MEDIUM_ROOM,
|
||||
EAXROOMTYPE_LARGE_ROOM,
|
||||
EAXROOMTYPE_OUTDOORS_FLAT,
|
||||
EAXROOMTYPE_OUTDOORS_CANYON,
|
||||
EAXROOMTYPE_UNDERWATER,
|
||||
|
||||
EAXROOMTYPE_NUM_TYPES
|
||||
};
|
||||
|
||||
// Global startup/shutdown functions
|
||||
extern BOOLEAN InitializeSoundManager(void);
|
||||
extern void ShutdownSoundManager(void);
|
||||
extern void ShutdownSoundManager(void);
|
||||
|
||||
// Configuration functions
|
||||
extern BOOLEAN SoundSetMemoryLimit(UINT32 uiLimit);
|
||||
extern BOOLEAN SoundSetCacheThreshhold(UINT32 uiThreshold);
|
||||
extern HDIGDRIVER SoundGetDriverHandle(void);
|
||||
extern void * SoundGetDriverHandle( void );
|
||||
|
||||
// Master volume control functions
|
||||
extern BOOLEAN SoundSetDigitalVolume(UINT32 uiVolume);
|
||||
extern UINT32 SoundGetDigitalVolume(UINT32 uiVolume);
|
||||
extern void SoundSetDefaultVolume(UINT32 uiVolume);
|
||||
extern UINT32 SoundGetDefaultVolume(void);
|
||||
|
||||
extern void SoundSetDefaultVolume(UINT32 uiVolume);
|
||||
extern UINT32 SoundGetDefaultVolume(void);
|
||||
|
||||
// Cache control functions
|
||||
UINT32 SoundLoadSample(STR pFilename);
|
||||
//extern UINT32 SoundLoadSample(STR pFilename);
|
||||
UINT32 SoundLoadSample(STR pFilename);
|
||||
|
||||
extern UINT32 SoundFreeSample(STR pFilename);
|
||||
extern UINT32 SoundLockSample(STR pFilename);
|
||||
extern UINT32 SoundUnlockSample(STR pFilename);
|
||||
extern UINT32 SoundFreeSample(STR pFilename);
|
||||
extern UINT32 SoundLockSample(STR pFilename);
|
||||
extern UINT32 SoundUnlockSample(STR pFilename);
|
||||
extern BOOLEAN SoundEmptyCache(void);
|
||||
extern BOOLEAN SoundSampleIsInUse(UINT32 uiSample);
|
||||
|
||||
// Play/service sample functions
|
||||
extern UINT32 SoundPlay(STR pFilename, SOUNDPARMS *pParms);
|
||||
extern UINT32 SoundPlayStreamedFile( STR pFilename, SOUNDPARMS *pParms );
|
||||
|
||||
extern UINT32 SoundPlayRandom(STR pFilename, RANDOMPARMS *pParms);
|
||||
extern BOOLEAN SoundRandomShouldPlay(UINT32 uiSample);
|
||||
extern UINT32 SoundStartRandom(UINT32 uiSample);
|
||||
extern UINT32 SoundStreamCallback(STR pFilename, SOUNDPARMS *pParms, void (*pCallback)(UINT8 *, UINT32, UINT32, UINT32, void *), void *);
|
||||
extern UINT32 SoundPlay(STR pFilename, SOUNDPARMS *pParms);
|
||||
extern UINT32 SoundPlayStreamedFile( STR pFilename, SOUNDPARMS *pParms );
|
||||
extern UINT32 SoundPlayRandom(STR pFilename, RANDOMPARMS *pParms);
|
||||
extern BOOLEAN SoundServiceStreams(void);
|
||||
extern BOOLEAN SoundServiceRandom(void);
|
||||
extern void SoundSampleSetVolumeRange(UINT32 uiSample, UINT32 uiVolMin, UINT32 uiVolMax);
|
||||
extern void SoundSampleSetPanRange(UINT32 uiSample, UINT32 uiPanMin, UINT32 uiPanMax);
|
||||
|
||||
// Sound instance manipulation functions
|
||||
extern void SoundSetMusic(UINT32 uiSound);
|
||||
extern BOOLEAN SoundStopMusic(void);
|
||||
extern BOOLEAN SoundStopAll(void);
|
||||
extern BOOLEAN SoundStopAllRandom(void);
|
||||
extern BOOLEAN SoundStop(UINT32 uiSoundID);
|
||||
extern BOOLEAN SoundIsPlaying(UINT32 uiSoundID);
|
||||
extern BOOLEAN SoundFileIsPlaying(CHAR8 *pFilename);
|
||||
extern BOOLEAN SoundSetFadeVolume(UINT32 uiSoundID, UINT32 uiVolume, UINT32 uiRate, BOOLEAN fStopAtZero);
|
||||
extern BOOLEAN SoundSetVolume(UINT32 uiSoundID, UINT32 uiVolume);
|
||||
extern BOOLEAN SoundSetPan(UINT32 uiSoundID, UINT32 uiPan);
|
||||
extern BOOLEAN SoundSetFrequency(UINT32 uiSoundID, UINT32 uiFreq);
|
||||
extern BOOLEAN SoundSetLoop(UINT32 uiSoundID, UINT32 uiLoop);
|
||||
extern UINT32 SoundGetVolume(UINT32 uiSoundID);
|
||||
extern UINT32 SoundGetPan(UINT32 uiSoundID);
|
||||
extern UINT32 SoundGetFrequency(UINT32 uiSoundID);
|
||||
extern UINT32 SoundGetLoop(UINT32 uiSoundID);
|
||||
extern UINT32 SoundGetPosition(UINT32 uiSoundID);
|
||||
extern BOOLEAN SoundGetMilliSecondPosition(UINT32 uiSoundID, UINT32 *puiTotalMilliseconds, UINT32 *puiCurrentMilliseconds);
|
||||
|
||||
// Sound instance group functions
|
||||
extern BOOLEAN SoundStopGroup(UINT32 uiPriority);
|
||||
extern BOOLEAN SoundFreeGroup(UINT32 uiPriority);
|
||||
extern UINT32 SoundGetVolume(UINT32 uiSoundID);
|
||||
extern UINT32 SoundGetPosition(UINT32 uiSoundID);
|
||||
|
||||
extern void SoundSetSampleFlags( UINT32 uiSample, UINT32 uiFlags );
|
||||
extern void SoundRemoveSampleFlags( UINT32 uiSample, UINT32 uiFlags );
|
||||
|
||||
extern void SoundEnableSound(BOOLEAN fEnable);
|
||||
|
||||
|
||||
// New 3D sound priovider
|
||||
extern void Sound3DSetProvider(CHAR8 *pProviderName);
|
||||
extern BOOLEAN Sound3DInitProvider(CHAR8 *pProviderName);
|
||||
extern void Sound3DShutdownProvider(void);
|
||||
|
||||
// 3D sound control
|
||||
extern void Sound3DSetPosition(UINT32 uiSample, FLOAT flX, FLOAT flY, FLOAT flZ);
|
||||
extern void Sound3DSetVelocity(UINT32 uiSample, FLOAT flX, FLOAT flY, FLOAT flZ);
|
||||
extern void Sound3DSetListener(FLOAT flX, FLOAT flY, FLOAT flZ);
|
||||
extern void Sound3DSetFacing(FLOAT flXFace, FLOAT flYFace, FLOAT flZFace, FLOAT flXUp, FLOAT flYUp, FLOAT flZUp);
|
||||
extern void Sound3DSetDirection(UINT32 uiSample, FLOAT flXFace, FLOAT flYFace, FLOAT flZFace, FLOAT flXUp, FLOAT flYUp, FLOAT flZUp);
|
||||
extern void Sound3DSetFalloff(UINT32 uiSample, FLOAT flMax, FLOAT flMin);
|
||||
extern void Sound3DSetEnvironment(INT32 iEnvironment);
|
||||
extern UINT32 Sound3DPlay(STR pFilename, SOUND3DPARMS *pParms);
|
||||
extern UINT32 Sound3DStartSample(UINT32 uiSample, UINT32 uiChannel, SOUND3DPARMS *pParms);
|
||||
extern void Sound3DStopAll(void);
|
||||
extern UINT32 Sound3DPlayRandom(STR pFilename, RANDOM3DPARMS *pParms);
|
||||
extern UINT32 Sound3DStartRandom(UINT32 uiSample, SOUND3DPOS *Pos);
|
||||
extern void Sound3DSetRoomType(UINT32 uiRoomType);
|
||||
|
||||
// Status query functions
|
||||
extern UINT32 Sound3DChannelsInUse(void);
|
||||
extern UINT32 SoundStreamsInUse(void);
|
||||
extern UINT32 Sound2DChannelsInUse(void);
|
||||
extern UINT32 SoundTotalChannelsInUse(void);
|
||||
extern void SoundLog(CHAR8 *strMessage);
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user