sound patch from stephen anthony

git-svn-id: https://svn.eduke32.com/eduke32@585 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-12-12 23:07:52 +00:00
parent 31a901b7eb
commit 717d839815
20 changed files with 1975 additions and 1591 deletions

View file

@ -71,20 +71,14 @@ JMACTOBJ=$(OBJ)/util_lib.$o \
AUDIOLIB_FX_STUB=$(OBJ)/audiolib_fxstub.$o
AUDIOLIB_MUSIC_STUB=$(OBJ)/audiolib_musicstub.$o
AUDIOLIB_FX_SDL=$(OBJ)/mv_mix.$o \
$(OBJ)/mv_mix16.$o \
$(OBJ)/mvreverb.$o \
$(OBJ)/ll_man.$o \
AUDIOLIB_FX_SDL=$(OBJ)/ll_man.$o \
$(OBJ)/fx_man.$o \
$(OBJ)/dsl.$o \
$(OBJ)/pitch.$o \
$(OBJ)/multivoc.$o
AUDIOLIB_MUSIC_SDL=$(OBJ)/sdlmusic.$o
AUDIOLIB_FX=$(OBJ)/mv_mix.$o \
$(OBJ)/mv_mix16.$o \
$(OBJ)/mvreverb.$o \
$(OBJ)/pitch.$o \
AUDIOLIB_FX=$(OBJ)/pitch.$o \
$(OBJ)/multivoc.$o \
$(OBJ)/ll_man.$o \
$(OBJ)/fx_man.$o \
@ -93,6 +87,17 @@ AUDIOLIB_MUSIC=$(OBJ)/midi.$o \
$(OBJ)/mpu401.$o \
$(OBJ)/music.$o
ifeq (0,$(NOASM))
# Assembly sound mixing code
AUDIOLIB_FX_SDL += $(OBJ)/mv_mix.$o $(OBJ)/mv_mix16.$o $(OBJ)/mvreverb.$o
AUDIOLIB_FX += $(OBJ)/mv_mix.$o $(OBJ)/mv_mix16.$o $(OBJ)/mvreverb.$o
else
# C fallbacks for sound mixing code
AUDIOLIB_FX_SDL += $(OBJ)/mv_mix-c.$o $(OBJ)/mvreverb-c.$o
AUDIOLIB_FX += $(OBJ)/mv_mix-c.$o $(OBJ)/mvreverb-c.$o
endif
GAMEOBJS=$(OBJ)/game.$o \
$(OBJ)/actors.$o \
$(OBJ)/anim.$o \

View file

@ -54,6 +54,8 @@ $(OBJ)/audiolib_fx_fmod.$o: $(SRC)/jaudiolib/audiolib_fx_fmod.c $(SRC)/jaudiolib
$(OBJ)/mv_mix.$o: $(SRC)/jaudiolib/mv_mix.nasm
$(OBJ)/mv_mix16.$o: $(SRC)/jaudiolib/mv_mix16.nasm
$(OBJ)/mvreverb.$o: $(SRC)/jaudiolib/mvreverb.nasm
$(OBJ)/mv_mix-c.$o: $(SRC)/jaudiolib/mv_mix-c.c
$(OBJ)/mvreverb-c.$o: $(SRC)/jaudiolib/mvreverb-c.c
$(OBJ)/pitch.$o: $(SRC)/jaudiolib/pitch.c $(SRC)/jaudiolib/pitch.h
$(OBJ)/multivoc.$o: $(SRC)/jaudiolib/multivoc.c $(SRC)/jaudiolib/usrhooks.h $(SRC)/jaudiolib/linklist.h $(SRC)/jaudiolib/pitch.h $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/_multivc.h
$(OBJ)/fx_man.$o: $(SRC)/jaudiolib/fx_man.c $(SRC)/jaudiolib/multivoc.h $(SRC)/jaudiolib/ll_man.h $(SRC)/jaudiolib/fx_man.h

View file

