Subversion Repositories eduke32

Rev

Rev 8741 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5270 terminx 1
/*
2
Copyright (C) 1994-1995 Apogee Software, Ltd.
3
 
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License
6
as published by the Free Software Foundation; either version 2
7
of the License, or (at your option) any later version.
8
 
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
 
13
See the GNU General Public License for more details.
14
 
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18
 
19
*/
20
/**********************************************************************
21
   module: FX_MAN.H
22
 
23
   author: James R. Dose
24
   date:   March 17, 1994
25
 
26
   Public header for FX_MAN.C
27
 
28
   (c) Copyright 1994 James R. Dose.  All Rights Reserved.
29
**********************************************************************/
30
 
31
#ifndef FX_MAN_H_
32
#define FX_MAN_H_
33
 
8219 terminx 34
#include <inttypes.h>
8280 hendricks2 35
#include "sndcards.h"
5270 terminx 36
#include "limits.h"
5814 terminx 37
#include "multivoc.h"
5270 terminx 38
 
39
#ifdef __cplusplus
40
extern "C" {
41
#endif
42
 
43
enum FX_ERRORS
44
{
45
    FX_Warning = -2,
46
    FX_Error = -1,
47
    FX_Ok = 0,
48
    FX_InvalidCard,
49
    FX_MultiVocError,
50
};
51
 
52
enum FX_LOOP_HOW
53
{
54
    FX_ONESHOT = -1,
55
    FX_LOOP = 0,
56
};
57
 
58
#define FX_MUSIC_PRIORITY       INT_MAX
59
 
8216 terminx 60
const char *FX_ErrorString(int ErrorNumber);
8225 terminx 61
int FX_Init(int numvoices, int numchannels, int mixrate, void *initdata);
8390 terminx 62
void FX_InitCvars(void);
8216 terminx 63
int FX_Shutdown(void);
8261 hendricks2 64
int FX_GetDevice(void);
5270 terminx 65
 
66
 
67
 
8216 terminx 68
int FX_Play(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pitchoffset,
8427 hendricks2 69
                      int vol, int left, int right, int priority, fix16_t volume, intptr_t callbackval);
8216 terminx 70
int FX_Play3D(char *ptr, uint32_t ptrlength, int loophow, int pitchoffset, int angle,
8427 hendricks2 71
                  int distance, int priority, fix16_t volume, intptr_t callbackval);
8450 hendricks2 72
int FX_PlayRaw(char *ptr, uint32_t ptrlength, int rate, int pitchoffset, int vol,
73
    int left, int right, int priority, fix16_t volume, intptr_t callbackval);
74
int FX_PlayLoopedRaw(char *ptr, uint32_t ptrlength, char *loopstart, char *loopend, int rate,
75
    int pitchoffset, int vol, int left, int right, int priority, fix16_t volume, intptr_t callbackval);
5270 terminx 76
 
8741 hendricks2 77
int FX_StartDemandFeedPlayback(void (*function)(const char** ptr, uint32_t* length, void* userdata), int bitdepth, int channels, int rate, int pitchoffset,
78
    int vol, int left, int right, int priority, fix16_t volume, intptr_t callbackval, void* userdata);
5270 terminx 79
 
8216 terminx 80
int FX_SetPrintf(void(*function)(const char *, ...));
5270 terminx 81
 
8216 terminx 82
extern int FX_ErrorCode;
8771 terminx 83
extern int FX_MixRate;
84
 
5814 terminx 85
#define FX_SetErrorCode(status) FX_ErrorCode = (status);
5270 terminx 86
 
8216 terminx 87
static FORCE_INLINE int FX_CheckMVErr(int status)
5814 terminx 88
{
89
    if (status != MV_Ok)
90
    {
91
        FX_SetErrorCode(FX_MultiVocError);
92
        status = FX_Warning;
93
    }
94
 
95
    return status;
96
}
97
 
8427 hendricks2 98
static FORCE_INLINE void FX_SetCallBack(void(*function)(intptr_t)) { MV_SetCallBack(function); }
8216 terminx 99
static FORCE_INLINE void FX_SetVolume(int volume) { MV_SetVolume(volume); }
100
static FORCE_INLINE int FX_GetVolume(void) { return MV_GetVolume(); }
8480 hendricks2 101
#ifdef ASS_REVERSESTEREO
102
static FORCE_INLINE void FX_SetReverseStereo(int setting) { MV_SetReverseStereo(setting); }
103
static FORCE_INLINE int FX_GetReverseStereo(void) { return MV_GetReverseStereo(); }
104
#endif
8216 terminx 105
static FORCE_INLINE void FX_SetReverb(int reverb) { MV_SetReverb(reverb); }
106
static FORCE_INLINE int FX_GetMaxReverbDelay(void) { return MV_GetMaxReverbDelay(); }
107
static FORCE_INLINE int FX_GetReverbDelay(void) { return MV_GetReverbDelay(); }
108
static FORCE_INLINE void FX_SetReverbDelay(int delay) { MV_SetReverbDelay(delay); }
109
static FORCE_INLINE int FX_VoiceAvailable(int priority) { return MV_VoiceAvailable(priority); }
110
static FORCE_INLINE int FX_PauseVoice(int handle, int pause) { return FX_CheckMVErr(MV_PauseVoice(handle, pause)); }
111
static FORCE_INLINE int FX_GetPosition(int handle, int *position) { return FX_CheckMVErr(MV_GetPosition(handle, position)); }
112
static FORCE_INLINE int FX_SetPosition(int handle, int position) { return FX_CheckMVErr(MV_SetPosition(handle, position)); }
113
static FORCE_INLINE int FX_EndLooping(int handle) { return FX_CheckMVErr(MV_EndLooping(handle)); }
114
static FORCE_INLINE int FX_SetPan(int handle, int vol, int left, int right)
5814 terminx 115
{
116
    return FX_CheckMVErr(MV_SetPan(handle, vol, left, right));
117
}
8216 terminx 118
static FORCE_INLINE int FX_SetPitch(int handle, int pitchoffset) { return FX_CheckMVErr(MV_SetPitch(handle, pitchoffset)); }
119
static FORCE_INLINE int FX_SetFrequency(int handle, int frequency) { return FX_CheckMVErr(MV_SetFrequency(handle, frequency)); }
8449 hendricks2 120
static FORCE_INLINE int32_t FX_GetFrequency(int handle, int *frequency) { return FX_CheckMVErr(MV_GetFrequency(handle, frequency)); }
8216 terminx 121
static FORCE_INLINE int FX_Pan3D(int handle, int angle, int distance)
5814 terminx 122
{
123
    return FX_CheckMVErr(MV_Pan3D(handle, angle, distance));
124
}
8216 terminx 125
static FORCE_INLINE int FX_SoundActive(int handle) { return MV_VoicePlaying(handle); }
8311 hendricks2 126
static FORCE_INLINE int FX_SoundValidAndActive(int handle) { return handle > 0 && MV_VoicePlaying(handle); }
8216 terminx 127
static FORCE_INLINE int FX_SoundsPlaying(void) { return MV_VoicesPlaying(); }
128
static FORCE_INLINE int FX_StopSound(int handle) { return FX_CheckMVErr(MV_Kill(handle)); }
129
static FORCE_INLINE int FX_StopAllSounds(void) { return FX_CheckMVErr(MV_KillAllVoices()); }
5814 terminx 130
 
5270 terminx 131
#ifdef __cplusplus
132
}
133
#endif
134
 
135
#endif