12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337 |
- /*
- Copyright (C) 1994-1995 Apogee Software, Ltd.
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- See the GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
- /**********************************************************************
- module: FX_MAN.C
- author: James R. Dose
- date: March 17, 1994
- Device independant sound effect routines.
- (c) Copyright 1994 James R. Dose. All Rights Reserved.
- **********************************************************************/
- #include <stdio.h>
- #include <stdlib.h>
- #include "sndcards.h"
- #include "multivoc.h"
- #include "blaster.h"
- #include "pas16.h"
- #include "sndscape.h"
- #include "guswave.h"
- #include "sndsrc.h"
- #include "ll_man.h"
- #include "user.h"
- #include "fx_man.h"
- #define TRUE ( 1 == 1 )
- #define FALSE ( !TRUE )
- static unsigned FX_MixRate;
- int FX_SoundDevice = -1;
- int FX_ErrorCode = FX_Ok;
- int FX_Installed = FALSE;
- void TextMode( void );
- #pragma aux TextMode = \
- "mov ax, 0003h", \
- "int 10h" \
- modify [ ax ];
- #define FX_SetErrorCode( status ) \
- FX_ErrorCode = ( status );
- /*---------------------------------------------------------------------
- Function: FX_ErrorString
- Returns a pointer to the error message associated with an error
- number. A -1 returns a pointer the current error.
- ---------------------------------------------------------------------*/
- char *FX_ErrorString
- (
- int ErrorNumber
- )
- {
- char *ErrorString;
- switch( ErrorNumber )
- {
- case FX_Warning :
- case FX_Error :
- ErrorString = FX_ErrorString( FX_ErrorCode );
- break;
- case FX_Ok :
- ErrorString = "Fx ok.";
- break;
- case FX_ASSVersion :
- ErrorString = "Apogee Sound System Version " ASS_VERSION_STRING " "
- "Programmed by Jim Dose\n"
- "(c) Copyright 1995 James R. Dose. All Rights Reserved.\n";
- break;
- case FX_BlasterError :
- ErrorString = BLASTER_ErrorString( BLASTER_Error );
- break;
- case FX_SoundCardError :
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- ErrorString = BLASTER_ErrorString( BLASTER_Error );
- break;
- case ProAudioSpectrum :
- case SoundMan16 :
- ErrorString = PAS_ErrorString( PAS_Error );
- break;
- case SoundScape :
- ErrorString = SOUNDSCAPE_ErrorString( SOUNDSCAPE_Error );
- break;
- case UltraSound :
- ErrorString = GUSWAVE_ErrorString( GUSWAVE_Error );
- break;
- case SoundSource :
- case TandySoundSource :
- ErrorString = SS_ErrorString( SS_Error );
- break;
- }
- break;
- case FX_InvalidCard :
- ErrorString = "Invalid Sound Fx device.";
- break;
- case FX_MultiVocError :
- ErrorString = MV_ErrorString( MV_Error );
- break;
- case FX_DPMI_Error :
- ErrorString = "DPMI Error in FX_MAN.";
- break;
- default :
- ErrorString = "Unknown Fx error code.";
- break;
- }
- return( ErrorString );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetupCard
- Sets the configuration of a sound device.
- ---------------------------------------------------------------------*/
- int FX_SetupCard
- (
- int SoundCard,
- fx_device *device
- )
- {
- int status;
- int DeviceStatus;
- if ( USER_CheckParameter( "ASSVER" ) )
- {
- FX_SetErrorCode( FX_ASSVersion );
- return( FX_Error );
- }
- FX_SoundDevice = SoundCard;
- status = FX_Ok;
- FX_SetErrorCode( FX_Ok );
- switch( SoundCard )
- {
- case SoundBlaster :
- case Awe32 :
- DeviceStatus = BLASTER_Init();
- if ( DeviceStatus != BLASTER_Ok )
- {
- FX_SetErrorCode( FX_SoundCardError );
- status = FX_Error;
- break;
- }
- device->MaxVoices = 32;
- BLASTER_GetCardInfo( &device->MaxSampleBits, &device->MaxChannels );
- break;
- case ProAudioSpectrum :
- case SoundMan16 :
- DeviceStatus = PAS_Init();
- if ( DeviceStatus != PAS_Ok )
- {
- FX_SetErrorCode( FX_SoundCardError );
- status = FX_Error;
- break;
- }
- device->MaxVoices = 32;
- PAS_GetCardInfo( &device->MaxSampleBits, &device->MaxChannels );
- break;
- case GenMidi :
- case SoundCanvas :
- case WaveBlaster :
- device->MaxVoices = 0;
- device->MaxSampleBits = 0;
- device->MaxChannels = 0;
- break;
- case SoundScape :
- device->MaxVoices = 32;
- DeviceStatus = SOUNDSCAPE_GetCardInfo( &device->MaxSampleBits,
- &device->MaxChannels );
- if ( DeviceStatus != SOUNDSCAPE_Ok )
- {
- FX_SetErrorCode( FX_SoundCardError );
- status = FX_Error;
- }
- break;
- case UltraSound :
- if ( GUSWAVE_Init( 8 ) != GUSWAVE_Ok )
- {
- FX_SetErrorCode( FX_SoundCardError );
- status = FX_Error;
- break;
- }
- device->MaxVoices = 8;
- device->MaxSampleBits = 0;
- device->MaxChannels = 0;
- break;
- case SoundSource :
- case TandySoundSource :
- DeviceStatus = SS_Init( SoundCard );
- if ( DeviceStatus != SS_Ok )
- {
- FX_SetErrorCode( FX_SoundCardError );
- status = FX_Error;
- break;
- }
- SS_Shutdown();
- device->MaxVoices = 32;
- device->MaxSampleBits = 8;
- device->MaxChannels = 1;
- break;
- default :
- FX_SetErrorCode( FX_InvalidCard );
- status = FX_Error;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_GetBlasterSettings
- Returns the current BLASTER environment variable settings.
- ---------------------------------------------------------------------*/
- int FX_GetBlasterSettings
- (
- fx_blaster_config *blaster
- )
- {
- int status;
- BLASTER_CONFIG Blaster;
- FX_SetErrorCode( FX_Ok );
- status = BLASTER_GetEnv( &Blaster );
- if ( status != BLASTER_Ok )
- {
- FX_SetErrorCode( FX_BlasterError );
- return( FX_Error );
- }
- blaster->Type = Blaster.Type;
- blaster->Address = Blaster.Address;
- blaster->Interrupt = Blaster.Interrupt;
- blaster->Dma8 = Blaster.Dma8;
- blaster->Dma16 = Blaster.Dma16;
- blaster->Midi = Blaster.Midi;
- blaster->Emu = Blaster.Emu;
- return( FX_Ok );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetupSoundBlaster
- Handles manual setup of the Sound Blaster information.
- ---------------------------------------------------------------------*/
- int FX_SetupSoundBlaster
- (
- fx_blaster_config blaster,
- int *MaxVoices,
- int *MaxSampleBits,
- int *MaxChannels
- )
- {
- int DeviceStatus;
- BLASTER_CONFIG Blaster;
- FX_SetErrorCode( FX_Ok );
- FX_SoundDevice = SoundBlaster;
- Blaster.Type = blaster.Type;
- Blaster.Address = blaster.Address;
- Blaster.Interrupt = blaster.Interrupt;
- Blaster.Dma8 = blaster.Dma8;
- Blaster.Dma16 = blaster.Dma16;
- Blaster.Midi = blaster.Midi;
- Blaster.Emu = blaster.Emu;
- BLASTER_SetCardSettings( Blaster );
- DeviceStatus = BLASTER_Init();
- if ( DeviceStatus != BLASTER_Ok )
- {
- FX_SetErrorCode( FX_SoundCardError );
- return( FX_Error );
- }
- *MaxVoices = 8;
- BLASTER_GetCardInfo( MaxSampleBits, MaxChannels );
- return( FX_Ok );
- }
- /*---------------------------------------------------------------------
- Function: FX_Init
- Selects which sound device to use.
- ---------------------------------------------------------------------*/
- int FX_Init
- (
- int SoundCard,
- int numvoices,
- int numchannels,
- int samplebits,
- unsigned mixrate
- )
- {
- int status;
- int devicestatus;
- if ( FX_Installed )
- {
- FX_Shutdown();
- }
- if ( USER_CheckParameter( "ASSVER" ) )
- {
- FX_SetErrorCode( FX_ASSVersion );
- return( FX_Error );
- }
- status = LL_LockMemory();
- if ( status != LL_Ok )
- {
- FX_SetErrorCode( FX_DPMI_Error );
- return( FX_Error );
- }
- FX_MixRate = mixrate;
- status = FX_Ok;
- FX_SoundDevice = SoundCard;
- switch( SoundCard )
- {
- case SoundBlaster :
- case Awe32 :
- case ProAudioSpectrum :
- case SoundMan16 :
- case SoundScape :
- case SoundSource :
- case TandySoundSource :
- case UltraSound :
- devicestatus = MV_Init( SoundCard, FX_MixRate, numvoices,
- numchannels, samplebits );
- if ( devicestatus != MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Error;
- }
- break;
- default :
- FX_SetErrorCode( FX_InvalidCard );
- status = FX_Error;
- }
- if ( status != FX_Ok )
- {
- LL_UnlockMemory();
- }
- else
- {
- FX_Installed = TRUE;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_Shutdown
- Terminates use of sound device.
- ---------------------------------------------------------------------*/
- int FX_Shutdown
- (
- void
- )
- {
- int status;
- if ( !FX_Installed )
- {
- return( FX_Ok );
- }
- status = FX_Ok;
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- case ProAudioSpectrum :
- case SoundMan16 :
- case SoundScape :
- case SoundSource :
- case TandySoundSource :
- case UltraSound :
- status = MV_Shutdown();
- if ( status != MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Error;
- }
- break;
- default :
- FX_SetErrorCode( FX_InvalidCard );
- status = FX_Error;
- }
- FX_Installed = FALSE;
- LL_UnlockMemory();
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetCallback
- Sets the function to call when a voice is done.
- ---------------------------------------------------------------------*/
- int FX_SetCallBack
- (
- void ( *function )( unsigned long )
- )
- {
- int status;
- status = FX_Ok;
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- case ProAudioSpectrum :
- case SoundMan16 :
- case SoundScape :
- case SoundSource :
- case TandySoundSource :
- case UltraSound :
- MV_SetCallBack( function );
- break;
- default :
- FX_SetErrorCode( FX_InvalidCard );
- status = FX_Error;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetVolume
- Sets the volume of the current sound device.
- ---------------------------------------------------------------------*/
- void FX_SetVolume
- (
- int volume
- )
- {
- int status;
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- if ( BLASTER_CardHasMixer() )
- {
- BLASTER_SetVoiceVolume( volume );
- }
- else
- {
- MV_SetVolume( volume );
- }
- break;
- case ProAudioSpectrum :
- case SoundMan16 :
- status = PAS_SetPCMVolume( volume );
- if ( status != PAS_Ok )
- {
- MV_SetVolume( volume );
- }
- break;
- case GenMidi :
- case SoundCanvas :
- case WaveBlaster :
- break;
- case SoundScape :
- MV_SetVolume( volume );
- break;
- case UltraSound :
- GUSWAVE_SetVolume( volume );
- break;
- case SoundSource :
- case TandySoundSource :
- MV_SetVolume( volume );
- break;
- }
- }
- /*---------------------------------------------------------------------
- Function: FX_GetVolume
- Returns the volume of the current sound device.
- ---------------------------------------------------------------------*/
- int FX_GetVolume
- (
- void
- )
- {
- int volume;
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- if ( BLASTER_CardHasMixer() )
- {
- volume = BLASTER_GetVoiceVolume();
- }
- else
- {
- volume = MV_GetVolume();
- }
- break;
- case ProAudioSpectrum :
- case SoundMan16 :
- volume = PAS_GetPCMVolume();
- if ( volume == PAS_Error )
- {
- volume = MV_GetVolume();
- }
- break;
- case GenMidi :
- case SoundCanvas :
- case WaveBlaster :
- volume = 255;
- break;
- case SoundScape :
- volume = MV_GetVolume();
- break;
- case UltraSound :
- volume = GUSWAVE_GetVolume();
- break;
- case SoundSource :
- case TandySoundSource :
- volume = MV_GetVolume();
- break;
- default :
- volume = 0;
- }
- return( volume );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetReverseStereo
- Set the orientation of the left and right channels.
- ---------------------------------------------------------------------*/
- void FX_SetReverseStereo
- (
- int setting
- )
- {
- MV_SetReverseStereo( setting );
- }
- /*---------------------------------------------------------------------
- Function: FX_GetReverseStereo
- Returns the orientation of the left and right channels.
- ---------------------------------------------------------------------*/
- int FX_GetReverseStereo
- (
- void
- )
- {
- return MV_GetReverseStereo();
- }
- /*---------------------------------------------------------------------
- Function: FX_SetReverb
- Sets the reverb level.
- ---------------------------------------------------------------------*/
- void FX_SetReverb
- (
- int reverb
- )
- {
- MV_SetReverb( reverb );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetFastReverb
- Sets the reverb level.
- ---------------------------------------------------------------------*/
- void FX_SetFastReverb
- (
- int reverb
- )
- {
- MV_SetFastReverb( reverb );
- }
- /*---------------------------------------------------------------------
- Function: FX_GetMaxReverbDelay
- Returns the maximum delay time for reverb.
- ---------------------------------------------------------------------*/
- int FX_GetMaxReverbDelay
- (
- void
- )
- {
- return MV_GetMaxReverbDelay();
- }
- /*---------------------------------------------------------------------
- Function: FX_GetReverbDelay
- Returns the current delay time for reverb.
- ---------------------------------------------------------------------*/
- int FX_GetReverbDelay
- (
- void
- )
- {
- return MV_GetReverbDelay();
- }
- /*---------------------------------------------------------------------
- Function: FX_SetReverbDelay
- Sets the delay level of reverb to add to mix.
- ---------------------------------------------------------------------*/
- void FX_SetReverbDelay
- (
- int delay
- )
- {
- MV_SetReverbDelay( delay );
- }
- /*---------------------------------------------------------------------
- Function: FX_VoiceAvailable
- Checks if a voice can be play at the specified priority.
- ---------------------------------------------------------------------*/
- int FX_VoiceAvailable
- (
- int priority
- )
- {
- return MV_VoiceAvailable( priority );
- }
- /*---------------------------------------------------------------------
- Function: FX_EndLooping
- Stops the voice associated with the specified handle from looping
- without stoping the sound.
- ---------------------------------------------------------------------*/
- int FX_EndLooping
- (
- int handle
- )
- {
- int status;
- status = MV_EndLooping( handle );
- if ( status == MV_Error )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Warning;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetPan
- Sets the stereo and mono volume level of the voice associated
- with the specified handle.
- ---------------------------------------------------------------------*/
- int FX_SetPan
- (
- int handle,
- int vol,
- int left,
- int right
- )
- {
- int status;
- status = MV_SetPan( handle, vol, left, right );
- if ( status == MV_Error )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Warning;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetPitch
- Sets the pitch of the voice associated with the specified handle.
- ---------------------------------------------------------------------*/
- int FX_SetPitch
- (
- int handle,
- int pitchoffset
- )
- {
- int status;
- status = MV_SetPitch( handle, pitchoffset );
- if ( status == MV_Error )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Warning;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_SetFrequency
- Sets the frequency of the voice associated with the specified handle.
- ---------------------------------------------------------------------*/
- int FX_SetFrequency
- (
- int handle,
- int frequency
- )
- {
- int status;
- status = MV_SetFrequency( handle, frequency );
- if ( status == MV_Error )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Warning;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayVOC
- Begin playback of sound data with the given volume and priority.
- ---------------------------------------------------------------------*/
- int FX_PlayVOC
- (
- char *ptr,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayVOC( ptr, pitchoffset, vol, left, right,
- priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayLoopedVOC
- Begin playback of sound data with the given volume and priority.
- ---------------------------------------------------------------------*/
- int FX_PlayLoopedVOC
- (
- char *ptr,
- long loopstart,
- long loopend,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayLoopedVOC( ptr, loopstart, loopend, pitchoffset,
- vol, left, right, priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayWAV
- Begin playback of sound data with the given volume and priority.
- ---------------------------------------------------------------------*/
- int FX_PlayWAV
- (
- char *ptr,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayWAV( ptr, pitchoffset, vol, left, right,
- priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayWAV
- Begin playback of sound data with the given volume and priority.
- ---------------------------------------------------------------------*/
- int FX_PlayLoopedWAV
- (
- char *ptr,
- long loopstart,
- long loopend,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayLoopedWAV( ptr, loopstart, loopend,
- pitchoffset, vol, left, right, priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayVOC3D
- Begin playback of sound data at specified angle and distance
- from listener.
- ---------------------------------------------------------------------*/
- int FX_PlayVOC3D
- (
- char *ptr,
- int pitchoffset,
- int angle,
- int distance,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayVOC3D( ptr, pitchoffset, angle, distance,
- priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayWAV3D
- Begin playback of sound data at specified angle and distance
- from listener.
- ---------------------------------------------------------------------*/
- int FX_PlayWAV3D
- (
- char *ptr,
- int pitchoffset,
- int angle,
- int distance,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayWAV3D( ptr, pitchoffset, angle, distance,
- priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayRaw
- Begin playback of raw sound data with the given volume and priority.
- ---------------------------------------------------------------------*/
- int FX_PlayRaw
- (
- char *ptr,
- unsigned long length,
- unsigned rate,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayRaw( ptr, length, rate, pitchoffset,
- vol, left, right, priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_PlayLoopedRaw
- Begin playback of raw sound data with the given volume and priority.
- ---------------------------------------------------------------------*/
- int FX_PlayLoopedRaw
- (
- char *ptr,
- unsigned long length,
- char *loopstart,
- char *loopend,
- unsigned rate,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_PlayLoopedRaw( ptr, length, loopstart, loopend,
- rate, pitchoffset, vol, left, right, priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_Pan3D
- Set the angle and distance from the listener of the voice associated
- with the specified handle.
- ---------------------------------------------------------------------*/
- int FX_Pan3D
- (
- int handle,
- int angle,
- int distance
- )
- {
- int status;
- status = MV_Pan3D( handle, angle, distance );
- if ( status != MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Warning;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_SoundActive
- Tests if the specified sound is currently playing.
- ---------------------------------------------------------------------*/
- int FX_SoundActive
- (
- int handle
- )
- {
- return( MV_VoicePlaying( handle ) );
- }
- /*---------------------------------------------------------------------
- Function: FX_SoundsPlaying
- Reports the number of voices playing.
- ---------------------------------------------------------------------*/
- int FX_SoundsPlaying
- (
- void
- )
- {
- return( MV_VoicesPlaying() );
- }
- /*---------------------------------------------------------------------
- Function: FX_StopSound
- Halts playback of a specific voice
- ---------------------------------------------------------------------*/
- int FX_StopSound
- (
- int handle
- )
- {
- int status;
- status = MV_Kill( handle );
- if ( status != MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- return( FX_Warning );
- }
- return( FX_Ok );
- }
- /*---------------------------------------------------------------------
- Function: FX_StopAllSounds
- Halts playback of all sounds.
- ---------------------------------------------------------------------*/
- int FX_StopAllSounds
- (
- void
- )
- {
- int status;
- status = MV_KillAllVoices();
- if ( status != MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- return( FX_Warning );
- }
- return( FX_Ok );
- }
- /*---------------------------------------------------------------------
- Function: FX_StartDemandFeedPlayback
- Plays a digitized sound from a user controlled buffering system.
- ---------------------------------------------------------------------*/
- int FX_StartDemandFeedPlayback
- (
- void ( *function )( char **ptr, unsigned long *length ),
- int rate,
- int pitchoffset,
- int vol,
- int left,
- int right,
- int priority,
- unsigned long callbackval
- )
- {
- int handle;
- handle = MV_StartDemandFeedPlayback( function, rate,
- pitchoffset, vol, left, right, priority, callbackval );
- if ( handle < MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- handle = FX_Warning;
- }
- return( handle );
- }
- /*---------------------------------------------------------------------
- Function: FX_StartRecording
- Starts the sound recording engine.
- ---------------------------------------------------------------------*/
- int FX_StartRecording
- (
- int MixRate,
- void ( *function )( char *ptr, int length )
- )
- {
- int status;
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- case ProAudioSpectrum :
- case SoundMan16 :
- status = MV_StartRecording( MixRate, function );
- if ( status != MV_Ok )
- {
- FX_SetErrorCode( FX_MultiVocError );
- status = FX_Warning;
- }
- else
- {
- status = FX_Ok;
- }
- break;
- default :
- FX_SetErrorCode( FX_InvalidCard );
- status = FX_Warning;
- break;
- }
- return( status );
- }
- /*---------------------------------------------------------------------
- Function: FX_StopRecord
- Stops the sound record engine.
- ---------------------------------------------------------------------*/
- void FX_StopRecord
- (
- void
- )
- {
- // Stop sound playback
- switch( FX_SoundDevice )
- {
- case SoundBlaster :
- case Awe32 :
- case ProAudioSpectrum :
- case SoundMan16 :
- MV_StopRecord();
- break;
- }
- }
|