1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
/*
Copyright (C) 1994-1995 Apogee Software, Ltd.
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 2
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**********************************************************************
module: BLASTER.H
author: James R. Dose
date: February 4, 1994
Public header for BLASTER.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __BLASTER_H
#define __BLASTER_H
typedef struct
{
unsigned Address;
unsigned Type;
unsigned Interrupt;
unsigned Dma8;
unsigned Dma16;
unsigned Midi;
unsigned Emu;
} BLASTER_CONFIG;
extern BLASTER_CONFIG BLASTER_Config;
extern int BLASTER_DMAChannel;
#define UNDEFINED -1
enum BLASTER_ERRORS
{
BLASTER_Warning = -2,
BLASTER_Error = -1,
BLASTER_Ok = 0,
BLASTER_EnvNotFound,
BLASTER_AddrNotSet,
BLASTER_DMANotSet,
BLASTER_DMA16NotSet,
BLASTER_InvalidParameter,
BLASTER_CardNotReady,
BLASTER_NoSoundPlaying,
BLASTER_InvalidIrq,
BLASTER_UnableToSetIrq,
BLASTER_DmaError,
BLASTER_NoMixer,
BLASTER_DPMI_Error,
BLASTER_OutOfMemory
};
enum BLASTER_Types
{
SB = 1,
SBPro = 2,
SB20 = 3,
SBPro2 = 4,
SB16 = 6
};
#define BLASTER_MinCardType SB
#define BLASTER_MaxCardType SB16
#define STEREO 1
#define SIXTEEN_BIT 2
#define MONO_8BIT 0
#define STEREO_8BIT ( STEREO )
#define MONO_16BIT ( SIXTEEN_BIT )
#define STEREO_16BIT ( STEREO | SIXTEEN_BIT )
#define BLASTER_MaxMixMode STEREO_16BIT
#define MONO_8BIT_SAMPLE_SIZE 1
#define MONO_16BIT_SAMPLE_SIZE 2
#define STEREO_8BIT_SAMPLE_SIZE ( 2 * MONO_8BIT_SAMPLE_SIZE )
#define STEREO_16BIT_SAMPLE_SIZE ( 2 * MONO_16BIT_SAMPLE_SIZE )
#define BLASTER_DefaultSampleRate 11000
#define BLASTER_DefaultMixMode MONO_8BIT
#define BLASTER_MaxIrq 15
char *BLASTER_ErrorString( int ErrorNumber );
void BLASTER_EnableInterrupt( void );
void BLASTER_DisableInterrupt( void );
int BLASTER_WriteDSP( unsigned data );
int BLASTER_ReadDSP( void );
int BLASTER_ResetDSP( void );
int BLASTER_GetDSPVersion( void );
void BLASTER_SpeakerOn( void );
void BLASTER_SpeakerOff( void );
void BLASTER_SetPlaybackRate( unsigned rate );
unsigned BLASTER_GetPlaybackRate( void );
int BLASTER_SetMixMode( int mode );
void BLASTER_StopPlayback( void );
int BLASTER_SetupDMABuffer( char *BufferPtr, int BufferSize, int mode );
int BLASTER_GetCurrentPos( void );
int BLASTER_DSP1xx_BeginPlayback( int length );
int BLASTER_DSP2xx_BeginPlayback( int length );
int BLASTER_DSP4xx_BeginPlayback( int length );
int BLASTER_BeginBufferedRecord( char *BufferStart, int BufferSize,
int NumDivisions, unsigned SampleRate, int MixMode,
void ( *CallBackFunc )( void ) );
int BLASTER_BeginBufferedPlayback( char *BufferStart,
int BufferSize, int NumDivisions, unsigned SampleRate,
int MixMode, void ( *CallBackFunc )( void ) );
void BLASTER_WriteMixer( int reg, int data );
int BLASTER_ReadMixer( int reg );
int BLASTER_GetVoiceVolume( void );
int BLASTER_SetVoiceVolume( int volume );
int BLASTER_GetMidiVolume( void );
int BLASTER_SetMidiVolume( int volume );
int BLASTER_CardHasMixer( void );
void BLASTER_SaveVoiceVolume( void );
void BLASTER_RestoreVoiceVolume( void );
void BLASTER_SaveMidiVolume( void );
void BLASTER_RestoreMidiVolume( void );
int BLASTER_GetEnv( BLASTER_CONFIG *Config );
int BLASTER_SetCardSettings( BLASTER_CONFIG Config );
int BLASTER_GetCardSettings( BLASTER_CONFIG *Config );
int BLASTER_GetCardInfo( int *MaxSampleBits, int *MaxChannels );
void BLASTER_SetCallBack( void ( *func )( void ) );
void BLASTER_SetupWaveBlaster( void );
void BLASTER_ShutdownWaveBlaster( void );
int BLASTER_Init( void );
void BLASTER_Shutdown( void );
void BLASTER_UnlockMemory( void );
int BLASTER_LockMemory( void );
#endif
|