@ -1,281 +1,281 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: _MIDI.H
author: James R. Dose
date: May 25, 1994
Private header for MIDI.C. Midi song file playback routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef ___MIDI_H
#define ___MIDI_H
#define RELATIVE_BEAT( measure, beat, tick ) \
( ( tick ) + ( ( beat ) << 9 ) + ( ( measure ) << 16 ) )
//Bobby Prince thinks this may be 100
//#define GENMIDI_DefaultVolume 100
#define GENMIDI_DefaultVolume 90
#define MAX_FORMAT 1
#define NUM_MIDI_CHANNELS 16
#define TIME_PRECISION 16
#define MIDI_HEADER_SIGNATURE 0x6468544d // "MThd"
#define MIDI_TRACK_SIGNATURE 0x6b72544d // "MTrk"
#define MIDI_VOLUME 7
#define MIDI_PAN 10
#define MIDI_DETUNE 94
#define MIDI_RHYTHM_CHANNEL 9
#define MIDI_RPN_MSB 100
#define MIDI_RPN_LSB 101
#define MIDI_DATAENTRY_MSB 6
#define MIDI_DATAENTRY_LSB 38
#define MIDI_PITCHBEND_MSB 0
#define MIDI_PITCHBEND_LSB 0
#define MIDI_RUNNING_STATUS 0x80
#define MIDI_NOTE_OFF 0x8
#define MIDI_NOTE_ON 0x9
#define MIDI_POLY_AFTER_TCH 0xA
#define MIDI_CONTROL_CHANGE 0xB
#define MIDI_PROGRAM_CHANGE 0xC
#define MIDI_AFTER_TOUCH 0xD
#define MIDI_PITCH_BEND 0xE
#define MIDI_SPECIAL 0xF
#define MIDI_SYSEX 0xF0
#define MIDI_SYSEX_CONTINUE 0xF7
#define MIDI_META_EVENT 0xFF
#define MIDI_END_OF_TRACK 0x2F
#define MIDI_TEMPO_CHANGE 0x51
#define MIDI_TIME_SIGNATURE 0x58
#define MIDI_RESET_ALL_CONTROLLERS 0x79
#define MIDI_ALL_NOTES_OFF 0x7b
#define MIDI_MONO_MODE_ON 0x7E
#define MIDI_SYSTEM_RESET 0xFF
#define GET_NEXT_EVENT( track, data ) \
( data ) = *( track )->pos; \
( track )->pos += 1
#define GET_MIDI_CHANNEL( event ) ( ( event ) & 0xf )
#define GET_MIDI_COMMAND( event ) ( ( event ) >> 4 )
#define EMIDI_INFINITE -1
#define EMIDI_END_LOOP_VALUE 127
#define EMIDI_ALL_CARDS 127
#define EMIDI_INCLUDE_TRACK 110
#define EMIDI_EXCLUDE_TRACK 111
#define EMIDI_PROGRAM_CHANGE 112
#define EMIDI_VOLUME_CHANGE 113
#define EMIDI_CONTEXT_START 114
#define EMIDI_CONTEXT_END 115
#define EMIDI_LOOP_START 116
#define EMIDI_LOOP_END 117
#define EMIDI_SONG_LOOP_START 118
#define EMIDI_SONG_LOOP_END 119
#define EMIDI_GeneralMIDI 0
#define EMIDI_AffectsCurrentCard( c, type ) \
( ( ( c ) == EMIDI_ALL_CARDS ) || ( ( c ) == ( type ) ) )
#define EMIDI_NUM_CONTEXTS 7
typedef struct
{
unsigned char *pos;
unsigned char *loopstart;
short loopcount;
short RunningStatus;
unsigned time;
int FPSecondsPerTick;
short tick;
short beat;
short measure;
short BeatsPerMeasure;
short TicksPerBeat;
short TimeBase;
int delay;
short active;
} songcontext;
typedef struct
{
unsigned char *start;
unsigned char *pos;
int delay;
short active;
short RunningStatus;
short currentcontext;
songcontext context[ EMIDI_NUM_CONTEXTS ];
char EMIDI_IncludeTrack;
char EMIDI_ProgramChange;
char EMIDI_VolumeChange;
} track;
static int _MIDI_ReadNumber( void *from, size_t size );
static int _MIDI_ReadDelta( track *ptr );
static void _MIDI_ResetTracks( void );
static void _MIDI_AdvanceTick( void );
static void _MIDI_MetaEvent( track *Track );
static void _MIDI_SysEx( track *Track );
static int _MIDI_InterpretControllerInfo( track *Track, int TimeSet,
int channel, int c1, int c2 );
static int _MIDI_SendControlChange( int channel, int c1, int c2 );
static void _MIDI_SetChannelVolume( int channel, int volume );
static void _MIDI_SendChannelVolumes( void );
static int _MIDI_ProcessNextTick( void );
static void _MIDI_InitEMIDI( void );
/*
if ( c1 == EMIDI_LOOP_START )
{
if ( c2 == 0 )
{
Track->context[ 0 ].loopcount = EMIDI_INFINITE;
}
else
{
Track->context[ 0 ].loopcount = c2;
}
Track->context[ 0 ].pos = Track->pos;
Track->context[ 0 ].loopstart = Track->pos;
Track->context[ 0 ].RunningStatus = Track->RunningStatus;
Track->context[ 0 ].time = _MIDI_Time;
Track->context[ 0 ].FPSecondsPerTick = _MIDI_FPSecondsPerTick;
Track->context[ 0 ].tick = _MIDI_Tick;
Track->context[ 0 ].beat = _MIDI_Beat;
Track->context[ 0 ].measure = _MIDI_Measure;
Track->context[ 0 ].BeatsPerMeasure = _MIDI_BeatsPerMeasure;
Track->context[ 0 ].TicksPerBeat = _MIDI_TicksPerBeat;
Track->context[ 0 ].TimeBase = _MIDI_TimeBase;
break;
}
if ( ( c1 == EMIDI_LOOP_END ) &&
( c2 == EMIDI_END_LOOP_VALUE ) )
{
if ( ( Track->context[ 0 ].loopstart != NULL ) &&
( Track->context[ 0 ].loopcount != 0 ) )
{
if ( Track->context[ 0 ].loopcount != EMIDI_INFINITE )
{
Track->context[ 0 ].loopcount--;
}
Track->pos = Track->context[ 0 ].loopstart;
Track->RunningStatus = Track->context[ 0 ].RunningStatus;
if ( !TimeSet )
{
_MIDI_Time = Track->context[ 0 ].time;
_MIDI_FPSecondsPerTick = Track->context[ 0 ].FPSecondsPerTick;
_MIDI_Tick = Track->context[ 0 ].tick;
_MIDI_Beat = Track->context[ 0 ].beat;
_MIDI_Measure = Track->context[ 0 ].measure;
_MIDI_BeatsPerMeasure = Track->context[ 0 ].BeatsPerMeasure;
_MIDI_TicksPerBeat = Track->context[ 0 ].TicksPerBeat;
_MIDI_TimeBase = Track->context[ 0 ].TimeBase;
TimeSet = TRUE;
}
}
break;
}
if ( c1 == MIDI_MONO_MODE_ON )
{
Track->pos++;
}
if ( ( c1 == MIDI_VOLUME ) && ( !Track->EMIDI_VolumeChange ) )
{
_MIDI_SetChannelVolume( channel, c2 );
break;
}
else if ( ( c1 == EMIDI_VOLUME_CHANGE ) &&
( Track->EMIDI_VolumeChange ) )
{
_MIDI_SetChannelVolume( channel, c2 );
break;
}
if ( ( c1 == EMIDI_PROGRAM_CHANGE ) &&
( Track->EMIDI_ProgramChange ) )
{
_MIDI_Funcs->ProgramChange( channel, MIDI_PatchMap[ c2 & 0x7f ] );
break;
}
if ( c1 == EMIDI_CONTEXT_START )
{
break;
}
if ( c1 == EMIDI_CONTEXT_END )
{
if ( ( Track->currentcontext != _MIDI_Context ) ||
( Track->context[ _MIDI_Context ].pos == NULL )
{
break;
}
Track->currentcontext = _MIDI_Context;
Track->context[ 0 ].loopstart = Track->context[ _MIDI_Context ].loopstart;
Track->context[ 0 ].loopcount = Track->context[ _MIDI_Context ].loopcount;
Track->pos = Track->context[ _MIDI_Context ].pos;
Track->RunningStatus = Track->context[ _MIDI_Context ].RunningStatus;
if ( TimeSet )
{
break;
}
_MIDI_Time = Track->context[ _MIDI_Context ].time;
_MIDI_FPSecondsPerTick = Track->context[ _MIDI_Context ].FPSecondsPerTick;
_MIDI_Tick = Track->context[ _MIDI_Context ].tick;
_MIDI_Beat = Track->context[ _MIDI_Context ].beat;
_MIDI_Measure = Track->context[ _MIDI_Context ].measure;
_MIDI_BeatsPerMeasure = Track->context[ _MIDI_Context ].BeatsPerMeasure;
_MIDI_TicksPerBeat = Track->context[ _MIDI_Context ].TicksPerBeat;
_MIDI_TimeBase = Track->context[ _MIDI_Context ].TimeBase;
TimeSet = TRUE;
break;
}
if ( _MIDI_Funcs->ControlChange )
{
_MIDI_Funcs->ControlChange( channel, c1, c2 );
}
*/
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: _MIDI.H
author: James R. Dose
date: May 25, 1994
Private header for MIDI.C. Midi song file playback routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef ___MIDI_H
#define ___MIDI_H
#define RELATIVE_BEAT( measure, beat, tick ) \
( ( tick ) + ( ( beat ) << 9 ) + ( ( measure ) << 16 ) )
//Bobby Prince thinks this may be 100
//#define GENMIDI_DefaultVolume 100
#define GENMIDI_DefaultVolume 90
#define MAX_FORMAT 1
#define NUM_MIDI_CHANNELS 16
#define TIME_PRECISION 16
#define MIDI_HEADER_SIGNATURE 0x6468544d // "MThd"
#define MIDI_TRACK_SIGNATURE 0x6b72544d // "MTrk"
#define MIDI_VOLUME 7
#define MIDI_PAN 10
#define MIDI_DETUNE 94
#define MIDI_RHYTHM_CHANNEL 9
#define MIDI_RPN_MSB 100
#define MIDI_RPN_LSB 101
#define MIDI_DATAENTRY_MSB 6
#define MIDI_DATAENTRY_LSB 38
#define MIDI_PITCHBEND_MSB 0
#define MIDI_PITCHBEND_LSB 0
#define MIDI_RUNNING_STATUS 0x80
#define MIDI_NOTE_OFF 0x8
#define MIDI_NOTE_ON 0x9
#define MIDI_POLY_AFTER_TCH 0xA
#define MIDI_CONTROL_CHANGE 0xB
#define MIDI_PROGRAM_CHANGE 0xC
#define MIDI_AFTER_TOUCH 0xD
#define MIDI_PITCH_BEND 0xE
#define MIDI_SPECIAL 0xF
#define MIDI_SYSEX 0xF0
#define MIDI_SYSEX_CONTINUE 0xF7
#define MIDI_META_EVENT 0xFF
#define MIDI_END_OF_TRACK 0x2F
#define MIDI_TEMPO_CHANGE 0x51
#define MIDI_TIME_SIGNATURE 0x58
#define MIDI_RESET_ALL_CONTROLLERS 0x79
#define MIDI_ALL_NOTES_OFF 0x7b
#define MIDI_MONO_MODE_ON 0x7E
#define MIDI_SYSTEM_RESET 0xFF
#define GET_NEXT_EVENT( track, data ) \
( data ) = *( track )->pos; \
( track )->pos += 1
#define GET_MIDI_CHANNEL( event ) ( ( event ) & 0xf )
#define GET_MIDI_COMMAND( event ) ( ( event ) >> 4 )
#define EMIDI_INFINITE -1
#define EMIDI_END_LOOP_VALUE 127
#define EMIDI_ALL_CARDS 127
#define EMIDI_INCLUDE_TRACK 110
#define EMIDI_EXCLUDE_TRACK 111
#define EMIDI_PROGRAM_CHANGE 112
#define EMIDI_VOLUME_CHANGE 113
#define EMIDI_CONTEXT_START 114
#define EMIDI_CONTEXT_END 115
#define EMIDI_LOOP_START 116
#define EMIDI_LOOP_END 117
#define EMIDI_SONG_LOOP_START 118
#define EMIDI_SONG_LOOP_END 119
#define EMIDI_GeneralMIDI 0
#define EMIDI_AffectsCurrentCard( c, type ) \
( ( ( c ) == EMIDI_ALL_CARDS ) || ( ( c ) == ( type ) ) )
#define EMIDI_NUM_CONTEXTS 7
typedef struct
{
unsigned char *pos;
unsigned char *loopstart;
short loopcount;
short RunningStatus;
unsigned time;
int FPSecondsPerTick;
short tick;
short beat;
short measure;
short BeatsPerMeasure;
short TicksPerBeat;
short TimeBase;
int delay;
short active;
} songcontext;
typedef struct
{
unsigned char *start;
unsigned char *pos;
int delay;
short active;
short RunningStatus;
short currentcontext;
songcontext context[ EMIDI_NUM_CONTEXTS ];
char EMIDI_IncludeTrack;
char EMIDI_ProgramChange;
char EMIDI_VolumeChange;
} track;
static int _MIDI_ReadNumber( void *from, size_t size );
static int _MIDI_ReadDelta( track *ptr );
static void _MIDI_ResetTracks( void );
static void _MIDI_AdvanceTick( void );
static void _MIDI_MetaEvent( track *Track );
static void _MIDI_SysEx( track *Track );
static int _MIDI_InterpretControllerInfo( track *Track, int TimeSet,
int channel, int c1, int c2 );
static int _MIDI_SendControlChange( int channel, int c1, int c2 );
static void _MIDI_SetChannelVolume( int channel, int volume );
static void _MIDI_SendChannelVolumes( void );
static int _MIDI_ProcessNextTick( void );
static void _MIDI_InitEMIDI( void );
/*
if ( c1 == EMIDI_LOOP_START )
{
if ( c2 == 0 )
{
Track->context[ 0 ].loopcount = EMIDI_INFINITE;
}
else
{
Track->context[ 0 ].loopcount = c2;
}
Track->context[ 0 ].pos = Track->pos;
Track->context[ 0 ].loopstart = Track->pos;
Track->context[ 0 ].RunningStatus = Track->RunningStatus;
Track->context[ 0 ].time = _MIDI_Time;
Track->context[ 0 ].FPSecondsPerTick = _MIDI_FPSecondsPerTick;
Track->context[ 0 ].tick = _MIDI_Tick;
Track->context[ 0 ].beat = _MIDI_Beat;
Track->context[ 0 ].measure = _MIDI_Measure;
Track->context[ 0 ].BeatsPerMeasure = _MIDI_BeatsPerMeasure;
Track->context[ 0 ].TicksPerBeat = _MIDI_TicksPerBeat;
Track->context[ 0 ].TimeBase = _MIDI_TimeBase;
break;
}
if ( ( c1 == EMIDI_LOOP_END ) &&
( c2 == EMIDI_END_LOOP_VALUE ) )
{
if ( ( Track->context[ 0 ].loopstart != NULL ) &&
( Track->context[ 0 ].loopcount != 0 ) )
{
if ( Track->context[ 0 ].loopcount != EMIDI_INFINITE )
{
Track->context[ 0 ].loopcount--;
}
Track->pos = Track->context[ 0 ].loopstart;
Track->RunningStatus = Track->context[ 0 ].RunningStatus;
if ( !TimeSet )
{
_MIDI_Time = Track->context[ 0 ].time;
_MIDI_FPSecondsPerTick = Track->context[ 0 ].FPSecondsPerTick;
_MIDI_Tick = Track->context[ 0 ].tick;
_MIDI_Beat = Track->context[ 0 ].beat;
_MIDI_Measure = Track->context[ 0 ].measure;
_MIDI_BeatsPerMeasure = Track->context[ 0 ].BeatsPerMeasure;
_MIDI_TicksPerBeat = Track->context[ 0 ].TicksPerBeat;
_MIDI_TimeBase = Track->context[ 0 ].TimeBase;
TimeSet = TRUE;
}
}
break;
}
if ( c1 == MIDI_MONO_MODE_ON )
{
Track->pos++;
}
if ( ( c1 == MIDI_VOLUME ) && ( !Track->EMIDI_VolumeChange ) )
{
_MIDI_SetChannelVolume( channel, c2 );
break;
}
else if ( ( c1 == EMIDI_VOLUME_CHANGE ) &&
( Track->EMIDI_VolumeChange ) )
{
_MIDI_SetChannelVolume( channel, c2 );
break;
}
if ( ( c1 == EMIDI_PROGRAM_CHANGE ) &&
( Track->EMIDI_ProgramChange ) )
{
_MIDI_Funcs->ProgramChange( channel, MIDI_PatchMap[ c2 & 0x7f ] );
break;
}
if ( c1 == EMIDI_CONTEXT_START )
{
break;
}
if ( c1 == EMIDI_CONTEXT_END )
{
if ( ( Track->currentcontext != _MIDI_Context ) ||
( Track->context[ _MIDI_Context ].pos == NULL )
{
break;
}
Track->currentcontext = _MIDI_Context;
Track->context[ 0 ].loopstart = Track->context[ _MIDI_Context ].loopstart;
Track->context[ 0 ].loopcount = Track->context[ _MIDI_Context ].loopcount;
Track->pos = Track->context[ _MIDI_Context ].pos;
Track->RunningStatus = Track->context[ _MIDI_Context ].RunningStatus;
if ( TimeSet )
{
break;
}
_MIDI_Time = Track->context[ _MIDI_Context ].time;
_MIDI_FPSecondsPerTick = Track->context[ _MIDI_Context ].FPSecondsPerTick;
_MIDI_Tick = Track->context[ _MIDI_Context ].tick;
_MIDI_Beat = Track->context[ _MIDI_Context ].beat;
_MIDI_Measure = Track->context[ _MIDI_Context ].measure;
_MIDI_BeatsPerMeasure = Track->context[ _MIDI_Context ].BeatsPerMeasure;
_MIDI_TicksPerBeat = Track->context[ _MIDI_Context ].TicksPerBeat;
_MIDI_TimeBase = Track->context[ _MIDI_Context ].TimeBase;
TimeSet = TRUE;
break;
}
if ( _MIDI_Funcs->ControlChange )
{
_MIDI_Funcs->ControlChange( channel, c1, c2 );
}
*/
#endif

