1196 lines
48 KiB
C++
1196 lines
48 KiB
C++
#include "SNDinc.h"
|
||
|
||
#include "sndres.h"
|
||
//#include "sndldscr.h"
|
||
#include "sndplay.h"
|
||
//#include "sndldbin.h" // included by snd.h
|
||
#include "sndevent.h"
|
||
#include "sndld_hy.h"
|
||
#include "snddbg.h"
|
||
|
||
#ifndef NO_ACP_SOUND
|
||
|
||
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
//* File: sndld_sh.cxx
|
||
//***************************************************************************
|
||
//* Project/Module: CPA project, SND module, Script / Hybrid version
|
||
//***************************************************************************
|
||
//* Description: Functions common to ths script an d the hybrid
|
||
//* version of the SND module.
|
||
//*
|
||
//***************************************************************************
|
||
//* Version 1.0
|
||
//* Creation date 09/08/96
|
||
//* Revision date
|
||
//*
|
||
//* (c) Ubi Sound Studio 1998
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
|
||
|
||
|
||
const tdstTypeSampleDisk c_stDefaultSample={FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,FALSE,0,0,44100,16,2,SAMPLE_PCM,""};
|
||
const tdstTypeMidiDisk c_stDefaultMidi={FALSE,TRUE,FALSE,0,0,0,""};
|
||
const tdstTypeCD c_stDefaultCd={1,TRUE,FALSE,0,0,0,0,0};
|
||
const tdstTypeSequenceDisk c_stDefaultSequence={FALSE,0,0,0,0};
|
||
const tdstTypeSwitchDisk c_stDefaultSwitch={0,0};
|
||
const tdstTypeSplitDisk c_stDefaultSplit={0,FALSE};
|
||
const tdstTypeThemeDisk c_stDefaultTheme={0,0};
|
||
const tdstTypeRandomDisk c_stDefaultRandom={0,0};
|
||
|
||
|
||
//---list of SectionName-IdEditor
|
||
typedef struct _tdstTypeElementEdSectionResource tdstTypeElementEdSectionResource;
|
||
typedef struct _tdstTypeListEdSectionResource tdstTypeListEdSectionResource;
|
||
|
||
struct _tdstTypeElementEdSectionResource {
|
||
unsigned long ulEdId;/*editor id for resource*/
|
||
char szSection[128];/*section name*/
|
||
SNDLST2_M_DynamicChildDeclaration(tdstTypeElementEdSectionResource*,tdstTypeListEdSectionResource*)
|
||
} ;
|
||
|
||
struct _tdstTypeListEdSectionResource
|
||
{
|
||
SNDLST2_M_DynamicParentDeclaration(tdstTypeElementEdSectionResource*)
|
||
};
|
||
|
||
tdstTypeListEdSectionResource SND_g_lListEdSectionResource;
|
||
|
||
//add e new couple editor-id/binray-id in list (if it's not yet in the list)
|
||
void fn_AddEdSectionResource(unsigned long EdId,char* section)
|
||
{
|
||
tdstTypeElementEdSectionResource* pElement;
|
||
int i;
|
||
|
||
//search element in the list
|
||
SNDLST2_M_DynamicForEachElementOf(&SND_g_lListEdSectionResource,pElement,i)
|
||
{
|
||
if ((pElement->ulEdId==EdId) && !strcmp(section,pElement->szSection))
|
||
//element is in the list
|
||
return;
|
||
}
|
||
|
||
//element is not in the list->add it
|
||
pElement=(tdstTypeElementEdSectionResource*)SND_fn_pvMallocSnd(sizeof(tdstTypeElementEdSectionResource));
|
||
SNDLST2_M_DynamicInitElement(pElement);
|
||
|
||
strncpy(pElement->szSection,section,sizeof(pElement->szSection)-1);
|
||
pElement->ulEdId=EdId;
|
||
|
||
SNDLST2_M_DynamicAddTail(&SND_g_lListEdSectionResource,pElement);
|
||
}
|
||
|
||
//get a resource's section name from its editor-id (using SND_g_lListEdSectionResource)
|
||
void fn_vGetSectionNameFromEdIdResource(unsigned long EdId,char* section,int size_section)
|
||
{
|
||
tdstTypeElementEdSectionResource* pElement;
|
||
int i;
|
||
|
||
//search element in the list
|
||
SNDLST2_M_DynamicForEachElementOf(&SND_g_lListEdSectionResource,pElement,i)
|
||
{
|
||
if (pElement->ulEdId==EdId)
|
||
{//found !!!
|
||
strncpy(section,pElement->szSection,size_section-1);
|
||
return;
|
||
}
|
||
}
|
||
|
||
section[0]=0;
|
||
}
|
||
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
//* *
|
||
//* *
|
||
//* MISCELLANEOUS FUNCTIONS *
|
||
//* *
|
||
//* *
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
|
||
|
||
unsigned char SND_gs_ucScriptMemLevel=0;
|
||
|
||
unsigned char SND_fn_uc_GetSoundScriptMemLevel(void)
|
||
{
|
||
return SND_gs_ucScriptMemLevel;
|
||
}
|
||
|
||
void SND_fn_v_SetSoundScriptMemLevel(unsigned char _ucLevel)
|
||
{
|
||
SND_gs_ucScriptMemLevel=_ucLevel;
|
||
}
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vConvertBRDiskToString
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Converts the binary representation of a BRDisk to a string
|
||
//-----------------------------------------------------------------------------
|
||
// Input : BRDisk *, String *
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------*/
|
||
|
||
|
||
void SND_fn_vConvertBRDiskToString(tdstBlockResourceDisk *_pDisk,char *_szString)
|
||
{
|
||
char *pIn;
|
||
int iTemp;
|
||
unsigned char *pOut,ucTemp;
|
||
pIn=(char *)_pDisk;
|
||
pOut=(unsigned char*)_szString;
|
||
for (iTemp=0;iTemp<sizeof(tdstBlockResourceDisk);iTemp++)
|
||
{
|
||
ucTemp=*pIn;
|
||
ucTemp&=0x0F;
|
||
ucTemp+=48;
|
||
*pOut++=ucTemp;
|
||
ucTemp=*pIn;
|
||
ucTemp&=0xF0;
|
||
ucTemp>>=4;
|
||
ucTemp+=48;
|
||
*pOut++=ucTemp;
|
||
// *pOut++=((*pIn)&(0x0F)) +20;
|
||
// *pOut++=((*pIn)&(0xF0))>>4 +20;
|
||
pIn++;
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vConvertBRDiskToString
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Creates a BRDisk from a string representing it
|
||
//-----------------------------------------------------------------------------
|
||
// Input : BRDisk *, String *
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------*/
|
||
|
||
|
||
void SND_fn_vConvertStringToBRDisk(char *_szString,tdstBlockResourceDisk *_pDisk)
|
||
{
|
||
char *pIn;
|
||
char *pOut;
|
||
char ucTemp;
|
||
int iTemp;
|
||
|
||
pIn=_szString;
|
||
pOut=(char *)_pDisk;
|
||
for (iTemp=0;iTemp<sizeof(tdstBlockResourceDisk);iTemp++)
|
||
{
|
||
ucTemp=(*pIn++);
|
||
ucTemp-=48;
|
||
*pOut=ucTemp;
|
||
ucTemp=(*pIn++);
|
||
ucTemp-=48;
|
||
ucTemp<<=4;
|
||
(*pOut)+=ucTemp;
|
||
// *pOut=((*pIn++))-20;
|
||
// *pOut+=(((*pIn++))-20)<<4;
|
||
pOut++;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
tdeTypeResource SND_fn_eGetResTypeFromString(char *czType)
|
||
{
|
||
if (strcmp(czType,"TYPE_SAMPLE")==0) return TYPE_SAMPLE;
|
||
if (strcmp(czType,"TYPE_MIDI")==0) return TYPE_MIDI;
|
||
if (strcmp(czType,"TYPE_CDAUDIO")==0) return TYPE_CDAUDIO;
|
||
if (strcmp(czType,"TYPE_SEQUENCE")==0) return TYPE_SEQUENCE;
|
||
if (strcmp(czType,"TYPE_SWITCH")==0) return TYPE_SWITCH;
|
||
if (strcmp(czType,"TYPE_SPLIT")==0) return TYPE_SPLIT;
|
||
if (strcmp(czType,"TYPE_THEME")==0) return TYPE_THEME;
|
||
if (strcmp(czType,"TYPE_RANDOM")==0) return TYPE_RANDOM;
|
||
|
||
SND_fn_vDisplayError(E_uwSndInvalidTypeOfResource,czType);
|
||
//return TYPE_SAMPLE;
|
||
return TYPE_INVALID;
|
||
}
|
||
|
||
tdeTypeEvent SND_fn_eGetEventTypeFromString(char *czType)
|
||
{
|
||
if (strcmp(czType,"EVT_SON_PLAY")==0) return EVT_SON_PLAY;
|
||
if (strcmp(czType,"EVT_SON_STOP")==0) return EVT_SON_STOP;
|
||
if (strcmp(czType,"EVT_SON_STOP_ALL")==0) return EVT_SON_STOP_ALL;
|
||
if (strcmp(czType,"EVT_SON_STOP_N_GO")==0) return EVT_SON_STOP_N_GO;
|
||
if (strcmp(czType,"EVT_SON_STOP_N_GO_CROSSFADE")==0) return EVT_SON_STOP_N_GO_CROSSFADE;
|
||
if (strcmp(czType,"EVT_SON_PITCH")==0) return EVT_SON_PITCH;
|
||
if (strcmp(czType,"EVT_SON_VOLUME")==0) return EVT_SON_VOLUME;
|
||
if (strcmp(czType,"EVT_SON_PAN")==0) return EVT_SON_PAN;
|
||
if (strcmp(czType,"EVT_SON_EFFET")==0) return EVT_SON_EFFET;
|
||
if (strcmp(czType,"EVT_SON_EXTRA")==0) return EVT_SON_EXTRA;
|
||
if (strcmp(czType,"EVT_SON_CHANGE_VOLUME")==0) return EVT_SON_CHANGE_VOLUME;
|
||
{
|
||
SND_fn_vDisplayError(E_uwSndScriptLoadError,"");
|
||
// return EVT_SON_STOP;
|
||
return EVT_INVALID;
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_bIsResLoaded
|
||
//-----------------------------------------------------------------------------
|
||
// Description : indicates if a resource is loaded in mem ( ready to be played)
|
||
//-----------------------------------------------------------------------------
|
||
// Input : BRMem *
|
||
// Output : SndBool
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------*/
|
||
|
||
SndBool SND_fn_bIsResLoaded(tdstBlockResourceMem* _pBRMem)
|
||
{
|
||
if (_pBRMem==NULL) return FALSE;
|
||
return (_pBRMem->eType!=TYPE_INVALID);
|
||
}
|
||
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_bIsEventLoaded
|
||
//-----------------------------------------------------------------------------
|
||
// Description : indicates if an event is loaded in mem:
|
||
// All the resources and events it references must be loaded
|
||
//-----------------------------------------------------------------------------
|
||
// Input : SND_tdstBlockEvent*
|
||
// Output : SndBool
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
|
||
SndBool SND_fn_bIsEventLoaded(SND_tdstBlockEvent* _pEvent)
|
||
{
|
||
switch (_pEvent->eType)
|
||
{
|
||
case EVT_SON_STOP_ALL:
|
||
case EVT_SON_EFFET: // no reference: always loaded..
|
||
case EVT_SON_CHANGE_VOLUME:
|
||
return TRUE;
|
||
case EVT_SON_STOP: // One event:
|
||
return(SND_fn_bIsEventLoaded(_pEvent->uParams.stStop.uEvt.pstPtr));
|
||
case EVT_SON_STOP_N_GO: // Two events:
|
||
if ((SND_fn_bIsEventLoaded(_pEvent->uParams.stStopNGo.uEvtStop.pstPtr))&&
|
||
(SND_fn_bIsEventLoaded(_pEvent->uParams.stStopNGo.uEvtGo.pstPtr)))
|
||
return TRUE;
|
||
else return FALSE;
|
||
case EVT_SON_STOP_N_GO_CROSSFADE: // Two events:
|
||
if ((SND_fn_bIsEventLoaded(_pEvent->uParams.stStopNGoFade.uEvtStop.pstPtr))&&
|
||
(SND_fn_bIsEventLoaded(_pEvent->uParams.stStopNGoFade.uEvtGo.pstPtr)))
|
||
return TRUE;
|
||
else return FALSE;
|
||
case EVT_SON_PLAY: // One resource
|
||
return(SND_fn_bIsResLoaded(_pEvent->uParams.stPlay.uResource.pstPtr));
|
||
case EVT_SON_PITCH:
|
||
case EVT_SON_VOLUME:
|
||
case EVT_SON_PAN: // One resource
|
||
return(SND_fn_bIsResLoaded(_pEvent->uParams.stExtraParam.uResource.pstPtr));
|
||
case EVT_SON_EXTRA:
|
||
return (SND_fn_bIsResLoaded(_pEvent->uParams.stExtraAll.uResource.pstPtr));
|
||
default:
|
||
SND_fn_vDisplayError(E_uwSndInvalidTypeOfEvent,"");
|
||
return FALSE;
|
||
}
|
||
}
|
||
|
||
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
//* *
|
||
//* *
|
||
//* SCRIPT CALLBACKS : RESOURCES *
|
||
//* *
|
||
//* *
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResGeneral
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries common to all types (volume,datasize,..).
|
||
// returns TRUE if the entry was found, FALSE if not.
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : BOOL
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
BOOL SND_fn_bAnalyseScriptEntryForResGeneral(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
char texte[256];
|
||
|
||
if (strcmp(szAction,"SetVolume")==0)
|
||
{
|
||
pResDisk->ucVolume=(unsigned char)atoi(szParams[0]);
|
||
if (pResDisk->ucVolume>127)
|
||
{
|
||
sprintf(texte
|
||
,"Volume for resource %d of Group %d is higher than 127. It now set to 127"
|
||
,(pResDisk->Id) & 0xFFFF
|
||
,pResDisk->Id>>16);
|
||
SND_fn_vDisplayError(E_uwSndScriptLoadError,texte);
|
||
pResDisk->ucVolume=127;
|
||
}
|
||
}
|
||
else if (strcmp(szAction,"SetStorage")==0)
|
||
{
|
||
if (strcmp(szParams[0],"TYPE_EXTERNAL")==0) pResDisk->eStorage=TYPE_EXTERNAL;
|
||
if (strcmp(szParams[0],"TYPE_MEGAFILE")==0) pResDisk->eStorage=TYPE_MEGAFILE;
|
||
if (strcmp(szParams[0],"TYPE_BIGFILE")==0) pResDisk->eStorage=TYPE_BIGFILE;
|
||
}
|
||
else if (strcmp(szAction,"SetDataOffset")==0)
|
||
pResDisk->ulDataOffset=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetDataSize")==0)
|
||
pResDisk->ulDataSize=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetFileName")==0)
|
||
{
|
||
if (strlen(szParams[0])>12)
|
||
SND_fn_vDisplayError(E_uwSndScriptLoadError,"Filename is too long(>12 chars)");
|
||
switch (pResDisk->eType)
|
||
{
|
||
case TYPE_SAMPLE:
|
||
strcpy(pResDisk->uRes.stSample.czFileName,szParams[0]);
|
||
break;
|
||
case TYPE_MIDI:
|
||
strcpy(pResDisk->uRes.stMidi.czFileName,szParams[0]);
|
||
break;
|
||
}
|
||
|
||
}
|
||
else return FALSE;
|
||
|
||
return TRUE;
|
||
}
|
||
|
||
|
||
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResSample(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
char *p_cFlags;
|
||
tdstTypeSampleDisk *pSampleData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pSampleData=&pResDisk->uRes.stSample;
|
||
|
||
if (strcmp(szAction,"SetLoop")==0)
|
||
pSampleData->bLoop=(SndBool)(*szParams[1]);
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetLoopData")==0)
|
||
{
|
||
pSampleData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
pSampleData->ulLoopLength=(unsigned long)atoi(szParams[1]);
|
||
}
|
||
else if (strcmp(szAction,"SetStartLoop")==0)
|
||
pSampleData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetLoopLength")==0)
|
||
pSampleData->ulLoopLength=(unsigned long)atoi(szParams[1]);
|
||
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetFlags")==0)
|
||
{
|
||
p_cFlags=szParams[1]; // Points to the array of booleans coded as chars:
|
||
pSampleData->bPitchable=(SndBool)p_cFlags[0];
|
||
pSampleData->bVolable=(SndBool)p_cFlags[1];
|
||
pSampleData->bPanable=(SndBool)p_cFlags[2];
|
||
pSampleData->bSpacable=(SndBool)p_cFlags[3];
|
||
pSampleData->bReverbable=(SndBool)p_cFlags[4];
|
||
pSampleData->bStream=(SndBool)p_cFlags[5];
|
||
}
|
||
|
||
else if (strcmp(szAction,"SetPitchable")==0)
|
||
pSampleData->bPitchable=(SndBool)(*szParams[1]);
|
||
else if (strcmp(szAction,"SetVolable")==0)
|
||
pSampleData->bVolable=(SndBool)(*szParams[1]);
|
||
|
||
else if (strcmp(szAction,"SetPanable")==0)
|
||
pSampleData->bPanable=(SndBool)(*szParams[1]);
|
||
else if (strcmp(szAction,"SetSpacable")==0)
|
||
pSampleData->bSpacable=(SndBool)(*szParams[1]);
|
||
else if (strcmp(szAction,"SetReverbable")==0)
|
||
pSampleData->bReverbable=(SndBool)(*szParams[1]);
|
||
|
||
else if (strcmp(szAction,"SetStreaming")==0)
|
||
pSampleData->bStream=(SndBool)(*szParams[1]);
|
||
|
||
// A VIRER DES QUE TOUS LES SCRIPTS AURONT CHANGE DE FORMAT:
|
||
else if (strcmp(szAction,"SetParameters")==0)
|
||
{
|
||
pSampleData->ulFreq=(unsigned long)atoi(szParams[0]);
|
||
pSampleData->uwNbChannels=(unsigned short)atoi(szParams[1]);
|
||
pSampleData->uwResolution=(unsigned short)atoi(szParams[2]);
|
||
}
|
||
else if (strcmp(szAction,"SetSampleFrequency")==0)
|
||
pSampleData->ulFreq=(unsigned long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetSampleChannelNumber")==0)
|
||
pSampleData->uwNbChannels=(unsigned short)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetSampleResolution")==0)
|
||
pSampleData->uwResolution=(unsigned short)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetZipFormat")==0)
|
||
{
|
||
if (strcmp(szParams[0],"SAMPLE_PCM")==0) pSampleData->eZip=SAMPLE_PCM;
|
||
else if (strcmp(szParams[0],"SAMPLE_MPEG")==0) pSampleData->eZip=SAMPLE_MPEG;
|
||
else if (strcmp(szParams[0],"SAMPLE_AIFF")==0) pSampleData->eZip=SAMPLE_AIFF;
|
||
else if (strcmp(szParams[0],"SAMPLE_ADPCM")==0) pSampleData->eZip=SAMPLE_ADPCM;
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResMidi
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to midi type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResMidi(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
char *p_cFlags;
|
||
tdstTypeMidiDisk *pMidiData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
pMidiData=&pResDisk->uRes.stMidi;
|
||
|
||
if (strcmp(szAction,"SetLoop")==0)
|
||
pMidiData->bLoop=(SndBool)(*szParams[1]);
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetLoopData")==0)
|
||
{
|
||
pMidiData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
pMidiData->ulEndLoop=(unsigned long)atoi(szParams[1]);
|
||
pMidiData->ulNbLoops=(unsigned long)atoi(szParams[2]);
|
||
}
|
||
else if (strcmp(szAction,"SetStartLoop")==0)
|
||
pMidiData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetEndLoop")==0)
|
||
pMidiData->ulEndLoop=(unsigned long)atoi(szParams[1]);
|
||
else if (strcmp(szAction,"SetNumberOfLoop")==0)
|
||
pMidiData->ulNbLoops=(unsigned long)atoi(szParams[2]);
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetFlags")==0)
|
||
{
|
||
p_cFlags=szParams[1]; // Points to the array of booleans coded as chars:
|
||
pMidiData->bVolable=(SndBool)p_cFlags[0];
|
||
pMidiData->bStream=(SndBool)p_cFlags[1];
|
||
}
|
||
|
||
else if (strcmp(szAction,"SetVolable")==0)
|
||
pMidiData->bVolable=(SndBool)(*szParams[1]);
|
||
else if (strcmp(szAction,"SetStreaming")==0)
|
||
pMidiData->bStream=(SndBool)(*szParams[1]);
|
||
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResCd
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to cd type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResCd(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
char *p_cFlags;
|
||
tdstTypeCD *pCdData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pCdData=&pResDisk->uRes.stCD;
|
||
|
||
if (strcmp(szAction,"SetLoop")==0)
|
||
pCdData->bLoop=(SndBool)(*szParams[1]);
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetLoopData")==0)
|
||
{
|
||
pCdData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
pCdData->ulEndLoop=(unsigned long)atoi(szParams[1]);
|
||
pCdData->iNbLoops=(unsigned long)atoi(szParams[2]);
|
||
}
|
||
else if (strcmp(szAction,"SetStartLoop")==0)
|
||
pCdData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetEndLoop")==0)
|
||
pCdData->ulEndLoop=(unsigned long)atoi(szParams[1]);
|
||
else if (strcmp(szAction,"SetNumberOfLoop")==0)
|
||
pCdData->iNbLoops=(unsigned long)atoi(szParams[2]);
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetFlags")==0)
|
||
{
|
||
p_cFlags=szParams[1]; // Points to the array of booleans coded as chars:
|
||
pCdData->bVolable=(SndBool)p_cFlags[0];
|
||
}
|
||
else if (strcmp(szAction,"SetVolable")==0)
|
||
pCdData->bVolable=(SndBool)(SndBool)(*szParams[1]);
|
||
|
||
// A VIRER DES QUE TOUS LES SCRIPTS AURONT CHANGE DE FORMAT:
|
||
else if (strcmp(szAction,"SetParameters")==0)
|
||
{
|
||
pCdData->ulStartingFrame=(unsigned long)atoi(szParams[0]);
|
||
pCdData->ulEndingFrame=(unsigned long)atoi(szParams[1]);
|
||
pCdData->wTrackId=(short)atoi(szParams[2]);
|
||
}
|
||
else if (strcmp(szAction,"SetCDStartingFrame")==0)
|
||
pCdData->ulStartingFrame=(unsigned long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetCDEndingFrame")==0)
|
||
pCdData->ulEndingFrame=(unsigned long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetCDTrackId")==0)
|
||
pCdData->wTrackId=(short)atoi(szParams[0]);
|
||
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResSwitch
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to switch type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResSwitch(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
tdstTypeSwitchDisk *pSwitchData;
|
||
char szTemp[260];
|
||
SCR_tdst_Cxt_Values *pScriptContext;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pSwitchData=&pResDisk->uRes.stSwitch;
|
||
|
||
// A VIRER:
|
||
|
||
// A VIRER DES QUE TOUS LES SCRIPTS AURONT CHANGE DE FORMAT:
|
||
if (strcmp(szAction,"SetParameters")==0)
|
||
{
|
||
pSwitchData->ulNbElements=(unsigned long)atoi(szParams[0]);
|
||
pSwitchData->lTypeSwitch=(long)atoi(szParams[1]);
|
||
// A VIRER: old version
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==3)
|
||
pSwitchData->hDefault=(long)atoi(szParams[2]); // A VIRER...
|
||
}
|
||
else if (strcmp(szAction,"SetNumberOfElements")==0)
|
||
pSwitchData->ulNbElements=(unsigned long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetSwitchType")==0) // A VIRER...
|
||
pSwitchData->lTypeSwitch=(long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SwitchInfoType")==0)
|
||
{
|
||
sprintf(szTemp,"%s.sif^%s",SND_fn_czGetProjectTitle(),szParams[0]);
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szTemp, SCR_CDF_uw_Anl_Normal);
|
||
pSwitchData->lTypeSwitch=(long)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext,0);
|
||
}
|
||
else if (strcmp(szAction,"SwitchDefaultValue")==0)
|
||
{
|
||
sprintf(szTemp,"%s.sif^%s",SND_fn_czGetProjectTitle(),szParams[0]);
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szTemp, SCR_CDF_uw_Anl_Normal);
|
||
pSwitchData->hDefault=(long)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext,0);
|
||
}
|
||
else if (strcmp(szAction,"SetSwitchDynamic")==0)
|
||
{
|
||
pSwitchData->bDynamic=(SndBool)((char*)szParams[1])[0];
|
||
}
|
||
else if (strcmp(szAction,"SetMaintainIfSwitched")==0)
|
||
{
|
||
pSwitchData->bMaintainIfSwitched=(SndBool)((char*)szParams[1])[0];
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResRandom
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to random type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 11/03/98 Author : St<53>phane RONSE
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResRandom(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
tdstTypeRandomDisk *pRandomData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pRandomData=&pResDisk->uRes.stRandom;
|
||
|
||
if (strcmp(szAction,"SetNumberOfElements")==0)
|
||
{
|
||
pRandomData->ulNbElements=(unsigned long)atoi(szParams[0]);
|
||
}
|
||
else
|
||
if (strcmp(szAction,"SetProbNothing")==0)
|
||
{
|
||
pRandomData->rProbNothing=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
}
|
||
else
|
||
if (strcmp(szAction,"SetNothingCanBeChoosenTwice")==0)
|
||
{
|
||
pRandomData->bNothingCanBeChosenTwice=(SndBool)((char*)szParams[1])[0];
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResSequence
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to sequence type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResSequence(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
tdstTypeSequenceDisk *pSeqData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pSeqData=&pResDisk->uRes.stSequence;
|
||
|
||
if (strcmp(szAction,"SetLoop")==0)
|
||
pSeqData->bLoop=(SndBool)(*szParams[1]);
|
||
// A VIRER:
|
||
else if (strcmp(szAction,"SetLoopData")==0)
|
||
{
|
||
pSeqData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
pSeqData->ulEndLoop=(unsigned long)atoi(szParams[1]);
|
||
pSeqData->ulNbLoops=(unsigned long)atoi(szParams[2]);
|
||
}
|
||
else if (strcmp(szAction,"SetStartLoop")==0)
|
||
pSeqData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetEndLoop")==0)
|
||
pSeqData->ulEndLoop=(unsigned long)atoi(szParams[1]);
|
||
else if (strcmp(szAction,"SetNumberOfLoop")==0)
|
||
pSeqData->ulNbLoops=(unsigned long)atoi(szParams[2]);
|
||
|
||
// A VIRER DES QUE TOUS LES SCRIPTS AURONT CHANGE DE FORMAT:
|
||
else if (strcmp(szAction,"SetParameters")==0)
|
||
pSeqData->ulNbElements=(unsigned long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetNumberOfElements")==0)
|
||
pSeqData->ulNbElements=(unsigned long)atoi(szParams[0]);
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResSplit
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to split type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseScriptEntryForResSplit(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
char *p_cFlags;
|
||
tdstTypeSplitDisk *pSplitData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pSplitData=&pResDisk->uRes.stSplit;
|
||
|
||
// A VIRER:
|
||
if (strcmp(szAction,"SetFlags")==0)
|
||
{
|
||
p_cFlags=szParams[1]; // Points to the array of booleans coded as chars:
|
||
pSplitData->bStayActive=(SndBool)p_cFlags[0];
|
||
}
|
||
else if (strcmp(szAction,"SetStayActive")==0)
|
||
pSplitData->bStayActive=(SndBool)(*szParams[1]);
|
||
|
||
|
||
// A VIRER DES QUE TOUS LES SCRIPTS AURONT CHANGE DE FORMAT:
|
||
else if (strcmp(szAction,"SetParameters")==0)
|
||
pSplitData->ulNbRanges=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetNumberOfElements")==0)
|
||
pSplitData->ulNbRanges=(unsigned long)atoi(szParams[0]);
|
||
}
|
||
|
||
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseScriptEntryForResTheme
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the BRDisk section script callback
|
||
// Analyses script entries specific to theme type resources
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
|
||
void SND_fn_vAnalyseScriptEntryForResTheme(char *szAction, char *szParams[],tdstBlockResourceDisk *pResDisk)
|
||
{
|
||
tdstTypeThemeDisk *pThemeData;
|
||
|
||
if (SND_fn_bAnalyseScriptEntryForResGeneral(szAction,szParams,pResDisk)) return;
|
||
|
||
|
||
pThemeData=&pResDisk->uRes.stTheme;
|
||
|
||
if (strcmp(szAction,"SetStartLoop")==0)
|
||
pThemeData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
|
||
// A VIRER:
|
||
if (strcmp(szAction,"SetLoopData")==0)
|
||
{
|
||
pThemeData->ulNbParts=(unsigned long)atoi(szParams[0]);
|
||
pResDisk->uRes.stTheme.ulStartLoop=(unsigned long)atoi(szParams[1]);
|
||
}
|
||
else if (strcmp(szAction,"SetStartLoop")==0)
|
||
pThemeData->ulStartLoop=(unsigned long)atoi(szParams[0]);
|
||
else if (strcmp(szAction,"SetEndLoop")==0)
|
||
pThemeData->ulNbParts=(unsigned long)atoi(szParams[0]);
|
||
|
||
// A VIRER DES QUE TOUS LES SCRIPTS AURONT CHANGE DE FORMAT:
|
||
else if (strcmp(szAction,"SetParameters")==0)
|
||
{
|
||
pThemeData->ulNbParts=(unsigned long)atoi(szParams[0]);
|
||
pThemeData->ulStartLoop=(unsigned long)atoi(szParams[1]);
|
||
}
|
||
else if (strcmp(szAction,"SetNumberOfElements")==0)
|
||
pThemeData->ulNbParts=(unsigned long)atoi(szParams[0]);
|
||
|
||
else if (strcmp(szAction,"SetFadeDuration")==0)
|
||
pThemeData->rFadeDuration=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
|
||
else if (strcmp(szAction,"SetNbMainLoop")==0)
|
||
pThemeData->ulNbLoops=(unsigned long)atoi(szParams[0]);
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
//* *
|
||
//* *
|
||
//* SCRIPT CALLBACKS : EVENTS *
|
||
//* *
|
||
//* *
|
||
//***************************************************************************
|
||
//***************************************************************************
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsPlay
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to play event parameters
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsPlay(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
SCR_tdst_Cxt_Values* pScriptContext;
|
||
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1) // A VIRER
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stPlay.uResource.pstPtr=(tdstBlockResourceMem*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
else if (strcmp(szAction,"SetParam2")==0)
|
||
pEvent->uParams.stPlay.stDeTune.rDelta=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsStop
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to stop event parameters
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsStop(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
SCR_tdst_Cxt_Values* pScriptContext;
|
||
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stStop.uEvt.pstPtr=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsStopNGo
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to "stop and go" event parameters
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsStopNGo(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
SCR_tdst_Cxt_Values* pScriptContext;
|
||
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stStopNGo.uEvtStop.pstPtr=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
else if (strcmp(szAction,"SetParam2")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stStopNGo.uEvtGo.pstPtr=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsStopNGoFade
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to
|
||
// "stop and go with crossfade" event parameters
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsStopNGoFade(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
SCR_tdst_Cxt_Values* pScriptContext;
|
||
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stStopNGoFade.uEvtStop.pstPtr=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
else if (strcmp(szAction,"SetParam2")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stStopNGoFade.uEvtGo.pstPtr=(SND_tdstBlockEvent*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
else if (strcmp(szAction,"SetParam3")==0)
|
||
pEvent->uParams.stStopNGoFade.iTime=SCRIPT_INT(szParams[0]);
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsXtraParam
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to "play with extra params"
|
||
// event parameters.
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsXtraParam(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
SCR_tdst_Cxt_Values* pScriptContext;
|
||
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
{
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stExtraParam.uResource.pstPtr=(tdstBlockResourceMem*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
else if (strcmp(szAction,"SetParam2")==0)
|
||
pEvent->uParams.stExtraParam.CoefA=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
else if (strcmp(szAction,"SetParam3")==0)
|
||
pEvent->uParams.stExtraParam.CoefB=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
else if (strcmp(szAction,"SetParam4")==0)
|
||
pEvent->uParams.stExtraParam.stDeTune.rDelta=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsExtraAll
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to "play with all extra params"
|
||
// event parameters.
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/09/98 Author : St<53>phane RONSE
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsExtraAll(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
SCR_tdst_Cxt_Values* pScriptContext;
|
||
SndReal rCoefA,rCoefB;
|
||
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
{//resource reference
|
||
if (SCR_fn_uc_RdL0_GetNumberOfParameters(szParams)==1)
|
||
pScriptContext=SCR_fnp_st_RdL0_AnalyseSection(szParams[0],SCR_CDF_uw_Anl_Normal);
|
||
else pScriptContext=((SCR_tdst_Cxt_Values**)szParams[1])[0];
|
||
pEvent->uParams.stExtraAll.uResource.pstPtr=(tdstBlockResourceMem*)SCR_M_ul_RdL0_ExtractLongValue(pScriptContext, 0);
|
||
}
|
||
else if (strcmp(szAction,"SetParamAPitch")==0)
|
||
{
|
||
rCoefA=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
SND_fn_vSndRealTwinToSndReal(pEvent->uParams.stExtraAll.rtCoefPitch,NULL,&rCoefB);
|
||
pEvent->uParams.stExtraAll.rtCoefPitch=SND_fn_rtSndRealToSndRealTwin(rCoefA,rCoefB);
|
||
}
|
||
else if (strcmp(szAction,"SetParamBPitch")==0)
|
||
{
|
||
rCoefB=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
SND_fn_vSndRealTwinToSndReal(pEvent->uParams.stExtraAll.rtCoefPitch,&rCoefA,NULL);
|
||
pEvent->uParams.stExtraAll.rtCoefPitch=SND_fn_rtSndRealToSndRealTwin(rCoefA,rCoefB);
|
||
}
|
||
else if (strcmp(szAction,"SetParamAVolume")==0)
|
||
{
|
||
rCoefA=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
SND_fn_vSndRealTwinToSndReal(pEvent->uParams.stExtraAll.rtCoefVol,NULL,&rCoefB);
|
||
pEvent->uParams.stExtraAll.rtCoefVol=SND_fn_rtSndRealToSndRealTwin(rCoefA,rCoefB);
|
||
}
|
||
else if (strcmp(szAction,"SetParamBVolume")==0)
|
||
{
|
||
rCoefB=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
SND_fn_vSndRealTwinToSndReal(pEvent->uParams.stExtraAll.rtCoefVol,&rCoefA,NULL);
|
||
pEvent->uParams.stExtraAll.rtCoefVol=SND_fn_rtSndRealToSndRealTwin(rCoefA,rCoefB);
|
||
}
|
||
else if (strcmp(szAction,"SetParamAPan")==0)
|
||
{
|
||
rCoefA=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
SND_fn_vSndRealTwinToSndReal(pEvent->uParams.stExtraAll.rtCoefPan,NULL,&rCoefB);
|
||
pEvent->uParams.stExtraAll.rtCoefPan=SND_fn_rtSndRealToSndRealTwin(rCoefA,rCoefB);
|
||
}
|
||
else if (strcmp(szAction,"SetParamBPan")==0)
|
||
{
|
||
rCoefB=M_DoubleToRealSnd(SCRIPT_DOUBLE(szParams[0]));
|
||
SND_fn_vSndRealTwinToSndReal(pEvent->uParams.stExtraAll.rtCoefPan,&rCoefA,NULL);
|
||
pEvent->uParams.stExtraAll.rtCoefPan=SND_fn_rtSndRealToSndRealTwin(rCoefA,rCoefB);
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventChangeVolume
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to "change objects volume"
|
||
// event parameters.
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/09/98 Author : St<53>phane RONSE
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventChangeVolume(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
if (strcmp(szAction,"SetConcernWithObjectType")==0)
|
||
{//
|
||
pEvent->uParams.stChangeVolume.bConcernWithObjectType=(SndBool)(*szParams[1]);
|
||
}
|
||
else if (strcmp(szAction,"SetVolume")==0)
|
||
{
|
||
pEvent->uParams.stChangeVolume.lNewVolume=(long)atoi(szParams[0]);
|
||
}
|
||
}
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : SND_fn_vAnalyseEventParamsEffect
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Subroutine for the event section script callback
|
||
// Analyses script entries specific to effect event parameters
|
||
//-----------------------------------------------------------------------------
|
||
// Input : script callback input params, BRDisk*
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//------------------------------------------------------------------------------
|
||
void SND_fn_vAnalyseEventParamsEffect(char *szAction, char *szParams[],SND_tdstBlockEvent *pEvent)
|
||
{
|
||
if (strcmp(szAction,"SetParam1")==0)
|
||
pEvent->uParams.stEffect.iIdEffect=SCRIPT_INT(szParams[0]);
|
||
}
|
||
|
||
|
||
//-----------------------------------------------------------------------------
|
||
// Name : fn_vSetProjectTitleForSuperVisater(char* _czProjectTitle)
|
||
//-----------------------------------------------------------------------------
|
||
// Description : Send the absolute filename of the project .lcb to the
|
||
// SuperVisater debugging DLL
|
||
//-----------------------------------------------------------------------------
|
||
// Input : const char *
|
||
// Output : void
|
||
//-----------------------------------------------------------------------------
|
||
// Creation date : 05/13/99 Author : Pascal Lalancette
|
||
//-----------------------------------------------------------------------------
|
||
// Modification date : Modification Author :
|
||
// Modifications :
|
||
//-----------------------------------------------------------------------------
|
||
|
||
|
||
#if defined (SUPERVISATER) && defined(_DLL_COMPILATION_MODE)
|
||
|
||
void fn_vSetProjectTitleForSuperVisater(const char* _czProjectTitle)
|
||
{
|
||
char czFileTitle[256];
|
||
char czProjectFileName[256];
|
||
char curDir[256];
|
||
|
||
if(!strcmp(_czProjectTitle, ""))
|
||
{
|
||
dbgSND_fn_vSetProjectTitleForSuperVisater("NoProjectTitle");
|
||
return;
|
||
}
|
||
|
||
|
||
strncpy(czFileTitle, _czProjectTitle, 256);
|
||
strcat(czFileTitle, ".lcb");
|
||
|
||
SND_fn_vResolveFileName(czFileTitle, czProjectFileName);
|
||
|
||
GetCurrentDirectory(256,curDir);
|
||
|
||
|
||
//if (strstr( czProjectFileName, curDir) == NULL)
|
||
if (strstr( czProjectFileName, ":\\") == NULL)
|
||
{
|
||
|
||
//The absolute path is not in the ProjectFilename
|
||
strcat(curDir, "\\");
|
||
strcat(curDir, czProjectFileName);
|
||
dbgSND_fn_vSetProjectTitleForSuperVisater(curDir);
|
||
|
||
|
||
|
||
}
|
||
else
|
||
dbgSND_fn_vSetProjectTitleForSuperVisater(czProjectFileName);
|
||
|
||
|
||
|
||
|
||
}
|
||
#endif //SUPERVISATER && _DLL_COMPILATION_MODE
|
||
|
||
|
||
|
||
#endif
|
||
//NO_ACP_SOUND*
|