Descent3/dd_sndlib/auddev.h

238 lines
6.4 KiB
C
Raw Normal View History

/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2024-04-16 03:43:29 +00:00
/*
* $Source: $
* $Revision: 16 $
* $Author: Samir $
* $Date: 8/23/99 5:29p $
*
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
*
* $Log: /DescentIII/Main/dd_sndlib/auddev.h $
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 16 8/23/99 5:29p Samir
* incremental EAX 2.0 checkin
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 15 8/13/99 2:00p Samir
* more aureal and geometry fixes.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 14 8/11/99 3:12p Samir
* fixes for aureal support.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 13 5/03/99 3:12a Samir
* added event management routines.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 12 4/29/99 3:01p Samir
* added some more functions.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 11 4/23/99 7:51p Samir
* added flush function.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 10 4/13/99 4:09p Samir
* more priority stuff.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 9 4/06/99 8:30p Samir
* added reflection support.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 8 3/29/99 11:02a Samir
* added geometry supoprt.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 7 1/14/99 6:10p Samir
* added DirectSound buffer duplication code.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 6 1/11/99 5:52p Samir
* updated EAX support.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 5 1/08/99 6:31p Samir
* added reverb
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 4 1/08/99 11:36a Samir
* implemented basic Aureal 2.0 support.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 3 12/23/98 11:50a Samir
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 2 12/23/98 11:48a Samir
* basic functionality.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 1 12/22/98 11:56a Samir
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
*/
#ifndef AUDDEV_H
#define AUDDEV_H
#include "dsound.h"
#include "vmanpset.h"
#include "pstypes.h"
#include "vecmat.h"
2024-04-16 18:56:40 +00:00
#define SOUND_DECAY_MAXTIME 100.0f
#define SOUND_GAIN_MAXSCALAR 1.0f
2024-04-16 03:43:29 +00:00
2024-04-16 20:59:11 +00:00
// #define SUPPORT_AUREAL
2024-04-16 03:43:29 +00:00
// Creative labs Environmental Audio Extension Interface
// starts up standard audio device (DirectSound)
2024-04-16 18:56:40 +00:00
bool EAX_Create(GUID *pguid, LPDIRECTSOUND *lpds);
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
// shutdown standard audio device (DirectSound)
void EAX_Destroy();
2024-04-16 03:43:29 +00:00
// returns EAX caps
2024-04-16 18:56:40 +00:00
#define EAXF_SOURCE_OBSTRUCTION 16
2024-04-16 03:43:29 +00:00
int EAX_Caps();
// initializes EAX specific interfaces.
2024-04-16 18:56:40 +00:00
bool EAX_SetPrimaryBuffer();
2024-04-16 03:43:29 +00:00
// sets up current global environment reverb
bool EAX_SetEnvironmentalReverb(float volume, float damping, float decay);
// intializes a sound source for EAX
bool EAX_InitSource(LPDIRECTSOUND3DBUFFER lpBuffer3D, LPKSPROPERTYSET *plpksp);
// frees an eax sound source
void EAX_FreeSource(LPKSPROPERTYSET lpksp);
// sets source properties
void EAX_SetSourceProperties(LPKSPROPERTYSET lpksp, float obstruction);
#ifdef SUPPORT_AUREAL
//////////////////////////////////////////////////////////////////////////////
// Aureal 2.0 Direct Path Interface
// Initialize object
2024-04-16 18:56:40 +00:00
bool A3D_Init(HWND hwnd);
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
// destroy object
2024-04-16 03:43:29 +00:00
void A3D_Destroy();
// sets units of measurement
void A3D_SetUnitsPerMeter(float units);
// sets rolloff for all source objects (from 0.0f to ???)
void A3D_SetRolloffFactor(float scalar);
// sets doppler for all source objects (from 0.0f to ???) (1.0f is default, 0.0f is none)
void A3D_SetDopplerFactor(float scalar);
// create or destroy geometry object
bool A3D_CreateGeometryInterface();
void A3D_DestroyGeometryInterface();
// create listener
bool A3D_CreateListener();
// create source
2024-04-16 18:56:40 +00:00
void *A3D_CreateSSource(int size, int bps, bool stereo, bool streaming, ushort freq = 22050, bool is3d = false);
2024-04-16 03:43:29 +00:00
// duplicates source
void *A3D_DuplicateSource(void *src);
// frees source
void A3D_FreeSSource(void *obj);
// loads data into source
bool A3D_LoadSample(void *obj, void *src_data, int src_length);
// plays a sound
void A3D_Play(void *obj, bool looping);
// stops a sound
void A3D_Stop(void *obj);
// returns current position in buffer of playback
2024-04-16 18:56:40 +00:00
void A3D_GetCurrentPosition(void *obj, uint *playp);
2024-04-16 03:43:29 +00:00
// sets current position in buffer
void A3D_SetCurrentPosition(void *obj, uint pos);
// sets properties for source object
// priority is from 0 to 1.0
void A3D_SetSourcePriority(void *obj, float priority);
// pan from 0 to 1.0f
void A3D_SetSourcePan(void *obj, float lpan, float rpan);
void A3D_GetSourcePan(void *obj, float *lpan, float *rpan);
// volume from 0 to 1.0f
void A3D_SetSourceVolume(void *obj, float volume);
float A3D_GetSourceVolume(void *obj);
void A3D_SetSourceCone(void *obj, float x, float y, float z);
void A3D_SetSourceVelocity(void *obj, float x, float y, float z);
void A3D_GetSourceVelocity(void *obj, vector *vel);
void A3D_SetSourcePosition(void *obj, float x, float y, float z);
void A3D_GetSourcePosition(void *obj, vector *pos);
void A3D_SetSourceOrientation(void *obj, const vector *fvec, const vector *uvec);
void A3D_GetSourceOrientation(void *obj, matrix *orient);
bool A3D_SetSourceWaveEvent(void *obj, DWORD offset, HANDLE hEvent);
bool A3D_ClearSourceWaveEvents(void *obj);
2024-04-16 18:56:40 +00:00
void A3D_SetMinMaxDistance(void *obj, float min, float max, bool mute_max = false);
2024-04-16 03:43:29 +00:00
// sets properties for listener
void A3D_SetListenerVelocity(float x, float y, float z);
void A3D_SetListenerOrient(vector *fvec, vector *uvec);
void A3D_SetListenerPosition(float x, float y, float z);
// call at start of sound frame
void A3D_StartFrame();
void A3D_EndFrame();
void A3D_Flush();
// gets status of current source buffer
#define A3D_STATUS_PLAYING 0x1
int A3D_GetSourceStatus(void *obj);
2024-04-16 18:56:40 +00:00
bool A3D_Lock(void *obj, DWORD dwWriteCursor, DWORD dwWriteBytes, void **ptr1, LPDWORD plen1, void **ptr2,
LPDWORD plen2);
2024-04-16 03:43:29 +00:00
bool A3D_Unlock(void *obj, void *ptr1, DWORD len1, void *ptr2, DWORD len2);
// sets up current global environment reverb
bool A3D_SetEnvironmentalReverb(float volume, float damping, float decay);
// room builder
// list = list id. 0 is only valid.
void A3D_GeomListStart(int list);
void A3D_GeomListEnd(int list);
void A3D_GeomListExec(int list);
2024-04-16 18:56:40 +00:00
void A3D_Clear(); // clears geometry info
2024-04-16 03:43:29 +00:00
// all below functions act on the current list.
void A3D_GeomAddListener(vector *pos, matrix *orient);
void A3D_GeomAddSource(void *obj, vector *pos, matrix *orient);
2024-04-16 18:56:40 +00:00
void A3D_GeomBindMaterial(void *obj);
2024-04-16 03:43:29 +00:00
void A3D_GeomAddTriangle(unsigned tag, vector **verts);
void A3D_GeomAddQuad(unsigned tag, vector **verts);
// used to create aureal 2.0 materials.
// gain and highfreq values range from 0 to 1.0
void *A3D_CreateMaterial(float xmit_gain, float xmit_highfreq, float reflect_gain, float reflect_highfreq);
void A3D_DestroyMaterial(void *obj);
#endif
#endif