#ifndef _SNDRES_H_ #define _SNDRES_H_ #ifdef SND_SCRIPT_VERSION /*Mode Script pur*/ #if defined(SNDLST2_StaticIsOptimised) || defined(LST2_StaticIsOptimised) #error Macros not coherent #endif #endif #ifdef SND_HYBRID_VERSION /*Mode Hybride*/ #define LST2_StaticIsOptimised #define SNDLST2_StaticIsOptimised #endif #ifdef SND_BINARY_VERSION /*Mode Binaire pur*/ #define LST2_StaticIsOptimised #define SNDLST2_StaticIsOptimised #endif #if ((!defined(SND_SCRIPT_VERSION))&&((!defined(SND_HYBRID_VERSION))&&(!defined(SND_BINARY_VERSION)))) #error neither SCRIPT,HYBRID, or BINARY defined #endif #include "sndlst2.h" /*-------------------------------------------------------------------------*/ /*definitions specifiques à la target*/ #include "sndhard.h" /****************************************************************/ /* Structures portables pour les Ressources */ /****************************************************************/ #define SND_C_RES_FANTOME_PTR NULL #define SND_C_RES_FANTOME_ID -1 extern tduRefRes SND_RES_FANTOME; typedef enum _tdeTypeResource{ TYPE_INVALID, TYPE_SAMPLE, TYPE_MIDI, TYPE_CDAUDIO, TYPE_SEQUENCE, TYPE_SWITCH_OLD, TYPE_SPLIT, TYPE_THEME_OLD, TYPE_SWITCH, TYPE_THEME_OLD2, TYPE_RANDOM, TYPE_THEME, TYPE_FOR_ALIGNEMENT=SND_ENUM_ALIGNEMENT } tdeTypeResource; #define NB_TYPES_RESOURCES 12 /* AJOUT FRED DECREAU : A VALIDER!!*/ typedef enum{ TYPE_EXTERNAL, /*les data sont chargees/dechargees ressources par ressources*/ TYPE_MEGAFILE, /*les data sont chargees/dechargees par bloc de ressources*/ TYPE_BIGFILE, STORAGE_FOR_ALIGNEMENT=SND_ENUM_ALIGNEMENT } tdeTypeStorage; /*--------------------------------------------------- RANDOM RESSOURCES*/ /*parametres d'un element d'une liste ACP de references de ressources:*/ struct _tdstRandomElement { tduRefRes uRes; /*reference sur la ressource associee à l’element*/ SndReal rProb; /*probabilite d'etre choisi*/ SndBool bCanBeChosenTwice; /*if FALSE, element cannot be choosen twice consecutively*/ SNDLST2_M_StaticChildDeclaration(tdstRandomElement*,tdstTypeRandomMem*) } ; /*Definition d’une ressource random en memoire :*/ struct _tdstTypeRandomMem { unsigned long ulNbElements; /*nb d’elements dans la liste d’aiguillage*/ SndReal rProbNothing; /*probabilite qu'aucun son ne soit choisi*/ SndBool bNothingCanBeChosenTwice; /*if FALSE, "nothing" element cannot be choosen twice consecutively*/ long lLastElementChoosen; /*used only in memory: last eleent choosen SILENCE or any RandomElement*/ long lLastResChoosen; /*used only in memory: last eleent choosen SILENCE or any RandomElement*/ SNDLST2_M_StaticParentDeclaration(tdstRandomElement*) }; /*Definition d’une ressource random sur disque :*/ struct _tdstTypeRandomDisk { unsigned long ulNbElements; /*nb d’elements dans la liste d’aiguillage*/ SndReal rProbNothing; /*probabilite qu'aucun son ne soit choisi*/ SndBool bNothingCanBeChosenTwice; /*if FALSE, "nothing" element cannot be choosen twice consecutively*/ long lLastResChoosenObsolet; /*NOT USED; only kept to avoid disalignment*/ SNDLST2_M_StaticParentDeclaration(tdstRandomElement*) /*not needed, but BNM alignement cannot be changed*/ }; /*----previous THEME (only for compatibility)*/ typedef struct _tdstThemeBridgeOld tdstThemeBridgeOld; typedef struct _tdstThemePartOld tdstThemePartOld; typedef struct _tdstTypeThemeOld tdstTypeThemeOld; typedef tdstThemePartOld* hThemePartOld; typedef tdstThemeBridgeOld* hThemeBridgeOld; SNDLST2_M_StaticUseListOf(hThemeBridgeOld); struct _tdstThemeBridgeOld { tduRefRes uResTarget; tduRefRes uRes; SNDLST2_M_StaticElementDeclaration(hThemeBridgeOld) }; struct _tdstThemePartOld { tduRefRes uRes; SNDLST2_M_StaticChildDeclaration(tdstThemePartOld*,tdstTypeThemeOld*) /*SNDLST2_M_StaticParentDeclaration(tdstThemeBridge*)*/ SNDLST2_M_StaticAnchorDeclaration(hThemeBridgeOld) hLstThemeBridge; }; struct _tdstTypeThemeOld { unsigned long ulStartLoop; /*indice du point de rebouclage*/ unsigned long ulEndLoop; /*indice du dernier point de la boucle la boucle*/ tduRefRes uBridgeIn; SNDLST2_M_StaticParentDeclaration(tdstThemePartOld*) }; /*--------------------------------------------------- THEME old2*/ typedef struct _tdstThemeBridgeOld2 tdstThemeBridgeOld2; typedef struct _tdstThemePartOld2 tdstThemePartOld2; typedef struct _tdstTypeThemeDiskOld2 tdstTypeThemeDiskOld2; typedef struct _tdstTypeThemeMemOld2 tdstTypeThemeMemOld2; typedef tdstThemePartOld2* hThemePartOld2; typedef tdstThemeBridgeOld2* hThemeBridgeOld2; SNDLST2_M_StaticUseListOf(hThemeBridgeOld2); typedef enum _tdeTypeTransitionOld2{ TRANSITION_CROSSFADE_Old2, TRANSITION_ATENDOFPART_Old2, TRANSITION_FOR_ALIGNEMENT_Old2=SND_ENUM_ALIGNEMENT } tdeTypeTransitionOld2; struct _tdstThemePartOld2 { tduRefRes uRes; SndBool_field_decl(bLoopStart); /*TRUE if this part is the begining of a loop*/ SndBool_field_decl(bLoopEnd); /*TRUE if this part is the last part of a loop*/ long lNbLoops; /*if bLoopStart, indicates the number of re-loops (0=played only once,1=2 times...)*/ tdeTypeTransitionOld2 eTransition; /*transition in case of new theme starting*/ SNDLST2_M_StaticChildDeclaration(tdstThemePartOld2*,tdstTypeThemeMemOld2*) }; struct _tdstTypeThemeDiskOld2 { unsigned long ulStartLoop; /*indice du point de rebouclage*/ unsigned long ulNbParts; /*nombre total de parts dans la liste*/ SNDLST2_M_StaticParentDeclaration(tdstThemePartOld2*) /*not needed, but BNM alignement cannot be changed*/ }; struct _tdstTypeThemeMemOld2 { unsigned long ulStartLoop; /*indice du point de rebouclage*/ unsigned long ulNbParts; /*nombre total de parts dans la liste*/ SNDLST2_M_StaticParentDeclaration(tdstThemePartOld2*) }; /*--------------------------------------------------- THEME*/ typedef enum _tdeTypeTransition{ TRANSITION_CROSSFADE, /*instantaneous transition with cross fade*/ TRANSITION_ATENDOFPART, /*transition at the end of current part*/ TRANSITION_OUTRO, /*transition at the end of current part followed by outro (if any)*/ TRANSITION_FOR_ALIGNEMENT=SND_ENUM_ALIGNEMENT } tdeTypeTransition; typedef tdstThemePart* hThemePart; #define DEFAULT_FADEDURATION M_IntToRealSnd(0) struct _tdstThemePart { tduRefRes uRes; SndBool_field_decl(bLoopStart); /*TRUE if this part is the begining of a loop*/ SndBool_field_decl(bLoopEnd); /*TRUE if this part is the last part of a loop*/ long lNbLoops; /*if bLoopStart, indicates the number of re-loops (0=played only once,1=2 times...)*/ tdeTypeTransition eTransition; /*transition in case of new theme starting*/ SndReal rFadeDuration; /*if DEFAULT, use Theme's fade duration; else, duration in sec*/ SNDLST2_M_StaticChildDeclaration(tdstThemePart*,tdstTypeThemeMem*) }; struct _tdstThemePartOutro { tduRefRes uRes; tdeTypeTransition eTransition; /*transition in case of new theme starting*/ SndReal rFadeDuration; /*if DEFAULT, use Theme's fade duration; else, duration in sec*/ }; #define C_THEME_NO_LOOP -1 #define C_THEME_PART_PLAY_ONCE 0 #define C_THEME_MAINLOOP_INFINITE 0 #define C_THEME_NO_PARTOUTRO -1 struct _tdstTypeThemeDisk { unsigned long ulStartLoop; /*main loop start (first part of the loop*/ unsigned long ulEndLoopObsolet;/*UNUSED; just keep to avoid disalignment and incompatiblity*/ unsigned long ulNbLoops; /*total number of loop;C_THEME_LOOP_INIFINITE=0 if infinite loop;1=play once;2=play twice...*/ unsigned long ulNbParts; /*total number of part in the list (excluding outro)*/ long lOffsetPartOutro; /*offset of Partoutro in this resource extra data; in bytes; 0 is the location of 1° part;C_THEME_NO_PARTOUTRO=no partoutro*/ SndReal rFadeDuration; /*if DEFAULT, use default duration (1sec); else, duration in sec*/ SNDLST2_M_StaticParentDeclaration(tdstThemePart*) /*not needed, but BNM alignement cannot be changed*/ }; struct _tdstTypeThemeMem { unsigned long ulStartLoop; /*main loop start (0=first part, 1=2° part...)*/ unsigned long ulEndLoopObsolet ;/*UNUSED; just keep to avoid disalignment and incompatiblity*/ unsigned long ulNbParts; /*total number of part in the list (excluding OUTRO)*/ tdstThemePartOutro* pstPartOutro; SndReal rFadeDuration; /*if DEFAULT, use default fade duration (1sec); else, duration in sec*/ unsigned long ulNbLoops; /*total number of loop;C_THEME_LOOP_INIFINITE=0 if infinite loop;1=play once;2=play twice...*/ SNDLST2_M_StaticParentDeclaration(tdstThemePart*) }; /*------ previous switch ressources (only for compatbilty)*/ typedef struct _tdstTypeSwitchOld tdstTypeSwitchOld; struct _tdstTypeSwitchOld { SNDLST2_M_StaticParentDeclaration(tdstSwitchElement*) unsigned long ulNbElements; /*nb d’elements dans la liste d’aiguillage*/ long lTypeSwitch; /*type moteur de switch*/ SND_tdxHandleToSoundInfo hDefault; /*indice de l'element par defaut*/ SndBool bDynamic; /*switch remis à jour dynamiquement*/ }; /*--------------------------------------------------- SWITCH RESSOURCES*/ /*parametres d'un element d'une liste ACP de references de ressources:*/ struct _tdstSwitchElement { tduRefRes uRes; /*reference sur la ressource associee à l’element*/ SND_tdxHandleToSoundInfo hIndice; /*indice associe à l'element*/ SNDLST2_M_StaticChildDeclaration(tdstSwitchElement*,tdstTypeSwitchMem*) } ; /* // Liste de references sur des ressources: struct _tdstSwitchList { SNDLST2_M_StaticParentDeclaration(tdstSwitchElement*) }; */ #define C_SWITCH_NODEFAULT ((SND_tdxHandleToSoundInfo)-1) /*Definition d’une ressource switch en memoire :*/ struct _tdstTypeSwitchMem { SNDLST2_M_StaticParentDeclaration(tdstSwitchElement*) unsigned long ulNbElements; /*nb d’elements dans la liste d’aiguillage*/ long lTypeSwitch; /*type moteur de switch*/ SND_tdxHandleToSoundInfo hDefault; /*indice de l'element par defaut*/ SndBool_field_decl(bDynamic); /*switch remis à jour dynamiquement*/ SndBool_field_decl(bMaintainIfSwitched); /*if TRUE, never stop a launched element, event if switch value change (there'll be only Plays)*/ }; /*Definition d’une ressource switch sur disque :*/ struct _tdstTypeSwitchDisk { SNDLST2_M_StaticParentDeclaration(tdstSwitchElement*) /*not needed, but BNM alignement cannot be changed*/ unsigned long ulNbElements; /*nb d’elements dans la liste d’aiguillage*/ long lTypeSwitch; /*type moteur de switch*/ SND_tdxHandleToSoundInfo hDefault; /*indice de l'element par defaut*/ SndBool_field_decl(bDynamic); /*switch remis à jour dynamiquement*/ SndBool_field_decl(bMaintainIfSwitched); /*if TRUE, never stop a launched element, event if switch value change (there'll be only Plays)*/ }; /*--------------------------------------------------- RESSOURCES SPLITS*/ /*Definition d’une ressource split sur disque: */ struct _tdstTypeSplitDisk { unsigned long ulNbRanges ; /*nb d’elements dans la liste d’aiguillage*/ SndBool bStayActive; /*rester actif si aucune plage active*/ /*char czFileName[13]; // nom du fichier de sequence Id des ressoures*/ } ; /*Description d'une plage (range) du split*/ struct _tdstRangeSplitDisk { tduRefRes uRes ; /*ressource associee à la plage*/ SndReal rPitchA ; /*pitch de la ressource split correspondant au point A*/ SndReal rPitchB ; /*pitch de la ressource split correspondant au point B*/ SndReal rPitchC ; /*pitch de la ressource split correspondant au point C*/ SndReal rPitchD ; /*pitch de la ressource split correspondant au point D*/ SndReal rCoefPitch ; /*rapport entre pitch effectif de la plage et pitch de la ressource Split*/ unsigned char ucVolume ; /*volume auquel doit etre jouee la ressource entre B et C*/ SNDLST2_M_StaticChildDeclaration(tdstRangeSplitDisk*,tdstRangeSplitListDisk*) } ; /*Liste ACP de plages:*/ struct _tdstRangeSplitListDisk{ SNDLST2_M_StaticParentDeclaration(tdstRangeSplitDisk *) } ; /*Description d'une plage (range) du split*/ struct _tdstRangeSplitMem { tduRefRes uRes ; /*ressource associee à la plage*/ SndReal rPitchA ; /*pitch de la ressource split correspondant au point A*/ SndReal rPitchB ; /*pitch de la ressource split correspondant au point B*/ SndReal rPitchC ; /*pitch de la ressource split correspondant au point C*/ SndReal rPitchD ; /*pitch de la ressource split correspondant au point D*/ SndReal rCoefPitch ; /*rapport entre pitch effectif de la plage et pitch de la ressource Split*/ unsigned char ucVolume ; /*volume auquel doit etre jouee la ressource entre B et C*/ SNDLST2_M_StaticChildDeclaration(tdstRangeSplitMem*,tdstRangeSplitListMem*) SndReal rCoefMagAB; /*coef precalcule*/ SndReal rCoefMagCD; } ; /*Liste ACP de plages:*/ struct _tdstRangeSplitListMem{ SNDLST2_M_StaticParentDeclaration( tdstRangeSplitMem *) } ; /*Definition d’une ressource switch en memoire :*/ struct _tdstTypeSplitMem { unsigned long ulNbRanges; /*nb de plages*/ SndBool bStayActive; /*rester actif si aucune plage active*/ tdstRangeSplitListMem stRangeList; /*liste des plages*/ } ; /*--------------------------------------------------- SEQUENCES*/ /*parametres d'un element d'une sequence (donnees sur disk)*/ struct _tdstInfoTrackDisk { unsigned long ulFadeIn; /*fade in sur cet element*/ unsigned long ulFadeOut; /*fade out à la fin de l’element*/ /* unsigned char ucNbLoops; //nombre de repetition de cet element*/ unsigned long ulCrossFade;/*cross-fade avec l ‘element suivant*/ tduRefRes uRes; /*reference sur la ressource associee à l’element*/ } ; /*parametres d'un element d'une sequence (donnees en mem), element de liste ACP:*/ struct _tdstInfoTrackMem { SNDLST2_M_StaticChildDeclaration(tdstInfoTrackMem*,tdstInfoTrackList*) unsigned long ulFadeIn; /*fade in sur cet element*/ unsigned long ulFadeOut; /*fade out à la fin de l’element*/ /* unsigned char ucNbLoops; //nombre de repetition de cet element*/ unsigned long ulCrossFade; /*cross-fade avec l ‘element suivant*/ tduRefRes uRes; /*reference sur la ressource associee à l’element*/ } ; /* Declaration d'une liste de ressources pour les sequences*/ struct _tdstInfoTrackList { /* M_LstParentDeclaration(tdstInfoTrackMem);*/ SNDLST2_M_StaticParentDeclaration(tdstInfoTrackMem*) }; /*parametres d'une ressource de type sequence (donnee sur disk)*/ struct _tdstTypeSequenceDisk { SndBool bLoop; /*la sequence boucle-t-elle*/ unsigned long ulStartLoop; /*indice du point de rebouclage*/ unsigned long ulEndLoop; /*nd d’elements dans la boucle*/ unsigned long ulNbLoops; /*nombre de boucle dans la sequence*/ unsigned long ulNbElements; /*nombre d’elements constituant la sequence*/ /*char czFileName[13]; // nom du fichier de sequence Id des ressoures*/ } ; /*parametres d'une ressource de type sequence (donnee en mem)*/ struct _tdstTypeSequenceMem { SndBool bLoop; /*la sequence boucle-t-elle*/ unsigned long ulStartLoop; /*indice du point de rebouclage*/ unsigned long ulEndLoop; /*nd d’elements dans la boucle*/ unsigned long ulNbLoops; /*nombre de boucle dans la sequence*/ unsigned long ulNbElements; /*nombre d’elements constituant la sequence*/ tdstInfoTrackList stResList; /*liste des ressources contenues dans la sequence*/ } ; /*--------------------------------------------------- BLOCSRESOURCES*/ /*union des descripteurs de ressources sur disk*/ union _tduResDisk { tdstTypeSampleDisk stSample ; tdstTypeMidiDisk stMidi ; tdstTypeCD stCD; tdstTypeSequenceDisk stSequence ; tdstTypeSwitchDisk stSwitch ; tdstTypeSwitchOld stSwitchOld ;/*obsolete*/ tdstTypeSplitDisk stSplit; tdstTypeThemeDisk stTheme; tdstTypeRandomDisk stRandom; tdstTypeThemeOld stThemeOld;/*obsolete*/ tdstTypeThemeDiskOld2 stThemeOld2;/*obsolete*/ } ; /*description d'une ressource (donnees sur disk)*/ struct _tdstBlockResourceDisk { tdxId Id; /*id de la ressource*/ tdeTypeResource eType; /*type*/ tdeTypeStorage eStorage; /*storage ???*/ unsigned long ulDataSize; /*taille des donnees utilse (i.e. taille des samples (