View file

@ -1,317 +1,313 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
file: _MULTIVC.H
author: James R. Dose
date: December 20, 1993
Private header for MULTIVOC.C
(c) Copyright 1993 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef ___MULTIVC_H
#define ___MULTIVC_H
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#define VOC_8BIT 0x0
#define VOC_CT4_ADPCM 0x1
#define VOC_CT3_ADPCM 0x2
#define VOC_CT2_ADPCM 0x3
#define VOC_16BIT 0x4
#define VOC_ALAW 0x6
#define VOC_MULAW 0x7
#define VOC_CREATIVE_ADPCM 0x200
#define T_SIXTEENBIT_STEREO 0
#define T_8BITS 1
#define T_MONO 2
#define T_16BITSOURCE 4
#define T_LEFTQUIET 8
#define T_RIGHTQUIET 16
#define T_DEFAULT T_SIXTEENBIT_STEREO
#define MV_MaxPanPosition 31
#define MV_NumPanPositions ( MV_MaxPanPosition + 1 )
#define MV_MaxTotalVolume 255
//#define MV_MaxVolume 63
#define MV_NumVoices 8
#define MIX_VOLUME( volume ) \
( ( max( 0, min( ( volume ), 255 ) ) * ( MV_MaxVolume + 1 ) ) >> 8 )
// ( ( max( 0, min( ( volume ), 255 ) ) ) >> 2 )
//#define SILENCE_16BIT 0x80008000
#define SILENCE_16BIT 0
#define SILENCE_8BIT 0x80808080
//#define SILENCE_16BIT_PAS 0
#if defined(_WIN32)
#define MixBufferSize (MV_GetBufferSize(MV_RequestedMixRate))
#else
#define MixBufferSize 512
#endif
#define NumberOfBuffers 16
#define TotalBufferSize ( MixBufferSize * NumberOfBuffers )
#define PI 3.1415926536
typedef enum
{
Raw,
VOC,
DemandFeed,
WAV
} wavedata;
typedef enum
{
NoMoreData,
KeepPlaying
} playbackstatus;
typedef struct VoiceNode
{
struct VoiceNode *next;
struct VoiceNode *prev;
wavedata wavetype;
char bits;
playbackstatus ( *GetSound )( struct VoiceNode *voice );
void ( *mix )( unsigned int position, unsigned int rate,
char *start, unsigned int length );
char *NextBlock;
char *LoopStart;
char *LoopEnd;
unsigned LoopCount;
unsigned int LoopSize;
unsigned int BlockLength;
unsigned int PitchScale;
unsigned int FixedPointBufferSize;
char *sound;
unsigned int length;
unsigned int SamplingRate;
unsigned int RateScale;
unsigned int position;
int Playing;
int handle;
int priority;
void ( *DemandFeed )( char **ptr, unsigned int *length );
short *LeftVolume;
short *RightVolume;
unsigned int callbackval;
} VoiceNode;
typedef struct
{
VoiceNode *start;
VoiceNode *end;
} VList;
typedef struct
{
char left;
char right;
} Pan;
typedef signed short MONO16;
typedef signed char MONO8;
typedef struct
{
MONO16 left;
MONO16 right;
// unsigned short left;
// unsigned short right;
} STEREO16;
typedef struct
{
MONO16 left;
MONO16 right;
} SIGNEDSTEREO16;
typedef struct
{
// MONO8 left;
// MONO8 right;
char left;
char right;
} STEREO8;
typedef struct
{
char RIFF[ 4 ];
unsigned int file_size;
char WAVE[ 4 ];
char fmt[ 4 ];
unsigned int format_size;
} riff_header;
typedef struct
{
unsigned short wFormatTag;
unsigned short nChannels;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned short nBlockAlign;
unsigned short nBitsPerSample;
} format_header;
typedef struct
{
unsigned char DATA[ 4 ];
unsigned int size;
} data_header;
typedef MONO8 VOLUME8[ 256 ];
typedef MONO16 VOLUME16[ 256 ];
typedef char HARSH_CLIP_TABLE_8[ MV_NumVoices * 256 ];
static unsigned MV_GetBufferSize(unsigned);
static void MV_Mix( VoiceNode *voice, int buffer );
static void MV_PlayVoice( VoiceNode *voice );
static void MV_StopVoice( VoiceNode *voice );
static int MV_ServiceVoc( int );
static playbackstatus MV_GetNextVOCBlock( VoiceNode *voice );
static playbackstatus MV_GetNextDemandFeedBlock( VoiceNode *voice );
static playbackstatus MV_GetNextRawBlock( VoiceNode *voice );
static playbackstatus MV_GetNextWAVBlock( VoiceNode *voice );
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
file: _MULTIVC.H
author: James R. Dose
date: December 20, 1993
Private header for MULTIVOC.C
(c) Copyright 1993 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef ___MULTIVC_H
#define ___MULTIVC_H
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#define VOC_8BIT 0x0
#define VOC_CT4_ADPCM 0x1
#define VOC_CT3_ADPCM 0x2
#define VOC_CT2_ADPCM 0x3
#define VOC_16BIT 0x4
#define VOC_ALAW 0x6
#define VOC_MULAW 0x7
#define VOC_CREATIVE_ADPCM 0x200
#define T_SIXTEENBIT_STEREO 0
#define T_8BITS 1
#define T_MONO 2
#define T_16BITSOURCE 4
#define T_LEFTQUIET 8
#define T_RIGHTQUIET 16
#define T_DEFAULT T_SIXTEENBIT_STEREO
#define MV_MaxPanPosition 31
#define MV_NumPanPositions ( MV_MaxPanPosition + 1 )
#define MV_MaxTotalVolume 255
//#define MV_MaxVolume 63
#define MV_NumVoices 8
#define MIX_VOLUME( volume ) \
( ( max( 0, min( ( volume ), 255 ) ) * ( MV_MaxVolume + 1 ) ) >> 8 )
// ( ( max( 0, min( ( volume ), 255 ) ) ) >> 2 )
//#define SILENCE_16BIT 0x80008000
#define SILENCE_16BIT 0
#define SILENCE_8BIT 0x80808080
//#define SILENCE_16BIT_PAS 0
#if defined(_WIN32)
#define MixBufferSize (MV_GetBufferSize(MV_RequestedMixRate))
#else
#define MixBufferSize 512
#endif
#define NumberOfBuffers 16
#define TotalBufferSize ( MixBufferSize * NumberOfBuffers )
#define PI 3.1415926536
typedef enum
{
Raw,
VOC,
DemandFeed,
WAV
} wavedata;
typedef enum
{
NoMoreData,
KeepPlaying
} playbackstatus;
typedef struct VoiceNode
{
struct VoiceNode *next;
struct VoiceNode *prev;
wavedata wavetype;
char bits;
playbackstatus ( *GetSound )( struct VoiceNode *voice );
void ( *mix )( unsigned int position, unsigned int rate,
char *start, unsigned int length );
char *NextBlock;
char *LoopStart;
char *LoopEnd;
unsigned LoopCount;
unsigned int LoopSize;
unsigned int BlockLength;
unsigned int PitchScale;
unsigned int FixedPointBufferSize;
char *sound;
unsigned int length;
unsigned int SamplingRate;
unsigned int RateScale;
unsigned int position;
int Playing;
int handle;
int priority;
void ( *DemandFeed )( char **ptr, unsigned int *length );
short *LeftVolume;
short *RightVolume;
unsigned int callbackval;
} VoiceNode;
typedef struct
{
VoiceNode *start;
VoiceNode *end;
} VList;
typedef struct
{
char left;
char right;
} Pan;
typedef signed short MONO16;
typedef signed char MONO8;
typedef struct
{
MONO16 left;
MONO16 right;
// unsigned short left;
// unsigned short right;
} STEREO16;
typedef struct
{
MONO16 left;
MONO16 right;
} SIGNEDSTEREO16;
typedef struct
{
// MONO8 left;
// MONO8 right;
char left;
char right;
} STEREO8;
typedef struct
{
char RIFF[ 4 ];
unsigned int file_size;
char WAVE[ 4 ];
char fmt[ 4 ];
unsigned int format_size;
} riff_header;
typedef struct
{
unsigned short wFormatTag;
unsigned short nChannels;
unsigned int nSamplesPerSec;
unsigned int nAvgBytesPerSec;
unsigned short nBlockAlign;
unsigned short nBitsPerSample;
} format_header;
typedef struct
{
unsigned char DATA[ 4 ];
unsigned int size;
} data_header;
typedef MONO8 VOLUME8[ 256 ];
typedef MONO16 VOLUME16[ 256 ];
typedef char HARSH_CLIP_TABLE_8[ MV_NumVoices * 256 ];
static unsigned MV_GetBufferSize(unsigned);
static void MV_Mix( VoiceNode *voice, int buffer );
static void MV_PlayVoice( VoiceNode *voice );
static void MV_StopVoice( VoiceNode *voice );
static int MV_ServiceVoc( int );
static playbackstatus MV_GetNextVOCBlock( VoiceNode *voice );
static playbackstatus MV_GetNextDemandFeedBlock( VoiceNode *voice );
static playbackstatus MV_GetNextRawBlock( VoiceNode *voice );
static playbackstatus MV_GetNextWAVBlock( VoiceNode *voice );
// static void MV_ServiceRecord( void );
static VoiceNode *MV_GetVoice( int handle );
static VoiceNode *MV_AllocVoice( int priority );
static short *MV_GetVolumeTable( int vol );
static void MV_SetVoiceMixMode( VoiceNode *voice );
static void MV_SetVoicePitch( VoiceNode *voice, unsigned int rate, int pitchoffset );
static void MV_CalcVolume( int MaxLevel );
static void MV_CalcPanTable( void );
static void ClearBuffer_DW(void *ptr, int data, int length);
/*
#define ClearBuffer_DW( ptr, data, length ) \
({ void *__ptr=(ptr); unsigned __data=(data); int __length=(length); \
__asm__ __volatile__ ("rep; stosl" \
: "+c" (__length), "+D" (__ptr) : "a" (__data) : "memory", "cc"); \
0; })
*/
/*
#pragma aux ClearBuffer_DW = \
"cld", \
"push es", \
"push ds", \
"pop es", \
"rep stosd", \
"pop es", \
parm [ edi ] [ eax ] [ ecx ] modify exact [ ecx edi ];
*/
#if defined(__WATCOMC__)
#pragma aux MV_Mix8BitMono parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix8BitStereo parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitMono parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitStereo parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitMono16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix8BitMono16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix8BitStereo16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitStereo16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_16BitReverb parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#pragma aux MV_8BitReverb parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#pragma aux MV_16BitReverbFast parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#pragma aux MV_8BitReverbFast parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#define CDEC
#elif defined(_MSC_VER)
#define CDEC _cdecl
#elif defined(_WIN32)
// static void MV_ServiceRecord( void );
static VoiceNode *MV_GetVoice( int handle );
static VoiceNode *MV_AllocVoice( int priority );
static short *MV_GetVolumeTable( int vol );
static void MV_SetVoiceMixMode( VoiceNode *voice );
static void MV_SetVoicePitch( VoiceNode *voice, unsigned int rate, int pitchoffset );
static void MV_CalcVolume( int MaxLevel );
static void MV_CalcPanTable( void );
void ClearBuffer_DW(void *ptr, int data, int length)
{
int *pptr = ptr;
for (; length>0; length--) *(pptr++) = data;
}
/*
#define ClearBuffer_DW( ptr, data, length ) \
({ void *__ptr=(ptr); unsigned __data=(data); int __length=(length); \
__asm__ __volatile__ ("rep; stosl" \
: "+c" (__length), "+D" (__ptr) : "a" (__data) : "memory", "cc"); \
0; })
*/
/*
#pragma aux ClearBuffer_DW = \
"cld", \
"push es", \
"push ds", \
"pop es", \
"rep stosd", \
"pop es", \
parm [ edi ] [ eax ] [ ecx ] modify exact [ ecx edi ];
*/
#if defined(__WATCOMC__)
#pragma aux MV_Mix8BitMono parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix8BitStereo parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitMono parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitStereo parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitMono16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix8BitMono16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix8BitStereo16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_Mix16BitStereo16 parm [eax] [edx] [ebx] [ecx]
#pragma aux MV_16BitReverb parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#pragma aux MV_8BitReverb parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#pragma aux MV_16BitReverbFast parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#pragma aux MV_8BitReverbFast parm [eax] [edx] [ebx] [ecx] modify exact [eax ebx ecx edx esi edi]
#define CDEC
#elif defined(_MSC_VER)
#define CDEC _cdecl
#elif defined(_WIN32)
#define CDEC __cdecl
#else
#define CDEC
#endif
void CDEC MV_Mix8BitMono( unsigned int position, unsigned int rate,
char *start, unsigned int length );
void CDEC MV_Mix8BitStereo( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitMono( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitStereo( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitMono16( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix8BitMono16( unsigned int position, unsigned int rate,
char *start, unsigned int length );
void CDEC MV_Mix8BitStereo16( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitStereo16( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_16BitReverb( char *src, char *dest, VOLUME16 *volume, int count );
void CDEC MV_8BitReverb( signed char *src, signed char *dest, VOLUME16 *volume, int count );
void CDEC MV_16BitReverbFast( char *src, char *dest, int count, int shift );
void CDEC MV_8BitReverbFast( signed char *src, signed char *dest, int count, int shift );
#undef CDEC
#endif
#define CDEC
#endif
void CDEC MV_Mix8BitMono( unsigned int position, unsigned int rate,
char *start, unsigned int length );
void CDEC MV_Mix8BitStereo( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitMono( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitStereo( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitMono16( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix8BitMono16( unsigned int position, unsigned int rate,
char *start, unsigned int length );
void CDEC MV_Mix8BitStereo16( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_Mix16BitStereo16( unsigned int position,
unsigned int rate, char *start, unsigned int length );
void CDEC MV_16BitReverb( char *src, char *dest, VOLUME16 *volume, int count );
void CDEC MV_8BitReverb( signed char *src, signed char *dest, VOLUME16 *volume, int count );
void CDEC MV_16BitReverbFast( char *src, char *dest, int count, int shift );
void CDEC MV_8BitReverbFast( signed char *src, signed char *dest, int count, int shift );
#undef CDEC
#endif

View file

@ -37,11 +37,11 @@ enum DSL_ERRORS
DSL_MixerInitFailure
};
extern int DSL_ErrorCode;
extern int DSL_ErrorCode;
char *DSL_ErrorString( int ErrorNumber );
int DisableInterrupts(void); // simulated using critical sections
int RestoreInterrupts(int);
int DisableInterrupts(void); // simulated using critical sections
int RestoreInterrupts(int);
int DSL_Init( void );
void DSL_StopPlayback( void );

View file

@ -1,62 +1,62 @@
//-------------------------------------------------------------------------
/*
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D 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.
*/
//-------------------------------------------------------------------------
#ifndef __dsoundout_h__
#define __dsoundout_h__
enum DSOUND_ERRORS {
DSOUND_Warning = -2,
DSOUND_Error = -1,
DSOUND_Ok = 0,
DSOUND_NoDLL,
DSOUND_NoDirectSoundCreate,
DSOUND_FailedDSC,
DSOUND_FailedSetCoopLevel,
DSOUND_FailedCreatePrimary,
DSOUND_FailedSetFormat,
DSOUND_FailedCreateSecondary,
DSOUND_FailedCreateNotifyEvent,
DSOUND_FailedQueryNotify,
DSOUND_FailedSetNotify,
DSOUND_FailedCreateFinishEvent,
DSOUND_FailedCreateThread,
DSOUND_FailedPlaySecondary,
DSOUND_FailedGetExitCode
};
extern int DSOUND_ErrorCode;
char *DSOUND_ErrorString(int);
int DisableInterrupts(void); // simulated using critical sections
int RestoreInterrupts(int);
int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int buffersize);
int DSOUND_Shutdown(void);
int DSOUND_SetMixMode(int mode);
int DSOUND_BeginBufferedPlayback(char *BufferStart, int (*CallBackFunc)(int), int buffersize, int numdivisions);
int DSOUND_StopPlayback(void);
#endif // __dsoundout_h__
//-------------------------------------------------------------------------
/*
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D 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.
*/
//-------------------------------------------------------------------------
#ifndef __dsoundout_h__
#define __dsoundout_h__
enum DSOUND_ERRORS {
DSOUND_Warning = -2,
DSOUND_Error = -1,
DSOUND_Ok = 0,
DSOUND_NoDLL,
DSOUND_NoDirectSoundCreate,
DSOUND_FailedDSC,
DSOUND_FailedSetCoopLevel,
DSOUND_FailedCreatePrimary,
DSOUND_FailedSetFormat,
DSOUND_FailedCreateSecondary,
DSOUND_FailedCreateNotifyEvent,
DSOUND_FailedQueryNotify,
DSOUND_FailedSetNotify,
DSOUND_FailedCreateFinishEvent,
DSOUND_FailedCreateThread,
DSOUND_FailedPlaySecondary,
DSOUND_FailedGetExitCode
};
extern int DSOUND_ErrorCode;
char *DSOUND_ErrorString(int);
int DisableInterrupts(void); // simulated using critical sections
int RestoreInterrupts(int);
int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int buffersize);
int DSOUND_Shutdown(void);
int DSOUND_SetMixMode(int mode);
int DSOUND_BeginBufferedPlayback(char *BufferStart, int (*CallBackFunc)(int), int buffersize, int numdivisions);
int DSOUND_StopPlayback(void);
#endif // __dsoundout_h__

View file

@ -1,137 +1,137 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: FX_MAN.H
author: James R. Dose
date: March 17, 1994
Public header for FX_MAN.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __FX_MAN_H
#define __FX_MAN_H
typedef struct
{
int MaxVoices;
int MaxSampleBits;
int MaxChannels;
} fx_device;
#define MonoFx 1
#define StereoFx 2
typedef struct
{
unsigned int Address;
unsigned int Type;
unsigned int Interrupt;
unsigned int Dma8;
unsigned int Dma16;
unsigned int Midi;
unsigned int Emu;
} fx_blaster_config;
enum FX_ERRORS
{
FX_Warning = -2,
FX_Error = -1,
FX_Ok = 0,
FX_ASSVersion,
FX_BlasterError,
FX_SoundCardError,
FX_InvalidCard,
FX_MultiVocError,
FX_DPMI_Error
};
/*
enum fx_BLASTER_Types
{
fx_SB = 1,
fx_SBPro = 2,
fx_SB20 = 3,
fx_SBPro2 = 4,
fx_SB16 = 6
};
*/
char *FX_ErrorString( int ErrorNumber );
//int FX_SetupCard( int SoundCard, fx_device *device );
//int FX_GetBlasterSettings( fx_blaster_config *blaster );
//int FX_SetupSoundBlaster( fx_blaster_config blaster, int *MaxVoices, int *MaxSampleBits, int *MaxChannels );
int FX_Init( int SoundCard, int numvoices, int numchannels, int samplebits, unsigned mixrate );
int FX_Shutdown( void );
int FX_SetCallBack( void ( *function )( unsigned int ) );
void FX_SetVolume( int volume );
int FX_GetVolume( void );
void FX_SetReverseStereo( int setting );
int FX_GetReverseStereo( void );
void FX_SetReverb( int reverb );
void FX_SetFastReverb( int reverb );
int FX_GetMaxReverbDelay( void );
int FX_GetReverbDelay( void );
void FX_SetReverbDelay( int delay );
int FX_VoiceAvailable( int priority );
int FX_EndLooping( int handle );
int FX_SetPan( int handle, int vol, int left, int right );
int FX_SetPitch( int handle, int pitchoffset );
int FX_SetFrequency( int handle, int frequency );
int FX_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int FX_PlayLoopedVOC( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayWAV( char *ptr, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int FX_PlayLoopedWAV( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int FX_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int FX_PlayRaw( char *ptr, unsigned int length, unsigned rate,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayLoopedRaw( char *ptr, unsigned int length, char *loopstart,
char *loopend, unsigned rate, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int FX_Pan3D( int handle, int angle, int distance );
int FX_SoundActive( int handle );
int FX_SoundsPlaying( void );
int FX_StopSound( int handle );
int FX_StopAllSounds( void );
int FX_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned int *length ),
int rate, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int FX_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) );
void FX_StopRecord( void );
void FX_Update(void);
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: FX_MAN.H
author: James R. Dose
date: March 17, 1994
Public header for FX_MAN.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __FX_MAN_H
#define __FX_MAN_H
typedef struct
{
int MaxVoices;
int MaxSampleBits;
int MaxChannels;
} fx_device;
#define MonoFx 1
#define StereoFx 2
typedef struct
{
unsigned int Address;
unsigned int Type;
unsigned int Interrupt;
unsigned int Dma8;
unsigned int Dma16;
unsigned int Midi;
unsigned int Emu;
} fx_blaster_config;
enum FX_ERRORS
{
FX_Warning = -2,
FX_Error = -1,
FX_Ok = 0,
FX_ASSVersion,
FX_BlasterError,
FX_SoundCardError,
FX_InvalidCard,
FX_MultiVocError,
FX_DPMI_Error
};
/*
enum fx_BLASTER_Types
{
fx_SB = 1,
fx_SBPro = 2,
fx_SB20 = 3,
fx_SBPro2 = 4,
fx_SB16 = 6
};
*/
char *FX_ErrorString( int ErrorNumber );
//int FX_SetupCard( int SoundCard, fx_device *device );
//int FX_GetBlasterSettings( fx_blaster_config *blaster );
//int FX_SetupSoundBlaster( fx_blaster_config blaster, int *MaxVoices, int *MaxSampleBits, int *MaxChannels );
int FX_Init( int SoundCard, int numvoices, int numchannels, int samplebits, unsigned mixrate );
int FX_Shutdown( void );
int FX_SetCallBack( void ( *function )( unsigned int ) );
void FX_SetVolume( int volume );
int FX_GetVolume( void );
void FX_SetReverseStereo( int setting );
int FX_GetReverseStereo( void );
void FX_SetReverb( int reverb );
void FX_SetFastReverb( int reverb );
int FX_GetMaxReverbDelay( void );
int FX_GetReverbDelay( void );
void FX_SetReverbDelay( int delay );
int FX_VoiceAvailable( int priority );
int FX_EndLooping( int handle );
int FX_SetPan( int handle, int vol, int left, int right );
int FX_SetPitch( int handle, int pitchoffset );
int FX_SetFrequency( int handle, int frequency );
int FX_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int FX_PlayLoopedVOC( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayWAV( char *ptr, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int FX_PlayLoopedWAV( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int FX_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int FX_PlayRaw( char *ptr, unsigned int length, unsigned rate,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int FX_PlayLoopedRaw( char *ptr, unsigned int length, char *loopstart,
char *loopend, unsigned rate, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int FX_Pan3D( int handle, int angle, int distance );
int FX_SoundActive( int handle );
int FX_SoundsPlaying( void );
int FX_StopSound( int handle );
int FX_StopAllSounds( void );
int FX_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned int *length ),
int rate, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int FX_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) );
void FX_StopRecord( void );
void FX_Update(void);
#endif

View file

@ -1,119 +1,119 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
#ifndef __linklist_h
#define __linklist_h
#ifdef __cplusplus
extern "C" {
#endif
#define NewNode(type) ((type*)SafeMalloc(sizeof(type)))
#define LL_CreateNewLinkedList(rootnode,type,next,prev) \
{ \
(rootnode) = NewNode(type); \
(rootnode)->prev = (rootnode); \
(rootnode)->next = (rootnode); \
}
#define LL_AddNode(rootnode, newnode, next, prev) \
{ \
(newnode)->next = (rootnode); \
(newnode)->prev = (rootnode)->prev; \
(rootnode)->prev->next = (newnode); \
(rootnode)->prev = (newnode); \
}
#define LL_TransferList(oldroot,newroot,next,prev) \
{ \
if ((oldroot)->prev != (oldroot)) \
{ \
(oldroot)->prev->next = (newroot); \
(oldroot)->next->prev = (newroot)->prev; \
(newroot)->prev->next = (oldroot)->next; \
(newroot)->prev = (oldroot)->prev; \
(oldroot)->next = (oldroot); \
(oldroot)->prev = (oldroot); \
} \
}
#define LL_ReverseList(root,type,next,prev) \
{ \
type *newend,*trav,*tprev; \
\
newend = (root)->next; \
for(trav = (root)->prev; trav != newend; trav = tprev) \
{ \
tprev = trav->prev; \
LL_MoveNode(trav,newend,next,prev); \
} \
}
#define LL_RemoveNode(node,next,prev) \
{ \
(node)->prev->next = (node)->next; \
(node)->next->prev = (node)->prev; \
(node)->next = (node); \
(node)->prev = (node); \
}
#define LL_SortedInsertion(rootnode,insertnode,next,prev,type,sortparm) \
{ \
type *hoya; \
\
hoya = (rootnode)->next; \
while((hoya != (rootnode)) && ((insertnode)->sortparm > hoya->sortparm)) \
{ \
hoya = hoya->next; \
} \
LL_AddNode(hoya,(insertnode),next,prev); \
}
#define LL_MoveNode(node,newroot,next,prev) \
{ \
LL_RemoveNode((node),next,prev); \
LL_AddNode((newroot),(node),next,prev); \
}
#define LL_ListEmpty(list,next,prev) \
( \
((list)->next == (list)) && \
((list)->prev == (list)) \
)
#define LL_Free(list) SafeFree(list)
#define LL_Reset(list,next,prev) (list)->next = (list)->prev = (list)
#define LL_New LL_CreateNewLinkedList
#define LL_Remove LL_RemoveNode
#define LL_Add LL_AddNode
#define LL_Empty LL_ListEmpty
#define LL_Move LL_MoveNode
#ifdef __cplusplus
};
#endif
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
#ifndef __linklist_h
#define __linklist_h
#ifdef __cplusplus
extern "C" {
#endif
#define NewNode(type) ((type*)SafeMalloc(sizeof(type)))
#define LL_CreateNewLinkedList(rootnode,type,next,prev) \
{ \
(rootnode) = NewNode(type); \
(rootnode)->prev = (rootnode); \
(rootnode)->next = (rootnode); \
}
#define LL_AddNode(rootnode, newnode, next, prev) \
{ \
(newnode)->next = (rootnode); \
(newnode)->prev = (rootnode)->prev; \
(rootnode)->prev->next = (newnode); \
(rootnode)->prev = (newnode); \
}
#define LL_TransferList(oldroot,newroot,next,prev) \
{ \
if ((oldroot)->prev != (oldroot)) \
{ \
(oldroot)->prev->next = (newroot); \
(oldroot)->next->prev = (newroot)->prev; \
(newroot)->prev->next = (oldroot)->next; \
(newroot)->prev = (oldroot)->prev; \
(oldroot)->next = (oldroot); \
(oldroot)->prev = (oldroot); \
} \
}
#define LL_ReverseList(root,type,next,prev) \
{ \
type *newend,*trav,*tprev; \
\
newend = (root)->next; \
for(trav = (root)->prev; trav != newend; trav = tprev) \
{ \
tprev = trav->prev; \
LL_MoveNode(trav,newend,next,prev); \
} \
}
#define LL_RemoveNode(node,next,prev) \
{ \
(node)->prev->next = (node)->next; \
(node)->next->prev = (node)->prev; \
(node)->next = (node); \
(node)->prev = (node); \
}
#define LL_SortedInsertion(rootnode,insertnode,next,prev,type,sortparm) \
{ \
type *hoya; \
\
hoya = (rootnode)->next; \
while((hoya != (rootnode)) && ((insertnode)->sortparm > hoya->sortparm)) \
{ \
hoya = hoya->next; \
} \
LL_AddNode(hoya,(insertnode),next,prev); \
}
#define LL_MoveNode(node,newroot,next,prev) \
{ \
LL_RemoveNode((node),next,prev); \
LL_AddNode((newroot),(node),next,prev); \
}
#define LL_ListEmpty(list,next,prev) \
( \
((list)->next == (list)) && \
((list)->prev == (list)) \
)
#define LL_Free(list) SafeFree(list)
#define LL_Reset(list,next,prev) (list)->next = (list)->prev = (list)
#define LL_New LL_CreateNewLinkedList
#define LL_Remove LL_RemoveNode
#define LL_Add LL_AddNode
#define LL_Empty LL_ListEmpty
#define LL_Move LL_MoveNode
#ifdef __cplusplus
};
#endif
#endif

View file

@ -1,75 +1,75 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: LL_MAN.H
author: James R. Dose
date: February 4, 1994
Public header for LL_MAN.C. Linked list management routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __LL_MAN_H
#define __LL_MAN_H
enum LL_Errors
{
LL_Warning = -2,
LL_Error = -1,
LL_Ok = 0
};
typedef struct list
{
void *start;
void *end;
} list;
void LL_AddNode( char *node, char **head, char **tail, int next, int prev );
void LL_RemoveNode( char *node, char **head, char **tail, int next, int prev );
#define LL_AddToHead( type, listhead, node ) \
LL_AddNode( ( char * )( node ), \
( char ** )&( ( listhead )->start ), \
( char ** )&( ( listhead )->end ), \
( int )&( ( type * ) 0 )->next, \
( int )&( ( type * ) 0 )->prev )
#define LL_AddToTail( type, listhead, node ) \
LL_AddNode( ( char * )( node ), \
( char ** )&( ( listhead )->end ), \
( char ** )&( ( listhead )->start ), \
( int )&( ( type * ) 0 )->prev, \
( int )&( ( type * ) 0 )->next )
#define LL_Remove( type, listhead, node ) \
LL_RemoveNode( ( char * )( node ), \
( char ** )&( ( listhead )->start ), \
( char ** )&( ( listhead )->end ), \
( int )&( ( type * ) 0 )->next, \
( int )&( ( type * ) 0 )->prev )
#define LL_NextNode( node ) ( ( node )->next )
#define LL_PreviousNode( node ) ( ( node )->prev )
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: LL_MAN.H
author: James R. Dose
date: February 4, 1994
Public header for LL_MAN.C. Linked list management routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __LL_MAN_H
#define __LL_MAN_H
enum LL_Errors
{
LL_Warning = -2,
LL_Error = -1,
LL_Ok = 0
};
typedef struct list
{
void *start;
void *end;
} list;
void LL_AddNode( char *node, char **head, char **tail, int next, int prev );
void LL_RemoveNode( char *node, char **head, char **tail, int next, int prev );
#define LL_AddToHead( type, listhead, node ) \
LL_AddNode( ( char * )( node ), \
( char ** )&( ( listhead )->start ), \
( char ** )&( ( listhead )->end ), \
( int )&( ( type * ) 0 )->next, \
( int )&( ( type * ) 0 )->prev )
#define LL_AddToTail( type, listhead, node ) \
LL_AddNode( ( char * )( node ), \
( char ** )&( ( listhead )->end ), \
( char ** )&( ( listhead )->start ), \
( int )&( ( type * ) 0 )->prev, \
( int )&( ( type * ) 0 )->next )
#define LL_Remove( type, listhead, node ) \
LL_RemoveNode( ( char * )( node ), \
( char ** )&( ( listhead )->start ), \
( char ** )&( ( listhead )->end ), \
( int )&( ( type * ) 0 )->next, \
( int )&( ( type * ) 0 )->prev )
#define LL_NextNode( node ) ( ( node )->next )
#define LL_PreviousNode( node ) ( ( node )->prev )
#endif

View file

@ -1,100 +1,100 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: MIDI.H
author: James R. Dose
date: May 25, 1994
Public header for MIDI.C. Midi song file playback routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __MIDI_H
#define __MIDI_H
enum MIDI_Errors
{
MIDI_Warning = -2,
MIDI_Error = -1,
MIDI_Ok = 0,
MIDI_NullMidiModule,
MIDI_InvalidMidiFile,
MIDI_UnknownMidiFormat,
MIDI_NoTracks,
MIDI_InvalidTrack,
MIDI_NoMemory,
MIDI_DPMI_Error
};
#define MIDI_PASS_THROUGH 1
#define MIDI_DONT_PLAY 0
#define MIDI_MaxVolume 255
extern char MIDI_PatchMap[ 128 ];
typedef struct
{
void ( *NoteOff )( int channel, int key, int velocity );
void ( *NoteOn )( int channel, int key, int velocity );
void ( *PolyAftertouch )( int channel, int key, int pressure );
void ( *ControlChange )( int channel, int number, int value );
void ( *ProgramChange )( int channel, int program );
void ( *ChannelAftertouch )( int channel, int pressure );
void ( *PitchBend )( int channel, int lsb, int msb );
void ( *ReleasePatches )( void );
void ( *LoadPatch )( int number );
void ( *SetVolume )( int volume );
int ( *GetVolume )( void );
void ( *FinishBuffer )( void );
} midifuncs;
void MIDI_RerouteMidiChannel( int channel, int ( *function )( int event, int c1, int c2 ) );
int MIDI_AllNotesOff( void );
void MIDI_SetUserChannelVolume( int channel, int volume );
void MIDI_ResetUserChannelVolume( void );
int MIDI_Reset( void );
int MIDI_SetVolume( int volume );
int MIDI_GetVolume( void );
void MIDI_SetMidiFuncs( midifuncs *funcs );
void MIDI_SetContext( int context );
int MIDI_GetContext( void );
void MIDI_SetLoopFlag( int loopflag );
void MIDI_ContinueSong( void );
void MIDI_PauseSong( void );
int MIDI_SongPlaying( void );
void MIDI_StopSong( void );
int MIDI_PlaySong( unsigned char *song, int loopflag );
void MIDI_SetTempo( int tempo );
int MIDI_GetTempo( void );
void MIDI_SetSongTick( unsigned int PositionInTicks );
void MIDI_SetSongTime( unsigned int milliseconds );
void MIDI_SetSongPosition( int measure, int beat, int tick );
void MIDI_GetSongPosition( songposition *pos );
void MIDI_GetSongLength( songposition *pos );
void MIDI_LoadTimbres( void );
void MIDI_UpdateMusic(void);
void MIDI_SetDivision( int division );
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: MIDI.H
author: James R. Dose
date: May 25, 1994
Public header for MIDI.C. Midi song file playback routines.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __MIDI_H
#define __MIDI_H
enum MIDI_Errors
{
MIDI_Warning = -2,
MIDI_Error = -1,
MIDI_Ok = 0,
MIDI_NullMidiModule,
MIDI_InvalidMidiFile,
MIDI_UnknownMidiFormat,
MIDI_NoTracks,
MIDI_InvalidTrack,
MIDI_NoMemory,
MIDI_DPMI_Error
};
#define MIDI_PASS_THROUGH 1
#define MIDI_DONT_PLAY 0
#define MIDI_MaxVolume 255
extern char MIDI_PatchMap[ 128 ];
typedef struct
{
void ( *NoteOff )( int channel, int key, int velocity );
void ( *NoteOn )( int channel, int key, int velocity );
void ( *PolyAftertouch )( int channel, int key, int pressure );
void ( *ControlChange )( int channel, int number, int value );
void ( *ProgramChange )( int channel, int program );
void ( *ChannelAftertouch )( int channel, int pressure );
void ( *PitchBend )( int channel, int lsb, int msb );
void ( *ReleasePatches )( void );
void ( *LoadPatch )( int number );
void ( *SetVolume )( int volume );
int ( *GetVolume )( void );
void ( *FinishBuffer )( void );
} midifuncs;
void MIDI_RerouteMidiChannel( int channel, int ( *function )( int event, int c1, int c2 ) );
int MIDI_AllNotesOff( void );
void MIDI_SetUserChannelVolume( int channel, int volume );
void MIDI_ResetUserChannelVolume( void );
int MIDI_Reset( void );
int MIDI_SetVolume( int volume );
int MIDI_GetVolume( void );
void MIDI_SetMidiFuncs( midifuncs *funcs );
void MIDI_SetContext( int context );
int MIDI_GetContext( void );
void MIDI_SetLoopFlag( int loopflag );
void MIDI_ContinueSong( void );
void MIDI_PauseSong( void );
int MIDI_SongPlaying( void );
void MIDI_StopSong( void );
int MIDI_PlaySong( unsigned char *song, int loopflag );
void MIDI_SetTempo( int tempo );
int MIDI_GetTempo( void );
void MIDI_SetSongTick( unsigned int PositionInTicks );
void MIDI_SetSongTime( unsigned int milliseconds );
void MIDI_SetSongPosition( int measure, int beat, int tick );
void MIDI_GetSongPosition( songposition *pos );
void MIDI_GetSongLength( songposition *pos );
void MIDI_LoadTimbres( void );
void MIDI_UpdateMusic(void);
void MIDI_SetDivision( int division );
#endif

View file

@ -1,66 +1,66 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
#ifndef __MPU401_H
#define __MPU401_H
#define MPU_DefaultAddress 0x330
enum MPU_ERRORS
{
MPU_Warning = -2,
MPU_Error = -1,
MPU_Ok = 0
};
#define MPU_NotFound -1
#define MPU_UARTFailed -2
#define MPU_ReadyToWrite 0x40
#define MPU_ReadyToRead 0x80
#define MPU_CmdEnterUART 0x3f
#define MPU_CmdReset 0xff
#define MPU_CmdAcknowledge 0xfe
extern int _MPU_CurrentBuffer;
extern int _MPU_BuffersWaiting;
void MPU_SendMidi( char *data, int count );
void MPU_SendMidiImmediate( char *data, int count );
int MPU_Reset( void );
int MPU_Init( int addr );
void MPU_NoteOff( int channel, int key, int velocity );
void MPU_NoteOn( int channel, int key, int velocity );
void MPU_PolyAftertouch( int channel, int key, int pressure );
void MPU_ControlChange( int channel, int number, int value );
void MPU_ProgramChange( int channel, int program );
void MPU_ChannelAftertouch( int channel, int pressure );
void MPU_PitchBend( int channel, int lsb, int msb );
void MPU_SetTempo(int tempo);
void MPU_SetDivision(int division);
void MPU_SetVolume(int volume);
int MPU_GetVolume(void);
void MPU_BeginPlayback( void );
void MPU_Pause(void);
void MPU_Unpause(void);
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
#ifndef __MPU401_H
#define __MPU401_H
#define MPU_DefaultAddress 0x330
enum MPU_ERRORS
{
MPU_Warning = -2,
MPU_Error = -1,
MPU_Ok = 0
};
#define MPU_NotFound -1
#define MPU_UARTFailed -2
#define MPU_ReadyToWrite 0x40
#define MPU_ReadyToRead 0x80
#define MPU_CmdEnterUART 0x3f
#define MPU_CmdReset 0xff
#define MPU_CmdAcknowledge 0xfe
extern int _MPU_CurrentBuffer;
extern int _MPU_BuffersWaiting;
void MPU_SendMidi( char *data, int count );
void MPU_SendMidiImmediate( char *data, int count );
int MPU_Reset( void );
int MPU_Init( int addr );
void MPU_NoteOff( int channel, int key, int velocity );
void MPU_NoteOn( int channel, int key, int velocity );
void MPU_PolyAftertouch( int channel, int key, int pressure );
void MPU_ControlChange( int channel, int number, int value );
void MPU_ProgramChange( int channel, int program );
void MPU_ChannelAftertouch( int channel, int pressure );
void MPU_PitchBend( int channel, int lsb, int msb );
void MPU_SetTempo(int tempo);
void MPU_SetDivision(int division);
void MPU_SetVolume(int volume);
int MPU_GetVolume(void);
void MPU_BeginPlayback( void );
void MPU_Pause(void);
void MPU_Unpause(void);
#endif

View file

@ -126,6 +126,19 @@ int MV_ErrorCode = MV_Ok;
MV_ErrorCode = (status);
/*---------------------------------------------------------------------
Function: ClearBuffer_DW
Function code relocated from _multivc.h due to linking issues.
---------------------------------------------------------------------*/
void ClearBuffer_DW(void *ptr, int data, int length)
{
int *pptr = ptr;
for (; length>0; length--) *(pptr++) = data;
}
/*---------------------------------------------------------------------
Function: MV_ErrorString

View file

@ -1,117 +1,117 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
file: MULTIVOC.H
author: James R. Dose
date: December 20, 1993
Public header for MULTIVOC.C
(c) Copyright 1993 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __MULTIVOC_H
#define __MULTIVOC_H
#define MV_MinVoiceHandle 1
extern int MV_ErrorCode;
enum MV_Errors
{
MV_Warning = -2,
MV_Error = -1,
MV_Ok = 0,
MV_UnsupportedCard,
MV_NotInstalled,
MV_NoVoices,
MV_NoMem,
MV_VoiceNotFound,
MV_BlasterError,
MV_DPMI_Error,
MV_InvalidVOCFile,
MV_InvalidWAVFile,
MV_InvalidMixMode,
MV_IrqFailure,
MV_DMAFailure,
MV_DMA16Failure,
MV_NullRecordFunction
};
char *MV_ErrorString( int ErrorNumber );
int MV_VoicePlaying( int handle );
int MV_KillAllVoices( void );
int MV_Kill( int handle );
int MV_VoicesPlaying( void );
int MV_VoiceAvailable( int priority );
int MV_SetPitch( int handle, int pitchoffset );
int MV_SetFrequency( int handle, int frequency );
int MV_EndLooping( int handle );
int MV_SetPan( int handle, int vol, int left, int right );
int MV_Pan3D( int handle, int angle, int distance );
void MV_SetReverb( int reverb );
void MV_SetFastReverb( int reverb );
int MV_GetMaxReverbDelay( void );
int MV_GetReverbDelay( void );
void MV_SetReverbDelay( int delay );
int MV_SetMixMode( int numchannels, int samplebits );
int MV_StartPlayback( void );
void MV_StopPlayback( void );
int MV_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) );
void MV_StopRecord( void );
int MV_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned int *length ),
int rate, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int MV_PlayRaw( char *ptr, unsigned int length,
unsigned rate, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int MV_PlayLoopedRaw( char *ptr, int length,
char *loopstart, char *loopend, unsigned rate, int pitchoffset,
int vol, int left, int right, int priority,
unsigned int callbackval );
int MV_PlayWAV( char *ptr, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int MV_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int MV_PlayLoopedWAV( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int MV_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int MV_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int MV_PlayLoopedVOC( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
void MV_CreateVolumeTable( int index, int volume, int MaxVolume );
void MV_SetVolume( int volume );
int MV_GetVolume( void );
void MV_SetCallBack( void ( *function )( unsigned int ) );
void MV_SetReverseStereo( int setting );
int MV_GetReverseStereo( void );
int MV_Init( int soundcard, int MixRate, int Voices, int numchannels,
int samplebits );
int MV_Shutdown( void );
void MV_Update(void);
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
file: MULTIVOC.H
author: James R. Dose
date: December 20, 1993
Public header for MULTIVOC.C
(c) Copyright 1993 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __MULTIVOC_H
#define __MULTIVOC_H
#define MV_MinVoiceHandle 1
extern int MV_ErrorCode;
enum MV_Errors
{
MV_Warning = -2,
MV_Error = -1,
MV_Ok = 0,
MV_UnsupportedCard,
MV_NotInstalled,
MV_NoVoices,
MV_NoMem,
MV_VoiceNotFound,
MV_BlasterError,
MV_DPMI_Error,
MV_InvalidVOCFile,
MV_InvalidWAVFile,
MV_InvalidMixMode,
MV_IrqFailure,
MV_DMAFailure,
MV_DMA16Failure,
MV_NullRecordFunction
};
char *MV_ErrorString( int ErrorNumber );
int MV_VoicePlaying( int handle );
int MV_KillAllVoices( void );
int MV_Kill( int handle );
int MV_VoicesPlaying( void );
int MV_VoiceAvailable( int priority );
int MV_SetPitch( int handle, int pitchoffset );
int MV_SetFrequency( int handle, int frequency );
int MV_EndLooping( int handle );
int MV_SetPan( int handle, int vol, int left, int right );
int MV_Pan3D( int handle, int angle, int distance );
void MV_SetReverb( int reverb );
void MV_SetFastReverb( int reverb );
int MV_GetMaxReverbDelay( void );
int MV_GetReverbDelay( void );
void MV_SetReverbDelay( int delay );
int MV_SetMixMode( int numchannels, int samplebits );
int MV_StartPlayback( void );
void MV_StopPlayback( void );
int MV_StartRecording( int MixRate, void ( *function )( char *ptr, int length ) );
void MV_StopRecord( void );
int MV_StartDemandFeedPlayback( void ( *function )( char **ptr, unsigned int *length ),
int rate, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int MV_PlayRaw( char *ptr, unsigned int length,
unsigned rate, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int MV_PlayLoopedRaw( char *ptr, int length,
char *loopstart, char *loopend, unsigned rate, int pitchoffset,
int vol, int left, int right, int priority,
unsigned int callbackval );
int MV_PlayWAV( char *ptr, int pitchoffset, int vol, int left,
int right, int priority, unsigned int callbackval );
int MV_PlayWAV3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int MV_PlayLoopedWAV( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
int MV_PlayVOC3D( char *ptr, int pitchoffset, int angle, int distance,
int priority, unsigned int callbackval );
int MV_PlayVOC( char *ptr, int pitchoffset, int vol, int left, int right,
int priority, unsigned int callbackval );
int MV_PlayLoopedVOC( char *ptr, int loopstart, int loopend,
int pitchoffset, int vol, int left, int right, int priority,
unsigned int callbackval );
void MV_CreateVolumeTable( int index, int volume, int MaxVolume );
void MV_SetVolume( int volume );
int MV_GetVolume( void );
void MV_SetCallBack( void ( *function )( unsigned int ) );
void MV_SetReverseStereo( int setting );
int MV_GetReverseStereo( void );
int MV_Init( int soundcard, int MixRate, int Voices, int numchannels,
int samplebits );
int MV_Shutdown( void );
void MV_Update(void);
#endif

View file

@ -1,90 +1,90 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: MUSIC.H
author: James R. Dose
date: March 25, 1994
Public header for MUSIC.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __MUSIC_H
#define __MUSIC_H
extern int MUSIC_ErrorCode;
enum MUSIC_ERRORS
{
MUSIC_Warning = -2,
MUSIC_Error = -1,
MUSIC_Ok = 0,
MUSIC_ASSVersion,
MUSIC_SoundCardError,
MUSIC_MPU401Error,
MUSIC_InvalidCard,
MUSIC_MidiError,
MUSIC_TaskManError,
MUSIC_DPMI_Error
};
typedef struct
{
unsigned int tickposition;
unsigned int milliseconds;
unsigned int measure;
unsigned int beat;
unsigned int tick;
} songposition;
#define MUSIC_LoopSong ( 1 == 1 )
#define MUSIC_PlayOnce ( !MUSIC_LoopSong )
char *MUSIC_ErrorString( int ErrorNumber );
int MUSIC_Init( int SoundCard, int Address );
int MUSIC_Shutdown( void );
void MUSIC_SetVolume( int volume );
void MUSIC_SetMidiChannelVolume( int channel, int volume );
void MUSIC_ResetMidiChannelVolumes( void );
int MUSIC_GetVolume( void );
void MUSIC_SetLoopFlag( int loopflag );
int MUSIC_SongPlaying( void );
void MUSIC_Continue( void );
void MUSIC_Pause( void );
int MUSIC_StopSong( void );
int MUSIC_PlaySong( unsigned char *song, int loopflag );
void MUSIC_SetContext( int context );
int MUSIC_GetContext( void );
void MUSIC_SetSongTick( unsigned int PositionInTicks );
void MUSIC_SetSongTime( unsigned int milliseconds );
void MUSIC_SetSongPosition( int measure, int beat, int tick );
void MUSIC_GetSongPosition( songposition *pos );
void MUSIC_GetSongLength( songposition *pos );
int MUSIC_FadeVolume( int tovolume, int milliseconds );
int MUSIC_FadeActive( void );
void MUSIC_StopFade( void );
void MUSIC_RerouteMidiChannel( int channel, int ( *function )( int event, int c1, int c2 ) );
void MUSIC_RegisterTimbreBank( unsigned char *timbres );
void MUSIC_Update(void);
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: MUSIC.H
author: James R. Dose
date: March 25, 1994
Public header for MUSIC.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __MUSIC_H
#define __MUSIC_H
extern int MUSIC_ErrorCode;
enum MUSIC_ERRORS
{
MUSIC_Warning = -2,
MUSIC_Error = -1,
MUSIC_Ok = 0,
MUSIC_ASSVersion,
MUSIC_SoundCardError,
MUSIC_MPU401Error,
MUSIC_InvalidCard,
MUSIC_MidiError,
MUSIC_TaskManError,
MUSIC_DPMI_Error
};
typedef struct
{
unsigned int tickposition;
unsigned int milliseconds;
unsigned int measure;
unsigned int beat;
unsigned int tick;
} songposition;
#define MUSIC_LoopSong ( 1 == 1 )
#define MUSIC_PlayOnce ( !MUSIC_LoopSong )
char *MUSIC_ErrorString( int ErrorNumber );
int MUSIC_Init( int SoundCard, int Address );
int MUSIC_Shutdown( void );
void MUSIC_SetVolume( int volume );
void MUSIC_SetMidiChannelVolume( int channel, int volume );
void MUSIC_ResetMidiChannelVolumes( void );
int MUSIC_GetVolume( void );
void MUSIC_SetLoopFlag( int loopflag );
int MUSIC_SongPlaying( void );
void MUSIC_Continue( void );
void MUSIC_Pause( void );
int MUSIC_StopSong( void );
int MUSIC_PlaySong( unsigned char *song, int loopflag );
void MUSIC_SetContext( int context );
int MUSIC_GetContext( void );
void MUSIC_SetSongTick( unsigned int PositionInTicks );
void MUSIC_SetSongTime( unsigned int milliseconds );
void MUSIC_SetSongPosition( int measure, int beat, int tick );
void MUSIC_GetSongPosition( songposition *pos );
void MUSIC_GetSongLength( songposition *pos );
int MUSIC_FadeVolume( int tovolume, int milliseconds );
int MUSIC_FadeActive( void );
void MUSIC_StopFade( void );
void MUSIC_RerouteMidiChannel( int channel, int ( *function )( int event, int c1, int c2 ) );
void MUSIC_RegisterTimbreBank( unsigned char *timbres );
void MUSIC_Update(void);
#endif

View file

@ -0,0 +1,301 @@
#include "multivoc.h"
extern char *MV_MixDestination;
extern unsigned int MV_MixPosition;
extern char *MV_LeftVolume;
extern char *MV_RightVolume;
extern unsigned char *MV_HarshClipTable;
extern int MV_RightChannelOffset;
extern int MV_SampleSize;
void MV_Mix8BitMono(unsigned int position, unsigned int rate,
const char *start, unsigned int length)
{
const unsigned char *src;
unsigned char *dest;
unsigned int i;
src = (const unsigned char *)start;
dest = (unsigned char *)MV_MixDestination;
for (i = 0; i < length; i++)
{
int s = src[position >> 16];
int d = *dest;
s = MV_LeftVolume[s * 2];
s += d;
s = MV_HarshClipTable[s + 0x80];
*dest = (s & 0xff);
position += rate;
dest += MV_SampleSize;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix8BitStereo(unsigned int position,
unsigned int rate, const char *start, unsigned int length)
{
const unsigned char *src;
unsigned char *dest;
unsigned int i;
src = (const unsigned char *)start;
dest = (unsigned char *)MV_MixDestination;
for (i = 0; i < length; i++)
{
int s = src[(position >> 16)];
int dl = dest[0];
int dr = dest[MV_RightChannelOffset];
dl += MV_LeftVolume[s * 2];
dr += MV_RightVolume[s * 2];
dl = MV_HarshClipTable[dl + 0x80];
dr = MV_HarshClipTable[dr + 0x80];
dest[0] = (dl & 0xff);
dest[MV_RightChannelOffset] = (dr & 0xff);
position += rate;
dest += MV_SampleSize;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix16BitMono(unsigned int position,
unsigned int rate, const char *start, unsigned int length)
{
const short *MV_LeftVolumeS;
const unsigned char *src;
short *dest;
unsigned int i;
src = (const unsigned char *)start;
dest = (short *)MV_MixDestination;
MV_LeftVolumeS = (const short *)MV_LeftVolume;
for (i = 0; i < length; i++)
{
int s = src[position >> 16];
int d = dest[0];
s = MV_LeftVolumeS[s];
s += d;
if (s < -32768) s = -32768;
if (s > 32767) s = 32767;
*dest = (short) s;
position += rate;
dest += MV_SampleSize/2;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix16BitStereo(unsigned int position,
unsigned int rate, const char *start, unsigned int length)
{
const short *MV_LeftVolumeS;
const short *MV_RightVolumeS;
const unsigned char *src;
short *dest;
unsigned int i;
src = (unsigned char *)start;
dest = (short *)MV_MixDestination;
MV_LeftVolumeS = (const short *)MV_LeftVolume;
MV_RightVolumeS = (const short *)MV_RightVolume;
for (i = 0; i < length; i++)
{
int s = src[position >> 16];
int dl = dest[0];
int dr = dest[MV_RightChannelOffset/2];
dl += MV_LeftVolumeS[s];
dr += MV_RightVolumeS[s];
if (dl < -32768) dl = -32768;
if (dl > 32767) dl = 32767;
if (dr < -32768) dr = -32768;
if (dr > 32767) dr = 32767;
dest[0] = (short) dl;
dest[MV_RightChannelOffset/2] = (short) dr;
position += rate;
dest += MV_SampleSize/2;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix8BitMono16(unsigned int position, unsigned int rate,
const char *start, unsigned int length)
{
const char *src;
unsigned char *dest;
unsigned int i;
src = (const char *)start + 1;
dest = (unsigned char *)MV_MixDestination;
for (i = 0; i < length; i++)
{
int s = (int)src[(position >> 16) * 2] + 0x80;
int d = *dest;
s = MV_LeftVolume[s * 2];
s += d;
s = MV_HarshClipTable[s + 0x80];
*dest = (s & 0xff);
position += rate;
dest += MV_SampleSize;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix8BitStereo16(unsigned int position,
unsigned int rate, const char *start, unsigned int length)
{
const char *src;
unsigned char *dest;
unsigned int i;
src = (const char *)start + 1;
dest = (unsigned char *)MV_MixDestination;
for (i = 0; i < length; i++)
{
int s = src[(position >> 16) * 2] + 0x80;
int dl = dest[0];
int dr = dest[MV_RightChannelOffset];
dl += MV_LeftVolume[s * 2];
dr += MV_RightVolume[s * 2];
dl = MV_HarshClipTable[dl + 0x80];
dr = MV_HarshClipTable[dr + 0x80];
dest[0] = (dl & 0xff);
dest[MV_RightChannelOffset] = (dr & 0xff);
position += rate;
dest += MV_SampleSize;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix16BitMono16(unsigned int position,
unsigned int rate, const char *start, unsigned int length)
{
const short *MV_LeftVolumeS;
const unsigned char *src;
short *dest;
unsigned int i;
src = (const unsigned char *)start;
dest = (short *)MV_MixDestination;
MV_LeftVolumeS = (const short *)MV_LeftVolume;
for (i = 0; i < length; i++)
{
int sl = src[(position >> 16) * 2 + 0];
int sh = src[(position >> 16) * 2 + 1] ^ 0x80;
int d = *dest;
sl = MV_LeftVolume[sl * 2 + 1];
sh = MV_LeftVolumeS[sh];
d = sl + sh + 0x80 + d;
if (d < -32768) d = -32768;
if (d > 32767) d = 32767;
*dest = (short) d;
position += rate;
dest += MV_SampleSize/2;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}
void MV_Mix16BitStereo16(unsigned int position,
unsigned int rate, const char *start, unsigned int length)
{
const short *MV_LeftVolumeS;
const short *MV_RightVolumeS;
const unsigned char *src;
short *dest;
unsigned int i;
src = (const unsigned char *)start;
dest = (short *)MV_MixDestination;
MV_LeftVolumeS = (const short *)MV_LeftVolume;
MV_RightVolumeS = (const short *)MV_RightVolume;
for (i = 0; i < length; i++)
{
int sl = src[(position >> 16) * 2 + 0];
int sh = src[(position >> 16) * 2 + 1] ^ 0x80;
int dl = dest[0];
int dr = dest[MV_RightChannelOffset/2];
int sll = MV_LeftVolume[sl * 2 + 1];
int slh = MV_LeftVolumeS[sh];
int srl = MV_RightVolume[sl * 2 + 1];
int srh = MV_RightVolumeS[sh];
dl = sll + slh + 0x80 + dl;
dr = srl + srh + 0x80 + dr;
if (dl < -32768) dl = -32768;
if (dl > 32767) dl = 32767;
if (dr < -32768) dr = -32768;
if (dr > 32767) dr = 32767;
dest[0] = (short) dl;
dest[MV_RightChannelOffset/2] = (short) dr;
position += rate;
dest += MV_SampleSize/2;
}
MV_MixPosition = position;
MV_MixDestination = (char *)dest;
}

View file

@ -0,0 +1,67 @@
#include "multivoc.h"
#include "_multivc.h"
void MV_16BitReverb(char *src, char *dest, VOLUME16 *volume, int count)
{
int i;
short *pdest = (short *)dest;
for (i = 0; i < count; i++)
{
#if PLATFORM_BIGENDIAN
int sl = src[i*2+1];
int sh = src[i*2+0] ^ 0x80;
#else
int sl = src[i*2+0];
int sh = src[i*2+1] ^ 0x80;
#endif
sl = (*volume)[sl] >> 8;
sh = (*volume)[sh];
pdest[i] = (short)(sl + sh + 0x80);
}
}
void MV_8BitReverb(signed char *src, signed char *dest, VOLUME16 *volume, int count)
{
int i;
for (i = 0; i < count; i++)
{
unsigned char s = (unsigned char) src[i];
s = (*volume)[s] & 0xff;
dest[i] = (char)(s + 0x80);
}
}
void MV_16BitReverbFast(char *src, char *dest, int count, int shift)
{
int i;
short *pdest = (short *)dest;
const short *psrc = (const short *)src;
for (i = 0; i < count; i++)
{
pdest[i] = psrc[i] >> shift;
}
}
void MV_8BitReverbFast(signed char *src, signed char *dest, int count, int shift)
{
int i;
unsigned char sh = 0x80 - (0x80 >> shift);
for (i = 0; i < count; i++)
{
unsigned char a = ((unsigned char) src[i]) >> shift;
unsigned char c = (((unsigned char) src[i]) ^ 0x80) >> 7;
dest[i] = (signed char)(a + sh + c);
}
}

View file

@ -1,44 +1,44 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: PITCH.H
author: James R. Dose
date: June 14, 1994
Public header for PITCH.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __PITCH_H
#define __PITCH_H
enum PITCH_ERRORS
{
PITCH_Warning = -2,
PITCH_Error = -1,
PITCH_Ok = 0,
};
//void PITCH_Init( void );
unsigned int PITCH_GetScale( int pitchoffset );
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: PITCH.H
author: James R. Dose
date: June 14, 1994
Public header for PITCH.C
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __PITCH_H
#define __PITCH_H
enum PITCH_ERRORS
{
PITCH_Warning = -2,
PITCH_Error = -1,
PITCH_Ok = 0,
};
//void PITCH_Init( void );
unsigned int PITCH_GetScale( int pitchoffset );
#endif

View file

@ -1,48 +1,48 @@
//-------------------------------------------------------------------------
/*
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D 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.
*/
//-------------------------------------------------------------------------
#ifndef __sdlout_h__
#define __sdlout_h__
enum SDLSOUND_ERRORS {
SDLSOUND_Warning = -2,
SDLSOUND_Error = -1,
SDLSOUND_Ok = 0
};
extern int SDLSOUND_ErrorCode;
char *SDLSOUND_ErrorString(int);
int DisableInterrupts(void); // simulated using critical sections
int RestoreInterrupts(int);
int SDLSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int buffersize);
int SDLSOUND_Shutdown(void);
int SDLSOUND_SetMixMode(int mode);
int SDLSOUND_BeginBufferedPlayback(char *BufferStart, int (*CallBackFunc)(int), int buffersize, int numdivisions);
int SDLSOUND_StopPlayback(void);
#endif // __sdlout_h__
//-------------------------------------------------------------------------
/*
Duke Nukem Copyright (C) 1996, 2003 3D Realms Entertainment
This file is part of Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D 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.
*/
//-------------------------------------------------------------------------
#ifndef __sdlout_h__
#define __sdlout_h__
enum SDLSOUND_ERRORS {
SDLSOUND_Warning = -2,
SDLSOUND_Error = -1,
SDLSOUND_Ok = 0
};
extern int SDLSOUND_ErrorCode;
char *SDLSOUND_ErrorString(int);
int DisableInterrupts(void); // simulated using critical sections
int RestoreInterrupts(int);
int SDLSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int buffersize);
int SDLSOUND_Shutdown(void);
int SDLSOUND_SetMixMode(int mode);
int SDLSOUND_BeginBufferedPlayback(char *BufferStart, int (*CallBackFunc)(int), int buffersize, int numdivisions);
int SDLSOUND_StopPlayback(void);
#endif // __sdlout_h__

View file

@ -1,73 +1,73 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: STANDARD.H
author: James R. Dose
date: May 25, 1994
Header containing standard definitions.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __STANDARD_H
#define __STANDARD_H
typedef int boolean;
typedef int errorcode;
#ifndef TRUE
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#endif
enum STANDARD_ERRORS
{
Warning = -2,
FatalError = -1,
Success = 0
};
#define BITSET( data, bit ) \
( ( ( data ) & ( bit ) ) == ( bit ) )
#define ARRAY_LENGTH( array ) \
( sizeof( array ) / sizeof( ( array )[ 0 ] ) )
#define WITHIN_BOUNDS( array, index ) \
( ( 0 <= ( index ) ) && ( ( index ) < ARRAY_LENGTH( array ) ) )
#define FOREVER for( ; ; )
#ifdef NDEBUG
#define DEBUGGING 0
#else
#define DEBUGGING 1
#endif
#define DEBUG_CODE \
if ( DEBUGGING == 0 ) \
{ \
} \
else
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: STANDARD.H
author: James R. Dose
date: May 25, 1994
Header containing standard definitions.
(c) Copyright 1994 James R. Dose. All Rights Reserved.
**********************************************************************/
#ifndef __STANDARD_H
#define __STANDARD_H
typedef int boolean;
typedef int errorcode;
#ifndef TRUE
#define TRUE ( 1 == 1 )
#define FALSE ( !TRUE )
#endif
enum STANDARD_ERRORS
{
Warning = -2,
FatalError = -1,
Success = 0
};
#define BITSET( data, bit ) \
( ( ( data ) & ( bit ) ) == ( bit ) )
#define ARRAY_LENGTH( array ) \
( sizeof( array ) / sizeof( ( array )[ 0 ] ) )
#define WITHIN_BOUNDS( array, index ) \
( ( 0 <= ( index ) ) && ( ( index ) < ARRAY_LENGTH( array ) ) )
#define FOREVER for( ; ; )
#ifdef NDEBUG
#define DEBUGGING 0
#else
#define DEBUGGING 1
#endif
#define DEBUG_CODE \
if ( DEBUGGING == 0 ) \
{ \
} \
else
#endif

View file

@ -1,56 +1,56 @@
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: USRHOOKS.H
author: James R. Dose
date: July 26, 1994
Public header file for USRHOOKS.C.
This module contains cover functions for operations the library
needs that may be restricted by the calling program. The function
prototypes in this header should not be modified.
**********************************************************************/
#ifndef __USRHOOKS_H
#define __USRHOOKS_H
/*---------------------------------------------------------------------
Error definitions
---------------------------------------------------------------------*/
enum USRHOOKS_Errors
{
USRHOOKS_Warning = -2,
USRHOOKS_Error = -1,
USRHOOKS_Ok = 0
};
/*---------------------------------------------------------------------
Function Prototypes
---------------------------------------------------------------------*/
int USRHOOKS_GetMem( void **ptr, unsigned int size );
int USRHOOKS_FreeMem( void *ptr );
#endif
/*
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.
Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
*/
/**********************************************************************
module: USRHOOKS.H
author: James R. Dose
date: July 26, 1994
Public header file for USRHOOKS.C.
This module contains cover functions for operations the library
needs that may be restricted by the calling program. The function
prototypes in this header should not be modified.
**********************************************************************/
#ifndef __USRHOOKS_H
#define __USRHOOKS_H
/*---------------------------------------------------------------------
Error definitions
---------------------------------------------------------------------*/
enum USRHOOKS_Errors
{
USRHOOKS_Warning = -2,
USRHOOKS_Error = -1,
USRHOOKS_Ok = 0
};
/*---------------------------------------------------------------------
Function Prototypes
---------------------------------------------------------------------*/
int USRHOOKS_GetMem( void **ptr, unsigned int size );
int USRHOOKS_FreeMem( void *ptr );
#endif