Add rayman2 source files

This commit is contained in:
2024-09-18 02:33:44 +08:00
parent bcc093f8ed
commit fb036c54fd
14339 changed files with 2596224 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
#include "SNDinc.H"
#include "sndrec.h"
#include "sndlst2.h"
#include "sndxd.h"
#ifndef DISABLE_RECORD
/*-------------------------------------------------------------*/
/* SND_fn_vInitRecord: init SNDREC*/
/*-------------------------------------------------------------*/
int SND_CALL SND_fn_iInitRecord(SND_tdstInitStruct *pInitStruct)
{
return C_INIT_FAILED;
}
/*-------------------------------------------------------------*/
/* SND_fn_vDesInitRecord: desinit SNDREC*/
/*-------------------------------------------------------------*/
void SND_CALL SND_fn_vDesInitRecord(void)
{
}
/*---------------------------------------------------------------*/
/* SND_fn_bTestFormatRecord:test is a fromat is valid for recording*/
/* Parameters:*/
/* pformat: format to be tested; some fields may be filled depending of flags value*/
/* to return a effective valid format*/
/* flags: boolean combinaison of following*/
/* FORMATREC_RESOLUTION: test Resolution field value; will fill pFormat with a valid value*/
/* FORMATREC_FREQUENCY: test Frequency field value; will fill pFormat with a valid value*/
/* FORMATREC_NBCHANNEL: test NbChannlel field value; will fill pFormat with a valid value*/
/* FORMATREC_ZIP: test eZip field value; will fill pFormat with a valid value*/
/* Return:*/
/* TRUE when a calid format was found; some filed of pFormat could be changed*/
/* FALSE when no format is availlable regardless to flags value*/
/*---------------------------------------------------------------*/
SndBool SND_CALL SND_fn_bTestFormatRecord(SND_tdstFormat* pformat,int flags)
{
return FALSE;
}
/*-----------------------------------------------------------*/
/* SND_fn_lCreateBufferRecord: create a recording buffer*/
/* Parameters:*/
/* SND_tdstFormat: format souhaite*/
/* pCallback; type de callback*/
/* Return:*/
/* C_PLAY_FAILED if failed; else, Buffer is ready to record*/
/*-----------------------------------------------------------*/
long SND_CALL SND_fn_lCreateBufferRecord(SND_tdstFormat* pformat,SND_tdstCallback* pCallback)
{
return C_PLAY_FAILED;
}
/*---------------------------------------------------------------*/
/* SND_fn_ucGetInstantVuMeterRecordSound: get current value for VuMeter*/
/* Return:*/
/* volume (0=silence; 127= maximum power)*/
/*-----------------------------------------------------------------*/
unsigned char SND_CALL SND_fn_ucGetInstantVuMeterRecord(void)
{
return 0;
}
/*---------------------------------------------------------------*/
/* SND_fn_lPushBufferToRecord: add a new buffer to record data into*/
/* Parameters:*/
/* id_buffer: id of RecordBuffer*/
/* ptr: pointer where copy recorded data*/
/* size_ptr: nb bytes to copy*/
/* Return:*/
/* id of data buffer*/
/*-----------------------------------------------------------------*/
long SND_CALL SND_fn_lPushBufferToRecord(long id_buffer,void* ptr,int size_ptr)
{
return C_PLAY_FAILED;
}
SndBool SND_CALL SND_fn_bStartRecord(long id_buffer)
{
return FALSE;
}
void SND_CALL SND_fn_vStopRecord(long id_buffer)
{
}
SndBool SND_CALL SND_fn_bIsBufferFullDuplexRecord(long id_buffer)
{
return FALSE;
}
SndBool SND_CALL SND_fn_bIsWorkingRecord(long id_buffer)
{
return FALSE;
}
/*---------------------------------------------------------*/
/* SND_fn_bManageMsgForRecord: traitement des messages envoyes <20> la Thread Wave*/
/* Parametres:*/
/* msg: message to be processed*/
/* Return:*/
/* TRUE if message was processed for WaveIn*/
/* FALSE if message must be processed by the thread*/
/*---------------------------------------------------------*/
SndBool SND_CALL SND_fn_bManageMsgForRecord(long p_msg)
{
return FALSE;
}
#endif /*DISABLE_RECORD*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,635 @@
/*---------------------------------------------------------------
FILE: client3d.c
ROLE: management of client buffers for DSound3d
MODIFICATIONS:
- J.Vibert - 10/12/98 - small modif on errors returned
- J.Vibert - 07/12/98 - test on StaticBuffer+StreaminigBuffer in DSCAPS test
+ dsound buffer pointers checked
- J.Vibert - 01/12/98 - extracted from sndxdwav.c
----------------------------------------------------------------*/
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "SNDinc.h"
#include "sndthrd.h"
#include "sndxd.h"
#include "sndres.h"
#include "sndhardw.h"
#if defined(_DLL_COMPILATION_MODE) && defined(_DLL_MODULE)
#include "snddll.h"
#endif
#include "priv3dfl.h"
extern long vol_2_hth_dB[128];
extern LPDIRECTSOUND g_lpDirectSoundObject;
extern SndBool driver_SND_OK;
extern SndBool bReleasedForced;
// M_AdaptVolume macro:
// compute SND_volume to get DS_volume
// Due to mixing level compatibility with WinMM DLL, Stereo ClientBuffers should twice as loud as any other buffers
#define M_AdaptVolume(SND_volume,iNbChannels,bClientBuffer) \
( (((int)iNbChannels==2) && bClientBuffer) ? (unsigned char)SND_volume : (unsigned char)(SND_volume/2))
//buffers clients
/*
typedef struct _tdstStackElement *p_tdstStackElement;
SNDLST2_M_DynamicUseListOf(p_tdstStackElement);
typedef struct _tdstStackElement {
} tdstStackElement;
*/
typedef struct _tdstBufferClientStack {
td_pfn_vBufferClientPoped pfnCallback;
} tdstBufferClientStack;
typedef struct _tdstBufferClientAsynchrone {
unsigned long ulSamples; //size of buffer (in samples)
unsigned long ulNextToCompute;//id of the next sample to compute
td_pfn_vRefreshBufferClient pfnCallback; //callback function for client buffer
} tdstBufferClientAsynchrone;
typedef struct _tdstBufferClient *p_tdstBufferClient;
SNDLST2_M_DynamicUseListOf(p_tdstBufferClient);
typedef struct _tdstBufferClient {
SND_tduTypeCallback eType;
long lVoice; //associated sample voice
//SndBool bPaused;//TRUE si buffer paused
unsigned long dwFlags; //FLAG_PAUSED|FLAG_VIRTUAL//FLAG_SETVIRTFREQ
DWORD pos_when_paused;
long lUserId;
LPDIRECTSOUNDBUFFER lpDSBuffer; //DSSound buffer
SND_tdstFormat stFormat;
unsigned long ulDecalBytes; //nb_sample<<buffer->ulDecalBytes=nb_bytes
union {
tdstBufferClientAsynchrone stAsynchrone;
tdstBufferClientStack stStack;
} uParam;
DWORD ulTimeNextToCompute;//time measured when updating
double dLastDeltaT; //last Dt used to extrapolate (GetPos)
unsigned long ulFreq; //added 02/09/98 to restore frequency if needed after a forceRestore
SNDLST2_M_DynamicElementDeclaration(p_tdstBufferClient)
} tdstBufferClient;
typedef struct _tdstBufferClientList {
SNDLST2_M_DynamicAnchorDeclaration(p_tdstBufferClient) pList;
} tdstBufferClientList;
static tdstBufferClientList buffers_clients;
//tdstBufferClientList buffers_clients;
void refresh_buffer_asynchrone(p_tdstBufferClient buffer_client)
{
tdstBufferClientAsynchrone *buffer_asynchron=&buffer_client->uParam.stAsynchrone;
DWORD sizeptr1,sizeptr2,*ptr1,*ptr2;
DWORD playptr,writeptr;
DWORD nbbytes_to_calcul;
HRESULT result;
if (buffer_client==NULL)
return; //04/12/98
if (buffer_client->lpDSBuffer==NULL)
return; //04/12/98
//_RPT4(_CRT_WARN,"%d-%d-%f-%x\n",buffer->ulNextToCompute,nbbytes_to_calcul,buffer->dLastDeltaT,SND_fn_rGetPosBufferSample((long)buffer));
IDirectSoundBuffer_GetCurrentPosition(buffer_client->lpDSBuffer,&playptr,&writeptr);
playptr=(playptr>>buffer_client->ulDecalBytes)<<buffer_client->ulDecalBytes;
nbbytes_to_calcul=playptr-(buffer_asynchron->ulNextToCompute<<buffer_client->ulDecalBytes);
if ((long)nbbytes_to_calcul<0) nbbytes_to_calcul+=buffer_asynchron->ulSamples<<buffer_client->ulDecalBytes;
buffer_client->dLastDeltaT-=(double)(nbbytes_to_calcul>>buffer_client->ulDecalBytes)/buffer_client->stFormat.uFormat.stPCM.ulFreq;
if (buffer_client->dLastDeltaT<0.0)
buffer_client->dLastDeltaT=0.0;
if (nbbytes_to_calcul)
{
result=
IDirectSoundBuffer_Lock(buffer_client->lpDSBuffer
,buffer_asynchron->ulNextToCompute<<buffer_client->ulDecalBytes,nbbytes_to_calcul
,&ptr1,&sizeptr1,&ptr2,&sizeptr2,0);
while (result==DSERR_BUFFERLOST)
{
result=IDirectSoundBuffer_Restore(buffer_client->lpDSBuffer);
if (result!=DSERR_BUFFERLOST)
result=
IDirectSoundBuffer_Lock(buffer_client->lpDSBuffer
,buffer_asynchron->ulNextToCompute<<buffer_client->ulDecalBytes,nbbytes_to_calcul
,&ptr1,&sizeptr1,&ptr2,&sizeptr2,0);
}
if (result != DS_OK)
DebugBreak();
if (sizeptr1!=nbbytes_to_calcul)
{//wrap out
(*(buffer_asynchron->pfnCallback))(
buffer_client->lUserId
,buffer_asynchron->ulNextToCompute
,sizeptr1>>buffer_client->ulDecalBytes
,ptr1);
snd_assert(ptr2);
(*(buffer_asynchron->pfnCallback))(
buffer_client->lUserId
,0
,sizeptr2>>buffer_client->ulDecalBytes
,ptr2);
snd_assert(sizeptr2==(nbbytes_to_calcul-sizeptr1));
buffer_asynchron->ulNextToCompute=sizeptr2>>buffer_client->ulDecalBytes;
}
else
{
(*(buffer_asynchron->pfnCallback))(
buffer_client->lUserId
,buffer_asynchron->ulNextToCompute
,sizeptr1>>buffer_client->ulDecalBytes
,ptr1);
buffer_asynchron->ulNextToCompute+=nbbytes_to_calcul>>buffer_client->ulDecalBytes;
if (buffer_asynchron->ulNextToCompute==buffer_asynchron->ulSamples)
buffer_asynchron->ulNextToCompute=0;
}
IDirectSoundBuffer_Unlock(buffer_client->lpDSBuffer,ptr1,sizeptr1,ptr2,sizeptr2);
buffer_client->ulTimeNextToCompute=timeGetTime();
}
}
// we manage a stack of buffers to be played one after another
void refresh_buffer_stack(p_tdstBufferClient buffer)
{
}
void updateClients()
{
p_tdstBufferClient buffer_client;
int i;
//--- buffers clients
//update buffers clients
SNDLST2_M_DynamicForEachElementOf(&buffers_clients.pList,buffer_client,i)
{
if (!(buffer_client->dwFlags & FLAG_PAUSED)) //bPaused)
{
switch (buffer_client->eType)
{
case BUFFER_ASYNCHRONE:
case BUFFER_SYNCHRONE:
refresh_buffer_asynchrone(buffer_client);
break;
case BUFFER_STACK:
refresh_buffer_stack(buffer_client);
break;
}
}
}
}
void SND_fn_vSetParamBufferSxdWave(long id_buffer,SoundParam *par)
{
#ifndef DISABLE_WAVE
p_tdstBufferClient buffer;
DWORD dwPitch;
unsigned char ucDSvolume;
if ((id_buffer == -1)||(id_buffer == 0)) return;
buffer = (p_tdstBufferClient)id_buffer;
if (driver_SND_OK == FALSE)
return ;
if (buffer->lpDSBuffer==NULL)
return; //04/12/98
if (par)
{
ucDSvolume=M_AdaptVolume(par->ucVol
,buffer->stFormat.uFormat.stPCM.uwNbChannels
,TRUE);
IDirectSoundBuffer_SetVolume(buffer->lpDSBuffer,vol_2_hth_dB[ucDSvolume]);
dwPitch=(DWORD)(M_RealToDoubleSnd(par->Freq)*(double)(buffer->stFormat.uFormat.stPCM.ulFreq));
}
else
{
ucDSvolume=M_AdaptVolume(127
,buffer->stFormat.uFormat.stPCM.uwNbChannels
,TRUE);
IDirectSoundBuffer_SetVolume(buffer->lpDSBuffer,vol_2_hth_dB[ucDSvolume]);
dwPitch=buffer->stFormat.uFormat.stPCM.ulFreq;
}
IDirectSoundBuffer_SetFrequency(buffer->lpDSBuffer,dwPitch);
#endif
}
void SND_fn_vDeleteBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE)
return ;
if ((id_buffer == -1)||(id_buffer == 0)) return;
SND_fn_vEnterCriticalSectionThreadSnd();
SNDLST2_M_DynamicIsolate((p_tdstBufferClient)id_buffer);
if (!(((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_VIRTUAL)) //forceRelease 01/09/98
{
if (((p_tdstBufferClient)id_buffer)->lpDSBuffer) //precaution 01/09/98
{
IDirectSoundBuffer_Stop(((p_tdstBufferClient)id_buffer)->lpDSBuffer);
IDirectSoundBuffer_Release(((p_tdstBufferClient)id_buffer)->lpDSBuffer);
((p_tdstBufferClient)id_buffer)->lpDSBuffer=NULL;
}
}
SND_fn_vFreeSnd((void*)id_buffer);
SND_fn_vQuitCriticalSectionThreadSnd();
#endif //DISABLE_WAVE
}
void SND_fn_vPauseBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if ((driver_SND_OK == FALSE)||id_buffer==0) { //id_buffer: 04/12/98
return ;
}
if (
(id_buffer!=C_PLAY_FAILED)
&& (!((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_PAUSED) //bPaused
)
{
//((p_tdstBufferClient)id_buffer)->bPaused=TRUE;
((p_tdstBufferClient)id_buffer)->dwFlags|=FLAG_PAUSED;
if (!((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_VIRTUAL)
{
if (((p_tdstBufferClient)id_buffer)->lpDSBuffer!=NULL) //04/12/98
IDirectSoundBuffer_Stop(((p_tdstBufferClient)id_buffer)->lpDSBuffer);
}
}
#endif
}
void SND_fn_vResumeBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE) {
return ;
}
if (id_buffer!=C_PLAY_FAILED)
{
if (((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_PAUSED) //bPaused)
{
if (! (((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_VIRTUAL))
if (((p_tdstBufferClient)id_buffer)->lpDSBuffer!=NULL) //04/12/98
IDirectSoundBuffer_Play(((p_tdstBufferClient)id_buffer)->lpDSBuffer,0,0,DSBPLAY_LOOPING);
//raj de l'horloge d'interpolation
((p_tdstBufferClient)id_buffer)->ulTimeNextToCompute=timeGetTime();
((p_tdstBufferClient)id_buffer)->dwFlags&=~FLAG_PAUSED; //bPaused=FALSE;
}
}
#endif
}
void* SND_fn_pvGetPtrBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE) {
return NULL;
}
#endif
return NULL;
}
SndReal SND_fn_rGetPosBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
tdstBufferClient *buffer;
DWORD lT;
double deltaT;
double rT;
if (driver_SND_OK == FALSE) {
return SND_C_POS_UNKNOWN;
}
if (id_buffer==C_PLAY_FAILED)
return SND_C_POS_UNKNOWN;
buffer=(tdstBufferClient*)id_buffer;
//if (!buffer->bPaused)
if (!(buffer->dwFlags&FLAG_PAUSED))
{
//deltaT=real time between now and the last computed sample
lT=timeGetTime();
if (buffer->ulTimeNextToCompute)
deltaT=(double)(lT-buffer->ulTimeNextToCompute)/1000.0;
else
deltaT=0.0;
if (deltaT>buffer->dLastDeltaT)
{
buffer->dLastDeltaT=deltaT;
if (buffer->dLastDeltaT>=(double)buffer->uParam.stAsynchrone.ulSamples/buffer->stFormat.uFormat.stPCM.ulFreq)
{//big looping problem => slow slow slow...
buffer->dLastDeltaT=0.0;
}
}
}
//rT=last coherent value (ulNextToCompute) + time interpolation (dLastDeltaT)
rT=(double)buffer->uParam.stAsynchrone.ulNextToCompute/buffer->stFormat.uFormat.stPCM.ulFreq
+buffer->dLastDeltaT;
//modulo T (duration of buffer)
while (rT>=(double)buffer->uParam.stAsynchrone.ulSamples/buffer->stFormat.uFormat.stPCM.ulFreq)
rT-=(double)buffer->uParam.stAsynchrone.ulSamples/buffer->stFormat.uFormat.stPCM.ulFreq;
return M_DoubleToRealSnd(rT);
#endif
return SND_C_POS_UNKNOWN;
}
/*---------------------------------------------------------------------------
FUNCTION: fn_lCreateDxBufferForClientBuffer
ROLE: Create directsound buffer for client buffer
(for internal use only)
MODIFICATIONS:
01/09/98 - Joel Vibert - isolated from CreateNewBufferExAsynchrone
---------------------------------------------------------------------------*/
#ifndef DISABLE_WAVE
long fn_lCreateDxBufferForClientBuffer(p_tdstBufferClient buffer, SoundParam* par, tdstBufferClientAsynchrone *buffer_asynchron)
{
DWORD sizeptr1,sizeptr2;
LPVOID ptr1,ptr2;
DWORD dwPitch;
PCMWAVEFORMAT pcmwf;
DSBUFFERDESC dsbdesc;
HRESULT res;
unsigned char ucDSvolume;
// Set up wave format structure.
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
pcmwf.wf.wFormatTag=WAVE_FORMAT_PCM;
pcmwf.wf.nChannels=buffer->stFormat.uFormat.stPCM.uwNbChannels; //pformat->uFormat.stPCM.uwNbChannels;
pcmwf.wf.nSamplesPerSec=buffer->stFormat.uFormat.stPCM.ulFreq; //pformat->uFormat.stPCM.ulFreq;
pcmwf.wBitsPerSample=buffer->stFormat.uFormat.stPCM.uwResolution; //pformat->uFormat.stPCM.uwResolution;
pcmwf.wf.nBlockAlign=pcmwf.wf.nChannels*pcmwf.wBitsPerSample/8;
pcmwf.wf.nAvgBytesPerSec=pcmwf.wf.nSamplesPerSec*pcmwf.wf.nBlockAlign;
// Set up DSBUFFERDESC structure.
memset(&dsbdesc,0,sizeof(DSBUFFERDESC));
dsbdesc.dwSize=sizeof(DSBUFFERDESC);
dsbdesc.dwFlags=DSBCAPS_CTRLDEFAULT|DSBCAPS_LOCSOFTWARE;
dsbdesc.dwBufferBytes=buffer_asynchron->ulSamples<<buffer->ulDecalBytes;
dsbdesc.lpwfxFormat=(LPWAVEFORMATEX)&pcmwf;
// create buffer
if ((res=IDirectSound_CreateSoundBuffer(g_lpDirectSoundObject
,&dsbdesc
,&buffer->lpDSBuffer
,NULL))==DS_OK) {
IDirectSoundBuffer_Lock(buffer->lpDSBuffer,0,dsbdesc.dwBufferBytes,&ptr1,&sizeptr1,&ptr2,&sizeptr2,0);
//pCallback->uCallback.CallbackASynchrone
buffer_asynchron->pfnCallback(buffer->lUserId,0,sizeptr1>>buffer->ulDecalBytes,ptr1);
IDirectSoundBuffer_Unlock(buffer->lpDSBuffer,ptr1,sizeptr1,ptr2,sizeptr2);
IDirectSoundBuffer_Play(buffer->lpDSBuffer,0,0,DSBPLAY_LOOPING);
if (par) {
ucDSvolume=M_AdaptVolume(par->ucVol,buffer->stFormat.uFormat.stPCM.uwNbChannels,TRUE);
IDirectSoundBuffer_SetVolume(buffer->lpDSBuffer,vol_2_hth_dB[ucDSvolume]);
dwPitch=(DWORD)(M_RealToDoubleSnd(par->Freq)*(double)(buffer->stFormat.uFormat.stPCM.ulFreq));
}
else {
ucDSvolume=M_AdaptVolume(127,buffer->stFormat.uFormat.stPCM.uwNbChannels,TRUE);
IDirectSoundBuffer_SetVolume(buffer->lpDSBuffer,vol_2_hth_dB[ucDSvolume]);
dwPitch=buffer->stFormat.uFormat.stPCM.ulFreq;
}
IDirectSoundBuffer_SetFrequency(buffer->lpDSBuffer,dwPitch);
}
else
{
return C_PLAY_FAILED;
}
return (long)buffer;
}
#endif
long CreateNewBufferExAsynchrone(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
#ifndef DISABLE_WAVE
p_tdstBufferClient buffer;
tdstBufferClientAsynchrone *buffer_asynchron;
long res;
if (driver_SND_OK == FALSE)
return C_PLAY_FAILED;
buffer=SND_fn_pvMallocSnd(sizeof(tdstBufferClient));
buffer_asynchron=&buffer->uParam.stAsynchrone;
SNDLST2_M_DynamicInitElement(buffer);
buffer->eType=BUFFER_ASYNCHRONE;
buffer->lUserId=user_id;
buffer_asynchron->ulSamples=pformat->uFormat.stPCM.ulNbSamples;
buffer->ulDecalBytes=((pformat->uFormat.stPCM.uwResolution==8) ? 0 : 1) + ((pformat->uFormat.stPCM.uwNbChannels==1) ? 0 : 1);
buffer_asynchron->pfnCallback=pCallback->uCallback.CallbackASynchrone;
buffer_asynchron->ulNextToCompute=0;
buffer->ulTimeNextToCompute=0;
buffer->dLastDeltaT=0.0;
//buffer->bPaused=FALSE;
buffer->dwFlags=0;
if (bReleasedForced) buffer->dwFlags|=FLAG_VIRTUAL;
//--
buffer->lpDSBuffer=NULL;
memcpy(&buffer->stFormat,pformat,sizeof(SND_tdstFormat));
if (bReleasedForced)
{
SNDLST2_M_DynamicAddTail(&buffers_clients.pList,buffer);
return (long)buffer;
} else
{
res=fn_lCreateDxBufferForClientBuffer(buffer, par, buffer_asynchron);
if (res==C_PLAY_FAILED)
return res;
SNDLST2_M_DynamicAddTail(&buffers_clients.pList,buffer);
return res; //(long)buffer
}
#else //DISABLE_WAVE
return C_PLAY_FAILED;
#endif
}
//synchronous buffer= simulation by a small asynchronous buffer
long CreateNewBufferExSynchrone(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
SND_tdstFormat stFormatSynchrone;
SND_tdstCallback stCallbackSynchrone;
long id_buffer;
//no difference between synchronous and asynchronous versions
memcpy(&stFormatSynchrone,pformat,sizeof(stFormatSynchrone));
stFormatSynchrone.uFormat.stPCM.ulNbSamples=stFormatSynchrone.uFormat.stPCM.ulFreq*400/1000;
memcpy(&stCallbackSynchrone,pCallback,sizeof(stCallbackSynchrone));
id_buffer=CreateNewBufferExAsynchrone(&stFormatSynchrone,&stCallbackSynchrone,par,user_id);
if (id_buffer!=C_PLAY_FAILED)
((p_tdstBufferClient)id_buffer)->eType=BUFFER_SYNCHRONE;
return id_buffer;
}
//creation of a synchronous client buffer
long CreateNewBufferExStack(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
#ifndef DISABLE_WAVE
#endif
return C_PLAY_FAILED;
}
long SND_fn_lCreateNewBufferExSxdWave(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
switch (pCallback->eType)
{
case BUFFER_ASYNCHRONE:
return CreateNewBufferExAsynchrone(pformat,pCallback,par,user_id);
case BUFFER_SYNCHRONE:
//no difference between synchronous and asynchronous versions
return CreateNewBufferExSynchrone(pformat,pCallback,par,user_id);
case BUFFER_STACK:
return CreateNewBufferExStack(pformat,pCallback,par,user_id);
default:
return C_PLAY_FAILED;
}
}
//obsolete: emulation via new fonction
long SND_fn_lCreateNewBufferSxdWave(unsigned long nb_samples,unsigned short uwResolution,unsigned short uwNbChannels,unsigned long ulFreq,SoundParam* par,td_pfn_vRefreshBufferClient callback,long user_id)
{
#ifndef DISABLE_WAVE
SND_tdstFormat format;
SND_tdstCallback Callback;
memset(&format,0,sizeof(format));
format.eZip=SAMPLE_PCM;
format.uFormat.stPCM.ulNbSamples=nb_samples;
format.uFormat.stPCM.uwResolution=uwResolution;
format.uFormat.stPCM.uwNbChannels=uwNbChannels;
format.uFormat.stPCM.ulFreq=ulFreq;
memset(&Callback,0,sizeof(Callback));
Callback.eType=BUFFER_ASYNCHRONE;
Callback.uCallback.CallbackASynchrone=callback;
return SND_fn_lCreateNewBufferExSxdWave(&format,&Callback,par,user_id);
#endif
}
long SND_fn_lGetPosBufferExSxdWave(long id_buffer)
{
return SND_C_POS_UNKNOWN;
}
long SND_fn_lPushBufferExSxdWave(long id_buffer,SND_tdstStackBuffer* pStack)
{
return C_PLAY_FAILED;
}
void fn_vForceReleaseClientBuffers(void)
{
p_tdstBufferClient buffer_client;
int i;
//force release of client buffers
SNDLST2_M_DynamicForEachElementOf(&buffers_clients.pList,buffer_client,i)
{
if ((buffer_client!=NULL)&&((long)buffer_client!=-1))
{
if (!(buffer_client->dwFlags&FLAG_VIRTUAL)) //forceRelease 01/09/98
{
buffer_client->dwFlags|=FLAG_VIRTUAL;
if (buffer_client->lpDSBuffer) //precaution 01/09/98
{
IDirectSoundBuffer_Stop(buffer_client->lpDSBuffer);
IDirectSoundBuffer_Release(buffer_client->lpDSBuffer);
buffer_client->lpDSBuffer=NULL;
} //Loop
} //!FLAG_VIRTUAL
} //valid buffer_client
} //SNDLST2_M_DynamicForEachElementOf
}
void fn_vForceRestoreClientBuffers(void)
{
p_tdstBufferClient buffer_client;
int i;
unsigned char ucDSvolume;
//reactivate client buffers
SNDLST2_M_DynamicForEachElementOf(&buffers_clients.pList,buffer_client,i)
{
if (fn_lCreateDxBufferForClientBuffer(buffer_client, //create directsound buffer
NULL , //SoundParam* par,
&buffer_client->uParam.stAsynchrone)!=C_PLAY_FAILED)
{
if (buffer_client->dwFlags&FLAG_PAUSED) //paused => pause again
{
buffer_client->dwFlags&=~(FLAG_PAUSED|FLAG_VIRTUAL);
SND_fn_vPauseBufferSxdWave((long)buffer_client);
}
if (buffer_client->dwFlags&FLAG_SETVIRTVOL) /* restore volume */
{
buffer_client->dwFlags&=~FLAG_SETVIRTVOL;
//if (buffer->Attack)
// IDirectSoundBuffer_SetVolume(buffer->Attack,uwVolume);
if (buffer_client->lpDSBuffer)
{
ucDSvolume=M_AdaptVolume(((buffer_client->dwFlags&C_VIRTUAL_VOL_MASK)>>C_VIRTUAL_VOL_SHIFT)
,buffer_client->stFormat.uFormat.stPCM.uwNbChannels
,TRUE);
IDirectSoundBuffer_SetVolume(buffer_client->lpDSBuffer,vol_2_hth_dB[ucDSvolume]);
}
} //FLAG_SETVIRTVOL
if (buffer_client->dwFlags&FLAG_SETVIRTFREQ) /* restore frequency */
{
buffer_client->dwFlags&=~FLAG_SETVIRTFREQ;
if (buffer_client->lpDSBuffer)
IDirectSoundBuffer_SetFrequency(buffer_client->lpDSBuffer,
buffer_client->ulFreq);
} //FLAG_SETVIRTFREQ
}
}
}

View File

@@ -0,0 +1,543 @@
/*-----------------------------------------------------
FILE: Sndeax.c
AUTHOR: Dominique Dumont
DATE: November 16th 1998
ROLE: Management of EAX effects WITH DirectSound3D
-----------------------------------------------------*/
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "SNDinc.h" //for USE_EAX
#include "eax.h"
#include "sndeax.h"
//
#if defined(_DLL_COMPILATION_MODE) && defined(_DLL_MODULE)
#include "snddll.h"
#endif
//
#ifdef USE_EAX
/*-----------------------------------------------------------
TYPEDEFS
-----------------------------------------------------------*/
typedef struct
{
EAX_REVERBPROPERTIES props;
int iProgNumber;
} tdstPreset;
/*-----------------------------------------------------------
VARIABLES
-----------------------------------------------------------*/
LPDIRECTSOUNDBUFFER lpPermanent2ndBufferToAttackEax = NULL;
LPKSPROPERTYSET lpPropertySet = NULL;
float fReverbMix = EAX_REVERBMIX_USEDISTANCE;
BOOL bIsEaxOk = FALSE;
EAX_REVERBPROPERTIES myPresets[30] = {
EAX_PRESET_GENERIC, //0
EAX_PRESET_PADDEDCELL, //1
EAX_PRESET_ROOM,//2
EAX_PRESET_BATHROOM,//3
EAX_PRESET_LIVINGROOM,//4
EAX_PRESET_STONEROOM,//5
EAX_PRESET_AUDITORIUM,//6
EAX_PRESET_CONCERTHALL,//7
EAX_PRESET_CAVE,//8
EAX_PRESET_ARENA,//9
EAX_PRESET_HANGAR,//10
EAX_PRESET_CARPETEDHALLWAY, //1
EAX_PRESET_HALLWAY,//12
EAX_PRESET_STONECORRIDOR, //13
EAX_PRESET_ALLEY,//14
EAX_PRESET_FOREST,//15
EAX_PRESET_CITY,//16
EAX_PRESET_MOUNTAINS,//17
EAX_PRESET_QUARRY,//18
EAX_PRESET_PLAIN,//19
EAX_PRESET_PARKINGLOT,//20
EAX_PRESET_SEWERPIPE,//21
EAX_PRESET_UNDERWATER,//22
EAX_PRESET_DRUGGED,//23
EAX_PRESET_DIZZY,//24
EAX_PRESET_PSYCHOTIC};//25
tdstPreset *pUserPresets = NULL;
int iNbUserPresets;
BOOL bUserPresetsAreGood = FALSE;
#endif
//---------------------------------------------------------
// int fniReadEaxPrograms()
//---------------------------------------------------------
//
//
//---------------------------------------------------------
int fniReadEaxPrograms()
{
#ifdef USE_EAX
FILE * fEAX;
char line[300];
char fileLocation[310];
int iRet;
float myFloat;
char commande[100];
BOOL bOk;
int iPhase;
// mini init
if (pUserPresets != NULL)
{
SND_fn_vFreeSnd(pUserPresets);
}
iNbUserPresets = 0;
bUserPresetsAreGood = FALSE;
/////////////////////////////////////////////////////
// Computes the name of the program file and opens it
strncpy(fileLocation,SND_fn_szGetSoftDirectory(),300);
strcat(fileLocation,"\\eax.prg");
fEAX = fopen(fileLocation,"rt");
if (fEAX== NULL)
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"EAX PROGRAM FILE NOT PRESENT");
return 1;
}
bOk = TRUE;
iPhase = 4;
do
{
if(fgets(line,300,fEAX) != NULL)
{
if ((line[0] == ' ')||(line[0] == ';')||(line[0] == 10)||(line[0] == 13)||(line[0] == '\0'))
{
// Commentaire
}
else
{
// no comment :-)
iRet = sscanf(line,"%s : %f",commande,&myFloat);
if (strcmp(commande,"PRG")==0)
{
if (iPhase == 4)
{
// We must create a new program entry
if (iNbUserPresets)
{
pUserPresets=SND_fn_pvReAllocSnd(pUserPresets,sizeof(tdstPreset)*(iNbUserPresets+1));
}
else
{
pUserPresets=SND_fn_pvMallocSnd(sizeof(tdstPreset));
}
pUserPresets[iNbUserPresets].iProgNumber = (long)myFloat;
iPhase = 0;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 2;
}
}
else
if (strcmp(commande,"ENV")==0)
{
if (iPhase == 0)
{
pUserPresets[iNbUserPresets].props.environment = (long)myFloat;
iPhase = 1;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 3;
}
}
else
if (strcmp(commande,"VOL")==0)
{
if (iPhase == 1)
{
pUserPresets[iNbUserPresets].props.fVolume = myFloat;
iPhase = 2;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 4;
}
}
else
if (strcmp(commande,"DEC")==0)
{
if (iPhase == 2)
{
pUserPresets[iNbUserPresets].props.fDecayTime_sec = myFloat;
iPhase = 3;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 5;
}
}
else
if (strcmp(commande,"DAM")==0)
{
if (iPhase == 3)
{
pUserPresets[iNbUserPresets].props.fDamping = myFloat;
iNbUserPresets++;
iPhase = 4;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 6;
}
}
}
}
else
{
bOk = FALSE;
}
}
while (bOk);
if (iPhase != 4)
{
bUserPresetsAreGood = FALSE;
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
}
else
{
bUserPresetsAreGood = TRUE;
}
fclose(fEAX);
#endif
return 0;
}
//---------------------------------------------------------
// BOOL fn_bIsEaxAvailable()
//---------------------------------------------------------
//
//
//---------------------------------------------------------
BOOL fn_bIsEaxAvailable()
{
#ifdef USE_EAX
return bIsEaxOk;
#else
return FALSE;
#endif
}
//---------------------------------------------------------
// void SND_fn_vInitEaxModule(LPDIRECTSOUND lpDSO)
//---------------------------------------------------------
// Initialize the eax module
// set the bIsEaxOk flag
//---------------------------------------------------------
void SND_fn_vInitEaxModule(LPDIRECTSOUND lpDSO)
{
#ifdef USE_EAX
WAVEFORMATEX pcmOut; // Format of the wave for secondary buffer if we need to make one.
DSBUFFERDESC dsbdSecondary; // description for creating secondary buffer if we need to make one.
HRESULT hr;
ULONG ulSupport = 0;
bIsEaxOk = FALSE;
if(lpPermanent2ndBufferToAttackEax == NULL)
{
// we don't have a secondary to work with so we will create one.
ZeroMemory( &dsbdSecondary, sizeof(DSBUFFERDESC));
ZeroMemory( &pcmOut, sizeof(WAVEFORMATEX));
// any format should do I just say 11kHz 16 bit mono
pcmOut.wFormatTag = WAVE_FORMAT_PCM;
pcmOut.nChannels = 1;
pcmOut.nSamplesPerSec = 11025;
pcmOut.nAvgBytesPerSec = 22050;
pcmOut.nBlockAlign = 2;
pcmOut.wBitsPerSample = 16;
pcmOut.cbSize = 0;
// size is just arbitary but not too small as I have seen problems with single sample buffers...
dsbdSecondary.dwSize = sizeof(DSBUFFERDESC);
dsbdSecondary.dwBufferBytes = 1024;
dsbdSecondary.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_STATIC ;
dsbdSecondary.lpwfxFormat = &pcmOut;
if( FAILED(hr=IDirectSound_CreateSoundBuffer(lpDSO,&dsbdSecondary,&lpPermanent2ndBufferToAttackEax,NULL)))
{
// MessageBox( hWndDemo, "Create secondary for getting property set extention failed",
// "Create secondary failed", MB_OK | MB_ICONSTOP );
// if we can't make a secondary we can't do anything else so just exit out.
bIsEaxOk = FALSE;
return;
}
fReverbMix = EAX_REVERBMIX_USEDISTANCE;
}
// if there is already a property set interface free it up before making a new one for the curent buffer
if(lpPropertySet != NULL)
{
IKsPropertySet_Release(lpPropertySet);
lpPropertySet = NULL;
}
// QI for the property set interface
if( FAILED( hr = IDirectSoundBuffer_QueryInterface(lpPermanent2ndBufferToAttackEax,&IID_IKsPropertySet,(void**)&lpPropertySet)))
{
//MessageBox( hWndDemo, "Couldn't QI for Property set interface",
// "QI PropertySet failed", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if our listener related property set is avalible and supports everything.
if( FAILED( hr = IKsPropertySet_QuerySupport(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties,
DSPROPERTY_EAX_ALL, &ulSupport)))
{
//MessageBox( hWndDemo, "Query support call failure",
// "Query support Error", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if we can get and set them.
if ((ulSupport &(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)) != (KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET))
{
//MessageBox( hWndDemo, "can't get and set all properties in Property set interface",
// "No EAX Support", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if our Buffer related property set is avalible and supports everything.
if( FAILED( hr = IKsPropertySet_QuerySupport(lpPropertySet,&DSPROPSETID_EAXBUFFER_ReverbProperties,DSPROPERTY_EAXBUFFER_ALL, &ulSupport)))
{
//MessageBox( hWndDemo, "Query support call failure",
// "Query support Error", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if we can get and set them.
if ((ulSupport &(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)) != (KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET))
{
//MessageBox( hWndDemo, "can't get and set all properties in Property set interface",
// "No EAX Support", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// everything is avalible.
bIsEaxOk = TRUE;
fniReadEaxPrograms();
}
}
}
}
} //Queryinterface OK
#endif
}
//---------------------------------------------------------
// EAX_REVERBPROPERTIES *fnpGetUserProgram(WORD w)
//---------------------------------------------------------
// Search for the good preset and return his address
//
//---------------------------------------------------------
EAX_REVERBPROPERTIES *fnpGetUserProgram(WORD w)
{
#ifdef USE_EAX
int i;
if (bUserPresetsAreGood == TRUE)
{
for(i=0;i<iNbUserPresets;i++)
{
if (pUserPresets[i].iProgNumber == w)
{
return &(pUserPresets[i].props);
}
}
}
#endif
return NULL;
}
//---------------------------------------------------------
// void SND_fn_vSetPreset(unsigned long ulNewPreset)
//---------------------------------------------------------
// Set a new preset for the primary buffer
//
//---------------------------------------------------------
void SND_fn_vSetPreset(unsigned long ulNewPreset)
{
#ifdef USE_EAX
HRESULT hr;
if (bIsEaxOk == FALSE) return;
if(lpPropertySet != NULL)
{
if ((ulNewPreset & 0xFFFF) == 0)
{
if (FAILED(hr = IKsPropertySet_Set(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties, DSPROPERTY_EAX_ALL,
NULL,0,&myPresets[(ulNewPreset>>16)],sizeof(EAX_REVERBPROPERTIES))))
{
//ERROR "Could not Set Environment",
return;
}
}
else
{
EAX_REVERBPROPERTIES *pTemp;
pTemp = fnpGetUserProgram((unsigned short)(ulNewPreset & 0xFFFF));
if (pTemp != NULL)
{
if (FAILED(hr = IKsPropertySet_Set(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties, DSPROPERTY_EAX_ALL,
NULL,0,pTemp,sizeof(EAX_REVERBPROPERTIES))))
{
//ERROR "Could not Set Environment",
return;
}
}
else
{
//ERROR "Preset doesn't exist",
// but we apply the factory preset
if (FAILED(hr = IKsPropertySet_Set(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties, DSPROPERTY_EAX_ALL,
NULL,0,&myPresets[(ulNewPreset>>16)],sizeof(EAX_REVERBPROPERTIES))))
{
//ERROR "Could not Set Environment",
return;
}
}
}
}
#endif
}
//---------------------------------------------------------
// void SND_fn_vDesInitEaxModule()
//---------------------------------------------------------
// Close the eax module
//
//---------------------------------------------------------
void SND_fn_vDesInitEaxModule()
{
#ifdef USE_EAX
if(lpPropertySet != NULL)
{
IKsPropertySet_Release(lpPropertySet);
lpPropertySet = NULL;
}
if ( NULL != lpPermanent2ndBufferToAttackEax)
{
IDirectSoundBuffer_Release(lpPermanent2ndBufferToAttackEax);
lpPermanent2ndBufferToAttackEax = NULL;
}
if (pUserPresets != NULL)
{
SND_fn_vFreeSnd(pUserPresets);
}
iNbUserPresets = 0;
#endif
}
/*-------------------------------------------------
fn_bGetInterfEAX
ROLE: Gets the EAX interface
last modification: 24/03/98
by: Dom Dum
---------------------------------------------------*/
BOOL fn_bGetInterfEAX(LPDIRECTSOUNDBUFFER Buffer2D,LPKSPROPERTYSET *pBufferEAX)
{
#ifdef USE_EAX
if (fn_bIsEaxAvailable())
{
if( FAILED(IDirectSoundBuffer_QueryInterface(Buffer2D,&IID_IKsPropertySet,(void**)pBufferEAX)))
{
return FALSE;
}
else
{
return TRUE;
}
}
else
#endif
return TRUE;
}
/*-------------------------------------------------
BOOL set_param_eax(LPKSPROPERTYSET *pBufferEAX,unsigned char ucReverb,BOOL bReverbable)
---------------------------------------------------*/
BOOL set_param_eax(LPKSPROPERTYSET pBufferEAX,unsigned char ucReverb,BOOL bReverbable)
{
#ifdef USE_EAX
float tempReverb;
if (bIsEaxOk == FALSE) return TRUE;
if(pBufferEAX != NULL)
{
if (bReverbable== FALSE)
{
tempReverb = 0; // no reverb 1.0 = FULL REVERB
}
else
{
tempReverb = ((float)ucReverb/127.0f);
}
if (FAILED(IKsPropertySet_Set(pBufferEAX,&DSPROPSETID_EAXBUFFER_ReverbProperties, DSPROPERTY_EAXBUFFER_REVERBMIX,
NULL,0,&tempReverb,sizeof(float))))
{
//ERROR "Could not Set Environment",
return FALSE;
}
}
#endif
return TRUE;
}

View File

@@ -0,0 +1,42 @@
#include <windows.h>
#include <mmsystem.h>
#include "SNDinc.H"
#if defined(_DLL_COMPILATION_MODE)
#include "snddll.h"
#else
#endif
int SND_fn_iMixerInitSample(HWAVEOUT hWave)
{
return 0;
}
//==================================
// Get sample value
//==================================
// retourne la valeur du mixer
// sample en %
//
//==================================
DWORD SND_fn_dwGetSampleValue(void)
{
return 0;
}
//==================================
// Set sample value
// en %
//
//==================================
void SND_fn_vSetSampleValue(DWORD val)
{
}
int SND_fn_iMixerDesInitSample(void)
{
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,136 @@
#ifdef M_SET_ALIGNMENT
#pragma pack(push)
#pragma pack(M_SET_ALIGNMENT)
#endif
#undef DLL_IMPEXP
#define DLL_IMPEXP __declspec(dllexport)
//sections et options du SND_CPA.INI
#define DX3D_SECTION "Directx3D Options"
#define DX3D_NBVOICES_KEY "Nb Voices"
#define DX3D_GUID_KEY "GUID for "
#define DX3D_SPEAKERS_KEY "Speakers Configuration"
#define DX3D_DISABLE_A3D "Disable A3D"
#define DX3D_DISABLE_A3D_YES "Yes"
#define DX3D_DISABLE_A3D_NO "No"
//typedef publiques
typedef struct {
SndBool bGuidNULL;
GUID Guid;
char description[128];
char module[128];
DSCAPS caps;
SndBool bA3D:1;
SndBool bA3Dold:1;
int iA3DCertified;
} stGUIDAvailable;
typedef stGUIDAvailable* pstGUIDAvailable;
//describe a allocated DSBuffer
typedef struct _allocated_resource3D *p_allocated_resource3D;
//--------------------------------------------------- SAMPLE DX3D
typedef struct _tdstSampleMemoryDX3D tdstSampleMemoryDX3D;
typedef union _tduDataSampleDX3D tduDataSampleDX3D;
typedef struct _tdstTypeSampleMemDX3D tdstTypeSampleMemDX3D;
typedef union _tduRefResDX3D tduRefResDX3D;
typedef struct _tdstBlockResourceMemDX3D tdstBlockResourceMemDX3D;
typedef union _tduResMemDX3D tduResMemDX3D;
union _tduRefResDX3D {
tdxId Id;
tdstBlockResourceMemDX3D *pstPtr;
} ;
//DANGER:
//we must have sizeof(tdstBlockResourceMem)<sizeof(tdstBlockResourceMemDX3D)
//to avoid memory overflow after use of cast from tdstSampleMemory* to tdstSampleMemoryDX3D*
//parameters of a resource(sample) in memory
struct _tdstSampleMemoryDX3D {
p_allocated_resource3D allocated_resource;//point onto a allocated DsBuffer resource (if any); if NULL, no DSBuffer have been yet created ofr this resource
char *pcDataAttack; //pointer onto atatck data (first bytes of data to be copied in attack DSBuffer);NULL if no attack (ie whole loop)
char *pcDataLoop; //pointer onto loop data(first bytes of data to be copied in looping DSBuffer);NULL is no loop (ie one-shoot sample)
long lSizeAttackBuff;//size of attack buffer (contains a part of loop)
long lAttackToLoopPoint;//point where loop start in AttackBuffer
long lSizeLoopBuff;//size of looping buffer
} ;
//union de la description du sample
union _tduDataSampleDX3D{
tdstSampleMemoryDX3D stMem ;
tdstSampleStreaming stStream ;
} ;
//param<61>tres d'une ressource sample (donn<6E>es en mem)
struct _tdstTypeSampleMemDX3D {
SndBool bPitchable; //peut-on changer le pitch du sample
SndBool bVolable; //peut-on changer son volume
SndBool bPanable; //peut le paner
SndBool bSpacable; //peut-on lui appliquer un effet space
SndBool bReverbable; //peut-on (ou doit-on) le reverber
SndBool bStream; //streming ou en m<>moire
SndBool bLoop; //loope-t-il
tduDataSampleDX3D uData; //description du sample
unsigned long ulInc0 ; //p<>riode en echantillons
unsigned long ulFreq; //p<>riode en echantillons
unsigned short uwResolution; //nb de bits (8 ou 16)
unsigned short uwNbChannels; //nb de canaux(mono, st<73>reo ...)
tdeTypeZip eZip;
} ;
union _tduResMemDX3D {
tdstTypeSampleMemDX3D stSample ;
tdstTypeMidiMem stMidi ;
tdstTypeCD stCD;
tdstTypeSequenceMem stSequence ;
tdstTypeSwitchMem stSwitch ;
tdstTypeSplitMem stSplit;
tdstTypeThemeMem stTheme;
} ;
//description d'une ressource (donn<6E>es en m<>moire)
struct _tdstBlockResourceMemDX3D {
tdxId Id; //id de la ressource
tdeTypeResource eType; //type
tdeTypeStorage eStorage; //storage ???
unsigned char ucVolume; //volume par dfaut
SndBool bIsLoaded ; //TRUE si en m<>oire
tduResMemDX3D uRes ; //description propre <20> la ressource
// M_LstChildDeclaration(tdstBlockResourceMem,tdstSndPolyResource); //insertion dans la liste ACP
SNDLST2_M_StaticChildDeclaration(tdstBlockResourceMemDX3D*,tdstSndPolyResource*) //insertion dans la liste ACP
};
#ifdef M_SET_ALIGNMENT
#pragma pack(pop)
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus*/
DLL_IMPEXP int SND_CALL SND_fn_iGetGUIDList(pstGUIDAvailable lpGuidDescrption,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetWantedGUID(char* GUID_wanted,int size,SndBool *pbA3DDisable);
DLL_IMPEXP void SND_CALL SND_fn_vGetCurrentGUID(char* description,int size,SndBool *pbA3DDisable);
DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedGUID(char* wanted,char* selected,int size,SndBool bA3DDisable);
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentGUID(char* wanted,char* selected,int size,SndBool bA3DDisable);
DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bChangeCurrentSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bGetWantedSpeakerConfigurationSxdWave(DWORD *config,DWORD *geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bGetCurrentSpeakerConfigurationSxdWave(DWORD *config,DWORD *geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bIsDirect3DOptimum();
//concerver pour compatibilit<69>
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
SndBool SND_fn_bIsResourceLoopingSxdDX3D(tduRefResDX3D tduRes);
#ifdef __cplusplus
}
#endif /* __cplusplus*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,169 @@
#ifndef _SNDVIRT3D_H_
#define _SNDVIRT3D_H_
#include "sndlst2.h"
//to trace dsbuffer allocation/destruction
#define DEBUG_TRACE_DSBUFFERALLOCATION
//to trace voice usage
#define DEBUG_TRACE_VOICES
/*typedefs*/
typedef struct _virtual_module3D *SND_tdhVirtualModule3D;
SNDLST2_M_DynamicUseListOf(SND_tdhVirtualModule3D);
typedef struct _virtual_voice3D *p_virtual_voice3D;
SNDLST2_M_DynamicUseListOf(p_virtual_voice3D);
typedef struct _audible_voice3D *p_audible_voice3D;
SNDLST2_M_DynamicUseListOf(p_audible_voice3D);
typedef struct _dead_voice3D *p_dead_voice3D;
SNDLST2_M_DynamicUseListOf(p_dead_voice3D);
typedef struct _virtual_voice_list3D *p_virtual_voice_list3D;
typedef struct _allocated_resource3D *p_allocated_resource3D;
SNDLST2_M_DynamicUseListOf(p_allocated_resource3D);
typedef struct _virtual_voice3D{
SndReal rNorme; /*norme permettant le classement des voies (+/- distance au micro)*/
long lPrio; /*priority level*/
long lInstance; /*instace (+/- ordre d'arrivee)*/
SND_td_pfn_vSoundCallback pfnCallback;/*fonction de callback haut-niveau (passee <20> SND_fn_lPlayVirt)*/
long lParamCallback;
tduRefResDX3D tduRes; /*ressource virtuellement associee <20> l voie (passee <20> SND_fn_lPlayVirt)*/
long lSizeParam; /*taille du suivant*/
SoundParam* pstParam; /*copy du dernier SetParam*/
SndBool_field_decl(bHardCallback); /*TRUE if Callback called by hard-leve, FALSE if called by SNDVIRT*/
SndBool_field_decl(bUsed); /*FALSE si aucune reference n'a encore ete rendue publique = destrction immediate toleree*/
SndBool_field_decl(bPaused); /*TRUE si en pause*/
SndBool_field_decl(bWaitingLoop); /*TRUE if transition will occur*/
/*---*/
p_audible_voice3D audible; /*!=NULL si voie audible*/
p_dead_voice3D dead; /*!=NULL si voie audible*/
SNDLST2_M_DynamicElementDeclaration(p_virtual_voice3D)
} virtual_voice3D;
typedef struct _virtual_voice_list3D{
SNDLST2_M_DynamicAnchorDeclaration(p_virtual_voice3D) pList;
} virtual_voice_list3D;
/*liste des audibles*/
typedef struct _audible_voice3D{
p_virtual_voice3D voice;
SndBool bCheck;
p_allocated_resource3D allocated_res;//associated resource
SNDLST2_M_DynamicElementDeclaration(p_audible_voice3D)
} audible_voice3D;
typedef struct _audible_voice_list3D{
SNDLST2_M_DynamicAnchorDeclaration(p_audible_voice3D) pList;
} audible_voice_list3D;
/*liste des voies tuees (<28> desallouee ou <20> reutiliser pour une nouvelle voie*/
typedef struct _dead_voice3D{
p_virtual_voice3D voice;
SNDLST2_M_DynamicElementDeclaration(p_dead_voice3D)
} dead_voice3D;
typedef struct _dead_voice_list3D{
SNDLST2_M_DynamicAnchorDeclaration(p_dead_voice3D) pList;
} dead_voice_list3D;
typedef struct _allocated_resource3D{
tdstBlockResourceMemDX3D *pstRes3D; //ressource associated
SndBool bValid; //TRUE if allocated resource may serve for any other audible voice
p_audible_voice3D pAudibleVoice; //audible voice associated (if any)
//at least Attack or Loop should be not NULL
//Attack and Loop are both non NULL for looping with attack samples
//attack3D and loop3d are used if 3D is required
//if attack!=NULL and 3D required, Attack!=NULL (or 3D creation failled); idem for Loop/Loop3D
LPDIRECTSOUNDBUFFER Attack; // attack buffer (never played when looping)
LPDIRECTSOUNDBUFFER Loop; // looping buffer
LPDIRECTSOUND3DBUFFER Attack3D; // attack buffer (never played when looping)
LPDIRECTSOUND3DBUFFER Loop3D; // looping buffer
#ifdef USE_EAX
LPKSPROPERTYSET AttackEAX;
LPKSPROPERTYSET LoopEAX;
#endif
//these 2 filed build a link from original BSBuffer to any duplicated buffers
p_allocated_resource3D original_resource;//pointer onto original DSBuffer isthis one has been created by duplicat an other one
//if NULL, this is a original DSbuffer
p_allocated_resource3D duplicate_resource;//pointer onto duplicated DSBuffer created from this one
//if NULL, there is no more duplicated of this DSBuffer
DWORD lLastPitch; //value of pitch at last update
DWORD lLastVolume; //value of volume at last update
SNDLST2_M_DynamicElementDeclaration(p_allocated_resource3D)
} allocated_resource3D;
typedef struct _allocated_resource3D_list{
SNDLST2_M_DynamicAnchorDeclaration(p_allocated_resource3D) pList;
} allocated_resource3D_list;
/*liste des module Virtual*/
typedef struct _virtual_module3D{
/*liste des voies virtuelles = id retournes par PlayVitual*/
virtual_voice_list3D virtual_voices;
/*liste des voies physique = id retournes par PlaySnd*/
audible_voice_list3D audible_voices;
/*liste des voies desallouees*/
dead_voice_list3D dead_voices;
long g_lInstance;
long g_lNbSxdAudible; //maximum wiche number of voices to be hearable
SNDLST2_M_DynamicElementDeclaration(SND_tdhVirtualModule3D)
} virtual_module3D;
/*functions*/
long SND_fn_lPlaySxdVirtual3D(tduRefRes res,SoundParam *par,long prio,SND_td_pfn_vSoundCallback fn_callback,long par_callback);
void SND_fn_vRemoveCallbackSxdVirtual3D(long voice);
SndBool SND_fn_bSetParamSxdVirtual3D(long voice,SoundParam *par);
SndBool SND_fn_bTestIsPlayingSxdVirtual3D(long voice);
void SND_fn_vStopSxdVirtual3D(long voice);
void SND_fn_vPauseSxdVirtual3D(long voice);
void SND_fn_vResumeSxdVirtual3D(long voice);
void SND_fn_vSynchroSxdVirtual3D();
SndReal SND_fn_rGetPosSxdVirtual3D(long voice);
SndReal SND_fn_rGetLengthSxdVirtual3D(long voice);
long SND_fn_lInitSxdVirtual3D(long lMaxNumberVoicesHearable);
SndBool SND_fn_bTestInitSxdVirtual3D();
void SND_fn_vDesInitSxdVirtual3D();
p_allocated_resource3D fn_pAllocateResource(tdstBlockResourceMemDX3D *mem);
void fn_vDesAllocateResource(p_allocated_resource3D pres3D);
SndBool fn_bCreate2ndBuffer(DSBUFFERDESC *pdsbdesc,char *pcData, LPDIRECTSOUNDBUFFER *pBuffer);
SndBool fn_bDuplicate2ndBuffer(LPDIRECTSOUNDBUFFER buffer, LPDIRECTSOUNDBUFFER *pBuffer);
void fn_vRelease2ndBuffer(LPDIRECTSOUNDBUFFER buffer);
SndBool fn_bTestDSBufferIsActive(p_audible_voice3D voice);
void fn_vGetDSInterfaces(p_allocated_resource3D pres3D);
void fn_vReleaseDSInterfaces(p_allocated_resource3D pres3D);
void fn_vPartiallyReleaseDSInterfaces(p_allocated_resource3D pres3D);
SndBool fn_bStart2ndBuffer(p_allocated_resource3D res3D,SoundParam* par,SndBool bLoop);
void set_param_DSBuffer(p_allocated_resource3D pres3D,SoundParam *par,SndBool bImmediate,SndBool bInconditionnal);
void fn_vStopDSBuffer(p_allocated_resource3D pres3D);
void fn_vStartCallBack(virtual_voice3D* pVoice);
void kill_virtual_voice3D(virtual_voice3D* pVoice);
extern allocated_resource3D_list g_AllocatedResources;
extern virtual_module3D g_VirtualModule3D;
#endif /*_SNDVIRT3D_H_*/

View File

@@ -0,0 +1,202 @@
/*---------------------------------------------------------------
FILE: micro3d.c
ROLE: management of Microphone+Doppler effect for DSound3d
MODIFICATIONS: - J.Vibert - 01/12/98 - extracted from sndxdwav.c
----------------------------------------------------------------*/
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "SNDinc.h"
#if defined(_DLL_COMPILATION_MODE) && defined(_DLL_MODULE)
#include "snddll.h"
#endif
#include "priv3dFl.h"
extern SndBool stereo_reverse;
extern SndBool driver_SND_OK;
extern LPDIRECTSOUND3DLISTENER lpListener3D;
long idMainMicro=C_CREATEMICRO_FAILED;
void SND_fn_vCreateMicroSxdWave(MicroParam* par,long idMicro)
{
#ifndef DISABLE_WAVE
DS3DLISTENER parameters;
SndVector dir_pv;
if (driver_SND_OK == FALSE) {
return ;
}
if (lpListener3D == NULL) return;
//only 1 micro supported
if (idMainMicro != C_CREATEMICRO_FAILED) return;
// VERSION computation of MICRO
parameters.dwSize = sizeof(DS3DLISTENER);
if (par!=NULL)
{
dir_pv.x = SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.z);
dir_pv.x -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.y);
dir_pv.y = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.z);
dir_pv.y -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.x);
dir_pv.z = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.y);
dir_pv.z -= SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.x);
if (!stereo_reverse) {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
} else {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
}
}
else
{
memset(&parameters.vPosition,0,sizeof(parameters.vPosition));
memset(&parameters.vVelocity,0,sizeof(parameters.vVelocity));
memset(&parameters.vOrientFront,0,sizeof(parameters.vOrientFront));
memset(&parameters.vOrientTop,0,sizeof(parameters.vOrientTop));
//05/11/98
parameters.vOrientFront.x=1.0f;
parameters.vOrientTop.z=1.0f;
}
parameters.flDistanceFactor = DISTANCE_FACTOR;
parameters.flRolloffFactor = ROLLOFF_FACTOR;
parameters.flDopplerFactor = DOPPLER_FACTOR;
IDirectSound3DListener_SetAllParameters(lpListener3D,&parameters,DS3D_DEFERRED);
idMainMicro =idMicro;
#endif
}
void SND_fn_vSetMicroParamSxdWave(long idMicro,MicroParam* par)
{
#ifndef DISABLE_WAVE
DS3DLISTENER parameters;
SndVector dir_pv;
// compute normal vector for this micro
if (driver_SND_OK == FALSE) {
return ;
}
if (lpListener3D == NULL) return;
if (idMicro != idMainMicro) return;
dir_pv.x = SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.z);
dir_pv.x -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.y);
dir_pv.y = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.z);
dir_pv.y -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.x);
dir_pv.z = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.y);
dir_pv.z -= SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.x);
parameters.dwSize = sizeof(DS3DLISTENER);
if (!stereo_reverse) {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
} else {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
}
parameters.flDistanceFactor = DISTANCE_FACTOR;
parameters.flRolloffFactor = ROLLOFF_FACTOR;
parameters.flDopplerFactor = DOPPLER_FACTOR;
IDirectSound3DListener_SetAllParameters(lpListener3D,&parameters,DS3D_DEFERRED);
#endif
}
void SND_fn_vDestroyMicroSxdWave(long sxdId)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE) {
return ;
}
idMainMicro = C_CREATEMICRO_FAILED;
#endif
}
//------------------------------------------------------------
// SetDopplerFactorSxdWave:change Doppler effect range
// input:new factor for Doppler effect
// 1.0=normal effect=physically realistic
// 0.0=no doppler effect
// output: none
//------------------------------------------------------------
void SND_fn_vSetDopplerFactorSxdWave(SndReal factor)
{
D3DVALUE flDopplerFactor;
if (driver_SND_OK == FALSE) {
return ;
}
if (lpListener3D == NULL) return;
/*
DS3D_MINDOPPLERFACTOR=0.0 to DS3D_MAXDOPPLERFACTOR=10.0
realistic=DS3D_DEFAULTDOPPLERFACTOR=1.0
*/
flDopplerFactor=(float)M_RealToDoubleSnd(factor);
if (flDopplerFactor<DS3D_MINDOPPLERFACTOR)
flDopplerFactor=DS3D_MINDOPPLERFACTOR;
else if (flDopplerFactor>DS3D_MAXDOPPLERFACTOR)
flDopplerFactor=DS3D_MAXDOPPLERFACTOR;
IDirectSound3DListener_SetDopplerFactor(lpListener3D,flDopplerFactor,DS3D_DEFERRED);
}

View File

@@ -0,0 +1,110 @@
/*---------------------------------------------------------------
FILE: priv3dFl.h
ROLE: private flags for DSound3d
MODIFICATIONS: - J.Vibert - 01/12/98 - extracted from sndxdwav.c
----------------------------------------------------------------*/
// suppress DEFINES (precaution to avoid random bug from visual)
#ifdef USE_DEBUGFILE
#undef USE_DEBUGFILE
#endif
#ifdef USE_TEST_CODE
#undef USE_TEST_CODE
#endif
#ifdef CREATE_ONLY
#undef CREATE_ONLY
#endif
#ifdef SIMU_CRITICAL_BUFF_NB
#undef SIMU_CRITICAL_BUFF_NB
#endif
#ifdef AVOID_FOCUS_PB
#undef AVOID_FOCUS_PB
#endif
//--------------------------------------------------------------------------
// DEFINES: comment or uncomment according to your needs
//--------------------------------------------------------------------------
//AVOID_FOCUS_PB=>if a bad window handle is used, allows to (still) hear sounds
//#define AVOID_FOCUS_PB
//USE_DEBUGFILE=>a call to jvdbg(char *) causes the string to be dumped into a file
#define USE_DEBUGFILE
//CREATE_ONLY=>buffers are always created during the play function or simply assigned
//otherwise, the first one is created "normally" during the play, and the next ones are
// duplicated or assigned(or created if the first one was destroyed or if an error occurred)
//[should be tested again]
//#define CREATE_ONLY
//DANGER_BUFF_NB: number of buffers left below which we must be very careful with buffer allocation
#define DANGER_BUFF_NB 8
//SIMU_CRITICAL_BUFF_NB: simulate allocated buffers
//(convenient to test DANGER_BUFF_NB on cards with many buffers)
//#define SIMU_CRITICAL_BUFF_NB
#define SIMU_BUFF_NB 235 //number of simulated allocated buffers (if SIMU_CRITICAL_BUFF_NB)
//very careful after SIMU_BUFF_NB+DANGER_BUFF_NB buffers
#define CRITICAL_BUFF_NB DANGER_BUFF_NB
//to activate temporary test code
//#define USE_TEST_CODE
#define DISTANCE_FACTOR 1.f
#define ROLLOFF_FACTOR 1.0f
#define DOPPLER_FACTOR 1.1f
#define FLAG_PLAYING 1
#define FLAG_LOOPING 2
#define FLAG_PAUSED 4
#define FLAG_3D 8
#define FLAG_WAITINGCALLBACK 16
#define FLAG_WAITINGLOOP 32
#define FLAG_VIRTUAL 256 // virtual management of sounds between ForceReleaseBuffer and ForceRestoreBuffer
#define FLAG_SETVIRTVOL 512 // modification of volume while Buffer released=>must be updated later
#define FLAG_SETVIRTFREQ 1024// modification of frequency while Buffer released=>must be updated later
#define C_VIRTUAL_VOL_MASK 0xFF0000 //the volume index is coded with the flags
#define C_VIRTUAL_VOL_SHIFT 0x10
//indicate if the directsound buffers have been created
#define FLAG_BUFFATT 64
#define FLAG_BUFFLOOP 128
#define FLAG_BUFFS (FLAG_BUFFATT|FLAG_BUFFLOOP)
//indicate if the data have been loaded (the same as the preceding flags now, but used to be !=)
//must be below 256 in current version (byte => mem)
#define FLAG_ALLOCATED 32
#define FLAG_LOADEDATT 64
#define FLAG_LOADEDLOOP 128
#define FLAG_LOADEDBUFFS (FLAG_LOADEDATT|FLAG_LOADEDLOOP)
/* global flags to indicate some actions to perform on the next ForceRestore */
#define SND_FLAG_FORCEVOL 1
/*
NB_VOICES maximum number of 3D voices description (1 or 2 buffers per voice)
>Number of virtual voices, to allow more allocations of buffers
Maximum number of virtual voices chosen by the dll: 31
F1: about 65 samples
31 voices can be played on MaxiSound (but 248 buffers can be created)
=>with 96 voices we should be able to avoid dynamic buffer creation
with F1 on cards with sufficient amount of buffers (MaxiSound...)
#define NB_VOICES 100
*/
#define NB_VOICES 64
#ifdef USE_DEBUGFILE
void jvdbg(char *s);
#else
#define jvdbg(a)
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,29 @@
/////////////////////////////////////////////////////////////////////////////
//
// VerifyA3D.h : header file for Aureal A3D verification handling.
//
/////////////////////////////////////////////////////////////////////////////
#ifndef __VERIFYA3D_H
#define __VERIFYA3D_H
#include <windows.h>
#ifdef __cplusplus
extern "C"
{
#endif
// Public verification function.
// Return TRUE if Aureal, FALSE if clone, -1 if check could not succeed.
extern int WINAPI VerifyAurealA3D(void);
#ifdef __cplusplus
}
#endif
#endif
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,66 @@
// A3DExample.c - example code-snippet for initializing A3D including certification check.
.
.
.
LPDIRECTSOUND lpDS;
int iResult;
char szError[80];
BOOL bA3DAvailable = FALSE;
// Create an A3D object.
iResult = A3dCreate(NULL, (void **) &lpDS, NULL);
if (iResult >= DS_OK)
{
// Check if the DLL is up-to-date.
if (iResult == A3D_OK_OLD_DLL)
{
// Tell the user to upgrade their drivers...
sprintf(szError, "Your A3D drivers are not current.\nPlease upgrade them at www.a3d.com");
}
iResult = VerifyAurealA3D();
if (iResult == FALSE)
{
// This is fake A3D!!! Say/do something about it...
sprintf(szError, "This is non-Aureal-certified A3D!\nPlease upgrade your drivers at www.a3d.com");
bA3DAvailable = FALSE;
// First release fake-A3D interface.
IDirectSound_Release(lpDS);
lpDS = NULL;
// Then use DirectSound in 2D-mode.
iResult = DirectSoundCreate(NULL, (void **) &lpDS, NULL);
if (iResult != DS_OK)
{
sprintf(szError, "Failed to create DirectSound object");
}
}
else if (iResult == TRUE)
{
// Everything is good. You have valid, certified Aureal A3D.
bA3DAvailable = TRUE;
}
else
{
// Could not verify A3D as Aureal-certified.
// Carry on, but user should be aware that cloned-A3D may cause problems in compatibility.
// The user should check at www.a3d.com for a list of certified A3D hardware.
bA3DAvailable = TRUE;
}
}
else
{
// Failed to intitialize with A3D, so use DirectSound in stereo-mode instead.
iResult = DirectSoundCreate(NULL, (void **) &lpDS, NULL);
bA3DAvailable = FALSE;
}
// Go on to do SetCooperativeLevel, etc.
.
.
.
}

View File

@@ -0,0 +1,85 @@
/*--------------------------------------------------------
FILE CMdxTool.h
ROLE : structure definition for main tool
LAST MODIFICATIONS:
- J.Vibert - 21/01/98 - fading
- J.Vibert - 21/01/98 - Main volume, incremental volume for MDX
- D.Dumont - created
--------------------------------------------------------*/
#ifndef __CMDXTOOL_H__
#define __CMDXTOOL_H__
#include <objbase.h>
#ifdef INIT
#include <initguid.h>
#endif /* INIT */
#include "IMDXTool.h"
// {DA64DF80-8A6C-11d1-B197-006097BAFA72}
DEFINE_GUID(CMDXTool_CLSID,
0xda64df80, 0x8a6c, 0x11d1, 0xb1, 0x97, 0x0, 0x60, 0x97, 0xba, 0xfa, 0x72);
typedef struct
{
IMDXTool Im;
int cRef;
WORD m_wMuteFlag;
WORD m_wVolFlag;
WORD m_wUserTempo;
WORD m_wActifTempo;
char m_cMainVolume;
char m_cFadeCoeff; //0..127
char m_cEndFadingVol;
long int m_lSlopeFading; // (dVol*10e6)/(dRt/1000)
char m_cFading; //boolean
REFERENCE_TIME m_rtEndFadingTime; //time when fading should end
char m_vol[16]; //incremental volume
char m_CurrVol[16]; //before mainVolume is applied, after incremental volume is applied
char m_RefVol[16]; //before incremental volume is applied (modified by volume change msg)
void ( _stdcall *pFadeCallback)(); //callback called when fading ends
} CMDXTool;
/*
Function prototypes, used to set up a VTable within
our class factory
*/
IMDXTool * fnpGetTool();
void fnvReleaseTool();
HRESULT _stdcall CMDXToolQueryInterface(IMDXTool *pIm, REFIID iid, void **ppv);
ULONG _stdcall CMDXToolAddRef( IMDXTool *pIm);
ULONG _stdcall CMDXToolRelease(IMDXTool *pIm);
HRESULT _stdcall CMDXToolInit(IMDXTool *pIm,IDirectMusicGraph* pGraph) ;
HRESULT _stdcall CMDXToolGetMsgDeliveryType(IMDXTool *pIm,DWORD* pdwDeliveryType ) ;
HRESULT _stdcall CMDXToolGetMediaTypeArraySize(IMDXTool *pIm,DWORD* pdwNumElements ) ;
HRESULT _stdcall CMDXToolGetMediaTypes(IMDXTool *pIm,DWORD** padwMediaTypes, DWORD dwNumElements) ;
HRESULT _stdcall CMDXToolProcessPMsg(IMDXTool *pIm,IDirectMusicPerformance* pPerf, DMUS_PMSG* pPMsg) ;
HRESULT _stdcall CMDXToolFlush(IMDXTool *pIm,IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG, REFERENCE_TIME rt) ;
void _stdcall SetUserTempo(IMDXTool *pIm,WORD wUserTempo);
void _stdcall SetMuteFlag(IMDXTool *pIm,WORD wMuteFlag);
void _stdcall SetVolFlag(IMDXTool *pIm,WORD wVolFlag);
void _stdcall SetVolValue(IMDXTool *pIm,int iChannel,char newValue);
void _stdcall SetMainVolValue(IMDXTool *pIm,char newValue);
char _stdcall GetMainVolValue(IMDXTool *pIm);
char _stdcall GetFadeCoeff(IMDXTool *pIm);
void _stdcall DoFade(IMDXTool *pIm, IDirectMusicPerformance* pPerf, char cBeginVolValue, char cEndVolValue, DWORD dwTimeFade, void *pCallback);
void _stdcall EndFade(IMDXTool *pIm);
char _stdcall IsFading(IMDXTool *pIm);
#endif /*CMDXTool_H */
/* End of file CMDXTool.h */

View File

@@ -0,0 +1,86 @@
#include "CMDXToolCF.h"
#include "CMDXTool.h"
HRESULT _stdcall CMDXToolCFQueryInterface( IClassFactory *pCF, REFIID iid, void **ppvObject)
{
CMDXToolCF *pThis = (CMDXToolCF *)pCF;
if( IsEqualIID( iid, &IID_IUnknown) ||IsEqualIID( iid, &IID_IClassFactory) )
{
*ppvObject = pThis;
pThis->icf.lpVtbl->AddRef(pCF );
return S_OK;
}
else
{
*ppvObject = NULL;
return E_NOINTERFACE;
}
}
ULONG _stdcall CMDXToolCFAddRef( IClassFactory *pCF )
{
CMDXToolCF *pThis = (CMDXToolCF *)pCF;
return ++pThis->cRef;
}
ULONG _stdcall CMDXToolCFRelease( IClassFactory *pCF )
{
CMDXToolCF *pThis = (CMDXToolCF *)pCF;
if( --pThis->cRef == 0 )
{
free( pThis );
return 0;
}
else
return pThis->cRef;
}
HRESULT _stdcall CMDXToolCFCreateInstance( IClassFactory *pICF, IUnknown * pUnkOuter, //Pointer to whether object is or isn't part of an aggregate
REFIID riid, /*Reference to the identifier of the interface*/
void ** ppvObject /*indirect pointer to the interface*/
)
{
CMDXToolCF *pThis = (CMDXToolCF *)pICF;
CMDXTool *pCM;
if( pUnkOuter != NULL )
{
return CLASS_E_NOAGGREGATION;
}
pCM = (CMDXTool *)malloc( sizeof( CMDXTool ) );
if( NULL == pCM )
{
return E_OUTOFMEMORY;
}
pCM->Im.lpVtbl = &IMVT;
pCM->cRef = 1;
/*
if( S_OK != pCM->Im.lpBack to the "COM Inproc Server in C" tutorial.tbl->pfnQueryInterface( &(pCM->Im), riid, ppvObject ) )
{
free( pCM );
return E_NOINTERFACE;
}
*/
pCM->Im.lpVtbl->pfnRelease(&(pCM->Im));
return TRUE;
}
HRESULT _stdcall CMDXToolCFLockServer( IClassFactory *pICF, BOOL fLock)
{
return S_OK;
}
struct IClassFactoryVtbl ICFVT =
{
CMDXToolCFQueryInterface,
CMDXToolCFAddRef,
CMDXToolCFRelease,
CMDXToolCFCreateInstance,
CMDXToolCFLockServer
};
/*//////////////////////// End of ClassFactory implementation //////////////////////*/

View File

@@ -0,0 +1,26 @@
/*//////////////////////////////// CMDXToolCF ////////////////////////////////
Contains information about the CMDXTool Class Factory that we'd like to export
Back to the "COM Inproc Server in C" tutorial.
*/
#ifndef CMDXToolCF_H
#define CMDXToolCF_H
#include "IMDXTool.h"
typedef struct _CMDXToolCF
{
IClassFactory icf;
int cRef;
} CMDXToolCF;
/*IMVT (IMDXTool VTable) is defined in CMDXTool.c */
extern struct IMDXTool_Vtbl IMVT ;
#endif /* CMDXToolCF_H */
/*//////////////////////////////// CMDXToolCF ////////////////////////////////*/

View File

@@ -0,0 +1,677 @@
/*--------------------------------------------------------
FILE CMdxTool.c
ROLE:
management of the performance tool, to modify tempo, volume...
LAST MODIFICATIONS:
- J.Vibert - 21/01/98 - fading
- J.Vibert - 21/01/98 - volumes modified by tool; Main volume, incremental volume for MDX
- D.Dumont - created, tempo modified by tool
--------------------------------------------------------*/
#define INIT /*only initialize GUIDs once per project. */
#include "CMdxtool.h"
#define _UNICODE
#include <TChar.h>
#ifdef _DEBUG
#define dbg0(msg) \
OutputDebugString(msg)
#else //release
#define dbg0(msg)
#endif //_DEBUG
const GUID MyIID_IDirectMusicTool2
={0xd2ac28ba, 0xb39b, 0x11d1, 0x87, 0x4, 0x0, 0x60, 0x8, 0x93, 0xb1, 0xbd};
CMDXTool *pCM;
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolQueryInterface(IMDXTool *pIm, REFIID iid, void **ppv)
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolQueryInterface(IMDXTool *pIm, REFIID iid, void **ppv)
{
CMDXTool *pThis = (CMDXTool *)pIm;
IID iidIMDXTool = IID_IMDXTool;
if( IsEqualIID( iid, &IID_IUnknown) || IsEqualIID( iid, &MyIID_IDirectMusicTool2) )
{
*ppv = &(pThis->Im);
((struct IMDXTool_Vtbl *)pIm->lpVtbl)->pfnAddRef( pIm );
return S_OK;
/*I think this means that we're technically cheating in the case of
//IUnknown: we really give out an implementation of the interface
//to IMDXTool(the first three of which are identical to IUnknown),and
// simply rely on the user to assume that only IUnknown methods are
// there*/
}
else
{
ppv = NULL;
return E_NOINTERFACE;
}
}
/*-------------------------------------------------------------------------------------------
ULONG _stdcall CMDXToolAddRef( IMDXTool *pIm)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
ULONG _stdcall CMDXToolAddRef( IMDXTool *pIm)
{
CMDXTool *pThis = (CMDXTool *)pIm;
return ++pThis->cRef;
}
/*-------------------------------------------------------------------------------------------
ULONG _stdcall CMDXToolRelease( IMDXTool *pIm)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
ULONG _stdcall CMDXToolRelease( IMDXTool *pIm)
{
CMDXTool *pThis = (CMDXTool *)pIm;
if( --pThis->cRef <= 0 )
{
//cCMDXTool--;
free( pThis );
return 0;
}
else
{
return pThis->cRef;
}
}
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolInit(IMDXTool *pIm,IDirectMusicGraph* pGraph)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolInit(IMDXTool *pIm,IDirectMusicGraph* pGraph)
{
// This tool has no need to do any type of initialization.
CMDXTool *pThis = (CMDXTool *)pIm;
return E_NOTIMPL;
}
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolGetMsgDeliveryType(IMDXTool *pIm,DWORD* pdwDeliveryType )
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolGetMsgDeliveryType(IMDXTool *pIm,DWORD* pdwDeliveryType )
{
// This tool wants messages immediately.
// This is the default, so returning E_NOTIMPL
// would work. The other method is to specifically
// set *pdwDeliveryType to the delivery type, DMUS_PMSGF_TOOL_IMMEDIATE,
// DMUS_PMSGF_TOOL_QUEUE, or DMUS_PMSGF_TOOL_ATTIME.
*pdwDeliveryType = DMUS_PMSGF_TOOL_IMMEDIATE;
return S_OK;
}
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolGetMediaTypeArraySize(IMDXTool *pIm,DWORD* pdwNumElements )
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolGetMediaTypeArraySize(IMDXTool *pIm,DWORD* pdwNumElements )
{
*pdwNumElements = 5;
return S_OK;
}
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolGetMediaTypeArraySize(IMDXTool *pIm,DWORD* pdwNumElements )
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolGetMediaTypes(IMDXTool *pIm,DWORD** padwMediaTypes, DWORD dwNumElements)
{
if( dwNumElements == 5)
{
// set the elements in the array to DMUS_PMSGT_NOTE,
// DMUS_PMSGT_MIDI, and DMUS_PMSGT_PATCH
(*padwMediaTypes)[0] = DMUS_PMSGT_NOTE;
(*padwMediaTypes)[1] = DMUS_PMSGT_MIDI;
(*padwMediaTypes)[2] = DMUS_PMSGT_PATCH;
(*padwMediaTypes)[3] = DMUS_PMSGT_TEMPO;
(*padwMediaTypes)[4] = DMUS_PMSGT_NOTIFICATION;
return S_OK;
}
else
{
// this should never happen
return E_FAIL;
}
}
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolGetMediaTypeArraySize(IMDXTool *pIm,DWORD* pdwNumElements )
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolProcessPMsg(IMDXTool *pIm,IDirectMusicPerformance* pPerf, DMUS_PMSG* pPMsg)
{
DMUS_NOTE_PMSG* pNote;
DMUS_NOTIFICATION_PMSG* pNotification;
CMDXTool * pThis = (CMDXTool *)pIm;
char cIncVolume,cDesiredVol;
long lVolume; //fading coefficient
char cMainVolume; //fading coefficient*gloabl main volume
int iChannel, iVolume;
DMUS_MIDI_PMSG* pMidi;
#ifdef _DEBUG
char stmp[150];
int a,b,c;
#endif
// returning S_FREE frees the message. If StampPMsg()
// fails, there is no destination for this message so
// free it.
if(( NULL == pPMsg->pGraph ) || FAILED(pPMsg->pGraph->lpVtbl->StampPMsg(pPMsg->pGraph,pPMsg)))
{
return DMUS_S_FREE;
}
if( pPMsg->dwType == DMUS_PMSGT_PATCH)
{
DMUS_PATCH_PMSG* pPatch;
pPatch = (DMUS_PATCH_PMSG*)pPMsg;
sprintf(stmp,"PROGRAM CHANGE WITH INSTRUMENT %d\n",pPatch->byInstrument);
OutputDebugString(stmp);
if (pPatch->byInstrument==0)
{
fn_vCallCallback();
return DMUS_S_FREE;
}
}
else
if( pPMsg->dwType == DMUS_PMSGT_NOTIFICATION)
{
pNotification = (DMUS_NOTIFICATION_PMSG*)pPMsg;
if(IsEqualGUID(&(pNotification->guidNotificationType),&GUID_NOTIFICATION_SEGMENT))
{
switch(pNotification->dwNotificationOption)
{
case DMUS_NOTIFICATION_SEGABORT:
OutputDebugString("===> Segment brutally Stopped");
if (pThis->m_cFading!=0)
{
pThis->m_cFading=0; //natural end of fading
lVolume=pThis->m_cMainVolume;
lVolume*=pThis->m_cEndFadingVol;
lVolume/=127;
cMainVolume=(char)lVolume;
if (pThis->pFadeCallback) //Fading callback
pThis->pFadeCallback();
}
break;
case DMUS_NOTIFICATION_SEGEND:
OutputDebugString("===> Segment natural end detected by tool");
if (pThis->m_cFading!=0)
{
pThis->m_cFading=0; //natural end of fading
lVolume=pThis->m_cMainVolume;
lVolume*=pThis->m_cEndFadingVol;
lVolume/=127;
cMainVolume=(char)lVolume;
if (pThis->pFadeCallback) //Fading callback
pThis->pFadeCallback();
}
break;
}
}
OutputDebugString("===> Notification In Tool");
}
else //DMUS_PMSGT_TEMPO
if( pPMsg->dwType == DMUS_PMSGT_TEMPO )
{
DMUS_TEMPO_PMSG* pTempo;
pTempo = (DMUS_TEMPO_PMSG*)pPMsg;
pTempo->dblTempo = (pTempo->dblTempo /(double)100)*pCM->m_wUserTempo;
}
else //DMUS_PMSGT_TEMPO
if( pPMsg->dwType == DMUS_PMSGT_MIDI )
{
iChannel=pPMsg->dwPChannel&0xF;
if (((pThis->m_wMuteFlag>>iChannel) & 1) == 1)
{
return DMUS_S_FREE;
} else // not muted
{
if ( (((DMUS_MIDI_PMSG*)pPMsg)->bStatus&0xF0)==(BYTE)0xB0)
{ //Ctrl Change msg
//dbg0("Ctrl Change msg\n");
if (((DMUS_MIDI_PMSG*)pPMsg)->bByte1==(BYTE)7) //Main Volume
{ //keep track of the Main Volume change
//dbg0("Main Volume intercepted\n");
pThis->m_RefVol[iChannel]=((DMUS_MIDI_PMSG*)pPMsg)->bByte2;
}
} //if Ctrl Change msg
//if (((DMUS_MIDI_PMSG*)pPMsg)->bFlags&DMUS_NOTEF_NOTEON)
} //not muted
} //DMUS_PMSGT_MIDI
else
if( pPMsg->dwType == DMUS_PMSGT_NOTE )
{
pNote = (DMUS_NOTE_PMSG*)pPMsg;
iChannel=pPMsg->dwPChannel&0xF;
if (((pThis->m_wMuteFlag>>iChannel) & 1) == 1)
{
return DMUS_S_FREE;
} else
{
//COMPUTE MAIN VOLUME AFTER FADING
if (pThis->m_cFading!=0)
{
if (pThis->m_rtEndFadingTime<=pPMsg->rtTime)
{
pThis->m_cFading=0; //natural end of fading
lVolume=pThis->m_cMainVolume;
lVolume*=pThis->m_cEndFadingVol;
lVolume/=127;
cMainVolume=(char)lVolume;
if (pThis->pFadeCallback) //Fading callback
pThis->pFadeCallback();
} else
{
lVolume= //compute fading coefficient
(long)pThis->m_cEndFadingVol-
(long)
((pCM->m_lSlopeFading*
((pThis->m_rtEndFadingTime-pPMsg->rtTime)/1000)
)/1000000);
//check fading coefficient and mix it with main volume
if (lVolume<=0) pThis->m_cFadeCoeff=cMainVolume=0;
else if (lVolume>=127)
{
cMainVolume=pThis->m_cMainVolume;
pThis->m_cFadeCoeff=127;
}
else
{
pThis->m_cFadeCoeff=(char)lVolume;
lVolume*=pThis->m_cMainVolume;
lVolume/=127;
cMainVolume=(char)lVolume;
}
}
} else
{
lVolume=pThis->m_cMainVolume;
//we still have to take it into account, so that the volume isn't brutally reset at the end
lVolume*=pThis->m_cFadeCoeff;
lVolume/=127;
cMainVolume=(char)lVolume;
//pThis->m_cFadeCoeff=127;
}
//COMPUTE DESIRED VOLUME
iVolume=(char)pThis->m_RefVol[iChannel];
if (((pThis->m_wVolFlag>>iChannel) & 1) == 1) //with volume increment value
{
cIncVolume=(char)pThis->m_vol[iChannel];
iVolume+=cIncVolume;
if (iVolume<0) cDesiredVol=0;
else if (iVolume>127)
{
cDesiredVol=cMainVolume;
} else
{
iVolume*=cMainVolume;
cDesiredVol=(BYTE)(iVolume/127);
}
} else //without volume increment value
{
iVolume*=cMainVolume;
cDesiredVol=(BYTE)(iVolume/127);
}
//APPLY DESIRED VOLUME
if (pThis->m_CurrVol[iChannel]!=cDesiredVol)
{ // Volume must be updated
if( SUCCEEDED( pPerf->lpVtbl->AllocPMsg(pPerf, sizeof(DMUS_MIDI_PMSG),
(DMUS_PMSG**)&pMidi )))
{ //Send Midi message to update the volume
pMidi->dwType = DMUS_PMSGT_MIDI;
pMidi->dwSize=sizeof(pMidi);
pPerf->lpVtbl->GetTime(pPerf,&pMidi->rtTime,&pMidi->mtTime);
pMidi->dwFlags=DMUS_PMSGF_TOOL_IMMEDIATE|DMUS_PMSGF_REFTIME;
pMidi->dwPChannel=pPMsg->dwPChannel;
pMidi->dwVirtualTrackID=pPMsg->dwVirtualTrackID;
pMidi->pTool=NULL;
pMidi->pGraph=NULL;
pMidi->punkUser=NULL;
pMidi->bStatus=0xB0; //ctrl chg
pMidi->bByte1=7; //volume
//if (pThis->m_cMainVolume>0x7F)
// pMidi->bByte2=0x7F;
//else
pMidi->bByte2=(BYTE)cDesiredVol;//pThis->m_cMainVolume; //volume value
if (S_OK==pPerf->lpVtbl->SendPMsg(pPerf, (DMUS_PMSG*) pMidi))
pThis->m_CurrVol[iChannel]!=cDesiredVol;
} //send MIDI message
} //volume must be updated
}
}
// return DMUS_S_REQUEUE so the original message is requeued
return DMUS_S_REQUEUE;
}
/*-------------------------------------------------------------------------------------------
HRESULT _stdcall CMDXToolFlush(IMDXTool *pIm,IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG, REFERENCE_TIME rt)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
HRESULT _stdcall CMDXToolFlush(IMDXTool *pIm,IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG, REFERENCE_TIME rt)
{
CMDXTool *pThis = (CMDXTool *)pIm;
// this tool does not need to flush.
return E_NOTIMPL;
}
/*-------------------------------------------------------------------------------------------
void _stdcall SetUserTempo(IMDXTool *pIm,WORD wUserTempo)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall SetUserTempo(IMDXTool *pIm,WORD wUserTempo)
{
CMDXTool *pThis = (CMDXTool *)pIm;
pThis->m_wUserTempo = wUserTempo;
}
/*-------------------------------------------------------------------------------------------
void _stdcall SetMuteFlag(IMDXTool *pIm,WORD wMuteFlag)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall SetMuteFlag(IMDXTool *pIm,WORD wMuteFlag)
{
CMDXTool *pThis = (CMDXTool *)pIm;
pThis->m_wMuteFlag = wMuteFlag;
}
/*-------------------------------------------------------------------------------------------
void _stdcall SetVolFlag(IMDXTool *pIm,WORD wVolFlag)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall SetVolFlag(IMDXTool *pIm,WORD wVolFlag)
{
CMDXTool *pThis = (CMDXTool *)pIm;
pThis->m_wVolFlag = wVolFlag;
}
/*-------------------------------------------------------------------------------------------
void _stdcall SetVolValue(IMDXTool *pIm,int iChannel,char newValue)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall SetVolValue(IMDXTool *pIm,int iChannel,char newValue)
{
//int iVolume;
CMDXTool *pThis = (CMDXTool *)pIm;
pThis->m_vol[iChannel] = newValue;
pThis->m_RefVol[iChannel]=pThis->m_CurrVol[iChannel];
pThis->m_CurrVol[iChannel]=(char)0xFF; //to force update
/* iVolume=pThis->m_CurrVol[iChannel];
iVolume+=newValue;
if (iVolume<0) pThis->m_DesiredVol[iChannel]=0;
else
{
iVolume>0
}*/
/*
if (((pThis->m_wVolFlag>>iChannel) & 1) == 1) //with volume value
{
cIncVolume=(char)pThis->m_vol[iChannel];
iVolume=(char)pThis->m_CurrVol[iChannel];
iVolume+=cIncVolume;
if (iVolume<0) pThis->m_DesiredVol[iChannel]=0;
else if (iVolume>127)
{
pThis->m_DesiredVol[iChannel]=(BYTE)pThis->m_cMainVolume;
} else
{
iVolume*=pThis->m_cMainVolume;
pThis->m_DesiredVol[iChannel]=(BYTE)(iVolume/127);
}
} else pThis->m_DesiredVol[iChannel]=(BYTE)pThis->m_cMainVolume;
*/
}
/*-------------------------------------------------------------------------------------------
void _stdcall SetMainVolValue(IMDXTool *pIm,char newValue)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall SetMainVolValue(IMDXTool *pIm,char newValue)
{
CMDXTool *pThis = (CMDXTool *)pIm;
int iChannel;
pThis->m_cMainVolume = (newValue<0)?127:newValue;
for (iChannel=0; iChannel<16; iChannel++)
pThis->m_CurrVol[iChannel]=(char)0xFF; //to force update
}
/*-------------------------------------------------------------------------------------------
char _stdcall GetMainVolValue(IMDXTool *pIm)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
char _stdcall GetMainVolValue(IMDXTool *pIm)
{
CMDXTool *pThis = (CMDXTool *)pIm;
return pThis->m_cMainVolume;
}
/*-------------------------------------------------------------------------------------------
char _stdcall GetFadeCoeff(IMDXTool *pIm)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
char _stdcall GetFadeCoeff(IMDXTool *pIm)
{
CMDXTool *pThis = (CMDXTool *)pIm;
return pThis->m_cFadeCoeff;
}
/*-------------------------------------------------------------------------------------------
void _stdcall DoFade(IMDXTool *pIm, IDirectMusicPerformance* pPerf, char cBeginVolValue, char cEndVolValue, DWORD dwTimeFade, void *pCallback)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall DoFade(IMDXTool *pIm, IDirectMusicPerformance* pPerf, char cBeginVolValue, char cEndVolValue, DWORD dwTimeFade, void *pCallback)
{
CMDXTool *pThis = (CMDXTool *)pIm;
REFERENCE_TIME aTime;
long int ldVol;
#ifdef _DEBUG
char s[100];
#endif
DWORD dwDuration=(dwTimeFade==0)?1:((dwTimeFade>100000)?100000:dwTimeFade);
(void*)pThis->pFadeCallback=pCallback;
pPerf->lpVtbl->GetTime(pPerf,&aTime,NULL);
ldVol=((long)cEndVolValue)-cBeginVolValue;
pThis->m_rtEndFadingTime=aTime+dwTimeFade*10000; //10 000 000 = 1 second
pThis->m_cEndFadingVol=cEndVolValue;
pThis->m_lSlopeFading=ldVol*100000/(long)dwDuration;
pThis->m_cFading=1;
//if (pThis->m_cFading<127)
// pThis->m_cFading++;
}
/*-------------------------------------------------------------------------------------------
void _stdcall EndFade(IMDXTool *pIm)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void _stdcall EndFade(IMDXTool *pIm)
{
CMDXTool *pThis = (CMDXTool *)pIm;
pThis->m_cFading=0;
pThis->m_cFadeCoeff=127;
//if (pThis->m_cFading>0)
// pThis->m_cFading--;
}
/*-------------------------------------------------------------------------------------------
char _stdcall IsFading(IMDXTool *pIm)
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
char _stdcall IsFading(IMDXTool *pIm)
{
return ((CMDXTool *)pIm)->m_cFading;
}
struct IMDXTool_Vtbl IMVT =
{
CMDXToolQueryInterface,
CMDXToolAddRef,
CMDXToolRelease,
CMDXToolInit,
CMDXToolGetMsgDeliveryType,
CMDXToolGetMediaTypeArraySize,
CMDXToolGetMediaTypes,
CMDXToolProcessPMsg,
CMDXToolFlush,
SetUserTempo,
SetMuteFlag,
SetVolFlag,
SetVolValue,
SetMainVolValue,
GetMainVolValue,
GetFadeCoeff,
DoFade,
EndFade,
IsFading
};
/*-------------------------------------------------------------------------------------------
IMDXTool * fnpGetTool()
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
IMDXTool * fnpGetTool()
{
int i;
pCM = (CMDXTool *)malloc( sizeof( CMDXTool ) );
if(pCM != NULL)
{
pCM->Im.lpVtbl = &IMVT;
pCM->cRef = 1; // jamais release par un client !!!
pCM->m_wMuteFlag = 0x0;
pCM->m_wActifTempo = 100;
pCM->m_wUserTempo = 100;
pCM->m_wVolFlag=0x0;
pCM->m_cMainVolume=127; //default volume
pCM->m_lSlopeFading=0;
pCM->m_cEndFadingVol=127;
pCM->m_rtEndFadingTime=0;
pCM->m_cFadeCoeff=127;
pCM->m_cFading=0;
pCM->pFadeCallback=NULL;
for (i=0; i<16; i++) //loop on channels
{
pCM->m_vol[i]=0;
pCM->m_CurrVol[i]=(char)0xFF; //to force update
pCM->m_RefVol[i]=127;
}
return &(pCM->Im);
} else return NULL;
}
/*-------------------------------------------------------------------------------------------
void fnvReleaseTool()
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------*/
void fnvReleaseTool()
{
if (pCM)
{
free(pCM);
pCM = NULL;
}
}
/*///////////////////////////////////// End of CMDXTool.c /////////////////*/

View File

@@ -0,0 +1,98 @@
#ifndef SNDDM_H
#define SNDDM_H
//----------------------------------------------------
//flags/constants to be moved to public header
#define DM_CONTAINED 1
#define DM_LOOP 2
//identification of DMusic objects
#define DM_EMPTY 0
#define DM_STYLE 1 /* -1 => index */
#define DM_PERSO 2
#define DM_SEGMT 3
#define DM_BAND 4
#define DM_DLS 5
#define DM_INVALIDREF 0xFFFFFFFF
//----------------------------------------------------
#define WITH_DM_NOTIFICATION
#ifndef __cplusplus
#define IDirectMusic_CreatePort(p,a,b,c,d,e) (p)->lpVtbl->CreatePort(p,&a,&b,c,d,e)
#define IDirectMusic_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicCollection_EnumInstrument(p,i,patch,wNam,max) (p)->lpVtbl->EnumInstrument(p,i,patch,wNam,max)
#define IDirectMusicCollection_GetInstrument(p,patch,pInst) (p)->lpVtbl->GetInstrument(p,patch,pInst)
#define IDirectMusicCollection_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicComposer_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicDownloadedInstrument_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicInstrument_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicInstrument_SetPatch(p,patch) (p)->lpVtbl->SetPatch(p,patch)
#define IDirectMusicLoader_GetObject(p,desc,guid,pObj) (p)->lpVtbl->GetObject(p,desc,&guid,pObj)
#define IDirectMusicLoader_ScanDirectory(p,guid,ext,cache) (p)->lpVtbl->ScanDirectory(p,&guid,ext,cache)
#define IDirectMusicLoader_SetSearchDirectory(p,guid,dir,b) (p)->lpVtbl->SetSearchDirectory(p,&guid,dir,b)
#define IDirectMusicLoader_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicPerformance_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicPerformance_CloseDown(p) (p)->lpVtbl->CloseDown(p)
#define IDirectMusicPerformance_Init(p,a) (p)->lpVtbl->Init(p,a)
#define IDirectMusicPerformance_AddPort(p,a) (p)->lpVtbl->AddPort(p,a)
#define IDirectMusicPerformance_AssignPChannelBlock(p,a,b,c) (p)->lpVtbl->AssignPChannelBlock( p,a,b,c)
#define IDirectMusicPerformance_PlaySegment(p,seg, fl, a, pstate) (p)->lpVtbl->PlaySegment(p,seg, fl, a, pstate)
#define IDirectMusicPerformance_Stop(p,a,b,c,d) (p)->lpVtbl->Stop(p,a,b,c,d)
#define IDirectMusicPort_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicPort_UnloadInstrument(p,i) (p)->lpVtbl->UnloadInstrument(p,i)
#define IDirectMusicSegment_Release(p) (p)->lpVtbl->Release(p)
#define IDirectMusicSegment_SetRepeats(p,n) (p)->lpVtbl->SetRepeats(p,n)
#define IDirectMusicSegment_GetLength(p,pt) (p)->lpVtbl->GetLength(p,pt)
#define IDirectMusicSegmentState_GetSeek(p,mt) (p)->lpVtbl->GetSeek(p,mt)
#define IDirectMusicPerformance_MusicToReferenceTime(p,t,pt) (p)->lpVtbl->MusicToReferenceTime(p,t,pt)
#define IDirectMusicPerformance_SetNotificationHandle(p,h,n) (p)->lpVtbl->SetNotificationHandle(p,h,n)
#define IDirectMusicPerformance_AddNotificationType(p, guid) (p)->lpVtbl->AddNotificationType(p, &guid)
#define IDirectMusicPerformance_DownloadInstrument(p,pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan) (p)->lpVtbl->DownloadInstrument(p,pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan)
#define IDirectMusicPerformance_FreePMsg(p,pMsg) (p)->lpVtbl->FreePMsg(p,pMsg)
#define IDirectMusicPerformance_GetNotificationPMsg(p, pMsg) (p)->lpVtbl->GetNotificationPMsg(p, pMsg)
#define IDirectMusicPerformance_IsPlaying(p,pSeg,pState) (p)->lpVtbl->IsPlaying(p,pSeg,pState)
#else
#define IDirectMusic_CreatePort(p,a,b,c,d,e) (p)->CreatePort(a,b,c,d,e)
#define IDirectMusic_Release(p) (p)->Release()
#define IDirectMusicCollection_EnumInstrument(p,i,patch,wNam,max) (p)->EnumInstrument(i,patch,wNam,max)
#define IDirectMusicCollection_GetInstrument(p,patch,pInst) (p)->GetInstrument(patch,pInst)
#define IDirectMusicCollection_Release(p) (p)->Release()
#define IDirectMusicComposer_Release(p) (p)->Release()
#define IDirectMusicDownloadedInstrument_Release(p) (p)->Release()
#define IDirectMusicInstrument_Release(p) (p)->Release()
#define IDirectMusicInstrument_SetPatch(p,patch) (p)->SetPatch(patch)
#define IDirectMusicLoader_GetObject(p,desc,guid,pObj) (p)->GetObject(desc,guid,pObj)
#define IDirectMusicLoader_ScanDirectory(p,guid,ext,cache) (p)->ScanDirectory(p,guid,ext,cache)
#define IDirectMusicLoader_SetSearchDirectory(p,guid,dir,b) (p)->SetSearchDirectory(guid,dir,b)
#define IDirectMusicLoader_Release(p) (p)->Release()
#define IDirectMusicPerformance_Release(p) (p)->Release()
#define IDirectMusicPerformance_CloseDown(p) (p)->CloseDown()
#define IDirectMusicPerformance_Init(p,a) (p)->Init(a)
#define IDirectMusicPerformance_AddPort(p,a) (p)->AddPort(a)
#define IDirectMusicPerformance_AssignPChannelBlock(p,a,b,c) (p)->AssignPChannelBlock(a,b,c)
#define IDirectMusicPerformance_PlaySegment(p,seg, fl, a, pstate) (p)->PlaySegment(seg, fl, a, pstate)
#define IDirectMusicPerformance_Stop(p,a,b,c,d) (p)->Stop(a,b,c,d)
#define IDirectMusicPort_Release(p) (p)->Release()
#define IDirectMusicPort_UnloadInstrument(p,i) (p)->UnloadInstrument(i)
#define IDirectMusicSegment_Release(p) (p)->Release()
#define IDirectMusicSegment_SetRepeats(p,n) (p)->SetRepeats(n)
#define IDirectMusicSegment_GetLength(p,pt) (p)->GetLength(pt)
#define IDirectMusicSegmentState_GetSeek(p,mt) (p)->GetSeek(p,mt)
#define IDirectMusicPerformance_MusicToReferenceTime(p,t,pt) (p)->MusicToReferenceTime(t,pt)
#define IDirectMusicPerformance_SetNotificationHandle(p,h,n) (p)->SetNotificationHandle(h,n)
#define IDirectMusicPerformance_AddNotificationType(p, guid) (p)->AddNotificationType(guid)
#define IDirectMusicPerformance_DownloadInstrument(p,pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan) (p)->DownloadInstrument(pIns,pChan,ppDLIns,range,numRange,pPort,pGroup,p2Chan)
#define IDirectMusicPerformance_FreePMsg(p,pMsg) (p)->FreePMsg(pMsg)
#define IDirectMusicPerformance_GetNotificationPMsg(p, pMsg) (p)->GetNotificationPMsg(pMsg)
#define IDirectMusicPerformance_IsPlaying(p,pSeg,pState) (p)->IsPlaying(pSeg,pState)
#endif
void fn_vFreeDirectMusic();
HRESULT fn_hrLoadExtDMObject(unsigned short uwType, char *szName, void **pObj);
#endif /* SNDDM_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
#include <windows.h>
#include <stdio.h>
#include "DMusici.h" //MS DirectMusic include files
#include "DMusicc.h"
HRESULT fn_hrDownloadDLS(char *szDlsName,DWORD dwBank);

View File

@@ -0,0 +1,69 @@
/*--------------------------------------------------------
FILE imdxTool.h
ROLE:
definition of the COM interface for the performance tool (to modify tempo, volume...)
LAST MODIFICATIONS:
- J.Vibert - 21/01/98 - fading
- J.Vibert - 21/01/98 - SetMainVolValue method
- D.Dumont - created, tempo modified by tool
--------------------------------------------------------*/
#ifndef __IMDXTOOL_H__
#define __IMDXTOOL_H__
#include <dmusici.h>
#include <objbase.h>
#ifdef INIT
#include <initguid.h>
#endif /*INIT */
// {673DEB61-8A6B-11d1-B197-006097BAFA72}
DEFINE_GUID(IID_IMDXTool,
0x673deb61, 0x8a6b, 0x11d1, 0xb1, 0x97, 0x0, 0x60, 0x97, 0xba, 0xfa, 0x72);
typedef struct _IMDXTool
{
struct IMDXTool_Vtbl *lpVtbl;
} IMDXTool;
//We then go on to define the virtual function table, like so:
struct IMDXTool_Vtbl
{
/*///// The IUnknown methods that all COM objects must support /////*/
HRESULT (_stdcall *pfnQueryInterface)(IMDXTool *pThis, REFIID pIID, void **ppv );
long (_stdcall *pfnAddRef)(IMDXTool *pThis );
long (_stdcall *pfnRelease)(IMDXTool *pThis );
/*///// The methods of the IDirectMusicTool interface /////*/
HRESULT (_stdcall *pfnInit)(IMDXTool *pThis ,IDirectMusicGraph* pGraph) ;
HRESULT (_stdcall *pfnGetMsgDeliveryType)(IMDXTool *pThis ,DWORD* pdwDeliveryType ) ;
HRESULT (_stdcall *pfnGetMediaTypeArraySize)(IMDXTool *pThis ,DWORD* pdwNumElements ) ;
HRESULT (_stdcall *pfnGetMediaTypes)(IMDXTool *pThis ,DWORD** padwMediaTypes, DWORD dwNumElements) ;
HRESULT (_stdcall *pfnProcessPMsg)(IMDXTool *pThis ,IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG) ;
HRESULT (_stdcall *pfnFlush)(IMDXTool *pThis ,IDirectMusicPerformance* pPerf, DMUS_PMSG* pDMUS_PMSG, REFERENCE_TIME rt) ;
void (_stdcall *SetUserTempo)(IMDXTool *pIm,WORD wUserTempo);
void (_stdcall *SetMuteFlag)(IMDXTool *pIm,WORD wMuteFlag);
void (_stdcall *SetVolFlag)(IMDXTool *pIm,WORD wVolFlag);
void (_stdcall *SetVolValue)(IMDXTool *pIm,int iChannel,char newValue);
void (_stdcall *SetMainVolValue)(IMDXTool *pIm,char newValue);
char (_stdcall *GetMainVolValue)(IMDXTool *pIm);
char (_stdcall *GetFadeCoeff)(IMDXTool *pIm);
void (_stdcall *DoFade)(IMDXTool *pIm, IDirectMusicPerformance* pPerf, char cBeginVolValue, char cEndVolValue, DWORD dwTimeFade, void *pCallback);
void (_stdcall *EndFade)(IMDXTool *pIm);
char (_stdcall *IsFading)(IMDXTool *pIm); //boolean
};
#endif

View File

@@ -0,0 +1,106 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040c04b0"
BEGIN
VALUE "CompanyName", "UBI SOUND STUDIO\0"
VALUE "FileDescription", "ACP-SND Dll\0"
VALUE "FileVersion",
#include "SND\version.txt"
VALUE "InternalName", "None\0"
VALUE "LegalCopyright", "Copyright <20> 1998\0"
VALUE "OriginalFilename", "None\0"
VALUE "ProductName", "UBI ACP-SND\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x40c, 1200
END
END
#endif // !_MAC
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,607 @@
#include "SNDinc.h"
#include "sndthrd.h"
#if defined(_DLL_COMPILATION_MODE)
#include "snddll.h"
#endif
#include "sndxd.h"
#include "sndres.h"
#include "sndstrm.h"
typedef struct STREAMING_BUFFER_ *pSTREAMING_BUFFER;
typedef struct STREAMING_VOICE_ *pSTREAMING_VOICE;
SNDLST2_M_DynamicUseListOf(pSTREAMING_BUFFER);
SNDLST2_M_DynamicUseListOf(pSTREAMING_VOICE);
typedef struct STREAMING_BUFFER_{
void* ptrData;
unsigned long ulNbSamples;
long lId;
SNDLST2_M_DynamicElementDeclaration(pSTREAMING_BUFFER)
} STREAMING_BUFFER;
typedef struct STREAMING_VOICE_{
long lIdBufferClient;
long lSampleToBytesShift;
tdhSndFile hFile;
long lLastPushed; //id du dernier data-buffer
SndBool bEnding; //TRUE quand il n'y a plus de donn<6E>es <20> pusher
SndBool bEnded; //TRUE quand la lectre est finie
SndBool bMustLoop; //TRUE si res loopante
unsigned long ulByteLoop; //offset du point de rebouclage dans le fichier
unsigned long ulByteMax; //offset de dernier octet dans le fichier
unsigned long ulNextPtr; //offset du prochain octet <20> lire dans le fichier
SND_td_pfn_vSoundCallback pfnCallback;
long lParCallback;
SndBool bWaitingCallback;
SndBool bStereo;
SNDLST2_M_DynamicAnchorDeclaration(pSTREAMING_BUFFER) pList;
SNDLST2_M_DynamicElementDeclaration(pSTREAMING_VOICE)
} STREAMING_VOICE;
typedef struct LISTE_STREAMING_VOICE_{
SNDLST2_M_DynamicAnchorDeclaration(pSTREAMING_VOICE) pList;
} LISTE_STREAMING_VOICE;
static LISTE_STREAMING_VOICE ListStreaming;
static SndBool bInitDone=FALSE;
#define SIZE_DATABUFFER 5120
#define NB_BUFFER_AVANCE 4
//------------
void purge_databuffer(pSTREAMING_BUFFER databuffer)
{
SNDLST2_M_DynamicIsolate(databuffer);
SND_fn_vFreeSnd(databuffer->ptrData);
SND_fn_vFreeSndEx(E_ucSndBlockMain,databuffer);
}
void push_databuffer(pSTREAMING_VOICE streaming)
{
pSTREAMING_BUFFER databuffer;
unsigned long nb_lus,nb_to_read,nb_left;
SND_tdstStackBuffer stackbuffer;
if (!streaming->bEnding)
{
databuffer=SND_fn_pvMallocSndEx(E_ucSndBlockMain,sizeof(STREAMING_BUFFER));
SNDLST2_M_DynamicInitElement(databuffer);
databuffer->ulNbSamples=SIZE_DATABUFFER>>streaming->lSampleToBytesShift;
databuffer->ptrData=SND_fn_pvMallocSnd(SIZE_DATABUFFER);
nb_to_read=SIZE_DATABUFFER;
if ((nb_lus=SND_fn_dwReadFileSnd(streaming->hFile
,min(nb_to_read,streaming->ulByteMax-streaming->ulNextPtr)
,databuffer->ptrData)) != nb_to_read)
{//on est arriv<69> <20> la fin du fichier
if (streaming->bMustLoop)
{
streaming->ulNextPtr=streaming->ulByteLoop;
SND_fn_dwSeekFileSnd(streaming->hFile,streaming->ulNextPtr,SEEKFILESND_BEGIN);
nb_left=nb_to_read-nb_lus;
while (nb_left>0)
{//reboucler tant que le buffer n'est pas plein
streaming->ulNextPtr=streaming->ulByteLoop;
nb_lus=SND_fn_dwReadFileSnd(streaming->hFile
,min(nb_left,streaming->ulByteMax-streaming->ulNextPtr)
,(char*)databuffer->ptrData+nb_to_read-nb_left);
nb_left-=nb_lus;
if (!nb_lus)
break;
}
streaming->ulNextPtr=streaming->ulByteLoop+nb_lus;
}
else
{
databuffer->ulNbSamples=nb_lus>>streaming->lSampleToBytesShift;
streaming->lLastPushed=databuffer->lId;
SND_fn_vCloseFileSnd(streaming->hFile);
streaming->hFile=OPENFILESND_FAILED;
streaming->bEnding=TRUE;
}
}
else
{//on n'est pas encore <20> la fin du fichier
streaming->ulNextPtr+=nb_to_read;
}
SNDLST2_M_DynamicAddTail(&streaming->pList,databuffer);
stackbuffer.ulNbSamples=databuffer->ulNbSamples;
stackbuffer.ptrData=databuffer->ptrData;
databuffer->lId=SND_fn_lPushBufferExSxd(streaming->lIdBufferClient,&stackbuffer);
if (streaming->bEnding)
streaming->lLastPushed=databuffer->lId;
//_RPTF1(_CRT_WARN,"Push %d\n",databuffer->lId);
}
else
{
if (streaming->bWaitingCallback)
{
streaming->bWaitingCallback=FALSE;
(*streaming->pfnCallback)(streaming->lParCallback);
}
}
}
void SND_CALL StreamingCallback(long user_id,long poped_id)
{
pSTREAMING_VOICE streaming;
pSTREAMING_BUFFER databuffer;
int i;
SndBool found=FALSE;
//_RPTF1(_CRT_WARN,"Callback %d\n",poped_id);
SND_fn_vEnterCriticalSectionThreadSnd();
streaming=(pSTREAMING_VOICE)user_id;
databuffer=(pSTREAMING_BUFFER)poped_id;
SNDLST2_M_DynamicForEachElementOf(&streaming->pList,databuffer,i)
{
if (databuffer->lId==poped_id)
{
purge_databuffer(databuffer);
found=TRUE;
break;
}
}
snd_assert(found);
if (!streaming->bEnding)
push_databuffer(streaming);
else
{
if (streaming->lLastPushed==poped_id)
streaming->bEnded=TRUE;
}
SND_fn_vQuitCriticalSectionThreadSnd();
}
void purge_streaming(pSTREAMING_VOICE streaming)
{
pSTREAMING_BUFFER pDataBuffer,pDataBufferNext;
int i;
snd_assert(streaming->bEnded);
SND_fn_vDeleteBufferSxd(streaming->lIdBufferClient);
streaming->lIdBufferClient=C_PLAY_FAILED;
if (streaming->hFile!=OPENFILESND_FAILED)
SND_fn_vCloseFileSnd(streaming->hFile);
streaming->hFile=OPENFILESND_FAILED;
SNDLST2_M_DynamicForEachMovingElementOf(&streaming->pList,pDataBuffer,pDataBufferNext,i)
{
purge_databuffer(pDataBuffer);
}
if (streaming->bWaitingCallback)
{
streaming->bWaitingCallback=FALSE;
(*streaming->pfnCallback)(streaming->lParCallback);
}
SNDLST2_M_DynamicIsolate(streaming);
SND_fn_vFreeSndEx(E_ucSndBlockMain,streaming);
}
///
long SND_fn_lPlaySxdStream(tduRefRes res,SoundParam *par,long prio,SND_td_pfn_vSoundCallback fn_callback,long par_callback)
{
pSTREAMING_VOICE streaming;
SND_tdstFormat format;
SND_tdstCallback callback;
char filename[256];
int i;
SoundParam *pstSoundParam;
if (bInitDone)
{
streaming=SND_fn_pvMallocSndEx(E_ucSndBlockMain,sizeof(STREAMING_VOICE));
SNDLST2_M_DynamicInitElement(streaming);
SNDLST2_M_DynamicAddTail(&ListStreaming.pList,streaming);
SNDLST2_M_DynamicInitAnchor(&streaming->pList);
format.eZip=SAMPLE_PCM;
format.uFormat.stPCM.ulNbSamples=0;
format.uFormat.stPCM.uwResolution=res.pstPtr->uRes.stSample.uwResolution;
format.uFormat.stPCM.uwNbChannels=res.pstPtr->uRes.stSample.uwNbChannels;
format.uFormat.stPCM.ulFreq=res.pstPtr->uRes.stSample.ulFreq;
callback.eType=BUFFER_STACK;
callback.uCallback.CallbackStack=StreamingCallback;
callback.uInfo.lNbSampleToPush=0;
streaming->bMustLoop=res.pstPtr->uRes.stSample.bLoop;
streaming->ulByteLoop=res.pstPtr->uRes.stSample.uData.stStream.ulOffsetLoop;
streaming->ulByteMax=res.pstPtr->uRes.stSample.uData.stStream.ulOffsetLast;
streaming->ulNextPtr=res.pstPtr->uRes.stSample.uData.stStream.ulOffsetFirst;
SND_fn_vResolveFileName(res.pstPtr->uRes.stSample.uData.stStream.szFileName,filename);
streaming->hFile=SND_fn_hOpenFileReadSnd(filename);
SND_fn_dwSeekFileSnd(streaming->hFile,streaming->ulNextPtr,SEEKFILESND_BEGIN);
pstSoundParam=SND_fn_pvMallocSnd(SND_M_lGetSizeOfSoundParam(par));
memcpy(pstSoundParam,par,SND_M_lGetSizeOfSoundParam(par));
if (format.uFormat.stPCM.uwNbChannels==2)
{
pstSoundParam->ucVol=par->ucVol/2;
pstSoundParam->iFlags|=C_SOUNDPARAM_COEF_VOL;
}
if (format.uFormat.stPCM.uwNbChannels==2)
streaming->bStereo=TRUE;
else
streaming->bStereo=FALSE;
streaming->lLastPushed=C_PLAY_FAILED;
streaming->bEnded=FALSE;
streaming->bEnding=FALSE;
streaming->lSampleToBytesShift=format.uFormat.stPCM.uwResolution/8+format.uFormat.stPCM.uwNbChannels-2;
streaming->lIdBufferClient=SND_fn_lCreateNewBufferExSxd(&format,&callback,pstSoundParam,(long)streaming);
SND_fn_vFreeSnd(pstSoundParam);
if (fn_callback)
{
streaming->pfnCallback=fn_callback;
streaming->lParCallback=par_callback;
streaming->bWaitingCallback=TRUE;
}
else
streaming->bWaitingCallback=FALSE;
//lancement des 1<> push
for (i=0;i<NB_BUFFER_AVANCE;i++)
{
push_databuffer(streaming);
}
return (long)streaming;
/*
if (buffer_dispo_streaming.bClientActive)
fn_vKillStream();
SND_fn_vResolveFileName(res.pstPtr->uRes.stSample.uData.stStream.szFileName,filename);
buffer_dispo_streaming.hFile=SND_fn_hOpenFileReadSnd(filename);
buffer_dispo_streaming.bFileOpened=TRUE;
if (buffer_dispo_streaming.hFile==OPENFILESND_FAILED)
{
SND_fn_vDisplayError(E_uwSndCannotOpenFile,filename);
return C_PLAY_FAILED;
}
SND_fn_dwSeekFileSnd(buffer_dispo_streaming.hFile,res.pstPtr->uRes.stSample.uData.stStream.ulOffsetFirst,SEEKFILESND_BEGIN);
nb_to_read=2*SIZE_FILE_BUFFER;
nb_lus=SND_fn_dwReadFileSnd(buffer_dispo_streaming.hFile,nb_to_read,hFileBuffer[0]);
buffer_dispo_streaming.uRes.pstPtr=res.pstPtr;
buffer_dispo_streaming.bMustLoop=res.pstPtr->uRes.stSample.bLoop;
buffer_dispo_streaming.ulByteLoop=res.pstPtr->uRes.stSample.uData.stStream.ulOffsetLoop;
buffer_dispo_streaming.ulByteMax=res.pstPtr->uRes.stSample.uData.stStream.ulOffsetLast;
buffer_dispo_streaming.bStarting=TRUE;
buffer_dispo_streaming.bStarted=TRUE;
buffer_dispo_streaming.bIsEnding=FALSE;
buffer_dispo_streaming.bIsLooping=FALSE;
buffer_dispo_streaming.lNextPtr=2*SIZE_FILE_BUFFER;
buffer_dispo_streaming.iNextFileBuffer=0;
if (nb_lus!=nb_to_read)
{//fin du sample
if (buffer_dispo_streaming.bMustLoop)
{//on reboucle
nb_to_read-=nb_lus;
while (nb_to_read!=0)
{
SND_fn_dwSeekFileSnd(buffer_dispo_streaming.hFile,buffer_dispo_streaming.ulByteLoop,SEEKFILESND_BEGIN);
nb_lus=SND_fn_dwReadFileSnd(buffer_dispo_streaming.hFile,nb_to_read,hFileBuffer[buffer_dispo_streaming.iNextFileBuffer]);
if (nb_lus!=nb_to_read)
nb_to_read-=nb_lus;
else
nb_to_read=0;
}
buffer_dispo_streaming.bIsLooping=TRUE;
buffer_dispo_streaming.lNextPtr=buffer_dispo_streaming.ulByteLoop+nb_lus;
}
else
{//d<>but de la fin (pr<70>matur<75>)
// buffer_dispo_streaming.bStarting=FALSE;
SND_fn_vCloseFileSnd(buffer_dispo_streaming.hFile);
buffer_dispo_streaming.bFileOpened=FALSE;
memset((char*)(hFileBuffer[buffer_dispo_streaming.iNextFileBuffer])+nb_lus,0,nb_to_read-nb_lus);
buffer_dispo_streaming.bIsEnding=TRUE;
buffer_dispo_streaming.lCmptEnding=2;
if (nb_to_read-nb_lus>SIZE_FILE_BUFFER)
//cas juste o<> le sample est assez petit (<28> peine partit, on arr<72>tre)
buffer_dispo_streaming.lCmptEnding--;
//_RPT0( _CRT_WARN,"bIsEnding mis <20> TRUE -");
}
}
if (fn_callback)
{
buffer_dispo_streaming.fn_callback=fn_callback;
buffer_dispo_streaming.par_callback=par_callback;
buffer_dispo_streaming.bWaitingCallback=TRUE;
}
if (fn_bCreateStream(res.pstPtr->uRes.stSample.uwResolution,res.pstPtr->uRes.stSample.uwNbChannels,res.pstPtr->uRes.stSample.ulFreq))
return VOICE_STREAMING;
*/
}
return C_PLAY_FAILED;
}
void SND_fn_vRemoveCallbackSxdStream(long voice)
{
}
SndBool SND_fn_bSetParamSxdStream(long voice,SoundParam *par)
{
pSTREAMING_VOICE streaming;
SoundParam *pstSoundParam;
if (voice==C_PLAY_FAILED)
return FALSE;
streaming=(pSTREAMING_VOICE)voice;
if (streaming->bEnded)
{
purge_streaming(streaming);
return FALSE;
}
else
{
pstSoundParam=SND_fn_pvMallocSnd(SND_M_lGetSizeOfSoundParam(par));
memcpy(pstSoundParam,par,SND_M_lGetSizeOfSoundParam(par));
if (streaming->bStereo)
{
pstSoundParam->ucVol=par->ucVol/2;
pstSoundParam->iFlags|=C_SOUNDPARAM_COEF_VOL;
}
SND_fn_vSetParamBufferSxd(streaming->lIdBufferClient,pstSoundParam);
SND_fn_vFreeSnd(pstSoundParam);
return TRUE;
}
}
SndBool SND_fn_bTestIsPlayingSxdStream(long voice)
{
pSTREAMING_VOICE streaming;
if (voice==C_PLAY_FAILED)
return FALSE;
streaming=(pSTREAMING_VOICE)voice;
if (streaming->bEnded)
{
purge_streaming(streaming);
return FALSE;
}
else
{
return TRUE;
}
}
void SND_fn_vStopSxdStream(long voice)
{
pSTREAMING_VOICE streaming;
if (voice!=C_PLAY_FAILED)
{
streaming=(pSTREAMING_VOICE)voice;
streaming->bEnded=TRUE;
if (streaming->bWaitingCallback)
{
streaming->bWaitingCallback=FALSE;
(*streaming->pfnCallback)(streaming->lParCallback);
}
purge_streaming(streaming);
}
}
void SND_fn_vPauseSxdStream(long voice)
{
}
void SND_fn_vResumeSxdStream(long voice)
{
}
int SND_fn_iInitSxdStream(SND_tdstInitStruct *pInitStruct)
{
SNDLST2_M_DynamicInitAnchor(&ListStreaming.pList);
bInitDone=TRUE;
return C_INIT_OK;
}
SndBool SND_fn_bTestInitSxdStream(void)
{
return TRUE;
}
void SND_fn_vDesInitSxdStream(void)
{
pSTREAMING_VOICE pStreaming,pStreamingNext;
int i;
SNDLST2_M_DynamicForEachMovingElementOf(&ListStreaming.pList,pStreaming,pStreamingNext,i)
{
purge_streaming(pStreaming);
}
}
//---------------------------------------------------------
// GetPos: retourne la position "th<74>orique" de la ressource
// exprim<69> en seconde depuis le d<>but
// diff<66>rent du temps absolu (car pitch, d<>rive..)
// Entr<74>e: voie concern<72>e
// Sortie: temps en S (SndReal)
//----------------------------------------------------------
SndReal SND_fn_rGetPosSxdStream(long voie)
{
pSTREAMING_VOICE streaming;
if (voie!=C_PLAY_FAILED)
{
streaming=(pSTREAMING_VOICE)voie;
if (!streaming->bEnded)
return SND_fn_rGetPosBufferSxd(streaming->lIdBufferClient);
else
return SND_C_POS_ENDED;
}
else
return SND_C_POS_UNKNOWN;
}
//---------------------------------------------------------
// GetLength: retourne la dur<75>e "th<74>orique" de la ressource
// exprim<69> en seconde (constant pour une ressource donn<6E>e)
// Entr<74>e: voie concern<72>e
// Sortie: dur<75>e en S (SndReal)
//----------------------------------------------------------
SndReal SND_fn_rGetLengthSxdStream(long voie)
{
return SND_C_LENGTH_UNKNOWN;
}
//-----------------------------------------------------------
// ConvertRsvDiskToMem: convertir in BlockResourceDisk en Mem
// Entr<74>es:ptrBegin=pointeur sur les donn<6E>es UTILES (jamias d'offset)
//------------------------------------------------------------
void SND_fn_vConvertResDiskToMemSxdStream(tdstBlockResourceDisk *disk
,tdstBlockResourceMem *mem
,void* ptrBegin)
{
#ifndef DISABLE_WAVE
snd_assert(disk->eType==TYPE_SAMPLE);
snd_assert(disk->uRes.stSample.eZip==SAMPLE_PCM);
snd_assert(disk->uRes.stSample.bStream);
mem->Id=disk->Id;
mem->eType=disk->eType;
mem->eStorage=disk->eStorage;
mem->ucVolume=disk->ucVolume;
mem->bIsLoaded=TRUE;
//partie sp<73>cifique au type de ressource
//
mem->uRes.stSample.eZip=SAMPLE_PCM;
mem->uRes.stSample.bPitchable=disk->uRes.stSample.bPitchable;
mem->uRes.stSample.bVolable=disk->uRes.stSample.bVolable;
mem->uRes.stSample.bPanable=disk->uRes.stSample.bPanable;
mem->uRes.stSample.bSpacable=disk->uRes.stSample.bSpacable;
mem->uRes.stSample.bReverbable=disk->uRes.stSample.bReverbable;
mem->uRes.stSample.bStream=disk->uRes.stSample.bStream;
mem->uRes.stSample.bLoop=disk->uRes.stSample.bLoop;
//mem->uRes.stSample.ulInc0=(disk->uRes.stSample.ulFreq<<OFFSET_BIT_INC)/g_stFormatOutput.nSamplesPerSec;
mem->uRes.stSample.ulFreq=disk->uRes.stSample.ulFreq;
mem->uRes.stSample.uwResolution=disk->uRes.stSample.uwResolution;
mem->uRes.stSample.uwNbChannels=disk->uRes.stSample.uwNbChannels;
strcpy(mem->uRes.stSample.uData.stStream.szFileName,disk->uRes.stSample.czFileName);
mem->uRes.stSample.uData.stStream.ulOffsetFirst=disk->ulDataOffset;
if (!disk->uRes.stSample.bLoop)
{
mem->uRes.stSample.uData.stStream.ulOffsetLoop=0;
mem->uRes.stSample.uData.stStream.ulOffsetLast=disk->ulDataSize+disk->ulDataOffset;
}
else
{
mem->uRes.stSample.uData.stStream.ulOffsetLoop=disk->ulDataOffset+disk->uRes.stSample.ulStartLoop;
mem->uRes.stSample.uData.stStream.ulOffsetLast=disk->ulDataOffset+disk->uRes.stSample.ulStartLoop+disk->uRes.stSample.ulLoopLength;
}
//le sample est pr<70>t <20> l'emplois
#endif
}
SndBool SND_fn_bLoadResScriptSxdStream(tdstBlockResourceDisk *disk,tdstBlockResourceMem *mem)
{
#ifndef DISABLE_WAVE
snd_assert(disk->uRes.stSample.eZip!=SAMPLE_AIFF);
snd_assert(disk->uRes.stSample.bStream);
//stream sample cannot be AIIF type
SND_fn_vConvertResDiskToMemSxdStream(disk,mem,NULL);
//en script, chaque ressources charge ces propres data (on ne tient pas compte de eStorage)
mem->eStorage=TYPE_EXTERNAL;
return TRUE;
#else
return FALSE;
#endif
}
SndBool SND_fn_bLoadResBinarySxdStream(tdstBlockResourceDisk *_pBRDisk,tdstBlockResourceMem *_pBRMem,char *pDataBloc)
{
#ifndef DISABLE_WAVE
snd_assert(_pBRDisk->uRes.stSample.eZip!=SAMPLE_AIFF);
snd_assert(_pBRDisk->uRes.stSample.bStream);
//binary load is disabled for AIFF sample
SND_fn_vConvertResDiskToMemSxdStream(_pBRDisk,_pBRMem,NULL);
return TRUE;
#else
return FALSE;
#endif
}
void SND_fn_vUnLoadResSxdStream(tdstBlockResourceMem* mem)
{
#ifndef DISABLE_WAVE
snd_assert(mem->uRes.stSample.bStream);
mem->uRes.stSample.uData.stMem.pvPtrFirst=NULL;
mem->eType=TYPE_INVALID;
#endif
}
SndBool SND_fn_bSetResourceStaticVolumeSxdStream(tdstBlockResourceMem* pstRes,unsigned char ucVolume)
{
#ifndef DISABLE_WAVE
pstRes->ucVolume=ucVolume;
return TRUE;
#else
return FALSE;
#endif
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,119 @@
#if !defined(AFX_EVENTSHISTORYPAGE_H__FB8CCD4B_DD7D_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_EVENTSHISTORYPAGE_H__FB8CCD4B_DD7D_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// EventsHistoryPage.h : header file
//
#include "SNDinc.h"
#include "sndevent.h"
#include "MyListCtrl.h"
typedef struct EventsHistElement{
SYSTEMTIME time;
SND_tdstBlockEvent *evt_pstPtr;
tdxId evt_Id;
tdeTypeEvent evt_eType;
tdstBlockResourceMem *res_pstPtr;
long asso;
CString cEvtName;
CString cEvtBankName;
CString cInfo;
}EventsHistElement;
//Ressource structure use by the Supervisater
typedef struct RegKeyEventPage{
int iCheckBankId;
int iCheckEventId;
BOOL bCheckFirstOccur;
int iColTime;
int iColEvtName;
int iColEvtId;
int iColBankName;
int iColBankId;
int iColEvtType;
int iColInfo;
}RegKeyEventPage;
/////////////////////////////////////////////////////////////////////////////
// CEventsHistoryPage dialog
class CEventsHistoryPage : public CPropertyPage
{
DECLARE_DYNCREATE(CEventsHistoryPage)
// Construction
public:
void SetFirstOccurEventsName(long lIndex);
void SetEventsName(long lIndex);
CRect m_arInitWindowSize[25];
void SetWindowSize(int iDeltaX, int iDeltaY) ;
void GetInitWindowSize();
BOOL m_bPauseProcess;
void SendEventInWatchList();
long AddToFirstEvtOccurArray(EventsHistElement* evt);
void FilterAndDisplayEvent(long lIndex);
void FilterAndDisplayFirstOccurEvent(long lIndex);
void RefreshEventsHistoList();
CEventsHistoryPage();
~CEventsHistoryPage();
// Dialog Data
//{{AFX_DATA(CEventsHistoryPage)
enum { IDD = IDD_EVENTS_HISTORY_PAGE };
CListBox m_WatchList;
CMyListCtrl m_EventsList;
BOOL m_bShowBankWithId;
BOOL m_bShowEventWithId;
long m_lBankId;
long m_lEventId;
BOOL m_bDebugBreak;
BOOL m_bFirstOccurence;
BOOL m_bWatchMode;
CString m_LCBPath;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CEventsHistoryPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CEventsHistoryPage)
virtual BOOL OnInitDialog();
afx_msg void OnResetButton();
afx_msg void OnCheckFirstOccur();
afx_msg void OnCheckBank();
afx_msg void OnCheckEvent();
afx_msg void OnChangeEditBankId();
afx_msg void OnChangeEditEventId();
afx_msg void OnHelpWatch();
afx_msg void OnCheckWatch();
afx_msg void OnEmptyWatch();
afx_msg void OnPauseButton();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EVENTSHISTORYPAGE_H__FB8CCD4B_DD7D_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,523 @@
// MicroAndObjectsPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MicroAndObjectsPage.h"
#include "snddbg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMicroAndObjectsPage property page
IMPLEMENT_DYNCREATE(CMicroAndObjectsPage, CPropertyPage)
CMicroAndObjectsPage::CMicroAndObjectsPage() : CPropertyPage(CMicroAndObjectsPage::IDD)
{
//{{AFX_DATA_INIT(CMicroAndObjectsPage)
m_dDopplerFactor = 0.0;
//}}AFX_DATA_INIT
}
CMicroAndObjectsPage::~CMicroAndObjectsPage()
{
}
void CMicroAndObjectsPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMicroAndObjectsPage)
DDX_Control(pDX, IDC_ASSO_MIC_LIST, m_MicroAssoList);
DDX_Control(pDX, IDC_OBJECT_LIST, m_ObjectList);
DDX_Control(pDX, IDC_MICRO_LIST, m_MicroList);
DDX_Text(pDX, IDC_DOPPLER_EFFECT, m_dDopplerFactor);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMicroAndObjectsPage, CPropertyPage)
//{{AFX_MSG_MAP(CMicroAndObjectsPage)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMicroAndObjectsPage message handlers
BOOL CMicroAndObjectsPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Initialise the ClistCtrl containing ressources descriptions
LV_COLUMN* lvc;
lvc = (LV_COLUMN*)malloc(sizeof(LV_COLUMN));
//
//Fill Micro list....
//
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColMicId; // width of the column, in pixels
lvc->pszText = "Micro Id"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_MicroList.InsertColumn(0, lvc);
lvc->pszText = "X"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColX; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_MicroList.InsertColumn(1, lvc);
lvc->pszText = "Y"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColY; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_MicroList.InsertColumn(2, lvc);
lvc->pszText = "Z"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColZ; // width of the column, in pixels
lvc->iSubItem = 3; // index of subitem associated with column
m_MicroList.InsertColumn(3, lvc);
lvc->pszText = "Nx"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColNx; // width of the column, in pixels
lvc->iSubItem = 4; // index of subitem associated with column
m_MicroList.InsertColumn(4, lvc);
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColNy; // width of the column, in pixels
lvc->pszText = "Ny"; // column heading
lvc->iSubItem = 5; // index of subitem associated with column
m_MicroList.InsertColumn(5, lvc);
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColNz; // width of the column, in pixels
lvc->pszText = "Nz"; // column heading
lvc->iSubItem = 6; // index of subitem associated with column
m_MicroList.InsertColumn(6, lvc);
lvc->pszText = "Tx"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColTx; // width of the column, in pixels
lvc->iSubItem = 7; // index of subitem associated with column
m_MicroList.InsertColumn(7, lvc);
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColTy; // width of the column, in pixels
lvc->pszText = "Ty"; // column heading
lvc->iSubItem = 8; // index of subitem associated with column
m_MicroList.InsertColumn(8, lvc);
lvc->cx = pSuperVisApp->m_RegKeyMicPage.iColTz; // width of the column, in pixels
lvc->pszText = "Tz"; // column heading
lvc->iSubItem = 9; // index of subitem associated with column
m_MicroList.InsertColumn(9, lvc);
//
//Fill Object list....
//
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColObjId; // width of the column, in pixels
lvc->pszText = "Object Id"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_ObjectList.InsertColumn(0, lvc);
lvc->pszText = "X"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColX; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_ObjectList.InsertColumn(1, lvc);
lvc->pszText = "Y"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColY; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_ObjectList.InsertColumn(2, lvc);
lvc->pszText = "Z"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColZ; // width of the column, in pixels
lvc->iSubItem = 3; // index of subitem associated with column
m_ObjectList.InsertColumn(3, lvc);
lvc->pszText = "Frequence"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColFreq; // width of the column, in pixels
lvc->iSubItem = 4; // index of subitem associated with column
m_ObjectList.InsertColumn(4, lvc);
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColVol; // width of the column, in pixels
lvc->pszText = "Volume"; // column heading
lvc->iSubItem = 5; // index of subitem associated with column
m_ObjectList.InsertColumn(5, lvc);
lvc->cx = pSuperVisApp->m_RegKeyObjPage.iColAsso; // width of the column, in pixels
lvc->pszText = "Evts:ptr(Id)->Asso"; // column heading
lvc->iSubItem = 6; // index of subitem associated with column
m_ObjectList.InsertColumn(6, lvc);
//
//Fill Object micro association list....
//
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = 35; // width of the column, in pixels
lvc->pszText = "No."; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_MicroAssoList.InsertColumn(0, lvc);
lvc->pszText = "Micro Id"; // column heading
lvc->cx = 75; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_MicroAssoList.InsertColumn(1, lvc);
lvc->pszText = "Distance"; // column heading
lvc->cx = 75; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_MicroAssoList.InsertColumn(2, lvc);
free( lvc );
//We update the listctrl with micro or oject that could
//have been added before the PropertyPage has been loaded
RefreshMicroList();
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CMicroAndObjectsPage::RefreshMicroList()
{
long i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//we refresh the global Doppler factor
m_dDopplerFactor = M_RealToDoubleSnd(dbgSND_fn_rGetDopplerFactor());
//Clear the list
m_MicroList.DeleteAllItems();
long lNbMicros = pSuperVisApp->m_apMicros.GetSize();
//Cycle through the pointer Array to filter
for (i = 0; i < lNbMicros; i ++ )
{
//Update the rsources list
AddMicroToList(i);
}
}
void CMicroAndObjectsPage::AddMicroToList(long lIndex)
{
MicroArrayElement *pMic;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pMic = (MicroArrayElement *)(pSuperVisApp->m_apMicros.GetAt(lIndex));
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA_TRUE, 0, 0);
char buffer[128];
//Display item
sprintf(buffer,"0x%x", pMic->lId);
m_MicroList.InsertItem( 0, buffer );
//Set the item data with the Micro Array index, to be used later for drag&drop, pop-memnu, etc.
m_MicroList.SetItemData( 0, (DWORD)lIndex );
//Micro Position X
sprintf(buffer, "%6.3f", pMic->dPosX);
m_MicroList.SetItem(0, 1, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Position Y
sprintf(buffer, "%6.3f", pMic->dPosY);
m_MicroList.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Position Z
sprintf(buffer, "%6.3f", pMic->dPosZ);
m_MicroList.SetItem(0, 3, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Normal X
sprintf(buffer, "%6.3f", pMic->dNormX);
m_MicroList.SetItem(0, 4, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Normal Y
sprintf(buffer, "%6.3f", pMic->dNormY);
m_MicroList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Normal Z
sprintf(buffer, "%6.3f", pMic->dNormZ);
m_MicroList.SetItem(0, 6, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Transversal X
sprintf(buffer, "%6.3f", pMic->dTransX);
m_MicroList.SetItem(0, 7, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Transversal Y
sprintf(buffer, "%6.3f", pMic->dTransY);
m_MicroList.SetItem(0, 8, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Micro Transversal Z
sprintf(buffer, "%6.3f", pMic->dTransZ);
m_MicroList.SetItem(0, 9, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Refresh data from the control
PostMessage(WM_USER_UPDATE_DATA_FALSE, 0, 0);
}
BOOL CMicroAndObjectsPage::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_USER_UPDATE_DATA_TRUE)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(TRUE);
}
if(pMsg->message == WM_USER_UPDATE_DATA_FALSE)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(FALSE);
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
void CMicroAndObjectsPage::RefreshObjectList()
{
long i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Clear the list
m_ObjectList.DeleteAllItems();
long lNbObjects = pSuperVisApp->m_apObjects.GetSize();
//Cycle through the pointer Array to filter
for (i = 0; i < lNbObjects; i ++ )
{
//Update the rsources list
AddObjectToList(i);
}
//Set the asso mic with currently selected object
if(lNbObjects > 0)
SetObjectAssoMicroList(0);
}
void CMicroAndObjectsPage::SetObjectAssoMicroList(long lIndexObject)
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
long i;
//Set the Associated Micro List
MicroArrayElement* pMic;
ObjectArrayElement *pObject;
SndVector Vector;
char buffer[256];
//Clear the list
m_MicroAssoList.DeleteAllItems();
pObject = (ObjectArrayElement *)(pSuperVisApp->m_apObjects.GetAt(lIndexObject));
long lNbMicros = pSuperVisApp->m_apMicros.GetSize();
for (i = 0; i < lNbMicros; i++){
pMic = (MicroArrayElement*)pSuperVisApp->m_apMicros.GetAt(i);
//Mic #
sprintf(buffer,"%d", i );
m_MicroAssoList.InsertItem( 0, buffer );
//Mic Id
sprintf(buffer,"0x%0x",pMic->lId );
m_MicroAssoList.SetItem(0, 1, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Object distance from current Micro
Vector.x = (long)(pObject->dPosX - pMic->dPosX);
Vector.y = (long)(pObject->dPosY - pMic->dPosY);
Vector.z = (long)(pObject->dPosZ - pMic->dPosZ);
sprintf(buffer,"%6.3f",M_RealToDoubleSnd(dbgSND_fn_rPseudoNormeVectorSnd(&Vector)));
m_MicroAssoList.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
}
}
void CMicroAndObjectsPage::AddObjectToList(long lIndex)
{
ObjectArrayElement *pObject;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pObject = (ObjectArrayElement *)(pSuperVisApp->m_apObjects.GetAt(lIndex));
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA_TRUE, 0, 0);
char buffer[128];
//Display item
if (pObject->lId == SND_C_OBJET_FANTOME)
sprintf(buffer,"OBJET_FANTOME");
else
sprintf(buffer,"0x%x", pObject->lId);
m_ObjectList.InsertItem( 0, buffer );
//Set the item data with the Micro Array index, to be used later for drag&drop, pop-memnu, etc.
m_ObjectList.SetItemData( 0, (DWORD)lIndex );
//Object Position X
sprintf(buffer, "%6.3f", pObject->dPosX);
m_ObjectList.SetItem(0, 1, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Object Position Y
sprintf(buffer, "%6.3f", pObject->dPosY);
m_ObjectList.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Object Position Z
sprintf(buffer, "%6.3f", pObject->dPosZ);
m_ObjectList.SetItem(0, 3, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Object Frequency
sprintf(buffer, "%6.3f", pObject->dFreq);
m_ObjectList.SetItem(0, 4, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Object Volume
sprintf(buffer, "%6.3f", pObject->ucVol);
m_ObjectList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Object Event pointer (the last one associated)
sprintf(buffer, "0x%0x", pObject->evt_pstPtr);
m_ObjectList.SetItem(0, 6, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Refresh data from the control
PostMessage(WM_USER_UPDATE_DATA_FALSE, 0, 0);
}
void CMicroAndObjectsPage::OnDestroy()
{
CPropertyPage::OnDestroy();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
int ColWidth = m_MicroList.GetColumnWidth(0);
pSuperVisApp->m_RegKeyMicPage.iColMicId= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(1);
pSuperVisApp->m_RegKeyMicPage.iColX= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(2);
pSuperVisApp->m_RegKeyMicPage.iColY= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(3);
pSuperVisApp->m_RegKeyMicPage.iColZ= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(4);
pSuperVisApp->m_RegKeyMicPage.iColNx= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(5);
pSuperVisApp->m_RegKeyMicPage.iColNy = ColWidth;
ColWidth = m_MicroList.GetColumnWidth(6);
pSuperVisApp->m_RegKeyMicPage.iColNz= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(7);
pSuperVisApp->m_RegKeyMicPage.iColTx= ColWidth;
ColWidth = m_MicroList.GetColumnWidth(8);
pSuperVisApp->m_RegKeyMicPage.iColTy = ColWidth;
ColWidth = m_MicroList.GetColumnWidth(9);
pSuperVisApp->m_RegKeyMicPage.iColTz = ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(0);
pSuperVisApp->m_RegKeyObjPage.iColObjId= ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(1);
pSuperVisApp->m_RegKeyObjPage.iColX= ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(2);
pSuperVisApp->m_RegKeyObjPage.iColY= ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(3);
pSuperVisApp->m_RegKeyObjPage.iColZ= ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(4);
pSuperVisApp->m_RegKeyObjPage.iColFreq= ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(5);
pSuperVisApp->m_RegKeyObjPage.iColVol = ColWidth;
ColWidth = m_ObjectList.GetColumnWidth(6);
pSuperVisApp->m_RegKeyObjPage.iColAsso= ColWidth;
}

View File

@@ -0,0 +1,137 @@
#if !defined(AFX_MICROANDOBJECTSPAGE_H__FA1253CF_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_MICROANDOBJECTSPAGE_H__FA1253CF_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MicroAndObjectsPage.h : header file
//
//Micro Structure used by the Supervisater
typedef struct MicroArrayElement{
long lId;
double dPosX;
double dPosY;
double dPosZ;
double dNormX;
double dNormY;
double dNormZ;
double dTransX;
double dTransY;
double dTransZ;
}MicroArrayElement;
typedef struct RegKeyMicPage{
int iColMicId;
int iColX;
int iColY;
int iColZ;
int iColNx;
int iColNy;
int iColNz;
int iColTx;
int iColTy;
int iColTz;
}RegKeyMicPage;
typedef struct RegKeyObjPage{
int iColObjId;
int iColX;
int iColY;
int iColZ;
int iColFreq;
int iColVol;
int iColAsso;
}RegKeyObjPage;
//Object Structure used by Supervisater
typedef struct ObjectArrayElement{
long lId;
unsigned char ucVol;
double dPosX;
double dPosY;
double dPosZ;
double dFreq;
long lDistToMicro;
SND_tdstBlockEvent *evt_pstPtr;
tdxId evt_Id;
tdeTypeEvent evt_eType;
long lAsso;
/// SndReal Freq; /*frequence relative du sample <20> jouer */
/// unsigned char ucPan; /*panoramique (0 gauche <20> 127 droite)*/
/// unsigned char ucSpace; /*parametre de spatialisation (codage DOLBY= 0 tout <20> l<>avant, 127 tout <20> l<>arriere)*/
/// unsigned char ucReverb; /*parametre de la reverberation (tunnels...)*/
/// SndVector Pos; /*position de la source associee*/
/// SndVector Vit; /*vitesse de la source associee*/
/// int iFlags ; /*flags justifiant les champs (cf plus loin)*/
/// int iNbLinks; /*nombre d'element du champ suivant*/
/// MicroLink astMicro[NB_LINK]; /*liste statique des liens micros<->objet*/
/// ExtraSoundParam xExtra; /*!!!!! this field should be never refered; it's only used to pre-size the struct SoundParam*/
}ObjectArrayElement;
/////////////////////////////////////////////////////////////////////////////
// CMicroAndObjectsPage dialog
class CMicroAndObjectsPage : public CPropertyPage
{
DECLARE_DYNCREATE(CMicroAndObjectsPage)
// Construction
public:
void SetObjectAssoMicroList(long lIndexObject);
void AddObjectToList(long lIndex);
void RefreshObjectList();
void RefreshMicroList();
void AddMicroToList(long lIndex);
CMicroAndObjectsPage();
~CMicroAndObjectsPage();
// Dialog Data
//{{AFX_DATA(CMicroAndObjectsPage)
enum { IDD = IDD_MICRO_OBJECTS_PAGE };
CListCtrl m_MicroAssoList;
CListCtrl m_ObjectList;
CListCtrl m_MicroList;
double m_dDopplerFactor;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CMicroAndObjectsPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMicroAndObjectsPage)
virtual BOOL OnInitDialog();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MICROANDOBJECTSPAGE_H__FA1253CF_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
#if !defined(AFX_MIXERPAGE_H__FA1253CE_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_MIXERPAGE_H__FA1253CE_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MixerPage.h : header file
//
#include "sndres.h"
#include "MyResListCtrl.h"
//#include "soundeditor.h" // Added by ClassView
//Ressource structure use by the Supervisater
typedef struct RessourceElement{
SYSTEMTIME time;
unsigned long ulId;
tdeTypeResource tdeType;
unsigned char ucVolume;
CString cResBankName;
CString cResName;
tdstBlockResourceMem *res;
CString cInfo;
SND_tduRefEvt evt;
}ResourceElement;
//Ressource structure use by the Supervisater
typedef struct RegKeyMixerPage{
int iCheckBankId;
int iCheckResId;
BOOL bCheckFirstOccur;
int iColTime;
int iColResName;
int iColResId;
int iColBankName;
int iColBankId;
int iColType;
int iColVol;
int iColInfo;
}RegKeyMixerPage;
/////////////////////////////////////////////////////////////////////////////
// CMixerPage dialog
class CMixerPage : public CPropertyPage
{
DECLARE_DYNCREATE(CMixerPage)
// Construction
public:
ResourceElement m_SelectedResElement;
void ResetReslistButton();
void SetResName(long lIndex);
void SetFirstOccurResName(long lIndex);
unsigned long m_ulSelectedResourceArrayIndex;
void SetEditBoxVolume(unsigned long _ulIndex);
long AddToFirstResOccurArray(ResourceElement* res);
void FilterAndDisplayFirstOccurRes(long lIndex);
void FilterAndDisplayRes(long lIndex);
void RefreshResList();
BOOL m_bPauseProcess;
CMixerPage();
~CMixerPage();
// Dialog Data
//{{AFX_DATA(CMixerPage)
enum { IDD = IDD_MIXER_PAGE };
CSliderCtrl m_VolumeSlider;
CMyResListCtrl m_ResList;
CString m_cSelectedRes;
BOOL m_bDebugBreak;
BOOL m_bFirstOccurence;
BOOL m_bShowBankWithId;
BOOL m_bShowResWithId;
long m_lBankId;
long m_lResId;
long m_ulSelectedResVol;
CString m_cSelectedResName;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CMixerPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
virtual BOOL OnSetActive();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMixerPage)
virtual BOOL OnInitDialog();
afx_msg void OnSave();
afx_msg void OnPauseResButton();
afx_msg void OnResetReslistButton();
afx_msg void OnCheckDebugOnRes();
afx_msg void OnCheckFirstResOccur();
afx_msg void OnCheckRes();
afx_msg void OnCheckResBank();
afx_msg void OnChangeEditResBankId();
afx_msg void OnChangeEditResId();
afx_msg void OnVolMoins();
afx_msg void OnVolPlus();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnDestroy();
afx_msg void OnPlay();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MIXERPAGE_H__FA1253CE_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,287 @@
// MyListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MyListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl
CMyListCtrl::CMyListCtrl()
{
nSortedCol = -1;
bSortAscending = TRUE;
}
CMyListCtrl::~CMyListCtrl()
{
}
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CMyListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHeaderClicked)
ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHeaderClicked)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl message handlers
void CMyListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the current mouse location and convert it to client
// coordinates.
DWORD pos = GetMessagePos();
CPoint pt(LOWORD(pos), HIWORD(pos));
ScreenToClient(&pt);
// Get indexes of the first and last visible items in listview
// control.
int index = GetTopIndex();
int last_visible_index = index + GetCountPerPage();
if (last_visible_index > GetItemCount())
last_visible_index = GetItemCount();
// Loop until number visible items has been reached.
while (index <= last_visible_index)
{
// Get the bounding rectangle of an item. If the mouse
// location is within the bounding rectangle of the item,
// you know you have found the item that was being clicked.
CRect r;
GetItemRect(index, &r, LVIR_BOUNDS);
if (r.PtInRect(pt))
{
UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
SetItemState(index, flag, flag);
break;
}
// Get the next item in listview control.
index++;
}
*pResult = 0;
}
void CMyListCtrl::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the current mouse location and convert it to client
// coordinates.
DWORD pos = GetMessagePos();
CPoint pt(LOWORD(pos), HIWORD(pos));
ScreenToClient(&pt);
// Get indexes of the first and last visible items in listview
// control.
int index = GetTopIndex();
int last_visible_index = index + GetCountPerPage();
if (last_visible_index > GetItemCount())
last_visible_index = GetItemCount();
// Loop until number visible items has been reached.
while (index <= last_visible_index)
{
// Get the bounding rectangle of an item. If the mouse
// location is within the bounding rectangle of the item,
// you know you have found the item that was being clicked.
CRect r;
GetItemRect(index, &r, LVIR_BOUNDS);
if (r.PtInRect(pt))
{
//Select item
UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
SetItemState(index, flag, flag);
//Show PopUp Menu
CMenu menu;
VERIFY(menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
//Modify the menu with the ressource name. The Command is handled in CPropertySheet::OnCmdMsg.
//pPopup->ModifyMenu( 0, MF_BYPOSITION | MF_STRING, ID_WATCH, "Voila, ca marche!!" );
ASSERT(pPopup != NULL);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
LOWORD(pos),
HIWORD(pos),
AfxGetMainWnd());
break;
}
// Get the next item in listview control.
index++;
}
*pResult = 0;
}
void CMyListCtrl::OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
if( phdn->iButton == 0 )
{
// User clicked on header using left mouse button
if( phdn->iItem == nSortedCol )
bSortAscending = !bSortAscending;
else
bSortAscending = TRUE;
nSortedCol = phdn->iItem;
SortTextItems( nSortedCol, bSortAscending , 0, -1);
}
*pResult = 0;
}
// SortTextItems - Sort the list based on column text
// Returns - Returns true for success
// nCol - column that contains the text to be sorted
// bAscending - indicate sort order
// low - row to start scanning from - default row is 0
// high - row to end scan. -1 indicates last row
BOOL CMyListCtrl::SortTextItems( int nCol, BOOL bAscending, int low /*= 0*/, int high /*= -1*/ )
{
if( nCol >= ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount() )
return FALSE;
if( high == -1 ) high = GetItemCount() - 1;
int lo = low;
int hi = high;
CString midItem;
if( hi <= lo ) return FALSE;
midItem = GetItemText( (lo+hi)/2, nCol );
// loop through the list until indices cross
while( lo <= hi )
{
// rowText will hold all column text for one row
CStringArray rowText;
// find the first element that is greater than or equal to
// the partition element starting from the left Index.
if( bAscending )
while( ( lo < high ) && ( GetItemText(lo, nCol) < midItem ) )
++lo;
else
while( ( lo < high ) && ( GetItemText(lo, nCol) > midItem ) )
++lo;
// find an element that is smaller than or equal to
// the partition element starting from the right Index.
if( bAscending )
while( ( hi > low ) && ( GetItemText(hi, nCol) > midItem ) )
--hi;
else
while( ( hi > low ) && ( GetItemText(hi, nCol) < midItem ) )
--hi;
// if the indexes have not crossed, swap
// and if the items are not equal
if( lo <= hi )
{
// swap only if the items are not equal
if( GetItemText(lo, nCol) != GetItemText(hi, nCol))
{
// swap the rows
LV_ITEM lvitemlo, lvitemhi;
int nColCount =
((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
rowText.SetSize( nColCount );
int i;
for( i=0; i<nColCount; i++)
rowText[i] = GetItemText(lo, i);
lvitemlo.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
lvitemlo.iItem = lo;
lvitemlo.iSubItem = 0;
lvitemlo.stateMask = LVIS_CUT | LVIS_DROPHILITED |
LVIS_FOCUSED | LVIS_SELECTED |
LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvitemhi = lvitemlo;
lvitemhi.iItem = hi;
GetItem( &lvitemlo );
GetItem( &lvitemhi );
for( i=0; i<nColCount; i++)
SetItemText(lo, i, GetItemText(hi, i));
lvitemhi.iItem = lo;
SetItem( &lvitemhi );
for( i=0; i<nColCount; i++)
SetItemText(hi, i, rowText[i]);
lvitemlo.iItem = hi;
SetItem( &lvitemlo );
}
++lo;
--hi;
}
}
// If the right index has not reached the left side of array
// must now sort the left partition.
if( low < hi )
SortTextItems( nCol, bAscending , low, hi);
// If the left index has not reached the right side of array
// must now sort the right partition.
if( lo < high )
SortTextItems( nCol, bAscending , lo, high );
return TRUE;
}

View File

@@ -0,0 +1,53 @@
#if !defined(AFX_MYLISTCTRL_H__C9F294B0_E16D_11D2_9F47_00104B6833D0__INCLUDED_)
#define AFX_MYLISTCTRL_H__C9F294B0_E16D_11D2_9F47_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl window
class CMyListCtrl : public CListCtrl
{
// Construction
public:
CMyListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
BOOL SortTextItems( int nCol, BOOL bAscending, int low, int high);
int nSortedCol;
BOOL bSortAscending;
virtual ~CMyListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CMyListCtrl)
afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYLISTCTRL_H__C9F294B0_E16D_11D2_9F47_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,223 @@
// MyResListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MyResListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyResListCtrl
CMyResListCtrl::CMyResListCtrl()
{
nSortedCol = -1;
bSortAscending = TRUE;
}
CMyResListCtrl::~CMyResListCtrl()
{
}
BEGIN_MESSAGE_MAP(CMyResListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CMyResListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
ON_NOTIFY(HDN_ITEMCLICKA, 0, OnHeaderClicked)
ON_NOTIFY(HDN_ITEMCLICKW, 0, OnHeaderClicked)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyResListCtrl message handlers
void CMyResListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the current mouse location and convert it to client
// coordinates.
DWORD pos = GetMessagePos();
CPoint pt(LOWORD(pos), HIWORD(pos));
ScreenToClient(&pt);
// Get indexes of the first and last visible items in listview
// control.
int index = GetTopIndex();
int last_visible_index = index + GetCountPerPage();
if (last_visible_index > GetItemCount())
last_visible_index = GetItemCount();
// Loop until number visible items has been reached.
while (index <= last_visible_index)
{
// Get the bounding rectangle of an item. If the mouse
// location is within the bounding rectangle of the item,
// you know you have found the item that was being clicked.
CRect r;
GetItemRect(index, &r, LVIR_BOUNDS);
if (r.PtInRect(pt))
{
UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
SetItemState(index, flag, flag);
//We add the new volume in the Volume EditBox
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
unsigned long UlData = (unsigned long)GetItemData(index);
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_MixerPage.SetEditBoxVolume(UlData);
break;
}
// Get the next item in listview control.
index++;
}
*pResult = 0;
}
void CMyResListCtrl::OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult)
{
HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
if( phdn->iButton == 0 )
{
// User clicked on header using left mouse button
if( phdn->iItem == nSortedCol )
bSortAscending = !bSortAscending;
else
bSortAscending = TRUE;
nSortedCol = phdn->iItem;
SortTextItems( nSortedCol, bSortAscending , 0, -1);
}
*pResult = 0;
}
// SortTextItems - Sort the list based on column text
// Returns - Returns true for success
// nCol - column that contains the text to be sorted
// bAscending - indicate sort order
// low - row to start scanning from - default row is 0
// high - row to end scan. -1 indicates last row
BOOL CMyResListCtrl::SortTextItems( int nCol, BOOL bAscending, int low /*= 0*/, int high /*= -1*/ )
{
if( nCol >= ((CHeaderCtrl*)GetDlgItem(0))->GetItemCount() )
return FALSE;
if( high == -1 ) high = GetItemCount() - 1;
int lo = low;
int hi = high;
CString midItem;
if( hi <= lo ) return FALSE;
midItem = GetItemText( (lo+hi)/2, nCol );
// loop through the list until indices cross
while( lo <= hi )
{
// rowText will hold all column text for one row
CStringArray rowText;
// find the first element that is greater than or equal to
// the partition element starting from the left Index.
if( bAscending )
while( ( lo < high ) && ( GetItemText(lo, nCol) < midItem ) )
++lo;
else
while( ( lo < high ) && ( GetItemText(lo, nCol) > midItem ) )
++lo;
// find an element that is smaller than or equal to
// the partition element starting from the right Index.
if( bAscending )
while( ( hi > low ) && ( GetItemText(hi, nCol) > midItem ) )
--hi;
else
while( ( hi > low ) && ( GetItemText(hi, nCol) < midItem ) )
--hi;
// if the indexes have not crossed, swap
// and if the items are not equal
if( lo <= hi )
{
// swap only if the items are not equal
if( GetItemText(lo, nCol) != GetItemText(hi, nCol))
{
// swap the rows
LV_ITEM lvitemlo, lvitemhi;
int nColCount =
((CHeaderCtrl*)GetDlgItem(0))->GetItemCount();
rowText.SetSize( nColCount );
int i;
for( i=0; i<nColCount; i++)
rowText[i] = GetItemText(lo, i);
lvitemlo.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_STATE;
lvitemlo.iItem = lo;
lvitemlo.iSubItem = 0;
lvitemlo.stateMask = LVIS_CUT | LVIS_DROPHILITED |
LVIS_FOCUSED | LVIS_SELECTED |
LVIS_OVERLAYMASK | LVIS_STATEIMAGEMASK;
lvitemhi = lvitemlo;
lvitemhi.iItem = hi;
GetItem( &lvitemlo );
GetItem( &lvitemhi );
for( i=0; i<nColCount; i++)
SetItemText(lo, i, GetItemText(hi, i));
lvitemhi.iItem = lo;
SetItem( &lvitemhi );
for( i=0; i<nColCount; i++)
SetItemText(hi, i, rowText[i]);
lvitemlo.iItem = hi;
SetItem( &lvitemlo );
}
++lo;
--hi;
}
}
// If the right index has not reached the left side of array
// must now sort the left partition.
if( low < hi )
SortTextItems( nCol, bAscending , low, hi);
// If the left index has not reached the right side of array
// must now sort the right partition.
if( lo < high )
SortTextItems( nCol, bAscending , lo, high );
return TRUE;
}

View File

@@ -0,0 +1,52 @@
#if !defined(AFX_MYRESLISTCTRL_H__0C3228FA_F275_11D2_9F68_00104B6833D0__INCLUDED_)
#define AFX_MYRESLISTCTRL_H__0C3228FA_F275_11D2_9F68_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyResListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyResListCtrl window
class CMyResListCtrl : public CListCtrl
{
// Construction
public:
CMyResListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyResListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
BOOL SortTextItems( int nCol, BOOL bAscending, int low, int high);
int nSortedCol;
BOOL bSortAscending;
virtual ~CMyResListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CMyResListCtrl)
afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYRESLISTCTRL_H__0C3228FA_F275_11D2_9F68_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// supervis.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,41 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__2CEA4ECD_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_)
#define AFX_STDAFX_H__2CEA4ECD_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC OLE automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__2CEA4ECD_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,198 @@
// SuperVisSettingsPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "SuperVisSettingsPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSuperVisSettingsPage property page
IMPLEMENT_DYNCREATE(CSuperVisSettingsPage, CPropertyPage)
CSuperVisSettingsPage::CSuperVisSettingsPage() : CPropertyPage(CSuperVisSettingsPage::IDD)
{
//{{AFX_DATA_INIT(CSuperVisSettingsPage)
m_uiRefreshRate = 0;
m_bSetWindowOnTop = FALSE;
m_BinaryLCBPath = _T("");
//}}AFX_DATA_INIT
}
CSuperVisSettingsPage::~CSuperVisSettingsPage()
{
}
void CSuperVisSettingsPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSuperVisSettingsPage)
DDX_Text(pDX, IDC_REFRESH_RATE, m_uiRefreshRate);
DDV_MinMaxUInt(pDX, m_uiRefreshRate, 250, 10000);
DDX_Check(pDX, IDC_WINDOW_ON_TOP, m_bSetWindowOnTop);
DDX_Text(pDX, IDC_EDIT_LCB_PATH, m_BinaryLCBPath);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSuperVisSettingsPage, CPropertyPage)
//{{AFX_MSG_MAP(CSuperVisSettingsPage)
ON_BN_CLICKED(IDC_PLUS, OnPlus)
ON_BN_CLICKED(IDC_MOINS, OnMoins)
ON_EN_SETFOCUS(IDC_REFRESH_RATE, OnSetfocusRefreshRate)
ON_BN_CLICKED(IDC_WINDOW_ON_TOP, OnWindowOnTop)
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_BROWSE_FOR_LCB, OnBrowseForLcb)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSuperVisSettingsPage message handlers
BOOL CSuperVisSettingsPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Refresh rate default
m_uiRefreshRate = (unsigned int)pSuperVisApp->m_iRefreshRate;
//Always on top check box
m_bSetWindowOnTop = pSuperVisApp->m_bWindowOnTop;
//Set the selected
((CEdit *)(GetDlgItem(IDC_REFRESH_RATE)))->LimitText(5);
//Set LCB Edit box
((CEdit *)(GetDlgItem(IDC_EDIT_LCB_PATH)))->SetReadOnly( TRUE );
m_BinaryLCBPath = pSuperVisApp->m_cBinaryLCBPath;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSuperVisSettingsPage::OnPlus()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
m_uiRefreshRate += 250;
if(m_uiRefreshRate > 10000)
m_uiRefreshRate = 10000;
pSuperVisApp->m_SuperVisThread->SuperVisSheet->SetTimer( WM_USER_TIMER, m_uiRefreshRate, NULL );
UpdateData(FALSE);
}
void CSuperVisSettingsPage::OnMoins()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
m_uiRefreshRate -= 250;
if(m_uiRefreshRate <= 250)
m_uiRefreshRate = 250;
pSuperVisApp->m_SuperVisThread->SuperVisSheet->SetTimer( WM_USER_TIMER, m_uiRefreshRate, NULL );
UpdateData(FALSE);
}
void CSuperVisSettingsPage::OnSetfocusRefreshRate()
{
//Set the selected
((CEdit *)(GetDlgItem(IDC_REFRESH_RATE)))->SetSel( 0, -1, FALSE );
}
void CSuperVisSettingsPage::OnWindowOnTop()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Update the variable
UpdateData(TRUE);
if(m_bSetWindowOnTop)
{
pSuperVisApp->m_SuperVisThread->SuperVisSheet->SetWindowPos(&wndTopMost ,0 ,0, 0, 0, SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOMOVE);
}
else
{
pSuperVisApp->m_SuperVisThread->SuperVisSheet->SetWindowPos(&wndNoTopMost ,0 ,0, 0, 0, SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOMOVE);
}
pSuperVisApp->m_bWindowOnTop = m_bSetWindowOnTop;
}
void CSuperVisSettingsPage::OnDestroy()
{
CPropertyPage::OnDestroy();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_iRefreshRate = (int)m_uiRefreshRate;
}
void CSuperVisSettingsPage::OnBrowseForLcb()
{
CString strFileName;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Leave if we already had intiated SoundEditor Automation
if(!pSuperVisApp->m_SuperVisThread->bAutomationActivated)
{
CFileDialog dlg( TRUE,"lcb","*.lcb",
OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR,
_T("SoundEditor|LCB |"));
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
//We have to extract the path, GetpathName include the filename
m_BinaryLCBPath = dlg.GetPathName();
UpdateData(FALSE);
//Update for later registry saving
pSuperVisApp->m_cBinaryLCBPath = m_BinaryLCBPath;
pSuperVisApp->m_SuperVisThread->Automation(m_BinaryLCBPath);
}
else if (nResponse == IDCANCEL)
{
return;
}
}
return;
}

View File

@@ -0,0 +1,57 @@
#if !defined(AFX_SUPERVISSETTINGSPAGE_H__FA1253D1_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_SUPERVISSETTINGSPAGE_H__FA1253D1_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// SuperVisSettingsPage.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSuperVisSettingsPage dialog
class CSuperVisSettingsPage : public CPropertyPage
{
DECLARE_DYNCREATE(CSuperVisSettingsPage)
// Construction
public:
CSuperVisSettingsPage();
~CSuperVisSettingsPage();
// Dialog Data
//{{AFX_DATA(CSuperVisSettingsPage)
enum { IDD = IDD_SUPERVIS_SETTINGS_PAGE };
UINT m_uiRefreshRate;
BOOL m_bSetWindowOnTop;
CString m_BinaryLCBPath;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CSuperVisSettingsPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CSuperVisSettingsPage)
virtual BOOL OnInitDialog();
afx_msg void OnPlus();
afx_msg void OnMoins();
afx_msg void OnSetfocusRefreshRate();
afx_msg void OnWindowOnTop();
afx_msg void OnDestroy();
afx_msg void OnBrowseForLcb();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SUPERVISSETTINGSPAGE_H__FA1253D1_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,745 @@
// SuperVisSheet.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "SuperVisSheet.h"
#include "SNDinc.h"
#include "snddll.h"
#include "snddbg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSuperVisSheet
IMPLEMENT_DYNAMIC(CSuperVisSheet, CPropertySheet)
CSuperVisSheet::CSuperVisSheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
//Read config in ini file...
ReadIniFile();
AddControlPages();
}
CSuperVisSheet::CSuperVisSheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
//Read config in ini file...
ReadIniFile();
AddControlPages();
}
CSuperVisSheet::CSuperVisSheet()
:CPropertySheet("SuperVisater99")
{
//Read config in ini file...
ReadIniFile();
AddControlPages();
}
CSuperVisSheet::~CSuperVisSheet()
{
//Save config in ini file...
WriteIniFile();
}
BEGIN_MESSAGE_MAP(CSuperVisSheet, CPropertySheet)
//{{AFX_MSG_MAP(CSuperVisSheet)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
ON_COMMAND(IDC_QUIT, OnQuit)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSuperVisSheet message handlers
void CSuperVisSheet::GetIniFilePath()
{
char szIniFile[256];
char szDllDirectory[256]=".";
strncpy(szDllDirectory,SND_fn_szGetSoftDirectory(),sizeof(szDllDirectory)-1);
strncpy(szIniFile, szDllDirectory, sizeof(szIniFile) -1);
strncat(szIniFile, "\\supervis.ini", sizeof(szIniFile) -1);
m_cIniFile = szIniFile;
}
void CSuperVisSheet::ReadIniFile()
{
CSupervisApp* pApp = (CSupervisApp*)AfxGetApp();
char buffer[256];
//Retrieve the .Ini path
GetIniFilePath();
//
//Get the registry configuration
//
//Key for the application
pApp->m_iActivePage = GetPrivateProfileInt("Settings", "ActivePage", 0, (LPCSTR)m_cIniFile);
pApp->m_iWindowLeft = GetPrivateProfileInt("Settings", "WindowLeft", 232, (LPCSTR)m_cIniFile);
pApp->m_iWindowTop = GetPrivateProfileInt("Settings", "WindowTop", 146, (LPCSTR)m_cIniFile);
pApp->m_iWindowRight = GetPrivateProfileInt("Settings", "WindowRight", 1012, (LPCSTR)m_cIniFile);
pApp->m_iWindowBottom = GetPrivateProfileInt("Settings", "WindowBottom", 855, (LPCSTR)m_cIniFile);
//SuperVisSetting key
GetPrivateProfileString("SettingsPage", "BinaryLCBPath", "NoLCBPath", buffer, sizeof(buffer) - 1, (LPCSTR)m_cIniFile);
pApp->m_cBinaryLCBPath = buffer;
GetPrivateProfileString("SettingsPage", "BinaryLCBFileTitle", "NoLCBFileTitle", buffer, sizeof(buffer) - 1, (LPCSTR)m_cIniFile);
pApp->m_cBinaryLCBFileTitle = buffer;
pApp->m_bWindowOnTop = GetPrivateProfileInt("SettingsPage", "AlwaysOnTop", FALSE, (LPCSTR)m_cIniFile);
pApp->m_iRefreshRate = GetPrivateProfileInt("SettingsPage", "RefreshRate", 500, (LPCSTR)m_cIniFile);
//Key for the Mixer Page
pApp->m_MixerPageRegKeys.iCheckBankId= GetPrivateProfileInt("MixerPage", "CheckBankId", 0, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iCheckResId= GetPrivateProfileInt("MixerPage", "CheckResId", 0, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.bCheckFirstOccur= GetPrivateProfileInt("MixerPage", "CheckFirstOccur", 0, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColTime= GetPrivateProfileInt("MixerPage", "ColTime", 77, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColResName= GetPrivateProfileInt("MixerPage", "ColResName", 90, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColResId= GetPrivateProfileInt("MixerPage", "ColResId", 35, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColBankName= GetPrivateProfileInt("MixerPage", "ColBankName", 71, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColBankId= GetPrivateProfileInt("MixerPage", "ColBankId", 54, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColType = GetPrivateProfileInt("MixerPage", "ColType", 100, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColVol= GetPrivateProfileInt("MixerPage", "ColVol", 50, (LPCSTR)m_cIniFile);
pApp->m_MixerPageRegKeys.iColInfo= GetPrivateProfileInt("MixerPage", "ColInfo", 194, (LPCSTR)m_cIniFile);
//Key for the EventsHistory Page
pApp->m_EventPageRegKeys.iCheckBankId= GetPrivateProfileInt("EventHistoryPage", "CheckBankId", 0, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iCheckEventId= GetPrivateProfileInt("EventHistoryPage", "CheckResId", 0, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.bCheckFirstOccur= GetPrivateProfileInt("EventHistoryPage", "CheckFirstOccur", 0, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColTime= GetPrivateProfileInt("EventHistoryPage", "ColTime", 75, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColEvtName= GetPrivateProfileInt("EventHistoryPage", "ColEvtName", 101, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColEvtId = GetPrivateProfileInt("EventHistoryPage", "ColEvtId", 52, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColBankName= GetPrivateProfileInt("EventHistoryPage", "ColBankName", 71, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColBankId= GetPrivateProfileInt("EventHistoryPage", "ColBankId", 51, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColEvtType = GetPrivateProfileInt("EventHistoryPage", "ColEvtType", 100, (LPCSTR)m_cIniFile);
pApp->m_EventPageRegKeys.iColInfo = GetPrivateProfileInt("EventHistoryPage", "ColInfo", 212, (LPCSTR)m_cIniFile);
//Key for the Micro&Object Page
pApp->m_RegKeyMicPage.iColMicId= GetPrivateProfileInt("MicroPage", "iColMicId", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColX= GetPrivateProfileInt("MicroPage", "iColX", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColY= GetPrivateProfileInt("MicroPage", "iColY", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColZ= GetPrivateProfileInt("MicroPage", "iColZ", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColNx= GetPrivateProfileInt("MicroPage", "iColNx", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColNy = GetPrivateProfileInt("MicroPage", "iColNy", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColNz= GetPrivateProfileInt("MicroPage", "iColNz", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColTx= GetPrivateProfileInt("MicroPage", "iColTx", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColTy = GetPrivateProfileInt("MicroPage", "iColTy", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyMicPage.iColTz = GetPrivateProfileInt("MicroPage", "iColTz", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColObjId= GetPrivateProfileInt("ObjectPage", "iColObjId", 102, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColX= GetPrivateProfileInt("ObjectPage", "iColX", 70, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColY= GetPrivateProfileInt("ObjectPage", "iColY", 70, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColZ= GetPrivateProfileInt("ObjectPage", "iColZ", 70, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColFreq= GetPrivateProfileInt("ObjectPage", "iColFreq", 78, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColVol = GetPrivateProfileInt("ObjectPage", "iColVol", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyObjPage.iColAsso= GetPrivateProfileInt("ObjectPage", "iColAsso", 125, (LPCSTR)m_cIniFile);
//Key for Volume Line & Theme Page
pApp->m_RegKeyThemePage.iColVolId= GetPrivateProfileInt("ThemePage", "iColVolId", 200, (LPCSTR)m_cIniFile);
pApp->m_RegKeyThemePage.iColVol= GetPrivateProfileInt("ThemePage", "iColVol", 200, (LPCSTR)m_cIniFile);
//Key for the Virtual Voices Page
pApp->m_RegKeyVoicePage.iColVoiceId = GetPrivateProfileInt("VoicesPage", "iColVoiceId", 83, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColPaused = GetPrivateProfileInt("VoicesPage", "iColPaused", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColResPtr = GetPrivateProfileInt("VoicesPage", "iColResPtr", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColResId = GetPrivateProfileInt("VoicesPage", "iColResId", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColLoop= GetPrivateProfileInt("VoicesPage", "iColLoop", 45, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColNorm = GetPrivateProfileInt("VoicesPage", "iColNorm", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColInstance = GetPrivateProfileInt("VoicesPage", "iColInstance", 68, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColAudibleV = GetPrivateProfileInt("VoicesPage", "iColAudibleV", 100, (LPCSTR)m_cIniFile);
pApp->m_RegKeyVoicePage.iColHardV = GetPrivateProfileInt("VoicesPage", "iColHardV", 100, (LPCSTR)m_cIniFile);
//Key for the Wav Voices Page
pApp->m_RegKeyWavVoicePage.iColWavVoiceId = GetPrivateProfileInt("WavVoicesPage", "iColWavVoiceId", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColResPtr = GetPrivateProfileInt("WavVoicesPage", "iColResPtr", 100, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColResId = GetPrivateProfileInt("WavVoicesPage", "iColResId", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColPaused = GetPrivateProfileInt("WavVoicesPage", "iColPaused", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColVol = GetPrivateProfileInt("WavVoicesPage", "iColVol", 60, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColPan = GetPrivateProfileInt("WavVoicesPage", "iColPan", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColSpace = GetPrivateProfileInt("WavVoicesPage", "iColSpace", 75, (LPCSTR)m_cIniFile);
pApp->m_RegKeyWavVoicePage.iColFreq = GetPrivateProfileInt("WavVoicesPage", "iColFreq", 75, (LPCSTR)m_cIniFile);
}
void CSuperVisSheet::WriteIniFile()
{
char buffer[256];
CSupervisApp* pApp = (CSupervisApp*)AfxGetApp();
//Key for the application
sprintf(buffer, "%d", pApp->m_iActivePage);
WritePrivateProfileString("Settings", "ActivePage", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_iWindowLeft);
WritePrivateProfileString("Settings", "WindowLeft", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_iWindowTop);
WritePrivateProfileString("Settings", "WindowTop", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_iWindowRight);
WritePrivateProfileString("Settings", "WindowRight", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_iWindowBottom);
WritePrivateProfileString("Settings", "WindowBottom", buffer, (LPCSTR)m_cIniFile);
//SuperVisSetting key
WritePrivateProfileString("SettingsPage", "LCBPath", (LPCSTR)(pApp->m_cBinaryLCBPath), (LPCSTR)m_cIniFile);
WritePrivateProfileString("SettingsPage", "LCBFileTitle", (LPCSTR)(pApp->m_cBinaryLCBFileTitle), (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_bWindowOnTop);
WritePrivateProfileString("SettingsPage", "AlwaysOnTop", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_iRefreshRate);
WritePrivateProfileString("SettingsPage", "RefreshRate", buffer, (LPCSTR)m_cIniFile);
//Key for the Mixer Page
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iCheckBankId);
WritePrivateProfileString("MixerPage", "RefreshRate", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iCheckResId);
WritePrivateProfileString("MixerPage", "CheckResId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.bCheckFirstOccur);
WritePrivateProfileString("MixerPage", "CheckFirstOccur", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColTime);
WritePrivateProfileString("MixerPage", "ColTime", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColResName);
WritePrivateProfileString("MixerPage", "ColResName", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColResId);
WritePrivateProfileString("MixerPage", "ColResId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColBankName);
WritePrivateProfileString("MixerPage", "ColBankName", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColBankId);
WritePrivateProfileString("MixerPage", "ColBankId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColVol);
WritePrivateProfileString("MixerPage", "ColVol", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColType);
WritePrivateProfileString("MixerPage", "ColType", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_MixerPageRegKeys.iColInfo);
WritePrivateProfileString("MixerPage", "ColInfo", buffer, (LPCSTR)m_cIniFile);
//Key for the EventsHistory Page
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iCheckBankId);
WritePrivateProfileString("EventHistoryPage", "CheckBankId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iCheckEventId);
WritePrivateProfileString("EventHistoryPage", "CheckEventId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.bCheckFirstOccur);
WritePrivateProfileString("EventHistoryPage", "CheckFirstOccur", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColTime);
WritePrivateProfileString("EventHistoryPage", "ColTime", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColEvtName);
WritePrivateProfileString("EventHistoryPage", "ColEvtName", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColEvtId);
WritePrivateProfileString("EventHistoryPage", "ColEvtId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColBankName);
WritePrivateProfileString("EventHistoryPage", "ColBankName", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColBankId);
WritePrivateProfileString("EventHistoryPage", "ColBankId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColEvtType);
WritePrivateProfileString("EventHistoryPage", "ColEvtType", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_EventPageRegKeys.iColInfo);
WritePrivateProfileString("EventHistoryPage", "ColInfo", buffer, (LPCSTR)m_cIniFile);
//Key for the Micro&Object Page
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColMicId);
WritePrivateProfileString("MicroPage", "iColMicId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColX);
WritePrivateProfileString("MicroPage", "iColX", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColY);
WritePrivateProfileString("MicroPage", "iColY", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColZ);
WritePrivateProfileString("MicroPage", "iColZ", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColNx);
WritePrivateProfileString("MicroPage", "iColNx", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColNy);
WritePrivateProfileString("MicroPage", "iColNy", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColNz);
WritePrivateProfileString("MicroPage", "iColNz", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColTx);
WritePrivateProfileString("MicroPage", "iColTx", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColTy);
WritePrivateProfileString("MicroPage", "iColTy", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyMicPage.iColTz);
WritePrivateProfileString("MicroPage", "iColTz", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColObjId);
WritePrivateProfileString("ObjectPage", "iColObjId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColX);
WritePrivateProfileString("ObjectPage", "iColX", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColY);
WritePrivateProfileString("ObjectPage", "iColY", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColZ);
WritePrivateProfileString("ObjectPage", "iColZ", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColFreq);
WritePrivateProfileString("ObjectPage", "iColFreq", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColVol);
WritePrivateProfileString("ObjectPage", "iColVol", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyObjPage.iColAsso);
WritePrivateProfileString("ObjectPage", "iColAsso", buffer, (LPCSTR)m_cIniFile);
//Key for Volume Line & Theme Page
sprintf(buffer, "%d", pApp->m_RegKeyThemePage.iColVolId);
WritePrivateProfileString("ThemePage", "iColVolId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyThemePage.iColVol);
WritePrivateProfileString("ThemePage", "iColVol", buffer, (LPCSTR)m_cIniFile);
//Key for the Virtual Voices Page
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColVoiceId);
WritePrivateProfileString("VoicesPage", "iColVoiceId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColPaused);
WritePrivateProfileString("VoicesPage", "iColPaused", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColResPtr);
WritePrivateProfileString("VoicesPage", "iColResPtr", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColResId);
WritePrivateProfileString("VoicesPage", "iColResId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColLoop);
WritePrivateProfileString("VoicesPage", "iColLoop", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColNorm);
WritePrivateProfileString("VoicesPage", "iColNorm", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColInstance);
WritePrivateProfileString("VoicesPage", "iColInstance", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColAudibleV);
WritePrivateProfileString("VoicesPage", "iColAudibleV", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyVoicePage.iColHardV);
WritePrivateProfileString("VoicesPage", "iColHardV", buffer, (LPCSTR)m_cIniFile);
//Key for the Wav Voices Page
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColWavVoiceId);
WritePrivateProfileString("WavVoicesPage", "iColWavVoiceId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColResPtr);
WritePrivateProfileString("WavVoicesPage", "iColResPtr", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColResId);
WritePrivateProfileString("WavVoicesPage", "iColResId", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColPaused);
WritePrivateProfileString("WavVoicesPage", "iColPaused", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColVol);
WritePrivateProfileString("WavVoicesPage", "iColVol", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColPan);
WritePrivateProfileString("WavVoicesPage", "iColPan", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColSpace);
WritePrivateProfileString("WavVoicesPage", "iColSpace", buffer, (LPCSTR)m_cIniFile);
sprintf(buffer, "%d", pApp->m_RegKeyWavVoicePage.iColFreq);
WritePrivateProfileString("WavVoicesPage", "iColFreq", buffer, (LPCSTR)m_cIniFile);
}
void CSuperVisSheet::AddControlPages()
{
AddPage(&m_EventsHistoryPage);
AddPage(&m_MixerPage);
AddPage(&m_MicroAndObjectsPage);
AddPage(&m_VoicesPage);
AddPage(&m_WavVoicesPage);
AddPage(&m_ThemesPage);
AddPage(&m_SuperVisSettingPage);
}
BOOL CSuperVisSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->m_bIsPSheettActive = TRUE;
//
//Little trick to add a button in a modeless CPropertySheet. A modeless
//propertysheet doesnt have ok, cancel and apply buttons.
//
RECT rc;
GetWindowRect (&rc);
// Increase the height of the CPropertySheet by 30
rc.bottom += 35;
// Resize the CPropertySheet
MoveWindow (rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
// Convert to client coordinates
ScreenToClient (&rc);
// m_Button is of type CButton and is a member of CMySheet
m_Button.Create ("&Quit", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
CRect (rc.right - 85, rc.bottom-35, rc.right - 10, rc.bottom-10),
this, IDC_QUIT);
m_Button.SetFont( GetFont() );
//Set the always OnTop Key
if(pSuperVisApp->m_bWindowOnTop)
SetWindowPos(&wndTopMost ,0 ,0, 0, 0, SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOMOVE);
else
SetWindowPos(&wndNoTopMost ,0 ,0, 0, 0, SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOMOVE);
//Move the window to where is was last time
CRect Pos;
Pos.left = pSuperVisApp->m_iWindowLeft;
Pos.top= pSuperVisApp->m_iWindowTop;
Pos.right = pSuperVisApp->m_iWindowRight;
Pos.bottom = pSuperVisApp->m_iWindowBottom;
MoveWindow(Pos, FALSE);
/*
//Retrieve the Size of the Window
m_bFirstSizing = TRUE;
GetWindowRect(m_rOriginalSize);
// ScreenToClient(&m_rOriginalSize);
*/
return bResult;
}
// Handler for button click of IDC_QUIT
void CSuperVisSheet::OnQuit ()
{
//Kill the propertysheet
DestroyWindow();
//Desacitvate the Supervisater
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_bSuperVisaterActive = FALSE;
}
void CSuperVisSheet::PostNcDestroy()
{
//Set the flag so we dont close the window a second time when the engine quit
((CSupervisApp*)AfxGetApp())->m_SuperVisThread->m_bIsPSheettActive = FALSE;
//Set the flag for the engine know we are inactive
((CSupervisApp*)AfxGetApp())->m_bSuperVisaterActive = FALSE;
//We erase everything
delete this;
CPropertySheet::PostNcDestroy();
}
BOOL CSuperVisSheet::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo)
{
// If pHandlerInfo is NULL, then handle the message
if (pHandlerInfo == NULL)
{
if (nID == ID_WATCH)
{
if (nCode == CN_COMMAND)
{
m_EventsHistoryPage.SendEventInWatchList();
}
return TRUE;
}
}
return CPropertySheet::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
void CSuperVisSheet::SendDestroyMsg()
{
PostMessage(WM_USER_DESTROY_WINDOW, 0, 0);
}
BOOL CSuperVisSheet::PreTranslateMessage(MSG* pMsg)
{
//We destroy the supervisheet here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
if (pMsg->message == WM_USER_DESTROY_WINDOW){
DestroyWindow();
}
if (pMsg->message == WM_TIMER){
if(pMsg->wParam == WM_USER_TIMER){
//Process the timer message to refresh all the control
RefreshSuperVisater();
}
}
return CPropertySheet::PreTranslateMessage(pMsg);
}
void CSuperVisSheet::RefreshSuperVisater()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
CSingleLock sLock( pSuperVisApp->SuperVisMutex, FALSE );
//Wait for Mutex Object
sLock.Lock( INFINITE );
//We look which page is active and we refresh it
int iActivePageIndex = GetActiveIndex();
switch (iActivePageIndex)
{
//EventsHistoryPage
case 0:
break;
//MixerPage
case 1:
break;
//MicroAndObjestsPage
case 2:
m_MicroAndObjectsPage.RefreshMicroList();
m_MicroAndObjectsPage.RefreshObjectList();
break;
//VoicesPage
case 3:
m_VoicesPage.RefreshVoiceList();
break;
//WavVoicesPage
case 4:
m_WavVoicesPage.RefreshVoicesList();
break;
//ThemePage
case 5:
m_ThemesPage.RefreshVolList();
m_ThemesPage.RefreshTheme();
break;
//SuperVisSettingPage
case 6:
break;
}
//Release Mutex Object
sLock.Unlock();
}
/*
void CSuperVisSheet::OnSizing(UINT fwSide, LPRECT pRect)
{
CPropertySheet::OnSizing(fwSide, pRect);
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
if(m_bFirstSizing)
{
m_bFirstSizing = FALSE;
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_EventsHistoryPage.GetInitWindowSize();
m_Button.GetWindowRect(m_ButtonInitSize);
m_Button.ScreenToClient(&m_ButtonInitSize);
}
CRect CurRect;
GetWindowRect(&CurRect);
int deltax = (pRect->right - pRect->left) - (m_rOriginalSize.right - m_rOriginalSize.left);
int deltay = (pRect->bottom - pRect->top) - (m_rOriginalSize.bottom - m_rOriginalSize.top);
//Move the Quit button
CRect rect = m_ButtonInitSize;
rect.right += deltax;
rect.left = rect.right - (m_ButtonInitSize.right - m_ButtonInitSize.left);
rect.bottom += deltay;
m_Button.MoveWindow(rect);
//We look which page is active and we resize it
int iActivePageIndex = GetActiveIndex();
switch (iActivePageIndex)
{
//VoicesPage
case 0:
break;
//ThemePage
case 1:
break;
//SuperVisSettingPage
case 2:
break;
//MixerPage
case 3:
break;
//MicroAndObjestsPage
case 4:
break;
//EventsHistoryPage
case 5:
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_EventsHistoryPage.SetWindowSize(deltax, deltay) ;
break;
//WavVoicesPage
case 6:
break;
}
}
*/
void CSuperVisSheet::OnDestroy()
{
CPropertySheet::OnDestroy();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_iActivePage = GetActiveIndex();
CRect Pos;
GetWindowRect(Pos);
pSuperVisApp->m_iWindowLeft = Pos.left;
pSuperVisApp->m_iWindowTop = Pos.top;
pSuperVisApp->m_iWindowRight = Pos.right;
pSuperVisApp->m_iWindowBottom = Pos.bottom;
}
LRESULT CSuperVisSheet::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
//The thread just received a message to do OLE automation with soundeditor
//to get the bank name and the Event name
//Wparam : index of the array to display
//LParam : Event to synchronise the two thread
if (message == WM_SETNAME_EVENT){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_EventsHistoryPage.SetEventsName(long(wParam));
pSuperVisApp->AddHistoSyncEvent->SetEvent();
}
//The thread just received a message to do OLE automation with soundeditor
//to get the bank name and the first occurence Event name
//Wparam : index of the array to display
//LParam : Event to synchronise the two thread
if (message == WM_SETNAME_FIRST_OCCUR_EVENT){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_EventsHistoryPage.SetFirstOccurEventsName(long(wParam));
pSuperVisApp->AddHistoSyncEvent->SetEvent();
}
//The thread just received a message to do OLE automation with soundeditor
//to get the bank name and the res name
//Wparam : index of the array to display
//LParam : Event to synchronise the two thread
if (message == WM_SETNAME_RES){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_MixerPage.SetResName(long(wParam));
pSuperVisApp->AddHistoSyncEvent->SetEvent();
}
//The thread just received a message to do OLE automation with soundeditor
//to get the bank name and the first occurence res name
//Wparam : index of the array to display
//LParam : Event to synchronise the two thread
if (message == WM_SETNAME_FIRST_OCCUR_RES){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_MixerPage.SetFirstOccurResName(long(wParam));
pSuperVisApp->AddHistoSyncEvent->SetEvent();
}
//The thread just received a message to do OLE automation with soundeditor
//to get the bank name and the first occurence res name
//Wparam : index of the array to display
//LParam : Event to synchronise the two thread
if (message == WM_RESETLIST){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_MixerPage.ResetReslistButton();
}
return CPropertySheet::DefWindowProc(message, wParam, lParam);
}

View File

@@ -0,0 +1,91 @@
#if !defined(AFX_SUPERVISSHEET_H__FB8CCD4A_DD7D_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_SUPERVISSHEET_H__FB8CCD4A_DD7D_11D2_9F40_00104B6833D0__INCLUDED_
#include "SuperVisSettingsPage.h" // Added by ClassView
#include "EventsHistoryPage.h" // Added by ClassView
#include "MicroAndObjectsPage.h" // Added by ClassView
#include "MixerPage.h" // Added by ClassView
#include "ThemesPage.h" // Added by ClassView
#include "VoicesPage.h" // Added by ClassView
#include "WavVoicesPage.h" // Added by ClassView
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// SuperVisSheet.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSuperVisSheet
class CSuperVisSheet : public CPropertySheet
{
DECLARE_DYNAMIC(CSuperVisSheet)
// Construction
public:
CSuperVisSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CSuperVisSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0);
CSuperVisSheet();
protected:
void AddControlPages(void);
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSuperVisSheet)
public:
virtual BOOL OnInitDialog();
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void PostNcDestroy();
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
public:
CString m_cIniFile;
void WriteIniFile();
void ReadIniFile();
void GetIniFilePath();
CRect m_ButtonInitSize;
BOOL m_bFirstSizing;
CRect m_rOriginalSize;
void RefreshSuperVisater();
CWavVoicesPage m_WavVoicesPage;
void SendDestroyMsg();
BOOL m_bIsPShtActive;
CButton m_Button;
CVoicesPage m_VoicesPage;
CThemesPage m_ThemesPage;
CSuperVisSettingsPage m_SuperVisSettingPage;
CMixerPage m_MixerPage;
CMicroAndObjectsPage m_MicroAndObjectsPage;
CEventsHistoryPage m_EventsHistoryPage;
virtual ~CSuperVisSheet();
// Generated message map functions
protected:
//{{AFX_MSG(CSuperVisSheet)
afx_msg void OnDestroy();
afx_msg void OnQuit();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SUPERVISSHEET_H__FB8CCD4A_DD7D_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,244 @@
// SuperVisThread.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "SuperVisThread.h"
#include "SNDinc.h"
#include "snddll.h"
#include "snddbg.h"
#include "sndplay.h"
#include "sndvect.h"
#include "sndres.h"
#include "sndini.h"
#include "sndtheme.h"
#include "sndvirt.h"
#include "sndevent.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSuperVisThread
IMPLEMENT_DYNCREATE(CSuperVisThread, CWinThread)
CSuperVisThread::CSuperVisThread()
{
}
CSuperVisThread::~CSuperVisThread()
{
}
BOOL CSuperVisThread::InitInstance()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
bAutomationActivated = FALSE;
//Create the modeless PropertySheet. This is the main dialog
SuperVisSheet = new CSuperVisSheet;
SuperVisSheet->Create(NULL, WS_OVERLAPPEDWINDOW | WS_VISIBLE , 0 );
//Activate the CPropertyPage.
SuperVisSheet->SetActivePage(0);
SuperVisSheet->SetActivePage(1);
SuperVisSheet->SetActivePage(2);
SuperVisSheet->SetActivePage(3);
SuperVisSheet->SetActivePage(4);
SuperVisSheet->SetActivePage(5);
SuperVisSheet->SetActivePage(6);
//Focus on page on startup
SuperVisSheet->SetActivePage(pSuperVisApp->m_iActivePage);
SuperVisSheet->ShowWindow(SW_SHOW);
//Start the Timer...
SuperVisSheet->m_SuperVisSettingPage.m_uiRefreshRate = pSuperVisApp->m_iRefreshRate;
UINT ret = SuperVisSheet->SetTimer( WM_USER_TIMER, SuperVisSheet->m_SuperVisSettingPage.m_uiRefreshRate, NULL );
if (ret != WM_USER_TIMER)
MessageBox(NULL, "SetTimer Failure", "Error!", MB_OK);
//Signal the Other Thread that this Thread have finished loading
pSuperVisApp->LaunchSuperVisEvent->SetEvent();
return TRUE;
}
int CSuperVisThread::ExitInstance()
{
//UnInstall Automation objects
ExitAutomation();
return CWinThread::ExitInstance();
}
BEGIN_MESSAGE_MAP(CSuperVisThread, CWinThread)
//{{AFX_MSG_MAP(CSuperVisThread)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSuperVisThread message handlers
BOOL CSuperVisThread::InitAutomation()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
if(pSuperVisApp->m_cLCBPath == "NoProjectTitle")
{
//The app didnt return ProjectTitle. We are in binary mode...
if( pSuperVisApp->m_cBinaryLCBPath != "NoLCBPath")
return Automation(pSuperVisApp->m_cBinaryLCBPath);
}
else
{
//We use the projectitle returned by the app.
return Automation(pSuperVisApp->m_cLCBPath);
}
return FALSE;
}
BOOL CSuperVisThread::Automation(CString _cProfectFile)
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
m_IEditor = new ISoundEditor;
if(OleInitialize(NULL) == OLE_E_WRONGCOMPOBJ )
{
AfxMessageBox("The versions of COMPOBJ.DLL and OLE2.DLL on your machine are incompatible with each other.");
return FALSE;
}
COleObjectFactory::RegisterAll();
// Sound editor init
if (!m_IEditor->CreateDispatch(_T("SoundEditor.Document")))
{
AfxMessageBox("Could Not Load SoundEditor. Check if it is installed on your computer and be sure to have it started once before using Supervisater.\n This will let know Windows where to find it");
return FALSE;
}
if (!m_IEditor->OpenDocument(_cProfectFile))
{
AfxMessageBox("Could not open the SoundEditor file project:" + _cProfectFile + "\nBrowse for a valid on");
return FALSE;
}
//Get all groups
m_IGroups = new IEventGroups;
m_IGroups->AttachDispatch(m_IEditor->GetEventGroups());
//Enable and disable controls
InitAutomationControls();
bAutomationActivated = TRUE;
return TRUE;
}
void CSuperVisThread::ExitAutomation()
{
if(bAutomationActivated)
{
//Close The SoundEditor document
m_IEditor->ReleaseDispatch();
//delete soundeditor object
/*delete m_IEditor;
delete m_IGroups;
*/
//Remove Ole object
OleUninitialize();
}
}
BOOL CSuperVisThread::PreTranslateMessage(MSG* pMsg)
{
//The thread just received a message to Init OLE automation with soundeditor
//Wparam : not used
//LParam : Event to synchronise the two thread
if (pMsg->message == WM_INIT_AUTOMATION){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
InitAutomation();
SetEvent((HANDLE)(pMsg->lParam));
}
//The thread just received a message to Exit OLE automation with soundeditor
//Wparam : not used
//LParam : Event to synchronise the two thread
if (pMsg->message == WM_EXIT_AUTOMATION){
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
ExitAutomation();
SetEvent((HANDLE)(pMsg->lParam));
}
return CWinThread::PreTranslateMessage(pMsg);
}
void CSuperVisThread::InitAutomationControls()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//
//This function init all controls related to automation on all property page
//
//Enable the save button on the Mixer Page
((CButton *)(pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_MixerPage.GetDlgItem(IDC_SAVE)))->EnableWindow( TRUE );
//Disable the browse for LCB button in the SuperVisetting page
((CButton *)(pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_SuperVisSettingPage.GetDlgItem(IDC_BROWSE_FOR_LCB)))->EnableWindow( FALSE );
}

View File

@@ -0,0 +1,64 @@
#if !defined(AFX_SUPERVISTHREAD_H__E3CA3806_EC2C_11D2_9F5E_00104B6833D0__INCLUDED_)
#define AFX_SUPERVISTHREAD_H__E3CA3806_EC2C_11D2_9F5E_00104B6833D0__INCLUDED_
#include "soundeditor.h" // Added by ClassView
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// SuperVisThread.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CSuperVisThread thread
class CSuperVisThread : public CWinThread
{
DECLARE_DYNCREATE(CSuperVisThread)
protected:
CSuperVisThread(); // protected constructor used by dynamic creation
// Attributes
public:
// Operations
public:
void InitAutomationControls();
BOOL Automation(CString _cProfectFile);
BOOL bAutomationActivated;
IEventGroups *m_IGroups;
void ExitAutomation();
BOOL InitAutomation();
ISoundEditor *m_IEditor;
IResource m_Resource;
BOOL m_bIsPSheettActive;
CSuperVisSheet * SuperVisSheet;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSuperVisThread)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL
// Implementation
protected:
virtual ~CSuperVisThread();
// Generated message map functions
//{{AFX_MSG(CSuperVisThread)
// NOTE - the ClassWizard will add and remove member functions here.
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SUPERVISTHREAD_H__E3CA3806_EC2C_11D2_9F5E_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,270 @@
// ThemesPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "ThemesPage.h"
//CPA
#include "SNDinc.h"
#include "snddll.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CThemesPage property page
IMPLEMENT_DYNCREATE(CThemesPage, CPropertyPage)
CThemesPage::CThemesPage() : CPropertyPage(CThemesPage::IDD)
{
//{{AFX_DATA_INIT(CThemesPage)
m_cAskedTheme = _T("");
m_cCurrentBridge = _T("");
m_cCurrentPart = _T("");
m_cCurrentTheme = _T("");
m_cState = _T("");
m_cAskedThemeBank = _T("");
m_cAskedThemeId = _T("");
m_cAskedThemePointer = _T("");
m_cAskedThemeResId = _T("");
m_cCurrentThemeBank = _T("");
m_cCurrentThemeId = _T("");
m_cCurrentThemeResId = _T("");
//}}AFX_DATA_INIT
}
CThemesPage::~CThemesPage()
{
}
void CThemesPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CThemesPage)
DDX_Control(pDX, IDC_VOLUME_LINE_LIST, m_VolListCtrl);
DDX_Text(pDX, IDC_CURRENT_BRIDGE, m_cCurrentBridge);
DDX_Text(pDX, IDC_CURRENT_PART, m_cCurrentPart);
DDX_Text(pDX, IDC_CURRENT_THEME, m_cCurrentTheme);
DDX_Text(pDX, IDC_STATE, m_cState);
DDX_Text(pDX, IDC_ASKED_THEME_BANK, m_cAskedThemeBank);
DDX_Text(pDX, IDC_ASKED_THEME_ID, m_cAskedThemeId);
DDX_Text(pDX, IDC_ASKED_THEME_POINTER, m_cAskedThemePointer);
DDX_Text(pDX, IDC_ASKED_THEME_RES_ID, m_cAskedThemeResId);
DDX_Text(pDX, IDC_CURRENT_THEME_BANK_ID, m_cCurrentThemeBank);
DDX_Text(pDX, IDC_CURRENT_THEME_ID, m_cCurrentThemeId);
DDX_Text(pDX, IDC_CURRENT_THEME_RES_ID, m_cCurrentThemeResId);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CThemesPage, CPropertyPage)
//{{AFX_MSG_MAP(CThemesPage)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CThemesPage message handlers
BOOL CThemesPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Initialise the ClistCtrl containing volume line descriptions
LV_COLUMN* lvc;
lvc = (LV_COLUMN*)malloc(sizeof(LV_COLUMN));
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = pSuperVisApp->m_RegKeyThemePage.iColVolId; // width of the column, in pixels
lvc->pszText = "Volume Line Id"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_VolListCtrl.InsertColumn(0, lvc);
lvc->pszText = "Volume"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyThemePage.iColVol; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_VolListCtrl.InsertColumn(1, lvc);
free( lvc );
//Init Theme edit box with nohing
m_cAskedTheme = "None";
m_cCurrentBridge = "0";
m_cCurrentPart = "None";
m_cCurrentTheme = "None";
m_cState = "No State";
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CThemesPage::RefreshVolList()
{
long i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Clear the list
m_VolListCtrl.DeleteAllItems();
//Cycle through the pointer Array to filter
for (i = 0; i < pSuperVisApp->m_apVolumeLine.GetSize(); i ++ )
{
AddVolumeToList(i);
}
}
void CThemesPage::AddVolumeToList(long lIndex)
{
VolumeArrayElement *pVol;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pVol = (VolumeArrayElement *)(pSuperVisApp->m_apVolumeLine.GetAt(lIndex));
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA_TRUE, 0, 0);
char buffer[128];
//Display item
sprintf(buffer,"0x%x", pVol->lId);
m_VolListCtrl.InsertItem( 0, buffer );
//Set the item data with the Micro Array index, to be used later for drag&drop, pop-memnu, etc.
m_VolListCtrl.SetItemData( 0, (DWORD)lIndex );
//Volume line volume....doh!
sprintf(buffer, "%d", pVol->lVol);
m_VolListCtrl.SetItem(0, 1, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Refresh data from the control
PostMessage(WM_USER_UPDATE_DATA_FALSE, 0, 0);
}
void CThemesPage::RefreshTheme()
{
tduRefRes CurrentTheme, AskedTheme;
long lIdPart,lIdLoop;
char buffer[256];
SndBool bTransiting;
unsigned long ulBankId, ulEventId;
if (dbgSND_fn_bGetThemePosition(&CurrentTheme, &lIdPart, &lIdLoop))
{
sprintf(buffer,"0x%x",CurrentTheme.pstPtr);
m_cCurrentTheme = buffer;
sprintf(buffer,"0x%x",CurrentTheme.pstPtr->Id);
m_cCurrentThemeId = buffer;
ulBankId = (0xFFFF0000 & CurrentTheme.pstPtr->Id) >> 16;
sprintf(buffer,"%d",ulBankId);
m_cCurrentThemeBank = buffer;
ulEventId= (0x0000FFFF & CurrentTheme.pstPtr->Id);
sprintf(buffer,"%d",ulEventId);
m_cCurrentThemeResId = buffer;
sprintf(buffer,"%x",lIdPart);
m_cCurrentPart = buffer;
sprintf(buffer," %d",lIdLoop);
m_cCurrentBridge = buffer;
if (dbgSND_fn_bGetAskedTheme(&AskedTheme, &bTransiting))
{
sprintf(buffer,"0x%x",AskedTheme.pstPtr);
m_cAskedTheme = buffer;
sprintf(buffer,"0x%x",AskedTheme.pstPtr->Id);
m_cAskedThemeId = buffer;
ulBankId = (0xFFFF0000 & AskedTheme.pstPtr->Id) >> 16;
sprintf(buffer,"%d",ulBankId);
m_cAskedThemeBank = buffer;
ulEventId= (0x0000FFFF & AskedTheme.pstPtr->Id);
sprintf(buffer,"%d",ulEventId);
m_cAskedThemeResId = buffer;
if (bTransiting)
sprintf(buffer,"Transiting...");
else
sprintf(buffer,"Waiting Before Transition...");
m_cState = buffer;
}
}
else
{
sprintf(buffer,"None");
m_cCurrentPart = buffer;
m_cCurrentTheme = buffer;
m_cAskedTheme = buffer;
sprintf(buffer,"");
m_cCurrentThemeId = buffer;
m_cCurrentThemeBank = buffer;
m_cCurrentThemeResId = buffer;
m_cCurrentBridge = buffer;
m_cAskedThemeId = buffer;
m_cAskedThemeBank = buffer;
m_cAskedThemeResId = buffer;
m_cState = buffer;
}
UpdateData(FALSE);
}
void CThemesPage::OnDestroy()
{
CPropertyPage::OnDestroy();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
int ColWidth = m_VolListCtrl.GetColumnWidth(0);
pSuperVisApp->m_RegKeyThemePage.iColVolId= ColWidth;
ColWidth = m_VolListCtrl.GetColumnWidth(1);
pSuperVisApp->m_RegKeyThemePage.iColVol= ColWidth;
}

View File

@@ -0,0 +1,84 @@
#if !defined(AFX_THEMESPAGE_H__FA1253D2_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_THEMESPAGE_H__FA1253D2_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// ThemesPage.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CThemesPage dialog
//Micro Structure used by the Supervisater
typedef struct VolumeArrayElement{
long lId;
long lVol;
}VolumeArrayElement;
typedef struct RegKeyThemePage{
int iColVolId;
int iColVol;
}RegKeyThemePage;
class CThemesPage : public CPropertyPage
{
DECLARE_DYNCREATE(CThemesPage)
// Construction
public:
void RefreshTheme();
void AddVolumeToList(long lIndex);
void RefreshVolList();
CThemesPage();
~CThemesPage();
// Dialog Data
//{{AFX_DATA(CThemesPage)
enum { IDD = IDD_THEMES_PAGE };
CListCtrl m_VolListCtrl;
CString m_cAskedTheme;
CString m_cCurrentBridge;
CString m_cCurrentPart;
CString m_cCurrentTheme;
CString m_cState;
CString m_cAskedThemeBank;
CString m_cAskedThemeId;
CString m_cAskedThemePointer;
CString m_cAskedThemeResId;
CString m_cCurrentThemeBank;
CString m_cCurrentThemeId;
CString m_cCurrentThemeResId;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CThemesPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CThemesPage)
virtual BOOL OnInitDialog();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_THEMESPAGE_H__FA1253D2_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,358 @@
// VoicesPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "VoicesPage.h"
//ACP Virtual Voice
#include "sndvirt.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVoicesPage property page
IMPLEMENT_DYNCREATE(CVoicesPage, CPropertyPage)
CVoicesPage::CVoicesPage() : CPropertyPage(CVoicesPage::IDD)
{
//{{AFX_DATA_INIT(CVoicesPage)
m_iMaxVoices = 0;
m_iUsedVoices = 0;
//}}AFX_DATA_INIT
}
CVoicesPage::~CVoicesPage()
{
}
void CVoicesPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CVoicesPage)
DDX_Control(pDX, IDC_VOICES_COMBO, m_VoicesCombo);
DDX_Control(pDX, IDC_VOICES_LIST, m_VoicesListCtrl);
DDX_Text(pDX, IDC_MAX_VOICES, m_iMaxVoices);
DDX_Text(pDX, IDC_USED_VOICES, m_iUsedVoices);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CVoicesPage, CPropertyPage)
//{{AFX_MSG_MAP(CVoicesPage)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVoicesPage message handlers
BOOL CVoicesPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Initialise the ClistCtrl containing virtual voices descriptions
LV_COLUMN* lvc;
lvc = (LV_COLUMN*)malloc(sizeof(LV_COLUMN));
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColVoiceId; // width of the column, in pixels
lvc->pszText = "Voices Id"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(0, lvc);
lvc->pszText = "Paused?"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColPaused; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(1, lvc);
lvc->pszText = "Res Ptr"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColResPtr; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(2, lvc);
lvc->pszText = "Res Id"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColResId; // width of the column, in pixels
lvc->iSubItem = 3; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(3, lvc);
lvc->pszText = "Loop"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColLoop; // width of the column, in pixels
lvc->iSubItem = 4; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(4, lvc);
lvc->pszText = "Norm"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColNorm; // width of the column, in pixels
lvc->iSubItem = 5; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(5, lvc);
lvc->pszText = "Instance"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColInstance; // width of the column, in pixels
lvc->iSubItem = 6; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(6, lvc);
lvc->pszText = "Audible Voice"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColAudibleV; // width of the column, in pixels
lvc->iSubItem = 7; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(7, lvc);
lvc->pszText = "Hard Voice"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyVoicePage.iColHardV; // width of the column, in pixels
lvc->iSubItem = 8; // index of subitem associated with column
m_VoicesListCtrl.InsertColumn(8, lvc);
free( lvc );
//init module ComboBox so GetCurSel() wont return a CB_ERR
m_VoicesCombo.SetCurSel(0);
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CVoicesPage::RefreshVoiceList()
{
int i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Get the module currently selected...
int iSelectedModule = m_VoicesCombo.GetCurSel();
//Clear the list
m_VoicesListCtrl.DeleteAllItems();
//Clear the comboBox
m_VoicesCombo.ResetContent();
//If there is nothing in the array we leave
int iNbModule = pSuperVisApp->m_apVirtualVoiceModule.GetSize();
if (iNbModule == 0)
return;
VirtualVoiceModule *pModule;
//Add module desciption in the ComboBox
for (i = 0; i < iNbModule; i++ )
{
pModule = (VirtualVoiceModule *)pSuperVisApp->m_apVirtualVoiceModule.GetAt(i);
m_VoicesCombo.AddString(pModule->cDescription);
}
//Set to the module currently
//No item is selected
if (iSelectedModule == CB_ERR)
iSelectedModule = 0;
//Set the combobox to the selected module
m_VoicesCombo.SetCurSel(iSelectedModule);
pModule = (VirtualVoiceModule *)pSuperVisApp->m_apVirtualVoiceModule.GetAt(iSelectedModule);
//Clean the virtual voices array
int iArraySize = pModule->apVirtualVoicesArray.GetSize();
VirtualVoice *pVoice;
for (i = 0; i < iArraySize; i ++ )
{
//Retrieve the current Voice
pVoice = (VirtualVoice *)(pModule->apVirtualVoicesArray.GetAt(i));
//Is the voice still active
if(!pVoice->bStillActive){
//Erase
pModule->apVirtualVoicesArray.RemoveAt(i);
delete pVoice;
i --;
iArraySize--;
}
}
//Cycle through the Current Virtual voices module.
iArraySize = pModule->apVirtualVoicesArray.GetSize();
for (i = 0; i < iArraySize; i ++ )
{
//We have to pass the index to the current module
AddVoiceToList(i, iSelectedModule);
}
//We display here the number of voices
SND_tdhVirtualModule pVirtualModule = (SND_tdhVirtualModule)pModule->lIdModule;
// m_iUsedVoices = SNDLST2_M_DynamicGetNumberOfElements(&pVirtualModule->virtual_voices.pList);
m_iUsedVoices = pModule->apVirtualVoicesArray.GetSize();
m_iMaxVoices = pVirtualModule->g_lNbSxdAudible;
UpdateData(FALSE);
}
void CVoicesPage::AddVoiceToList(long lVoiceIndex, long lModuleIndex)
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Retrieve the current module
VirtualVoiceModule *pModule;
pModule = (VirtualVoiceModule *)pSuperVisApp->m_apVirtualVoiceModule.GetAt(lModuleIndex);
//Retrieve the current Voice
VirtualVoice *pVoice;
pVoice = (VirtualVoice *)(pModule->apVirtualVoicesArray.GetAt(lVoiceIndex));
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA_TRUE, 0, 0);
char buffer[128];
//Display item, Voice Id
sprintf(buffer,"0x%08x", pVoice->lId);
m_VoicesListCtrl.InsertItem( 0, buffer );
//Set the item data with the Micro Array index, to be used later for drag&drop, pop-memnu, etc.
m_VoicesListCtrl.SetItemData( 0, (DWORD)lVoiceIndex );
//Paused?
if(pVoice->bPaused)
sprintf(buffer, "Yes");
else
sprintf(buffer, "No");
m_VoicesListCtrl.SetItem(0, 1, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Resource pointer
sprintf(buffer,"0x%08x", pVoice->lResRef);
m_VoicesListCtrl.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Resource ID
sprintf(buffer,"0x%08x", pVoice->lResId);
m_VoicesListCtrl.SetItem(0, 3, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//loop?
if(pVoice->bLoop)
sprintf(buffer, "Yes");
else
sprintf(buffer, "No");
m_VoicesListCtrl.SetItem(0, 4, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Norm
sprintf(buffer, "%6.3f", pVoice->dNorme);
m_VoicesListCtrl.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Instance
sprintf(buffer, "%d", pVoice->lInstance);
m_VoicesListCtrl.SetItem(0, 6, LVIF_TEXT, buffer, 0, 0, 0, NULL );
if (pVoice->lAudible)
{
//Audible voice
sprintf(buffer, "0x%08x", pVoice->lAudible);
m_VoicesListCtrl.SetItem(0, 7, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Hard voice
sprintf(buffer, "0x%08x", pVoice->lVoice);
m_VoicesListCtrl.SetItem(0, 8, LVIF_TEXT, buffer, 0, 0, 0, NULL );
}
else
{
//Audible voice
sprintf(buffer, "");
m_VoicesListCtrl.SetItem(0, 7, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Hard voice
sprintf(buffer, "");
m_VoicesListCtrl.SetItem(0, 8, LVIF_TEXT, buffer, 0, 0, 0, NULL );
}
//Refresh data from the control
// PostMessage(WM_USER_UPDATE_DATA_FALSE, 0, 0);
}
BOOL CVoicesPage::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_USER_UPDATE_DATA_TRUE)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(TRUE);
}
if(pMsg->message == WM_USER_UPDATE_DATA_FALSE)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(FALSE);
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
void CVoicesPage::OnDestroy()
{
CPropertyPage::OnDestroy();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
int ColWidth = m_VoicesListCtrl.GetColumnWidth(0);
pSuperVisApp->m_RegKeyVoicePage.iColVoiceId = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(1);
pSuperVisApp->m_RegKeyVoicePage.iColPaused = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(2);
pSuperVisApp->m_RegKeyVoicePage.iColResPtr = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(3);
pSuperVisApp->m_RegKeyVoicePage.iColResId = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(4);
pSuperVisApp->m_RegKeyVoicePage.iColLoop= ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(5);
pSuperVisApp->m_RegKeyVoicePage.iColNorm = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(6);
pSuperVisApp->m_RegKeyVoicePage.iColInstance = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(7);
pSuperVisApp->m_RegKeyVoicePage.iColAudibleV = ColWidth;
ColWidth = m_VoicesListCtrl.GetColumnWidth(8);
pSuperVisApp->m_RegKeyVoicePage.iColHardV = ColWidth;
}

View File

@@ -0,0 +1,100 @@
#if !defined(AFX_VOICESPAGE_H__FA1253D3_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_VOICESPAGE_H__FA1253D3_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// VoicesPage.h : header file
//
//Module Structure :
//
//id :
//cDescription :ex: "ADPCM Virtual voice module", etc..
//apVirtualVoicesArray : array of Vitual voices descriptors
typedef struct VirtualVoiceModule{
long lIdModule;
CString cDescription;
CPtrArray apVirtualVoicesArray;
}VirtualVoiceModule;
//Virtual Voices Structure
typedef struct VirtualVoice{
long lId;
BOOL bStillActive;
BOOL bDisplayed;
double dNorme;
BOOL bPaused;
long lResId;
long lResRef;
BOOL bLoop;
long lInstance;
long lAudible;
long lVoice;
}VirtualVoice;
typedef struct RegKeyVoicePage{
int iColVoiceId;
int iColPaused;
int iColResPtr;
int iColResId;
int iColLoop;
int iColNorm;
int iColInstance;
int iColAudibleV;
int iColHardV;
}RegKeyVoicePage;
/////////////////////////////////////////////////////////////////////////////
// CVoicesPage dialog
class CVoicesPage : public CPropertyPage
{
DECLARE_DYNCREATE(CVoicesPage)
// Construction
public:
void AddVoiceToList(long lIndex, long lModuleIndex);
void RefreshVoiceList();
CVoicesPage();
~CVoicesPage();
// Dialog Data
//{{AFX_DATA(CVoicesPage)
enum { IDD = IDD_VOICES_PAGE };
CComboBox m_VoicesCombo;
CListCtrl m_VoicesListCtrl;
int m_iMaxVoices;
int m_iUsedVoices;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CVoicesPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CVoicesPage)
virtual BOOL OnInitDialog();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_VOICESPAGE_H__FA1253D3_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,251 @@
// WavVoicesPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "WavVoicesPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWavVoicesPage property page
IMPLEMENT_DYNCREATE(CWavVoicesPage, CPropertyPage)
CWavVoicesPage::CWavVoicesPage() : CPropertyPage(CWavVoicesPage::IDD)
{
//{{AFX_DATA_INIT(CWavVoicesPage)
m_lProcessTime = 0;
//}}AFX_DATA_INIT
}
CWavVoicesPage::~CWavVoicesPage()
{
}
void CWavVoicesPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWavVoicesPage)
DDX_Control(pDX, IDC_WAV_VOICES_LIST, m_WavVoicesListCtrl);
DDX_Text(pDX, IDC_PROCESS_TIME, m_lProcessTime);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWavVoicesPage, CPropertyPage)
//{{AFX_MSG_MAP(CWavVoicesPage)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWavVoicesPage message handlers
BOOL CWavVoicesPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Initialise the ClistCtrl containing Events descriptions
LV_COLUMN* lvc;
lvc = (LV_COLUMN*)malloc(sizeof(LV_COLUMN));
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColWavVoiceId; // width of the column, in pixels
lvc->pszText = "Id"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(0, lvc);
lvc->pszText = "Resource Pointer"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColResPtr; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(1, lvc);
lvc->pszText = "Resource Id"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColResId; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(2, lvc);
lvc->pszText = "Paused?"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColPaused; // width of the column, in pixels
lvc->iSubItem = 3; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(3, lvc);
lvc->pszText = "Volume"; // column heading
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColVol; // width of the column, in pixels
lvc->iSubItem = 4; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(4, lvc);
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColPan; // width of the column, in pixels
lvc->pszText = "Pan"; // column heading
lvc->iSubItem = 5; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(5, lvc);
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColSpace; // width of the column, in pixels
lvc->pszText = "Space"; // column heading
lvc->iSubItem = 6; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(5, lvc);
lvc->cx = pSuperVisApp->m_RegKeyWavVoicePage.iColFreq; // width of the column, in pixels
lvc->pszText = "Frequency"; // column heading
lvc->iSubItem = 7; // index of subitem associated with column
m_WavVoicesListCtrl.InsertColumn(5, lvc);
free( lvc );
//Init the process time control
m_lProcessTime = 0;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CWavVoicesPage::RefreshVoicesList()
{
long i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Clear the list
m_WavVoicesListCtrl.DeleteAllItems();
//Cycle through the pointer Array to filter
for (i = 0; i < pSuperVisApp->m_apWavVoices.GetSize(); i ++ )
{
AddWavVoices(i);
}
//Add processTime
m_lProcessTime = pSuperVisApp->m_lProcessTime;
UpdateData(FALSE);
}
void CWavVoicesPage::AddWavVoices(long lIndex)
{
WavVoiceArrayElement *pVoice;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pVoice = (WavVoiceArrayElement *)(pSuperVisApp->m_apWavVoices.GetAt(lIndex));
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA_TRUE, 0, 0);
char buffer[128];
//Display item
sprintf(buffer,"0x%x", pVoice->lId);
m_WavVoicesListCtrl.InsertItem( 0, buffer );
//Set the item data with the Micro Array index, to be used later for drag&drop, pop-memnu, etc.
m_WavVoicesListCtrl.SetItemData( 0, (DWORD)lIndex );
//Resource pointer
sprintf(buffer,"0x%x", pVoice->res_pstPtr);
m_WavVoicesListCtrl.SetItem(0, 1, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Resource ID
sprintf(buffer,"0x%x", pVoice->res_Id);
m_WavVoicesListCtrl.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Paused?
if(pVoice->bPaused)
sprintf(buffer, "YES");
else
sprintf(buffer, "NO");
m_WavVoicesListCtrl.SetItem(0, 3, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Volume
sprintf(buffer, "%d", pVoice->ucVolume);
m_WavVoicesListCtrl.SetItem(0, 4, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Pan
sprintf(buffer, "%d", pVoice->ucPan);
m_WavVoicesListCtrl.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Space
sprintf(buffer, "%d", pVoice->ucSpace);
m_WavVoicesListCtrl.SetItem(0, 6, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Frequency
sprintf(buffer, "%6.3f", pVoice->dFreq);
m_WavVoicesListCtrl.SetItem(0, 7, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Refresh data from the control
PostMessage(WM_USER_UPDATE_DATA_FALSE, 0, 0);
}
BOOL CWavVoicesPage::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_USER_UPDATE_DATA_TRUE)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(TRUE);
}
if(pMsg->message == WM_USER_UPDATE_DATA_FALSE)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(FALSE);
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
void CWavVoicesPage::OnDestroy()
{
CPropertyPage::OnDestroy();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
int ColWidth = m_WavVoicesListCtrl.GetColumnWidth(0);
pSuperVisApp->m_RegKeyWavVoicePage.iColWavVoiceId = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(1);
pSuperVisApp->m_RegKeyWavVoicePage.iColResPtr = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(2);
pSuperVisApp->m_RegKeyWavVoicePage.iColResId = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(3);
pSuperVisApp->m_RegKeyWavVoicePage.iColPaused = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(4);
pSuperVisApp->m_RegKeyWavVoicePage.iColVol = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(5);
pSuperVisApp->m_RegKeyWavVoicePage.iColPan = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(6);
pSuperVisApp->m_RegKeyWavVoicePage.iColSpace = ColWidth;
ColWidth = m_WavVoicesListCtrl.GetColumnWidth(7);
pSuperVisApp->m_RegKeyWavVoicePage.iColFreq = ColWidth;
}

View File

@@ -0,0 +1,85 @@
#if !defined(AFX_WAVVOICESPAGE_H__6F53E3C9_F8C0_11D2_9F71_00104B6833D0__INCLUDED_)
#define AFX_WAVVOICESPAGE_H__6F53E3C9_F8C0_11D2_9F71_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// WavVoicesPage.h : header file
//
//Wav Voices Structure used by the Supervisater
typedef struct WavVoiceArrayElement{
long lId;
tdstBlockResourceMem *res_pstPtr;
tdxId res_Id;
BOOL bPaused;
unsigned char ucVolume;
unsigned char ucPan;
unsigned char ucSpace;
double dFreq;
}WavVoiceArrayElement;
typedef struct RegKeyWavVoicePage{
int iColWavVoiceId;
int iColResPtr;
int iColResId;
int iColPaused;
int iColVol;
int iColPan;
int iColSpace;
int iColFreq;
}RegKeyWavVoicePage;
/////////////////////////////////////////////////////////////////////////////
// CWavVoicesPage dialog
class CWavVoicesPage : public CPropertyPage
{
DECLARE_DYNCREATE(CWavVoicesPage)
// Construction
public:
void AddWavVoices(long lIndex);
void RefreshVoicesList();
CWavVoicesPage();
~CWavVoicesPage();
// Dialog Data
//{{AFX_DATA(CWavVoicesPage)
enum { IDD = IDD_WAV_VOICES_PAGE };
CListCtrl m_WavVoicesListCtrl;
long m_lProcessTime;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CWavVoicesPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CWavVoicesPage)
virtual BOOL OnInitDialog();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WAVVOICESPAGE_H__6F53E3C9_F8C0_11D2_9F71_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,13 @@
//
// SUPERVIS.RC2 - resources Microsoft Visual C++ does not edit directly
//
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...
/////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,89 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by supervis.rc
//
#define IDD_WAV_VOICES_PAGE 102
#define IDD_EVENTS_HISTORY_PAGE 106
#define IDD_RESSOURCES_HISTORIC 107
#define IDD_MICRO_OBJECTS_PAGE 108
#define IDD_SUPERVIS_SETTINGS_PAGE 109
#define IDD_THEMES_PAGE 110
#define IDD_VOICES_PAGE 111
#define IDD_VIRTUAL_VOICES_PAGE 111
#define IDD_MIXER_PAGE 112
#define IDD_DIALOG1 132
#define IDR_MENU1 136
#define IDC_BUTTON1 1000
#define IDC_RESET_BUTTON 1000
#define IDC_SAVE 1000
#define IDC_PLUS 1000
#define IDC_EDIT1 1001
#define IDC_EDIT_EVENT_ID 1001
#define IDC_RESET_RESLIST_BUTTON 1001
#define IDC_REFRESH_RATE 1001
#define IDC_CURRENT_THEME 1001
#define IDC_MAX_VOICES 1001
#define IDC_PROCESS_TIME 1001
#define IDC_DOPPLER_EFFECT 1001
#define IDC_QUIT 1002
#define IDC_EVENTS_HISTORY_LIST 1002
#define IDC_EDIT_RES_ID 1002
#define IDC_CHECK_EVENT 1003
#define IDC_CHECK_DEBUG_ON_EVENT 1004
#define IDC_CHECK_FIRST_OCCUR 1005
#define IDC_CHECK_BANK 1006
#define IDC_EDIT_BANK_ID 1007
#define IDC_WATCH_LIST 1008
#define IDC_EMPTY_WATCH 1009
#define IDC_CHECK_WATCH 1011
#define IDC_HELP_WATCH 1012
#define IDC_EDIT_LCB_PATH 1013
#define IDC_BROWSE_FOR_LCB 1014
#define IDC_BUTTON2 1015
#define IDC_PAUSE_BUTTON 1015
#define IDC_MOINS 1015
#define IDC_PLAY 1015
#define IDC_RES_LIST 1016
#define IDC_EDIT_RES_VOL 1017
#define IDC_VOL_PLUS 1018
#define IDC_VOL_MOINS 1019
#define IDC_PAUSE_RES_BUTTON 1020
#define IDC_CHECK_RES_BANK 1021
#define IDC_CHECK_RES 1022
#define IDC_CHECK_FIRST_RES_OCCUR 1023
#define IDC_CHECK_DEBUG_ON_RES 1024
#define IDC_EDIT_RES_BANK_ID 1025
#define IDC_VOLUME_SLIDER 1026
#define IDC_SEL_RES_NAME 1027
#define IDC_MICRO_LIST 1028
#define IDC_OBJECT_LIST 1029
#define IDC_VOLUME_LINE_LIST 1035
#define IDC_ASKED_THEME_POINTER 1036
#define IDC_CURRENT_PART 1037
#define IDC_STATE 1038
#define IDC_CURRENT_BRIDGE 1039
#define IDC_VOICES_LIST 1040
#define IDC_USED_VOICES 1041
#define IDC_VOICES_COMBO 1042
#define IDC_WAV_VOICES_LIST 1043
#define IDC_CURRENT_THEME_ID 1044
#define IDC_CURRENT_THEME_BANK_ID 1045
#define IDC_WINDOW_ON_TOP 1045
#define IDC_CURRENT_THEME_RES_ID 1046
#define IDC_ASKED_THEME_ID 1047
#define IDC_ASKED_THEME_BANK 1048
#define IDC_ASSO_MIC_LIST 1048
#define IDC_ASKED_THEME_RES_ID 1049
#define IDC_LANGUE_COMBO 1049
#define ID_WATCH 32775
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 139
#define _APS_NEXT_COMMAND_VALUE 32777
#define _APS_NEXT_CONTROL_VALUE 1050
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,820 @@
// Machine generated IDispatch wrapper class(es) created with ClassWizard
#include "stdafx.h"
#include "soundeditor.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// ISoundEditor properties
LPDISPATCH ISoundEditor::GetEventGroups()
{
LPDISPATCH result;
GetProperty(0x1, VT_DISPATCH, (void*)&result);
return result;
}
void ISoundEditor::SetEventGroups(LPDISPATCH propVal)
{
SetProperty(0x1, VT_DISPATCH, propVal);
}
long ISoundEditor::GetVersionNumber()
{
long result;
GetProperty(0x2, VT_I4, (void*)&result);
return result;
}
void ISoundEditor::SetVersionNumber(long propVal)
{
SetProperty(0x2, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// ISoundEditor operations
BOOL ISoundEditor::OpenDocument(LPCTSTR csFilename)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csFilename);
return result;
}
BOOL ISoundEditor::SaveDocument(LPCTSTR csFilename)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csFilename);
return result;
}
BOOL ISoundEditor::AddSoundDirectory(LPCTSTR csPath)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x5, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csPath);
return result;
}
BOOL ISoundEditor::RebuildBanks()
{
BOOL result;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
BOOL ISoundEditor::SaveLocalizedBanks(LPCTSTR _csDocumentPath, LPCTSTR _csLanguage)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR VTS_BSTR;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
_csDocumentPath, _csLanguage);
return result;
}
LPDISPATCH ISoundEditor::FindResFromEditorId(long _iId)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x8, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
_iId);
return result;
}
BOOL ISoundEditor::SetSoundDriver(BOOL bSet)
{
BOOL result;
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0x9, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
bSet);
return result;
}
BOOL ISoundEditor::UnloadAllEvents()
{
BOOL result;
InvokeHelper(0xa, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
long ISoundEditor::GetPosSound(long Handle)
{
long result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0xb, DISPATCH_METHOD, VT_I4, (void*)&result, parms,
Handle);
return result;
}
BOOL ISoundEditor::SetDriverActivation(BOOL bActivate)
{
BOOL result;
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0xc, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
bActivate);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IEventGroup properties
long IEventGroup::GetId()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEventGroup::SetId(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
CString IEventGroup::GetName()
{
CString result;
GetProperty(0x2, VT_BSTR, (void*)&result);
return result;
}
void IEventGroup::SetName(LPCTSTR propVal)
{
SetProperty(0x2, VT_BSTR, propVal);
}
LPDISPATCH IEventGroup::GetResources()
{
LPDISPATCH result;
GetProperty(0x3, VT_DISPATCH, (void*)&result);
return result;
}
void IEventGroup::SetResources(LPDISPATCH propVal)
{
SetProperty(0x3, VT_DISPATCH, propVal);
}
LPDISPATCH IEventGroup::GetEvents()
{
LPDISPATCH result;
GetProperty(0x4, VT_DISPATCH, (void*)&result);
return result;
}
void IEventGroup::SetEvents(LPDISPATCH propVal)
{
SetProperty(0x4, VT_DISPATCH, propVal);
}
CString IEventGroup::GetFilePath()
{
CString result;
GetProperty(0x5, VT_BSTR, (void*)&result);
return result;
}
void IEventGroup::SetFilePath(LPCTSTR propVal)
{
SetProperty(0x5, VT_BSTR, propVal);
}
long IEventGroup::GetVersionNumber()
{
long result;
GetProperty(0x6, VT_I4, (void*)&result);
return result;
}
void IEventGroup::SetVersionNumber(long propVal)
{
SetProperty(0x6, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEventGroup operations
BOOL IEventGroup::RemoveAll()
{
BOOL result;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
BOOL IEventGroup::CompactIds()
{
BOOL result;
InvokeHelper(0x8, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiBank properties
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiBank operations
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiMap properties
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiMap operations
/////////////////////////////////////////////////////////////////////////////
// IEventGroups properties
long IEventGroups::GetCount()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEventGroups::SetCount(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEventGroups operations
LPDISPATCH IEventGroups::Item(long Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x2, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Index);
return result;
}
LPDISPATCH IEventGroups::FindItem(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IEventGroups::Add(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
BOOL IEventGroups::Remove(LPCTSTR csEventGroupName)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x5, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csEventGroupName);
return result;
}
LPDISPATCH IEventGroups::FindItemByID(long ulBinID)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x6, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
ulBinID);
return result;
}
LPUNKNOWN IEventGroups::Get_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IResource properties
CString IResource::GetName()
{
CString result;
GetProperty(0x1, VT_BSTR, (void*)&result);
return result;
}
void IResource::SetName(LPCTSTR propVal)
{
SetProperty(0x1, VT_BSTR, propVal);
}
long IResource::GetVolume()
{
long result;
GetProperty(0x2, VT_I4, (void*)&result);
return result;
}
void IResource::SetVolume(long propVal)
{
SetProperty(0x2, VT_I4, propVal);
}
LPDISPATCH IResource::GetSampleRes()
{
LPDISPATCH result;
GetProperty(0x3, VT_DISPATCH, (void*)&result);
return result;
}
void IResource::SetSampleRes(LPDISPATCH propVal)
{
SetProperty(0x3, VT_DISPATCH, propVal);
}
long IResource::GetType()
{
long result;
GetProperty(0x4, VT_I4, (void*)&result);
return result;
}
void IResource::SetType(long propVal)
{
SetProperty(0x4, VT_I4, propVal);
}
long IResource::GetDataOffset()
{
long result;
GetProperty(0x5, VT_I4, (void*)&result);
return result;
}
void IResource::SetDataOffset(long propVal)
{
SetProperty(0x5, VT_I4, propVal);
}
long IResource::GetDataSize()
{
long result;
GetProperty(0x6, VT_I4, (void*)&result);
return result;
}
void IResource::SetDataSize(long propVal)
{
SetProperty(0x6, VT_I4, propVal);
}
long IResource::GetId()
{
long result;
GetProperty(0x7, VT_I4, (void*)&result);
return result;
}
void IResource::SetId(long propVal)
{
SetProperty(0x7, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IResource operations
/////////////////////////////////////////////////////////////////////////////
// IResources properties
long IResources::GetCount()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IResources::SetCount(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IResources operations
LPDISPATCH IResources::Item(long Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x2, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Index);
return result;
}
LPDISPATCH IResources::FindItem(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IResources::Add(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IResources::AddSampleRes(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x5, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
BOOL IResources::Remove(LPCTSTR csResName)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csResName);
return result;
}
LPDISPATCH IResources::FindItemByID(long EdiID)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x7, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
EdiID);
return result;
}
LPUNKNOWN IResources::Get_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// ISampleResource properties
CString ISampleResource::GetFileName()
{
CString result;
GetProperty(0x1, VT_BSTR, (void*)&result);
return result;
}
void ISampleResource::SetFileName(LPCTSTR propVal)
{
SetProperty(0x1, VT_BSTR, propVal);
}
long ISampleResource::GetZipType()
{
long result;
GetProperty(0x2, VT_I4, (void*)&result);
return result;
}
void ISampleResource::SetZipType(long propVal)
{
SetProperty(0x2, VT_I4, propVal);
}
BOOL ISampleResource::GetLoop()
{
BOOL result;
GetProperty(0x3, VT_BOOL, (void*)&result);
return result;
}
void ISampleResource::SetLoop(BOOL propVal)
{
SetProperty(0x3, VT_BOOL, propVal);
}
long ISampleResource::GetStartLoop()
{
long result;
GetProperty(0x4, VT_I4, (void*)&result);
return result;
}
void ISampleResource::SetStartLoop(long propVal)
{
SetProperty(0x4, VT_I4, propVal);
}
long ISampleResource::GetLoopLength()
{
long result;
GetProperty(0x5, VT_I4, (void*)&result);
return result;
}
void ISampleResource::SetLoopLength(long propVal)
{
SetProperty(0x5, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// ISampleResource operations
BOOL ISampleResource::SetSampleData(LPCTSTR csFilename)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x6, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csFilename);
return result;
}
LPDISPATCH ISampleResource::GetResource()
{
LPDISPATCH result;
InvokeHelper(0x7, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IEvents properties
long IEvents::GetCount()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEvents::SetCount(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEvents operations
LPDISPATCH IEvents::Item(long Index)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x2, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Index);
return result;
}
LPDISPATCH IEvents::FindItem(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x3, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IEvents::Add(LPCTSTR csName)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x4, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
csName);
return result;
}
LPDISPATCH IEvents::AddPlayEvent(LPDISPATCH Resource)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_DISPATCH;
InvokeHelper(0x5, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
Resource);
return result;
}
LPDISPATCH IEvents::AddStopEvent(LPDISPATCH lpEvent)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_DISPATCH;
InvokeHelper(0x6, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
lpEvent);
return result;
}
BOOL IEvents::Remove(LPCTSTR csEventName)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
csEventName);
return result;
}
LPDISPATCH IEvents::FindItemByID(long EdiID)
{
LPDISPATCH result;
static BYTE parms[] =
VTS_I4;
InvokeHelper(0x8, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, parms,
EdiID);
return result;
}
LPUNKNOWN IEvents::Get_NewEnum()
{
LPUNKNOWN result;
InvokeHelper(0xfffffffc, DISPATCH_PROPERTYGET, VT_UNKNOWN, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IEvent properties
long IEvent::GetId()
{
long result;
GetProperty(0x1, VT_I4, (void*)&result);
return result;
}
void IEvent::SetId(long propVal)
{
SetProperty(0x1, VT_I4, propVal);
}
CString IEvent::GetName()
{
CString result;
GetProperty(0x2, VT_BSTR, (void*)&result);
return result;
}
void IEvent::SetName(LPCTSTR propVal)
{
SetProperty(0x2, VT_BSTR, propVal);
}
BOOL IEvent::GetDynamic()
{
BOOL result;
GetProperty(0x3, VT_BOOL, (void*)&result);
return result;
}
void IEvent::SetDynamic(BOOL propVal)
{
SetProperty(0x3, VT_BOOL, propVal);
}
BOOL IEvent::GetStopable()
{
BOOL result;
GetProperty(0x4, VT_BOOL, (void*)&result);
return result;
}
void IEvent::SetStopable(BOOL propVal)
{
SetProperty(0x4, VT_BOOL, propVal);
}
long IEvent::GetType()
{
long result;
GetProperty(0x5, VT_I4, (void*)&result);
return result;
}
void IEvent::SetType(long propVal)
{
SetProperty(0x5, VT_I4, propVal);
}
/////////////////////////////////////////////////////////////////////////////
// IEvent operations
LPDISPATCH IEvent::GetResource()
{
LPDISPATCH result;
InvokeHelper(0x6, DISPATCH_METHOD, VT_DISPATCH, (void*)&result, NULL);
return result;
}
BOOL IEvent::LoadData()
{
BOOL result;
InvokeHelper(0x7, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
BOOL IEvent::UnloadData()
{
BOOL result;
InvokeHelper(0x8, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
long IEvent::Play()
{
long result;
InvokeHelper(0x9, DISPATCH_METHOD, VT_I4, (void*)&result, NULL);
return result;
}
BOOL IEvent::LoadPlayUnload()
{
BOOL result;
InvokeHelper(0xa, DISPATCH_METHOD, VT_BOOL, (void*)&result, NULL);
return result;
}
/////////////////////////////////////////////////////////////////////////////
// IOptionsSheet properties
/////////////////////////////////////////////////////////////////////////////
// IOptionsSheet operations
/////////////////////////////////////////////////////////////////////////////
// IEventOptionsPage properties
/////////////////////////////////////////////////////////////////////////////
// IEventOptionsPage operations
/////////////////////////////////////////////////////////////////////////////
// IResOptionsPage properties
/////////////////////////////////////////////////////////////////////////////
// IResOptionsPage operations
/////////////////////////////////////////////////////////////////////////////
// IPlugInOptionsPage properties
/////////////////////////////////////////////////////////////////////////////
// IPlugInOptionsPage operations
/////////////////////////////////////////////////////////////////////////////
// ILanguageOptionsPage properties
/////////////////////////////////////////////////////////////////////////////
// ILanguageOptionsPage operations
/////////////////////////////////////////////////////////////////////////////
// IViewSettingsOptions properties
/////////////////////////////////////////////////////////////////////////////
// IViewSettingsOptions operations

View File

@@ -0,0 +1,353 @@
// Machine generated IDispatch wrapper class(es) created with ClassWizard
/////////////////////////////////////////////////////////////////////////////
// ISoundEditor wrapper class
class ISoundEditor : public COleDispatchDriver
{
public:
ISoundEditor() {} // Calls COleDispatchDriver default constructor
ISoundEditor(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ISoundEditor(const ISoundEditor& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
LPDISPATCH GetEventGroups();
void SetEventGroups(LPDISPATCH);
long GetVersionNumber();
void SetVersionNumber(long);
// Operations
public:
BOOL OpenDocument(LPCTSTR csFilename);
BOOL SaveDocument(LPCTSTR csFilename);
BOOL AddSoundDirectory(LPCTSTR csPath);
BOOL RebuildBanks();
BOOL SaveLocalizedBanks(LPCTSTR _csDocumentPath, LPCTSTR _csLanguage);
LPDISPATCH FindResFromEditorId(long _iId);
BOOL SetSoundDriver(BOOL bSet);
BOOL UnloadAllEvents();
long GetPosSound(long Handle);
BOOL SetDriverActivation(BOOL bActivate);
};
/////////////////////////////////////////////////////////////////////////////
// IEventGroup wrapper class
class IEventGroup : public COleDispatchDriver
{
public:
IEventGroup() {} // Calls COleDispatchDriver default constructor
IEventGroup(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IEventGroup(const IEventGroup& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
long GetId();
void SetId(long);
CString GetName();
void SetName(LPCTSTR);
LPDISPATCH GetResources();
void SetResources(LPDISPATCH);
LPDISPATCH GetEvents();
void SetEvents(LPDISPATCH);
CString GetFilePath();
void SetFilePath(LPCTSTR);
long GetVersionNumber();
void SetVersionNumber(long);
// Operations
public:
BOOL RemoveAll();
BOOL CompactIds();
};
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiBank wrapper class
class ISND_EdiBank : public COleDispatchDriver
{
public:
ISND_EdiBank() {} // Calls COleDispatchDriver default constructor
ISND_EdiBank(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ISND_EdiBank(const ISND_EdiBank& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// ISND_EdiMap wrapper class
class ISND_EdiMap : public COleDispatchDriver
{
public:
ISND_EdiMap() {} // Calls COleDispatchDriver default constructor
ISND_EdiMap(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ISND_EdiMap(const ISND_EdiMap& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// IEventGroups wrapper class
class IEventGroups : public COleDispatchDriver
{
public:
IEventGroups() {} // Calls COleDispatchDriver default constructor
IEventGroups(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IEventGroups(const IEventGroups& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
long GetCount();
void SetCount(long);
// Operations
public:
LPDISPATCH Item(long Index);
LPDISPATCH FindItem(LPCTSTR csName);
LPDISPATCH Add(LPCTSTR csName);
BOOL Remove(LPCTSTR csEventGroupName);
LPDISPATCH FindItemByID(long ulBinID);
LPUNKNOWN Get_NewEnum();
};
/////////////////////////////////////////////////////////////////////////////
// IResource wrapper class
class IResource : public COleDispatchDriver
{
public:
IResource() {} // Calls COleDispatchDriver default constructor
IResource(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IResource(const IResource& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
CString GetName();
void SetName(LPCTSTR);
long GetVolume();
void SetVolume(long);
LPDISPATCH GetSampleRes();
void SetSampleRes(LPDISPATCH);
long GetType();
void SetType(long);
long GetDataOffset();
void SetDataOffset(long);
long GetDataSize();
void SetDataSize(long);
long GetId();
void SetId(long);
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// IResources wrapper class
class IResources : public COleDispatchDriver
{
public:
IResources() {} // Calls COleDispatchDriver default constructor
IResources(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IResources(const IResources& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
long GetCount();
void SetCount(long);
// Operations
public:
LPDISPATCH Item(long Index);
LPDISPATCH FindItem(LPCTSTR csName);
LPDISPATCH Add(LPCTSTR csName);
LPDISPATCH AddSampleRes(LPCTSTR csName);
BOOL Remove(LPCTSTR csResName);
LPDISPATCH FindItemByID(long EdiID);
LPUNKNOWN Get_NewEnum();
};
/////////////////////////////////////////////////////////////////////////////
// ISampleResource wrapper class
class ISampleResource : public COleDispatchDriver
{
public:
ISampleResource() {} // Calls COleDispatchDriver default constructor
ISampleResource(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ISampleResource(const ISampleResource& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
CString GetFileName();
void SetFileName(LPCTSTR);
long GetZipType();
void SetZipType(long);
BOOL GetLoop();
void SetLoop(BOOL);
long GetStartLoop();
void SetStartLoop(long);
long GetLoopLength();
void SetLoopLength(long);
// Operations
public:
BOOL SetSampleData(LPCTSTR csFilename);
LPDISPATCH GetResource();
};
/////////////////////////////////////////////////////////////////////////////
// IEvents wrapper class
class IEvents : public COleDispatchDriver
{
public:
IEvents() {} // Calls COleDispatchDriver default constructor
IEvents(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IEvents(const IEvents& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
long GetCount();
void SetCount(long);
// Operations
public:
LPDISPATCH Item(long Index);
LPDISPATCH FindItem(LPCTSTR csName);
LPDISPATCH Add(LPCTSTR csName);
LPDISPATCH AddPlayEvent(LPDISPATCH Resource);
LPDISPATCH AddStopEvent(LPDISPATCH lpEvent);
BOOL Remove(LPCTSTR csEventName);
LPDISPATCH FindItemByID(long EdiID);
LPUNKNOWN Get_NewEnum();
};
/////////////////////////////////////////////////////////////////////////////
// IEvent wrapper class
class IEvent : public COleDispatchDriver
{
public:
IEvent() {} // Calls COleDispatchDriver default constructor
IEvent(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IEvent(const IEvent& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
long GetId();
void SetId(long);
CString GetName();
void SetName(LPCTSTR);
BOOL GetDynamic();
void SetDynamic(BOOL);
BOOL GetStopable();
void SetStopable(BOOL);
long GetType();
void SetType(long);
// Operations
public:
LPDISPATCH GetResource();
BOOL LoadData();
BOOL UnloadData();
long Play();
BOOL LoadPlayUnload();
};
/////////////////////////////////////////////////////////////////////////////
// IOptionsSheet wrapper class
class IOptionsSheet : public COleDispatchDriver
{
public:
IOptionsSheet() {} // Calls COleDispatchDriver default constructor
IOptionsSheet(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IOptionsSheet(const IOptionsSheet& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// IEventOptionsPage wrapper class
class IEventOptionsPage : public COleDispatchDriver
{
public:
IEventOptionsPage() {} // Calls COleDispatchDriver default constructor
IEventOptionsPage(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IEventOptionsPage(const IEventOptionsPage& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// IResOptionsPage wrapper class
class IResOptionsPage : public COleDispatchDriver
{
public:
IResOptionsPage() {} // Calls COleDispatchDriver default constructor
IResOptionsPage(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IResOptionsPage(const IResOptionsPage& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// IPlugInOptionsPage wrapper class
class IPlugInOptionsPage : public COleDispatchDriver
{
public:
IPlugInOptionsPage() {} // Calls COleDispatchDriver default constructor
IPlugInOptionsPage(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IPlugInOptionsPage(const IPlugInOptionsPage& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// ILanguageOptionsPage wrapper class
class ILanguageOptionsPage : public COleDispatchDriver
{
public:
ILanguageOptionsPage() {} // Calls COleDispatchDriver default constructor
ILanguageOptionsPage(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ILanguageOptionsPage(const ILanguageOptionsPage& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};
/////////////////////////////////////////////////////////////////////////////
// IViewSettingsOptions wrapper class
class IViewSettingsOptions : public COleDispatchDriver
{
public:
IViewSettingsOptions() {} // Calls COleDispatchDriver default constructor
IViewSettingsOptions(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IViewSettingsOptions(const IViewSettingsOptions& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,119 @@
// supervis.h : main header file for the SUPERVIS DLL
//
#if !defined(AFX_SUPERVIS_H__2CEA4ECB_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_)
#define AFX_SUPERVIS_H__2CEA4ECB_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
#include "SuperVisSheet.h" // Added by ClassView
#include "SuperVisThread.h"
//Mutex
#include <afxmt.h>
//ACP
#include "SCR.h"
//user defined window message
#define WM_USER_UPDATE_DATA_TRUE 0x00008001
#define WM_USER_UPDATE_DATA_FALSE 0x00008002
#define WM_USER_DESTROY_WINDOW 0x00008003
#define WM_USER_MIXERPAGE 0x00008004
#define WM_USER_TIMER 0x00008005
#define WM_SETNAME_EVENT 0x00008006
#define WM_SETNAME_FIRST_OCCUR_EVENT 0x00008007
#define WM_SETNAME_RES 0x00008010
#define WM_SETNAME_FIRST_OCCUR_RES 0x00008009
#define WM_INIT_AUTOMATION 0x00008008
#define WM_EXIT_AUTOMATION 0x00008011
#define WM_RESETLIST 0x00008012
//Size used for all array
#define ARRAY_SIZE 256
#define VOICE_MODULE_ARRAY_SIZE 2
#define MICROS_ARRAY_SIZE 5
#define VOLUME_LINE_ARRAY_SIZE 5
SndReal dbg_calcul_pseudo_d(SndReal a,SndReal b);
SndReal dbgSND_fn_rPseudoNormeVectorSnd(SndVector *v);
/////////////////////////////////////////////////////////////////////////////
// CSupervisApp
// See supervis.cpp for the implementation of this class
//
class CSupervisApp : public CWinApp
{
public:
CEvent* AddHistoSyncEvent;
CEvent* LaunchSuperVisEvent;
CMutex* SuperVisMutex;
long m_lProcessTime;
int m_iActivePage;
int m_iRefreshRate;
int m_iWindowLeft;
int m_iWindowTop;
int m_iWindowRight;
int m_iWindowBottom;
RegKeyVoicePage m_RegKeyVoicePage;
RegKeyWavVoicePage m_RegKeyWavVoicePage;
RegKeyThemePage m_RegKeyThemePage;
RegKeyObjPage m_RegKeyObjPage;
RegKeyMicPage m_RegKeyMicPage;
RegKeyEventPage m_EventPageRegKeys;
RegKeyMixerPage m_MixerPageRegKeys;
BOOL m_bWindowOnTop;
BOOL m_bWavVoicePageLoaded;
CPtrArray m_apVirtualVoiceModule;
CPtrArray m_apVolumeLine;
CPtrArray m_apObjects;
CPtrArray m_apEventHistoArray;
CPtrArray m_apFirstOccurEventHistoArray;
CPtrArray m_apResources;
CPtrArray m_apFirstOccurResources;
CPtrArray m_apMicros;
CPtrArray m_apWavVoices;
BOOL m_bSuperVisaterActive;
CString m_cBinaryLCBFileTitle;
CString m_cBinaryLCBPath;
CString m_cLCBPath;
CSuperVisThread * m_SuperVisThread;
CSupervisApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSupervisApp)
public:
virtual BOOL InitInstance();
virtual int ExitInstance();
//}}AFX_VIRTUAL
//{{AFX_MSG(CSupervisApp)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_SUPERVIS_H__2CEA4ECB_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,418 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_OLE_RESOURCES\r\n"
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif\r\n"
"#include ""res\\supervis.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#endif\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "supervis DLL\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "supervis\0"
VALUE "LegalCopyright", "Copyright (C) 1999\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "supervis.DLL\0"
VALUE "ProductName", "supervis Dynamic Link Library\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_EVENTS_HISTORY_PAGE DIALOG DISCARDABLE 0, 0, 500, 375
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Events Historic"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_EVENTS_HISTORY_LIST,"SysListView32",
LVS_REPORT | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,21,
55,457,187
GROUPBOX "Events Historic List Settings",IDC_STATIC,7,263,228,103
CONTROL "Only display events with Event Id = ",IDC_CHECK_EVENT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,300,130,10
CONTROL "Debug Break on Next Event (need Visual C++ installed)",
IDC_CHECK_DEBUG_ON_EVENT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,13,340,190,9
CONTROL "Display only first occurence of Events",
IDC_CHECK_FIRST_OCCUR,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,13,321,134,11
EDITTEXT IDC_EDIT_EVENT_ID,147,298,22,12,ES_AUTOHSCROLL |
ES_NUMBER
CONTROL "Only display events with Bank Id = ",IDC_CHECK_BANK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,279,126,12
EDITTEXT IDC_EDIT_BANK_ID,147,279,22,12,ES_AUTOHSCROLL |
ES_NUMBER
PUSHBUTTON "&Reset List",IDC_RESET_BUTTON,408,34,70,15
GROUPBOX "Events Historic List",IDC_STATIC,7,7,485,252
LTEXT "Show all events that occured since the engine started. Press the ""Reset List"" button to empty the list",
IDC_STATIC,19,21,457,11,SS_SUNKEN | WS_BORDER
GROUPBOX "Events Watch List",IDC_STATIC,264,263,228,103
LISTBOX IDC_WATCH_LIST,367,287,111,72,LBS_SORT |
LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Empty List",IDC_EMPTY_WATCH,277,295,48,14
CONTROL "Only Show Events In Watch List",IDC_CHECK_WATCH,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,277,277,130,8
PUSHBUTTON "?",IDC_HELP_WATCH,459,271,19,12
PUSHBUTTON "&Pause Process",IDC_PAUSE_BUTTON,317,34,70,15
END
IDD_MICRO_OBJECTS_PAGE DIALOG DISCARDABLE 0, 0, 500, 374
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Micro and Objects"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_MICRO_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,19,21,461,113
CONTROL "List2",IDC_OBJECT_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,19,147,461,113
LTEXT "Nx, Ny, Nz = Micro Normal ",IDC_STATIC,356,326,104,10
LTEXT "Tx, ty, Tz = Micro Tangent",IDC_STATIC,356,342,104,10
GROUPBOX "Legend",IDC_STATIC,322,309,159,57
GROUPBOX "Current Selected Object",IDC_STATIC,14,264,291,101,NOT
WS_VISIBLE
GROUPBOX "Associated Micro",IDC_STATIC,22,274,108,86,NOT
WS_VISIBLE
CONTROL "List3",IDC_ASSO_MIC_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | NOT WS_VISIBLE | WS_BORDER | WS_TABSTOP,
30,285,91,70
GROUPBOX "Global Doppler Effect",IDC_STATIC,321,264,159,36
EDITTEXT IDC_DOPPLER_EFFECT,367,276,62,15,ES_AUTOHSCROLL |
ES_READONLY
END
IDD_SUPERVIS_SETTINGS_PAGE DIALOG DISCARDABLE 0, 0, 500, 374
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "SuperVisater Settings"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Refresh Rate",IDC_STATIC,13,25,174,54
EDITTEXT IDC_REFRESH_RATE,98,47,21,13,ES_AUTOHSCROLL
LTEXT "Refresh every",IDC_STATIC,50,50,48,10
LTEXT "msec",IDC_STATIC,124,50,24,10
PUSHBUTTON "+",IDC_PLUS,29,42,14,11
PUSHBUTTON "-",IDC_MOINS,29,55,14,11
GROUPBOX "Window Management",IDC_STATIC,13,99,174,54
CONTROL "Windows Always On Top",IDC_WINDOW_ON_TOP,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,25,121,121,13
EDITTEXT IDC_EDIT_LCB_PATH,17,177,276,12,ES_AUTOHSCROLL
PUSHBUTTON "&Browse for LCB file....",IDC_BROWSE_FOR_LCB,301,177,80,
15
GROUPBOX "LCB filename:",IDC_STATIC,7,166,385,33
END
IDD_THEMES_PAGE DIALOG DISCARDABLE 0, 0, 500, 374
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Themes"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Themes",IDC_STATIC,16,7,468,179
GROUPBOX "Volume Lines",IDC_STATIC,16,197,468,131
CONTROL "List1",IDC_VOLUME_LINE_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,27,213,446,107
LTEXT "Pointer :",IDC_STATIC,37,109,45,11
LTEXT "Current Part :",IDC_STATIC,165,33,56,11
LTEXT "Current Bridge :",IDC_STATIC,37,157,60,11
LTEXT "State :",IDC_STATIC,165,109,45,11
EDITTEXT IDC_CURRENT_THEME,90,31,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_ASKED_THEME_POINTER,90,107,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_CURRENT_PART,222,31,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_STATE,222,107,56,13,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_CURRENT_BRIDGE,106,155,38,13,ES_AUTOHSCROLL |
ES_READONLY
LTEXT "loops left",IDC_STATIC,149,157,43,11
EDITTEXT IDC_CURRENT_THEME_ID,90,60,56,13,ES_AUTOHSCROLL |
ES_READONLY
GROUPBOX "Current Theme",IDC_STATIC,25,18,450,72
LTEXT "Pointer :",IDC_STATIC,37,33,45,11
LTEXT "ID (Hex) :",IDC_STATIC,35,62,45,11
LTEXT "Bank Id :",IDC_STATIC,165,62,45,11
LTEXT "Resource Id :",IDC_STATIC,294,62,45,11
GROUPBOX "Asked Theme",IDC_STATIC,25,96,449,81
LTEXT "ID (Hex)",IDC_STATIC,37,133,45,11
LTEXT "Bank Id :",IDC_STATIC,165,133,45,11
LTEXT "Resource Id :",IDC_STATIC,294,133,45,11
EDITTEXT IDC_CURRENT_THEME_BANK_ID,222,60,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_CURRENT_THEME_RES_ID,349,60,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_ASKED_THEME_ID,90,131,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_ASKED_THEME_BANK,222,131,56,13,ES_AUTOHSCROLL |
ES_READONLY
EDITTEXT IDC_ASKED_THEME_RES_ID,349,131,56,13,ES_AUTOHSCROLL |
ES_READONLY
END
IDD_VIRTUAL_VOICES_PAGE DIALOG DISCARDABLE 0, 0, 499, 374
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Voices"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_VOICES_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,18,76,465,272
LTEXT "Maximum Available Virtual Voices :",IDC_STATIC,27,26,
115,11
LTEXT "Number of Virtual Voices used :",IDC_STATIC,287,26,115,
11
EDITTEXT IDC_MAX_VOICES,153,25,24,12,ES_AUTOHSCROLL | ES_READONLY
EDITTEXT IDC_USED_VOICES,413,25,24,12,ES_AUTOHSCROLL |
ES_READONLY
GROUPBOX "Stats",IDC_STATIC,15,13,468,31
COMBOBOX IDC_VOICES_COMBO,18,55,199,17,CBS_DROPDOWN | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
END
IDD_MIXER_PAGE DIALOG DISCARDABLE 0, 0, 500, 375
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Mixer"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_RES_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,18,54,466,195
PUSHBUTTON "&Save Changes in LCB",IDC_SAVE,261,340,95,16
LTEXT "Selected Ressource Volume :",IDC_STATIC,255,276,96,10
EDITTEXT IDC_EDIT_RES_VOL,360,274,26,12,ES_AUTOHSCROLL
PUSHBUTTON "+",IDC_VOL_PLUS,456,297,25,20
PUSHBUTTON "-",IDC_VOL_MOINS,456,325,25,21
GROUPBOX "Ressources list",IDC_STATIC,7,7,486,250
LTEXT "Show all resources that occured since the engine started. Press the ""Reset List"" button to empty the list",
IDC_STATIC,20,19,464,11,SS_SUNKEN | WS_BORDER
GROUPBOX "Mixing center",IDC_STATIC,250,262,243,103
GROUPBOX "Resources List Settings",IDC_STATIC,7,262,225,103
CONTROL "Only display resources with Res Id = ",IDC_CHECK_RES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,299,130,10
CONTROL "Debug Break on Next Resource (need Visual C++ installed)",
IDC_CHECK_DEBUG_ON_RES,"Button",BS_AUTOCHECKBOX |
BS_MULTILINE | WS_TABSTOP,27,339,174,17
CONTROL "Display only first occurence of Resourcess",
IDC_CHECK_FIRST_RES_OCCUR,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,27,320,151,11
EDITTEXT IDC_EDIT_RES_ID,161,297,22,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Only display resources with Bank Id = ",
IDC_CHECK_RES_BANK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
27,278,126,12
EDITTEXT IDC_EDIT_RES_BANK_ID,161,278,22,12,ES_AUTOHSCROLL |
ES_NUMBER
PUSHBUTTON "&Reset List",IDC_RESET_RESLIST_BUTTON,414,33,70,15
PUSHBUTTON "&Pause Process",IDC_PAUSE_RES_BUTTON,329,33,70,15
CONTROL "Slider1",IDC_VOLUME_SLIDER,"msctls_trackbar32",TBS_VERT |
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,410,288,17,71
LTEXT "Coarse tuning",IDC_STATIC,409,270,37,16
LTEXT "Fine tuning",IDC_STATIC,462,270,23,16
LTEXT "Name:",IDC_STATIC,255,295,26,9
EDITTEXT IDC_SEL_RES_NAME,283,292,103,12,ES_AUTOHSCROLL
PUSHBUTTON "&Replay Sound",IDC_PLAY,261,315,95,16
END
IDD_WAV_VOICES_PAGE DIALOG DISCARDABLE 0, 0, 500, 375
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
CAPTION "Wav Voices"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Process Time for all WAV Voices :",IDC_STATIC,74,27,
116,10
GROUPBOX "Stats",IDC_STATIC,14,15,472,29
EDITTEXT IDC_PROCESS_TIME,215,25,33,12,ES_AUTOHSCROLL |
ES_READONLY
LTEXT "/ 1000",IDC_STATIC,249,27,27,10
CONTROL "List1",IDC_WAV_VOICES_LIST,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,14,53,472,309
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_EVENTS_HISTORY_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 492
TOPMARGIN, 7
BOTTOMMARGIN, 368
END
IDD_MICRO_OBJECTS_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 493
TOPMARGIN, 7
BOTTOMMARGIN, 367
END
IDD_SUPERVIS_SETTINGS_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 493
TOPMARGIN, 7
BOTTOMMARGIN, 367
END
IDD_THEMES_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 493
TOPMARGIN, 7
BOTTOMMARGIN, 367
END
IDD_VIRTUAL_VOICES_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 492
TOPMARGIN, 7
BOTTOMMARGIN, 367
END
IDD_MIXER_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 493
TOPMARGIN, 7
BOTTOMMARGIN, 368
END
IDD_WAV_VOICES_PAGE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 493
TOPMARGIN, 7
BOTTOMMARGIN, 368
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDR_MENU1 MENU DISCARDABLE
BEGIN
POPUP ""
BEGIN
MENUITEM "Add Event to the Watch List", ID_WATCH
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif
#include "res\supervis.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,739 @@
/****************************************************************
SNDREC for DirectSound 5.0 (starring SoundCapture)
MODIFICATIONS:
modified 11/09/98 - Joel Vibert - Test on pointer to avoid crash if error
+ ForceReleaseDriver in case card is half duplex
+ set bDriverInRecording to TRUE
author: Stephane Ronse
******************************************************************/
#define INITGUID
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "SNDinc.H"
#include "sndrec.h"
#include "sndlst2.h"
#include "sndxd.h"
#if defined(_DLL_COMPILATION_MODE) || defined(USE_DBG_MODULE)
#include "snddll.h"
#else
#include "snddbg.h"
#endif
typedef struct RECORD_BUFFER_ *pRECORD_BUFFER;
typedef struct RECORD_VOICE_ *pRECORD_VOICE;
SNDLST2_M_DynamicUseListOf(pRECORD_BUFFER);
typedef struct RECORD_BUFFER_{
void* ptrData;
unsigned long ulNbBytesMax;//capacity of this data buffer
unsigned long ulNbBytesFree;//nb of sample copied into this buffer
pRECORD_VOICE pVoice;
SNDLST2_M_DynamicElementDeclaration(pRECORD_BUFFER)
} RECORD_BUFFER;
typedef struct RECORD_VOICE_{
long lIdBufferClient;
long lSampleToBytesShift;
SndBool bUsed;
SND_tdstFormat stFormat;
td_pfn_vBufferClientPoped CallbackStack;
SNDLST2_M_DynamicAnchorDeclaration(pRECORD_BUFFER) pBufferList;
} RECORD_VOICE;
static RECORD_VOICE RecordVoice;
static SndBool bDriverInRecording=FALSE;
static LPDIRECTSOUNDCAPTURE lpDirectSoundCapture=NULL;
static LPDIRECTSOUNDCAPTUREBUFFER lpDirectSoundCaptureBuffer=NULL;
static LPDIRECTSOUNDNOTIFY lpDsNotify=NULL;
static HANDLE hRecordThread=NULL;
static HANDLE hEventStopRecord=NULL;
//notify point location
#define NB_BUFFERS 16
static HANDLE hEventNotify[NB_BUFFERS+1];
static DWORD dwOffsetBytes[NB_BUFFERS];
static DWORD dwOffsetSamples[NB_BUFFERS];
static DWORD dwSizeBufferBytes;
static DWORD dwSizeBufferSamples;
//static UINT snd_msg_StartRecord,snd_msg_StopRecord,snd_msg_PushBuffer;
static HANDLE hMutexRecord;
static DWORD id_snd_thread=0;
static SndBool bDriverOutReleased=TRUE;
static long cumul_vumeter=0;
static long nb_element_vumeter=0;
//------------- DSoundTry(fct(x,y)) appelle fct(x,y) et affiche une <20>ventuelle erreur
static void GetErrorDSound(HRESULT err,char* texte,int size_texte)
{
if (err!=DS_OK)
{
switch (err)
{
case DSERR_CONTROLUNAVAIL:
strncpy(texte,"not available",size_texte);break;
case DSERR_ALLOCATED:
strncpy(texte,"allocated",size_texte);break;
case DSERR_BADFORMAT:
strncpy(texte,"bad format",size_texte);break;
case DSERR_INVALIDPARAM:
strncpy(texte,"invalid param",size_texte);break;
case DSERR_NOAGGREGATION:
strncpy(texte,"no aggregation",size_texte);break;
case DSERR_OUTOFMEMORY:
strncpy(texte,"out of memory",size_texte);break;
case DSERR_BUFFERLOST:
strncpy(texte,"bufferlost",size_texte);break;
case DSERR_PRIOLEVELNEEDED:
strncpy(texte,"priolevelneeded",size_texte);break;
case DSERR_INVALIDCALL:
strncpy(texte,"invalidcall",size_texte);break;
default:
strncpy(texte,"unidentified error",size_texte);
}
}
else
strncpy(texte,"No error",size_texte);
}
static HRESULT DSoundTry(HRESULT res)
{
char texte[80];
if (res!=DS_OK)
{
GetErrorDSound(res,texte,sizeof(texte));
SND_fn_vDisplayError(E_uwSndSystemError,texte);
//DisplayErrorDSound(res);
}
return res;
}
void refresh_vumeter(void* pData,long nb_data)
{
signed char *ptrByte;
signed short *ptrWord;
long cumul=0;
int i;
cumul_vumeter=0;
nb_element_vumeter=0;
/*
switch (RecordVoice.stFormat.uFormat.stPCM.uwResolution)
{//nota: pas de diff<66>rence entre mono et stereo (vumeter mono)
case 8:
for (i=0,ptrByte=pData;i<nb_data;i++,ptrByte++)
{
cumul_vumeter+=abs(*ptrByte);
}
nb_element_vumeter+=nb_data;
break;
case 16:
for (i=0,ptrWord=pData;i<nb_data/2;i++,ptrWord++)
{
cumul_vumeter+=abs(*ptrWord)>>8;
}
nb_element_vumeter+=nb_data/2;
break;
default:
snd_assert(FALSE);
break;
}
*/
switch (RecordVoice.stFormat.uFormat.stPCM.uwResolution)
{//nota: pas de diff<66>rence entre mono et stereo (vumeter mono)
case 8:
for (i=0,ptrByte=pData;i<nb_data;i++,ptrByte++)
{
cumul_vumeter=max(cumul_vumeter,*ptrByte);
}
nb_element_vumeter=1;
break;
case 16:
for (i=0,ptrWord=pData;i<nb_data/2;i++,ptrWord++)
{
cumul_vumeter=max(cumul_vumeter,*ptrWord);
}
nb_element_vumeter=1;
break;
default:
snd_assert(FALSE);
break;
}
}
unsigned char get_vumeter_value()
{
if (nb_element_vumeter)
{
return (unsigned char)(cumul_vumeter/nb_element_vumeter);
}
else
return 0;
}
DWORD WINAPI callback_thread(long* ptr_param)
{
(*(td_pfn_vBufferClientPoped)ptr_param[0])(ptr_param[1],ptr_param[2]);
GlobalFree(ptr_param);
return 0;
}
void start_callback(pRECORD_BUFFER buffer)
{
/*
DWORD id_thread;
long *ptr_param=GlobalAlloc(GMEM_FIXED,3*sizeof(long));
if (buffer->pVoice->CallbackStack)
{
ptr_param=GlobalAlloc(GMEM_FIXED,3*sizeof(long));
ptr_param[0]=(long)buffer->pVoice->CallbackStack;
ptr_param[1]=(long)buffer->pVoice;
ptr_param[2]=(long)buffer;
CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)callback_thread,(LPVOID)ptr_param,0,&id_thread);
}
*/
(*(td_pfn_vBufferClientPoped)buffer->pVoice->CallbackStack)((long)buffer->pVoice,(long)buffer);
}
DWORD WINAPI RecordThread(long* ptr_param)
{
DWORD ret;
DWORD dwOffset,dwSize;
DWORD dwData1,dwData2;
LPVOID pvData1,pvData2;
HRESULT res;
DWORD data_locked,nb_to_copy;
int i;
pRECORD_BUFFER pstPushedBuffer,pstPushedBufferNext;
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_ABOVE_NORMAL);
while ((ret=WaitForMultipleObjects(NB_BUFFERS+1,hEventNotify,FALSE,INFINITE))!=WAIT_OBJECT_0+NB_BUFFERS)
{//wait for any event to be signaled
//LockMutex
WaitForSingleObject(hMutexRecord,INFINITE);
if (lpDirectSoundCaptureBuffer)
{
dwOffset=dwOffsetBytes[ret-WAIT_OBJECT_0];
dwSize=dwSizeBufferBytes;
//Lock DSound data
res=DSoundTry(IDirectSoundCaptureBuffer_Lock(
lpDirectSoundCaptureBuffer,
dwOffset,
dwSize,
&pvData1,
&dwData1,
&pvData2,
&dwData2,
0));
snd_assert(!dwData2);snd_assert(dwData1==dwSize);
// _RPTF3(_CRT_WARN,"received %d ->Lock %d to %d\n",ret,dwOffset,dwOffset+dwSize);
refresh_vumeter(pvData1,dwData1);
data_locked=dwData1;
SNDLST2_M_DynamicForEachMovingElementOf(&RecordVoice.pBufferList,pstPushedBuffer,pstPushedBufferNext,i)
{//pop data buffer until there is data enough
nb_to_copy=min(data_locked,pstPushedBuffer->ulNbBytesFree);
CopyMemory((char*)pstPushedBuffer->ptrData+pstPushedBuffer->ulNbBytesMax-pstPushedBuffer->ulNbBytesFree,
pvData1,
nb_to_copy);
pstPushedBuffer->ulNbBytesFree-=nb_to_copy;
data_locked-=nb_to_copy;
if (!pstPushedBuffer->ulNbBytesFree)
{//Databuffer can be poped
SNDLST2_M_DynamicIsolate(pstPushedBuffer);
start_callback(pstPushedBuffer);
SND_fn_vFreeSndEx(E_ucSndBlockMain,pstPushedBuffer);
}
if (!data_locked)
//no more data locked to pop
break;
}
#ifdef SNDREC_REPORT
if (data_locked)
_RPTF1(_CRT_WARN,"databuffer lack (%d bytes)\n",data_locked);
#endif
res=DSoundTry(IDirectSoundCaptureBuffer_Unlock(
lpDirectSoundCaptureBuffer,
pvData1,
dwData1,
pvData2,
dwData2));
}
ReleaseMutex(hMutexRecord);
}
#ifdef SNDREC_REPORT
_RPTF0(_CRT_WARN,"record stop\n");
#endif
ExitThread(0);
return 0;
}
//-------------------------------------------------------------
// SND_fn_vInitRecord: init SNDREC
//-------------------------------------------------------------
int SND_CALL SND_fn_iInitRecord(SND_tdstInitStruct *pInitStruct)
{
int i;
#if defined(_DLL_COMPILATION_MODE)
SND_DllInitEntryPoints_StaticFunctions((HMODULE)pInitStruct->hProcessInstance );
SND_DllInitEntryPoints_WavFunctions(SND_hWavModule);
#endif
hMutexRecord=CreateMutex(NULL,FALSE,NULL);
hEventStopRecord=CreateEvent(NULL,FALSE,FALSE,NULL);
hEventNotify[NB_BUFFERS]=hEventStopRecord;
for (i=0;i<NB_BUFFERS;i++)
hEventNotify[i]=CreateEvent(NULL,FALSE,FALSE,NULL);
memset(&RecordVoice,0,sizeof(RecordVoice));
return C_INIT_OK;
}
//-------------------------------------------------------------
// SND_fn_vDesInitRecord: desinit SNDREC
//-------------------------------------------------------------
void SND_CALL SND_fn_vDesInitRecord(void)
{
if (bDriverInRecording)
SND_fn_vStopRecord((long)&RecordVoice);
}
//---------------------------------------------------------------
// SND_fn_bTestFormatRecord:test is a fromat is valid for recording
// Parameters:
// pformat: format to be tested; some fields may be filled depending of flags value
// to return a effective valid format
// flags: boolean combinaison of following
// FORMATREC_RESOLUTION: test Resolution field value; will fill pFormat with a valid value
// FORMATREC_FREQUENCY: test Frequency field value; will fill pFormat with a valid value
// FORMATREC_NBCHANNEL: test NbChannlel field value; will fill pFormat with a valid value
// FORMATREC_ZIP: test eZip field value; will fill pFormat with a valid value
// Return:
// TRUE when a calid format was found; some filed of pFormat could be changed
// FALSE when no format is availlable regardless to flags value
//---------------------------------------------------------------
SndBool SND_CALL SND_fn_bTestFormatRecord(SND_tdstFormat* pformat,int flags)
{
MMRESULT ret;
WAVEFORMATEX WaveFormatEx;
WAVEINCAPS WaveInCaps;
#define MASK_8BITS (WAVE_FORMAT_1M08 | WAVE_FORMAT_1S08 | WAVE_FORMAT_2M08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_4M08 | WAVE_FORMAT_4S08)
#define MASK_16BITS (WAVE_FORMAT_1M16 | WAVE_FORMAT_1S16 | WAVE_FORMAT_2M16 | WAVE_FORMAT_2S16 | WAVE_FORMAT_4M16 | WAVE_FORMAT_4S16)
#define MASK_MONO (WAVE_FORMAT_1M08 | WAVE_FORMAT_2M08 | WAVE_FORMAT_4M08 | WAVE_FORMAT_1M16 | WAVE_FORMAT_2M16 | WAVE_FORMAT_4M16)
#define MASK_STEREO (WAVE_FORMAT_1S08 | WAVE_FORMAT_2S08 | WAVE_FORMAT_4S08 | WAVE_FORMAT_1S16 | WAVE_FORMAT_2S16 | WAVE_FORMAT_4S16)
memset(&WaveInCaps,0,sizeof(WaveInCaps));
if ((ret=waveInGetDevCaps(WAVE_MAPPER,&WaveInCaps,sizeof(WaveInCaps)))!=MMSYSERR_NOERROR)
{
return FALSE;
}
//check eZip
if (flags & FORMATREC_ZIP)
{//eZip is forced to a value
if (pformat->eZip!=SAMPLE_PCM)
//PCM is currently the only format
return FALSE;
}
else
//return the best eZip value
pformat->eZip=SAMPLE_PCM;
//check resolution
if (flags & FORMATREC_RESOLUTION)
{//eResolution is forced to a value
if (pformat->uFormat.stPCM.uwResolution==8)
WaveInCaps.dwFormats^=MASK_8BITS;
if (pformat->uFormat.stPCM.uwResolution==16)
WaveInCaps.dwFormats^=MASK_16BITS;
//no more compatible format
if (!WaveInCaps.dwFormats)
return FALSE;
}
else
{
if (WaveInCaps.dwFormats & MASK_16BITS)
WaveInCaps.dwFormats&=MASK_16BITS;
pformat->uFormat.stPCM.uwResolution=(WaveInCaps.dwFormats & MASK_8BITS) ? 8 : 16;
}
//check channel
if (flags & FORMATREC_NBCHANNEL)
{//nbchannel is forced to a value
if (pformat->uFormat.stPCM.uwNbChannels==1)
WaveInCaps.dwFormats^=MASK_MONO;
if (pformat->uFormat.stPCM.uwNbChannels==2)
WaveInCaps.dwFormats^=MASK_STEREO;
//no more compatible format
if (!WaveInCaps.dwFormats)
return FALSE;
}
else
{
if (WaveInCaps.dwFormats & MASK_STEREO)
WaveInCaps.dwFormats&=MASK_STEREO;
pformat->uFormat.stPCM.uwNbChannels=(WaveInCaps.dwFormats & MASK_MONO) ? 1 : 2;
}
if (!(flags & FORMATREC_FREQUENCY))
{
if (WaveInCaps.dwFormats>=WAVE_FORMAT_4M08)
pformat->uFormat.stPCM.ulFreq=44100;
else
if (WaveInCaps.dwFormats>=WAVE_FORMAT_2M08)
pformat->uFormat.stPCM.ulFreq=22050;
else
pformat->uFormat.stPCM.ulFreq=11025;
}
//first try with exact value for frequency
memset(&WaveFormatEx,0,sizeof(WaveFormatEx));
WaveFormatEx.wFormatTag=WAVE_FORMAT_PCM;
WaveFormatEx.nChannels=pformat->uFormat.stPCM.uwNbChannels;
WaveFormatEx.wBitsPerSample=pformat->uFormat.stPCM.uwResolution;
WaveFormatEx.nSamplesPerSec=pformat->uFormat.stPCM.ulFreq;
WaveFormatEx.nBlockAlign=(WORD)(WaveFormatEx.nChannels*WaveFormatEx.wBitsPerSample/8);
WaveFormatEx.nAvgBytesPerSec=WaveFormatEx.nSamplesPerSec*WaveFormatEx.nBlockAlign;
WaveFormatEx.cbSize=0;
if ((ret=waveInOpen(NULL,WAVE_MAPPER,&WaveFormatEx,0,0,WAVE_FORMAT_QUERY))==MMSYSERR_NOERROR)
return TRUE;
else
return FALSE;
}
//-----------------------------------------------------------
// SND_fn_lCreateBufferRecord: create a recording buffer
// Parameters:
// SND_tdstFormat: format souhait<69>
// pCallback; type de callback
// Return:
// C_PLAY_FAILED if failed; else, Buffer is ready to record
//-----------------------------------------------------------
long SND_CALL SND_fn_lCreateBufferRecord(SND_tdstFormat* pformat,SND_tdstCallback* pCallback)
{
long ret;
snd_assert(pCallback->eType==BUFFER_STACK);
WaitForSingleObject(hMutexRecord,INFINITE);
if (!SND_fn_bTestFormatRecord(pformat,FORMATREC_RESOLUTION|FORMATREC_FREQUENCY|FORMATREC_NBCHANNEL|FORMATREC_ZIP)
|| RecordVoice.bUsed)
ret=C_PLAY_FAILED;
else
{
SNDLST2_M_DynamicInitAnchor(&RecordVoice.pBufferList);
memcpy(&RecordVoice.stFormat,pformat,sizeof(RecordVoice.stFormat));
RecordVoice.lSampleToBytesShift=0;
if (RecordVoice.stFormat.uFormat.stPCM.uwResolution==16) RecordVoice.lSampleToBytesShift++;
if (RecordVoice.stFormat.uFormat.stPCM.uwNbChannels==2) RecordVoice.lSampleToBytesShift++;
dwSizeBufferSamples=RecordVoice.stFormat.uFormat.stPCM.ulFreq/NB_BUFFERS;
dwSizeBufferBytes=dwSizeBufferSamples<<RecordVoice.lSampleToBytesShift;
RecordVoice.CallbackStack=pCallback->uCallback.CallbackStack;
RecordVoice.stFormat.uFormat.stPCM.ulNbSamples=NB_BUFFERS*dwSizeBufferSamples;
ret=(long)&RecordVoice;
}
ReleaseMutex(hMutexRecord);
return ret;
}
//---------------------------------------------------------------
// SND_fn_ucGetInstantVuMeterRecordSound: get current value for VuMeter
// Return:
// volume (0=silence; 127= maximum power)
//-----------------------------------------------------------------
unsigned char SND_CALL SND_fn_ucGetInstantVuMeterRecord(void)
{
unsigned char tmp;
WaitForSingleObject(hMutexRecord,INFINITE);
tmp=get_vumeter_value();
ReleaseMutex(hMutexRecord);
return tmp;
}
//---------------------------------------------------------------
// SND_fn_lPushBufferToRecord: add a new buffer to record data into
// Parameters:
// id_buffer: id of RecordBuffer
// ptr: pointer where copy recorded data
// size_ptr: nb bytes to copy
// Return:
// id of data buffer
//-----------------------------------------------------------------
long SND_CALL SND_fn_lPushBufferToRecord(long id_buffer,void* ptr,int size_ptr)
{
pRECORD_BUFFER pstPushedBuffer;
WaitForSingleObject(hMutexRecord,INFINITE);
pstPushedBuffer=SND_fn_pvMallocSndEx(E_ucSndBlockMain,sizeof(RECORD_BUFFER));
SNDLST2_M_DynamicInitElement(pstPushedBuffer);
//size_ptr must agree with data alignement
snd_assert(!(size_ptr & ((1<<RecordVoice.lSampleToBytesShift)>>1)));
pstPushedBuffer->ptrData=ptr;
pstPushedBuffer->ulNbBytesMax=size_ptr;
pstPushedBuffer->ulNbBytesFree=size_ptr;
snd_assert(id_buffer==(long)&RecordVoice);
pstPushedBuffer->pVoice=&RecordVoice;
SNDLST2_M_DynamicAddTail(&RecordVoice.pBufferList,pstPushedBuffer);
ReleaseMutex(hMutexRecord);
return (long)pstPushedBuffer;
}
int fn_iTryStartRecord(long id_buffer)
{
HRESULT res;
DSCBUFFERDESC buffer_desc;
WAVEFORMATEX WaveFormatEx;
DSBPOSITIONNOTIFY PositionNotify[NB_BUFFERS];
//DWORD id_thread;
int i;
//hRecordThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)RecordThread,NULL,0,&id_thread);
WaitForSingleObject(hMutexRecord,INFINITE);
if ((res=DSoundTry(DirectSoundCaptureCreate(
NULL,
&lpDirectSoundCapture,
NULL)))!=DS_OK)
{
/*MessageBox(NULL,"","DirectSoundCaptureCreate failed",MB_OK); */
ReleaseMutex(hMutexRecord);
return -1;
}
//create a DSCapture for 1 second
memset(&WaveFormatEx,0,sizeof(WaveFormatEx));
WaveFormatEx.wFormatTag=WAVE_FORMAT_PCM;
WaveFormatEx.nChannels=RecordVoice.stFormat.uFormat.stPCM.uwNbChannels;
WaveFormatEx.wBitsPerSample=RecordVoice.stFormat.uFormat.stPCM.uwResolution;
WaveFormatEx.nSamplesPerSec=RecordVoice.stFormat.uFormat.stPCM.ulFreq;
WaveFormatEx.nBlockAlign=(WORD)(WaveFormatEx.nChannels*WaveFormatEx.wBitsPerSample/8);
WaveFormatEx.nAvgBytesPerSec=WaveFormatEx.nSamplesPerSec*WaveFormatEx.nBlockAlign;
WaveFormatEx.cbSize=0;
memset(&buffer_desc,0,sizeof(buffer_desc));
buffer_desc.dwSize=sizeof(buffer_desc);
buffer_desc.dwFlags=DSCBCAPS_WAVEMAPPED;
buffer_desc.dwBufferBytes=RecordVoice.stFormat.uFormat.stPCM.ulNbSamples<<RecordVoice.lSampleToBytesShift;
buffer_desc.lpwfxFormat=&WaveFormatEx;
if ((res=DSoundTry(IDirectSoundCapture_CreateCaptureBuffer(
lpDirectSoundCapture,
&buffer_desc,
&lpDirectSoundCaptureBuffer,
NULL)))!=DS_OK)
{
/*MessageBox(NULL,"","IDirectSoundCapture_CreateCaptureBuffer failed",MB_OK);*/
IDirectSoundCapture_Release(lpDirectSoundCapture);
ReleaseMutex(hMutexRecord);
return -2;
}
res=DSoundTry(IDirectSoundCapture_QueryInterface(
lpDirectSoundCaptureBuffer,
&IID_IDirectSoundNotify,
&lpDsNotify));
for (i=0;i<NB_BUFFERS;i++)
{
dwOffsetBytes[i]=i*dwSizeBufferBytes;
dwOffsetSamples[i]=dwOffsetBytes[i]>>RecordVoice.lSampleToBytesShift;
}
for (i=0;i<NB_BUFFERS;i++)
{
PositionNotify[i].dwOffset=dwOffsetBytes[(i+1)%NB_BUFFERS];
PositionNotify[i].hEventNotify=hEventNotify[i];
}
res=DSoundTry(IDirectSoundNotify_SetNotificationPositions(
lpDsNotify,
NB_BUFFERS,
PositionNotify));
if ((res=DSoundTry(IDirectSoundCaptureBuffer_Start(
lpDirectSoundCaptureBuffer,
DSCBSTART_LOOPING)))!=DS_OK)
{
/* MessageBox(NULL,"","IDirectSoundCaptureBuffer_Start failed",MB_OK); */
IDirectSoundCaptureBuffer_Release(lpDirectSoundCaptureBuffer);
IDirectSoundCapture_Release(lpDirectSoundCapture);
ReleaseMutex(hMutexRecord);
return -3;
}
bDriverInRecording=TRUE;
ReleaseMutex(hMutexRecord);
return 0;
}
static SndBool bReleaseForced=FALSE;
SndBool SND_CALL SND_fn_bStartRecord(long id_buffer)
{
DWORD id_thread;
hRecordThread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)RecordThread,NULL,0,&id_thread);
switch(fn_iTryStartRecord(id_buffer))
{
case 0: return TRUE; /* succeed */
case -1: /* DirectCaptureObject: creation failure */
case -2: /* DirectCaptureBuffer: creation failure */
case -3: /* Start failure */
if (bReleaseForced)
{
CloseHandle(hRecordThread);
hRecordThread=NULL;
return FALSE;
}
/* release driver and retry (in case card is half duplex) */
bReleaseForced=TRUE;
SND_fn_vForceReleaseDriverSxd();
if (fn_iTryStartRecord(id_buffer)!=0) /* error */
{
/* failed again=>report error */
SND_fn_vForceRestoreDriverSxd();
CloseHandle(hRecordThread);
hRecordThread=NULL;
bReleaseForced=FALSE;
return FALSE;
}
return TRUE;
default: return FALSE;
}
}
void SND_CALL SND_fn_vStopRecord(long id_buffer)
{
HRESULT res;
int i;
pRECORD_BUFFER pstPushedBuffer,pstPushedBufferNext;
WaitForSingleObject(hMutexRecord,INFINITE);
if (lpDirectSoundCaptureBuffer) /* test: jv */
res=DSoundTry(IDirectSoundCaptureBuffer_Stop(lpDirectSoundCaptureBuffer));
if (lpDsNotify)
IDirectSoundNotify_Release(lpDsNotify);
lpDsNotify=NULL;
//purge databuffer list
SNDLST2_M_DynamicForEachMovingElementOf(&RecordVoice.pBufferList,pstPushedBuffer,pstPushedBufferNext,i)
{
SNDLST2_M_DynamicIsolate(pstPushedBuffer);
SND_fn_vFreeSndEx(E_ucSndBlockMain,pstPushedBuffer);
}
if (lpDirectSoundCaptureBuffer)
IDirectSoundCaptureBuffer_Release(lpDirectSoundCaptureBuffer);
lpDirectSoundCaptureBuffer=NULL;
bDriverInRecording=FALSE;
if (lpDirectSoundCapture)
IDirectSoundCapture_Release(lpDirectSoundCapture);
lpDirectSoundCapture=NULL;
ReleaseMutex(hMutexRecord);
SetEvent(hEventStopRecord);
if (bReleaseForced)
{
bReleaseForced=FALSE;
SND_fn_vForceRestoreDriverSxd();
}
}
SndBool SND_CALL SND_fn_bIsBufferFullDuplexRecord(long id_buffer)
{
return FALSE;
}
SndBool SND_CALL SND_fn_bIsWorkingRecord(long id_buffer)
{
return bDriverInRecording;
}
//---------------------------------------------------------
// SND_fn_bManageMsgForRecord: traitement des messages envoy<6F>s <20> la Thread Wave
// Param<61>tres:
// msg: message to be processed
// Return:
// TRUE if message was processed for WaveIn
// FALSE if message must be processed by the thread
//---------------------------------------------------------
SndBool SND_CALL SND_fn_bManageMsgForRecord(long p_msg)
{
return FALSE;
}

View File

@@ -0,0 +1,91 @@
// Module SNDWAVE - Version exclusive DirectX2D (X2)
#undef DLL_IMPEXP
#define DLL_IMPEXP __declspec(dllexport)
//sections et options du SND_CPA.INI
#define DX2D_SECTION "Directx2D Options"
#define DX2D_NBVOICES_KEY "Nb Voices"
#define DX2D_GUID_KEY "GUID for "
//typedef publiques
typedef struct {
SndBool bGuidNULL;
GUID Guid;
char description[128];
char module[128];
DSCAPS caps;
} stGUIDAvailable;
typedef stGUIDAvailable* pstGUIDAvailable;
//typedef moteur priv<69>s
typedef struct _tdstSampleMemoryDX2D tdstSampleMemoryDX2D;
typedef union _tduDataSampleDX2D tduDataSampleDX2D;
typedef struct _tdstTypeSampleMemDX2D tdstTypeSampleMemDX2D;
typedef union _tduRefResDX2D tduRefResDX2D;
typedef struct _tdstBlockResourceMemDX2D tdstBlockResourceMemDX2D;
typedef union _tduResMemDX2D tduResMemDX2D;
union _tduRefResDX2D {
tdxId Id;
tdstBlockResourceMemDX2D *pstPtr;
} ;
//param<61>tre d'une ressource sample en m<>moire
struct _tdstSampleMemoryDX2D {
LPDIRECTSOUNDBUFFER lpBufferAttack;
LPDIRECTSOUNDBUFFER lpBufferLoop;
int iSizeAttack;
} ;
//union de la description du sample
union _tduDataSampleDX2D{
tdstSampleMemoryDX2D stMem ;
tdstSampleStreaming stStream ;
} ;
//param<61>tres d'une ressource sample (donn<6E>es en mem)
struct _tdstTypeSampleMemDX2D {
SndBool bPitchable; //peut-on changer le pitch du sample
SndBool bVolable; //peut-on changer son volume
SndBool bPanable; //peut le paner
SndBool bSpacable; //peut-on lui appliquer un effet space
SndBool bReverbable; //peut-on (ou doit-on) le reverber
SndBool bStream; //streming ou en m<>moire
SndBool bLoop; //loope-t-il
tduDataSampleDX2D uData; //description du sample
unsigned long ulInc0 ; //p<>riode en echantillons
unsigned long ulFreq; //p<>riode en echantillons
unsigned short uwResolution; //nb de bits (8 ou 16)
unsigned short uwNbChannels; //nb de canaux(mono, st<73>reo ...)
tdeTypeZip eZip;
} ;
union _tduResMemDX2D {
tdstTypeSampleMemDX2D stSample ;
tdstTypeMidiMem stMidi ;
tdstTypeCD stCD;
tdstTypeSequenceMem stSequence ;
tdstTypeSwitchMem stSwitch ;
tdstTypeSplitMem stSplit;
tdstTypeThemeMem stTheme;
} ;
//description d'une ressource (donn<6E>es en m<>moire)
struct _tdstBlockResourceMemDX2D {
tdxId Id; //id de la ressource
tdeTypeResource eType; //type
tdeTypeStorage eStorage; //storage ???
unsigned char ucVolume; //volume par dfaut
SndBool bIsLoaded ; //TRUE si en m<>oire
tduResMemDX2D uRes ; //description propre <20> la ressource
// M_LstChildDeclaration(tdstBlockResourceMem,tdstSndPolyResource); //insertion dans la liste ACP
SNDLST2_M_StaticChildDeclaration(tdstBlockResourceMemDX2D*,tdstSndPolyResource*) //insertion dans la liste ACP
};
DLL_IMPEXP int SND_CALL SND_fn_iGetGUIDList(pstGUIDAvailable lpGuidDescrption,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetWantedGUID(char* GUID_wanted,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetCurrentGUID(char* description,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedGUID(char* wanted,char* selected,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentGUID(char* wanted,char* selected,int size);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,42 @@
#include <windows.h>
#include <mmsystem.h>
#include "SNDinc.H"
#if defined(_DLL_COMPILATION_MODE)
#include "snddll.h"
#else
#endif
int SND_fn_iMixerInitSample(HWAVEOUT hWave)
{
return 0;
}
//==================================
// Get sample value
//==================================
// retourne la valeur du mixer
// sample en %
//
//==================================
DWORD SND_fn_dwGetSampleValue(void)
{
return 0;
}
//==================================
// Set sample value
// en %
//
//==================================
void SND_fn_vSetSampleValue(DWORD val)
{
}
int SND_fn_iMixerDesInitSample(void)
{
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,841 @@
/*---------------------------------------------------------------
FILE: client3d.c
ROLE: management of client buffers for DSound3d
MODIFICATIONS:
- J.Vibert - 10/12/98 - small modif on errors returned
- J.Vibert - 07/12/98 - test on StaticBuffer+StreaminigBuffer in DSCAPS test
+ dsound buffer pointers checked
- J.Vibert - 01/12/98 - extracted from sndxdwav.c
----------------------------------------------------------------*/
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "SNDinc.h"
#include "sndthrd.h"
#include "sndxd.h"
#include "sndres.h"
#include "sndhardw.h"
#if defined(_DLL_COMPILATION_MODE) && defined(_DLL_MODULE)
#include "snddll.h"
#endif
#include "priv3dfl.h"
//to debug
#ifdef DBG_NB_BUF
extern int dbgBuffAtt,dbgBuffLoop,dbgBuff,dbgBuffExt;
#endif
#if (defined(DBG_NB_BUF)&&!defined(USE_DEBUGFILE))
#undef DBG_NB_BUF
#endif
extern long vol_2_hth_dB[128];
extern LPDIRECTSOUND lpDirectSoundObject;
extern SndBool driver_SND_OK;
extern SndBool bReleasedForced;
// M_AdaptVolume macro:
// compute SND_volume to get DS_volume
// Due to mixing level compatibility with WinMM DLL, Stereo ClientBuffers should twice as loud as any other buffers
#define M_AdaptVolume(SND_volume,iNbChannels,bClientBuffer) \
( (((int)iNbChannels==2) && bClientBuffer) ? (unsigned char)SND_volume : (unsigned char)(SND_volume/2))
//buffers clients
/*
typedef struct _tdstStackElement *p_tdstStackElement;
SNDLST2_M_DynamicUseListOf(p_tdstStackElement);
typedef struct _tdstStackElement {
} tdstStackElement;
*/
typedef struct _tdstBufferClientStack {
td_pfn_vBufferClientPoped pfnCallback;
} tdstBufferClientStack;
typedef struct _tdstBufferClientAsynchrone {
unsigned long ulSamples; //size of buffer (in samples)
unsigned long ulNextToCompute;//id of the next sample to compute
td_pfn_vRefreshBufferClient pfnCallback; //callback function for client buffer
} tdstBufferClientAsynchrone;
typedef struct _tdstBufferClient *p_tdstBufferClient;
SNDLST2_M_DynamicUseListOf(p_tdstBufferClient);
typedef struct _tdstBufferClient {
SND_tduTypeCallback eType;
long lVoice; //associated sample voice
//SndBool bPaused;//TRUE si buffer paused
unsigned long dwFlags; //FLAG_PAUSED|FLAG_VIRTUAL//FLAG_SETVIRTFREQ
DWORD pos_when_paused;
long lUserId;
tduRefResDX3D uPseudoRes; //uPseudoRes=&tdstPseudoRes
tdstBlockResourceMemDX3D tdstPseudoRes; //pseudo resource to mix samples
unsigned long ulDecalBytes; //nb_sample<<buffer->ulDecalBytes=nb_bytes
union {
tdstBufferClientAsynchrone stAsynchrone;
tdstBufferClientStack stStack;
} uParam;
DWORD ulTimeNextToCompute;//time measured when updating
double dLastDeltaT; //last Dt used to extrapolate (GetPos)
unsigned long ulFreq; //added 02/09/98 to restore frequency if needed after a forceRestore
SNDLST2_M_DynamicElementDeclaration(p_tdstBufferClient)
} tdstBufferClient;
typedef struct _tdstBufferClientList {
SNDLST2_M_DynamicAnchorDeclaration(p_tdstBufferClient) pList;
} tdstBufferClientList;
static tdstBufferClientList buffers_clients;
//tdstBufferClientList buffers_clients;
/*
typedef struct _tdstBufferClient *p_tdstBufferClient;
SNDLST2_M_DynamicUseListOf(p_tdstBufferClient);
typedef struct _tdstBufferClient tdstBufferClient;
struct _tdstBufferClient {
tduRefResDX3D uPseudoRes;
tdstBlockResourceMemDX3D tdstPseudoRes;
unsigned long ulSamples;//nb SAMPLE
unsigned long ulDecalBytes;//(SAMPLE<<ulDecalBytes)->BYTES
unsigned long ulNextToCompute;//next SAMPLE to compute
td_pfn_vRefreshBufferClient pfnCallbackBuffer;
long lUserId;
DWORD ulTimeNextToCompute;//temps mesur<75> au moment de la remise <20> jour de ulNextToCompute
double dLastDeltaT; //dernier Dt utilis<69> pour l'extrapolation de GetPos
BOOL paused;
SNDLST2_M_DynamicElementDeclaration(p_tdstBufferClient)
};
typedef struct _tdstBufferClientList {
SNDLST2_M_DynamicAnchorDeclaration(p_tdstBufferClient) pList;
} tdstBufferClientList;
*/
void refresh_buffer_asynchrone(p_tdstBufferClient buffer_client)
{
tdstBufferClientAsynchrone *buffer_asynchron=&buffer_client->uParam.stAsynchrone;
DWORD sizeptr1,sizeptr2,*ptr1,*ptr2;
DWORD playptr,writeptr;
DWORD nbbytes_to_calcul;
HRESULT result;
//jvdbg("refresh async");
if (buffer_client==NULL)
return; //04/12/98
if (buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop==NULL)
return; //04/12/98
//_RPT4(_CRT_WARN,"%d-%d-%f-%x\n",buffer->ulNextToCompute,nbbytes_to_calcul,buffer->dLastDeltaT,SND_fn_rGetPosBufferSample((long)buffer));
IDirectSoundBuffer_GetCurrentPosition(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,&playptr,&writeptr);
playptr=(playptr>>buffer_client->ulDecalBytes)<<buffer_client->ulDecalBytes;
nbbytes_to_calcul=playptr-(buffer_asynchron->ulNextToCompute<<buffer_client->ulDecalBytes);
if ((long)nbbytes_to_calcul<0) nbbytes_to_calcul+=buffer_asynchron->ulSamples<<buffer_client->ulDecalBytes;
buffer_client->dLastDeltaT-=(double)(nbbytes_to_calcul>>buffer_client->ulDecalBytes)/buffer_client->tdstPseudoRes.uRes.stSample.ulFreq;
if (buffer_client->dLastDeltaT<0.0)
buffer_client->dLastDeltaT=0.0;
if (nbbytes_to_calcul)
{
result=
IDirectSoundBuffer_Lock(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop
,buffer_asynchron->ulNextToCompute<<buffer_client->ulDecalBytes,nbbytes_to_calcul
,&ptr1,&sizeptr1,&ptr2,&sizeptr2,0);
while (result==DSERR_BUFFERLOST)
{
result=IDirectSoundBuffer_Restore(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop);
if (result!=DSERR_BUFFERLOST)
result=
IDirectSoundBuffer_Lock(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop
,buffer_asynchron->ulNextToCompute<<buffer_client->ulDecalBytes,nbbytes_to_calcul
,&ptr1,&sizeptr1,&ptr2,&sizeptr2,0);
}
if (result != DS_OK)
DebugBreak();
if (sizeptr1!=nbbytes_to_calcul)
{//wrap out
(*(buffer_asynchron->pfnCallback))(
buffer_client->lUserId
,buffer_asynchron->ulNextToCompute
,sizeptr1>>buffer_client->ulDecalBytes
,ptr1);
snd_assert(ptr2);
(*(buffer_asynchron->pfnCallback))(
buffer_client->lUserId
,0
,sizeptr2>>buffer_client->ulDecalBytes
,ptr2);
snd_assert(sizeptr2==(nbbytes_to_calcul-sizeptr1));
buffer_asynchron->ulNextToCompute=sizeptr2>>buffer_client->ulDecalBytes;
}
else
{
(*(buffer_asynchron->pfnCallback))(
buffer_client->lUserId
,buffer_asynchron->ulNextToCompute
,sizeptr1>>buffer_client->ulDecalBytes
,ptr1);
buffer_asynchron->ulNextToCompute+=nbbytes_to_calcul>>buffer_client->ulDecalBytes;
if (buffer_asynchron->ulNextToCompute==buffer_asynchron->ulSamples)
buffer_asynchron->ulNextToCompute=0;
}
IDirectSoundBuffer_Unlock(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,ptr1,sizeptr1,ptr2,sizeptr2);
buffer_client->ulTimeNextToCompute=timeGetTime();
}
}
// we manage a stack of buffers to be played one after another
void refresh_buffer_stack(p_tdstBufferClient buffer)
{
}
void updateClients()
{
p_tdstBufferClient buffer_client;
int i;
//--- buffers clients
//update buffers clients
SNDLST2_M_DynamicForEachElementOf(&buffers_clients.pList,buffer_client,i)
{
if (!(buffer_client->dwFlags & FLAG_PAUSED)) //bPaused)
{
switch (buffer_client->eType)
{
case BUFFER_ASYNCHRONE:
case BUFFER_SYNCHRONE:
refresh_buffer_asynchrone(buffer_client);
break;
case BUFFER_STACK:
refresh_buffer_stack(buffer_client);
break;
}
}
}
}
void fn_vSetVirtualVolume(unsigned long *pdwFlags, unsigned char ucVolume);
void SND_fn_vSetParamBufferSxdWave(long id_buffer,SoundParam *par)
{
#ifndef DISABLE_WAVE
p_tdstBufferClient buffer;
DWORD dwPitch;
unsigned char ucDSvolume;
if ((id_buffer == -1)||(id_buffer == 0)) return;
buffer = (p_tdstBufferClient)id_buffer;
if (buffer->dwFlags&FLAG_VIRTUAL)
{
//jvdbg("SetParamBufferSxdWav (virtual)");
buffer->dwFlags|=FLAG_SETVIRTFREQ;
if (par)
{
fn_vSetVirtualVolume(&buffer->dwFlags, par->ucVol);
dwPitch=(DWORD)(M_RealToDoubleSnd(par->Freq)*(double)(buffer->tdstPseudoRes.uRes.stSample.ulFreq));
} else
{
fn_vSetVirtualVolume(&buffer->dwFlags, 127);
dwPitch=buffer->tdstPseudoRes.uRes.stSample.ulFreq;
}
buffer->ulFreq=dwPitch;
return;
}
if (driver_SND_OK == FALSE)
return ;
if (buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop==NULL)
return; //04/12/98
//jvdbg("SetParamBufferSxdWav");
if (par)
{
ucDSvolume=M_AdaptVolume(par->ucVol
,buffer->tdstPseudoRes.uRes.stSample.uwNbChannels
,TRUE);
IDirectSoundBuffer_SetVolume(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,vol_2_hth_dB[ucDSvolume]);
dwPitch=(DWORD)(M_RealToDoubleSnd(par->Freq)*(double)(buffer->tdstPseudoRes.uRes.stSample.ulFreq));
}
else
{
ucDSvolume=M_AdaptVolume(127
,buffer->tdstPseudoRes.uRes.stSample.uwNbChannels
,TRUE);
IDirectSoundBuffer_SetVolume(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,vol_2_hth_dB[ucDSvolume]);
dwPitch=buffer->tdstPseudoRes.uRes.stSample.ulFreq;
}
IDirectSoundBuffer_SetFrequency(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,dwPitch);
#endif
}
void SND_fn_vDeleteBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
#ifdef DBG_NB_BUF
char s[80];
#endif //DBG_NB_BUF
//jvdbg("delete buff SxdWav");
if (driver_SND_OK == FALSE)
return ;
//jvdbg("delete2 buff SxdWav");
#ifdef DBG_NB_BUF
dbgBuffExt--;
sprintf(s," delete=>ext %d",dbgBuffExt);
//jvdbg(s);
#endif //DBG_NB_BUF
if ((id_buffer == -1)||(id_buffer == 0)) return;
SND_fn_vEnterCriticalSectionThreadSnd();
SNDLST2_M_DynamicIsolate((p_tdstBufferClient)id_buffer);
if (!(((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_VIRTUAL)) //forceRelease 01/09/98
{
if (((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop) //precaution 01/09/98
{
IDirectSoundBuffer_Stop(((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop);
IDirectSoundBuffer_Release(((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop);
((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop=NULL;
}
}
SND_fn_vFreeSnd((void*)id_buffer);
SND_fn_vQuitCriticalSectionThreadSnd();
#endif //DISABLE_WAVE
}
void SND_fn_vPauseBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if ((driver_SND_OK == FALSE)||id_buffer==0) { //id_buffer: 04/12/98
return ;
}
//jvdbg("pause buff SxdWav");
if (
(id_buffer!=C_PLAY_FAILED)
&& (!((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_PAUSED) //bPaused
)
{
//((p_tdstBufferClient)id_buffer)->bPaused=TRUE;
((p_tdstBufferClient)id_buffer)->dwFlags|=FLAG_PAUSED;
if (!((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_VIRTUAL)
{
if (((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop!=NULL) //04/12/98
IDirectSoundBuffer_Stop(((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop);
}
}
#endif
}
void SND_fn_vResumeBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE) {
return ;
}
//jvdbg("resume buff SxdWav");
if (id_buffer!=C_PLAY_FAILED)
{
if (((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_PAUSED) //bPaused)
{
if (! (((p_tdstBufferClient)id_buffer)->dwFlags&FLAG_VIRTUAL))
if (((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop!=NULL) //04/12/98
IDirectSoundBuffer_Play(((p_tdstBufferClient)id_buffer)->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,0,0,DSBPLAY_LOOPING);
//raj de l'horloge d'interpolation
((p_tdstBufferClient)id_buffer)->ulTimeNextToCompute=timeGetTime();
((p_tdstBufferClient)id_buffer)->dwFlags&=~FLAG_PAUSED; //bPaused=FALSE;
}
}
#endif
}
void* SND_fn_pvGetPtrBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE) {
return NULL;
}
#endif
return NULL;
}
SndReal SND_fn_rGetPosBufferSxdWave(long id_buffer)
{
#ifndef DISABLE_WAVE
tdstBufferClient *buffer;
DWORD lT;
double deltaT;
double rT;
if (driver_SND_OK == FALSE) {
return SND_C_POS_UNKNOWN;
}
if (id_buffer==C_PLAY_FAILED)
return SND_C_POS_UNKNOWN;
buffer=(tdstBufferClient*)id_buffer;
//if (!buffer->bPaused)
if (!(buffer->dwFlags&FLAG_PAUSED))
{
//deltaT=real time between now and the last computed sample
lT=timeGetTime();
if (buffer->ulTimeNextToCompute)
deltaT=(double)(lT-buffer->ulTimeNextToCompute)/1000.0;
else
deltaT=0.0;
if (deltaT>buffer->dLastDeltaT)
{
buffer->dLastDeltaT=deltaT;
if (buffer->dLastDeltaT>=(double)buffer->uParam.stAsynchrone.ulSamples/buffer->tdstPseudoRes.uRes.stSample.ulFreq)
{//big looping problem => slow slow slow...
buffer->dLastDeltaT=0.0;
}
}
}
//rT=last coherent value (ulNextToCompute) + time interpolation (dLastDeltaT)
rT=(double)buffer->uParam.stAsynchrone.ulNextToCompute/buffer->tdstPseudoRes.uRes.stSample.ulFreq
+buffer->dLastDeltaT;
//modulo T (duration of buffer)
while (rT>=(double)buffer->uParam.stAsynchrone.ulSamples/buffer->tdstPseudoRes.uRes.stSample.ulFreq)
rT-=(double)buffer->uParam.stAsynchrone.ulSamples/buffer->tdstPseudoRes.uRes.stSample.ulFreq;
return M_DoubleToRealSnd(rT);
#endif
return SND_C_POS_UNKNOWN;
}
/*---------------------------------------------------------------------------
FUNCTION: fn_lCreateDxBufferForClientBuffer
ROLE: Create directsound buffer for client buffer
(for internal use only)
MODIFICATIONS:
01/09/98 - Joel Vibert - isolated from CreateNewBufferExAsynchrone
---------------------------------------------------------------------------*/
#ifndef DISABLE_WAVE
SndBool fn_bFreeBuffer(void);
long fn_lCreateDxBufferForClientBuffer(p_tdstBufferClient buffer, SoundParam* par, tdstBufferClientAsynchrone *buffer_asynchron)
{
DWORD sizeptr1,sizeptr2;
LPVOID ptr1,ptr2;
DWORD dwPitch;
PCMWAVEFORMAT pcmwf;
DSCAPS dscaps; //to test available buffers
DSBUFFERDESC dsbdesc;
HRESULT res;
#ifdef USE_DEBUGFILE
char s[150];
#endif
unsigned char ucDSvolume;
// Set up wave format structure.
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
pcmwf.wf.wFormatTag=WAVE_FORMAT_PCM;
pcmwf.wf.nChannels=buffer->tdstPseudoRes.uRes.stSample.uwNbChannels; //pformat->uFormat.stPCM.uwNbChannels;
pcmwf.wf.nSamplesPerSec=buffer->tdstPseudoRes.uRes.stSample.ulFreq; //pformat->uFormat.stPCM.ulFreq;
pcmwf.wBitsPerSample=buffer->tdstPseudoRes.uRes.stSample.uwResolution; //pformat->uFormat.stPCM.uwResolution;
pcmwf.wf.nBlockAlign=pcmwf.wf.nChannels*pcmwf.wBitsPerSample/8;
pcmwf.wf.nAvgBytesPerSec=pcmwf.wf.nSamplesPerSec*pcmwf.wf.nBlockAlign;
// Set up DSBUFFERDESC structure.
memset(&dsbdesc,0,sizeof(DSBUFFERDESC));
dsbdesc.dwSize=sizeof(DSBUFFERDESC);
dsbdesc.dwFlags=DSBCAPS_CTRLDEFAULT|DSBCAPS_LOCSOFTWARE
#ifdef AVOID_FOCUS_PB
|DSBCAPS_GLOBALFOCUS
#endif
;
dsbdesc.dwBufferBytes=buffer_asynchron->ulSamples<<buffer->ulDecalBytes;
dsbdesc.lpwfxFormat=(LPWAVEFORMATEX)&pcmwf;
//memset(&dscaps,0,sizeof(DSCAPS));
dscaps.dwSize=sizeof(DSCAPS);
res=IDirectSound_GetCaps(lpDirectSoundObject,&dscaps);
if (res!=DS_OK)
{
#ifdef USE_DEBUGFILE
jvdbg("ERROR ON GETCAPS:");
GetErrorDSound(res,s,sizeof(s));
jvdbg(s);
#endif
}// else break;
//}
if (res==DS_OK)
{
#ifdef USE_DEBUGFILE
jvdbg("getcaps=>ok:");
sprintf(s,"MxSt=%ld; FrMStr=%ld; FrMSt=%ld; FrStr=%ld; FrST=%ld",
dscaps.dwMaxHw3DStaticBuffers,
dscaps.dwFreeHwMixingStreamingBuffers,
dscaps.dwFreeHwMixingStaticBuffers,
dscaps.dwFreeHw3DStreamingBuffers,
dscaps.dwFreeHw3DStaticBuffers
);
jvdbg(s);
#endif
if (dscaps.dwMaxHw3DStaticBuffers<=0) //2D card=>emulation
dscaps.dwFreeHw3DStaticBuffers=CRITICAL_BUFF_NB+2; //dummy value to simulate free buffers
else
{
#ifdef SIMU_CRITICAL_BUFF_NB
dscaps.dwFreeHw3DStaticBuffers-=SIMU_BUFF_NB;
if ((long int)dscaps.dwFreeHw3DStaticBuffers<0) dscaps.dwFreeHw3DStaticBuffers=0;
#endif
if ((dscaps.dwFreeHwMixingStreamingBuffers<1)&& //no available buffer
(dscaps.dwFreeHwMixingStaticBuffers<1))
{
if (fn_bFreeBuffer()==FALSE) //free one or two buffer(s) from buffer_dispo
return C_PLAY_FAILED;
}
}
}
// create buffer
if ((res=IDirectSound_CreateSoundBuffer(lpDirectSoundObject
,&dsbdesc
,&buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop
,NULL))==DS_OK) {
#ifdef DBG_NB_BUF
dbgBuffExt++;
sprintf(s," Create ext=> ext %d",dbgBuffExt);
jvdbg(s);
#endif //DBG_NB_BUF
IDirectSoundBuffer_Lock(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,0,dsbdesc.dwBufferBytes,&ptr1,&sizeptr1,&ptr2,&sizeptr2,0);
//pCallback->uCallback.CallbackASynchrone
buffer_asynchron->pfnCallback(buffer->lUserId,0,sizeptr1>>buffer->ulDecalBytes,ptr1);
IDirectSoundBuffer_Unlock(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,ptr1,sizeptr1,ptr2,sizeptr2);
IDirectSoundBuffer_Play(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,0,0,DSBPLAY_LOOPING);
if (par) {
ucDSvolume=M_AdaptVolume(par->ucVol,buffer->tdstPseudoRes.uRes.stSample.uwNbChannels,TRUE);
IDirectSoundBuffer_SetVolume(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,vol_2_hth_dB[ucDSvolume]);
dwPitch=(DWORD)(M_RealToDoubleSnd(par->Freq)*(double)(buffer->tdstPseudoRes.uRes.stSample.ulFreq));
}
else {
ucDSvolume=M_AdaptVolume(127,buffer->tdstPseudoRes.uRes.stSample.uwNbChannels,TRUE);
IDirectSoundBuffer_SetVolume(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,vol_2_hth_dB[ucDSvolume]);
dwPitch=buffer->tdstPseudoRes.uRes.stSample.ulFreq;
}
IDirectSoundBuffer_SetFrequency(buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,dwPitch);
}
else
{
//GetErrorDSound(res,texte,sizeof(texte));
//SND_fn_vDisplayError(E_uwSndSystemError,texte);
return C_PLAY_FAILED;
}
return (long)buffer;
}
#endif
long CreateNewBufferExAsynchrone(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
#ifndef DISABLE_WAVE
p_tdstBufferClient buffer;
tdstBufferClientAsynchrone *buffer_asynchron;
long res;
if (driver_SND_OK == FALSE)
return C_PLAY_FAILED;
jvdbg("CreateNewBuffExAsync");
buffer=SND_fn_pvMallocSnd(sizeof(tdstBufferClient));
buffer_asynchron=&buffer->uParam.stAsynchrone;
SNDLST2_M_DynamicInitElement(buffer);
buffer->eType=BUFFER_ASYNCHRONE;
buffer->lUserId=user_id;
buffer->uPseudoRes.pstPtr=&(buffer->tdstPseudoRes);
buffer_asynchron->ulSamples=pformat->uFormat.stPCM.ulNbSamples;
buffer->ulDecalBytes=((pformat->uFormat.stPCM.uwResolution==8) ? 0 : 1) + ((pformat->uFormat.stPCM.uwNbChannels==1) ? 0 : 1);
buffer_asynchron->pfnCallback=pCallback->uCallback.CallbackASynchrone;
buffer_asynchron->ulNextToCompute=0;
buffer->ulTimeNextToCompute=0;
buffer->dLastDeltaT=0.0;
//buffer->bPaused=FALSE;
buffer->dwFlags=0;
if (bReleasedForced) buffer->dwFlags|=FLAG_VIRTUAL;
//--
buffer->tdstPseudoRes.Id=0xFFFFFFFF;
buffer->tdstPseudoRes.eType=TYPE_SAMPLE;
buffer->tdstPseudoRes.eStorage=TYPE_EXTERNAL;
buffer->tdstPseudoRes.ucVolume=127;
buffer->tdstPseudoRes.bIsLoaded=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bPitchable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bVolable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bPanable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bSpacable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bReverbable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bStream=FALSE;
buffer->tdstPseudoRes.uRes.stSample.bLoop=TRUE;
buffer->tdstPseudoRes.uRes.stSample.ulFreq=pformat->uFormat.stPCM.ulFreq;
buffer->tdstPseudoRes.uRes.stSample.uwResolution=pformat->uFormat.stPCM.uwResolution;
buffer->tdstPseudoRes.uRes.stSample.uwNbChannels=pformat->uFormat.stPCM.uwNbChannels;
buffer->tdstPseudoRes.uRes.stSample.eZip=SAMPLE_PCM;
//buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferAttack=NULL;
buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lSizeAttackBuff=0;
if (bReleasedForced)
{
SNDLST2_M_DynamicAddTail(&buffers_clients.pList,buffer);
return (long)buffer;
} else
{
res=fn_lCreateDxBufferForClientBuffer(buffer, par, buffer_asynchron);
if (res==C_PLAY_FAILED)
return res;
SNDLST2_M_DynamicAddTail(&buffers_clients.pList,buffer);
return res; //(long)buffer
}
#else //DISABLE_WAVE
return C_PLAY_FAILED;
#endif
}
//synchronous buffer= simulation by a small asynchronous buffer
long CreateNewBufferExSynchrone(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
SND_tdstFormat stFormatSynchrone;
SND_tdstCallback stCallbackSynchrone;
long id_buffer;
//jvdbg("CreateNewBuffExSync");
//no difference between synchronous and asynchronous versions
memcpy(&stFormatSynchrone,pformat,sizeof(stFormatSynchrone));
stFormatSynchrone.uFormat.stPCM.ulNbSamples=stFormatSynchrone.uFormat.stPCM.ulFreq*400/1000;
memcpy(&stCallbackSynchrone,pCallback,sizeof(stCallbackSynchrone));
id_buffer=CreateNewBufferExAsynchrone(&stFormatSynchrone,&stCallbackSynchrone,par,user_id);
if (id_buffer!=C_PLAY_FAILED)
((p_tdstBufferClient)id_buffer)->eType=BUFFER_SYNCHRONE;
return id_buffer;
}
//creation of a synchronous client buffer
long CreateNewBufferExStack(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
#ifndef DISABLE_WAVE
/*
snd_assert(pformat->eZip==SAMPLE_PCM);snd_assert(pCallback->eType==BUFFER_STACK);
if (driver_SND_OK == FALSE)
return C_PLAY_FAILED;
buffer=SND_fn_pvMallocSnd(sizeof(tdstBufferClient));
buffer_stack=&buffer->uParam.stAsynchrone;
SNDLST2_M_DynamicInitElement(buffer);
buffer->eType=BUFFER_ASYNCHRONE;
buffer->lUserId=user_id;
buffer->uPseudoRes.pstPtr=&(buffer->tdstPseudoRes);
buffer_asynchron->ulSamples=pformat->uFormat.stPCM.ulNbSamples;
buffer->ulDecalBytes=((pformat->uFormat.stPCM.uwResolution==8) ? 0 : 1) + ((pformat->uFormat.stPCM.uwNbChannels==1) ? 0 : 1);
buffer_asynchron->pfnCallback=pCallback->uCallback.CallbackASynchrone;
buffer_asynchron->ulNextToCompute=0;
buffer->ulTimeNextToCompute=0;
buffer->dLastDeltaT=0.0;
buffer->bPaused=FALSE;
//--
buffer->tdstPseudoRes.Id=0xFFFFFFFF;
buffer->tdstPseudoRes.eType=TYPE_SAMPLE;
buffer->tdstPseudoRes.eStorage=TYPE_EXTERNAL;
buffer->tdstPseudoRes.ucVolume=127;
buffer->tdstPseudoRes.bIsLoaded=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bPitchable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bVolable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bPanable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bSpacable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bReverbable=TRUE;
buffer->tdstPseudoRes.uRes.stSample.bStream=FALSE;
buffer->tdstPseudoRes.uRes.stSample.bLoop=TRUE;
buffer->tdstPseudoRes.uRes.stSample.ulFreq=pformat->uFormat.stPCM.ulFreq;
buffer->tdstPseudoRes.uRes.stSample.uwResolution=pformat->uFormat.stPCM.uwResolution;
buffer->tdstPseudoRes.uRes.stSample.uwNbChannels=pformat->uFormat.stPCM.uwNbChannels;
buffer->tdstPseudoRes.uRes.stSample.eZip=SAMPLE_PCM;
buffer->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferAttack=NULL;
buffer->tdstPseudoRes.uRes.stSample.uData.stMem.iSizeAttack=0;
// Set up wave format structure.
memset(&pcmwf, 0, sizeof(PCMWAVEFORMAT));
pcmwf.wf.wFormatTag=WAVE_FORMAT_PCM;
pcmwf.wf.nChannels=pformat->uFormat.stPCM.uwNbChannels;
pcmwf.wf.nSamplesPerSec=pformat->uFormat.stPCM.ulFreq;
pcmwf.wBitsPerSample=pformat->uFormat.stPCM.uwResolution;
pcmwf.wf.nBlockAlign=pcmwf.wf.nChannels*pcmwf.wBitsPerSample/8;
pcmwf.wf.nAvgBytesPerSec=pcmwf.wf.nSamplesPerSec*pcmwf.wf.nBlockAlign;
// Set up DSBUFFERDESC structure.
memset(&dsbdesc,0,sizeof(DSBUFFERDESC));
dsbdesc.dwSize=sizeof(DSBUFFERDESC);
dsbdesc.dwFlags=DSBCAPS_CTRLDEFAULT|DSBCAPS_LOCSOFTWARE;
dsbdesc.dwBufferBytes=buffer_asynchron->ulSamples<<buffer->ulDecalBytes;
dsbdesc.lpwfxFormat=(LPWAVEFORMATEX)&pcmwf;
*/
#endif
return C_PLAY_FAILED;
}
long SND_fn_lCreateNewBufferExSxdWave(SND_tdstFormat* pformat,SND_tdstCallback* pCallback,SoundParam* par,long user_id)
{
//jvdbg("CreateNewBuffExSxdWav");
switch (pCallback->eType)
{
case BUFFER_ASYNCHRONE:
return CreateNewBufferExAsynchrone(pformat,pCallback,par,user_id);
case BUFFER_SYNCHRONE:
//no difference between synchronous and asynchronous versions
return CreateNewBufferExSynchrone(pformat,pCallback,par,user_id);
case BUFFER_STACK:
return CreateNewBufferExStack(pformat,pCallback,par,user_id);
default:
//jvdbg("CreateNewBuffExSxdWav=>FAILED");
return C_PLAY_FAILED;
}
}
//obsolete: emulation via new fonction
long SND_fn_lCreateNewBufferSxdWave(unsigned long nb_samples,unsigned short uwResolution,unsigned short uwNbChannels,unsigned long ulFreq,SoundParam* par,td_pfn_vRefreshBufferClient callback,long user_id)
{
#ifndef DISABLE_WAVE
SND_tdstFormat format;
SND_tdstCallback Callback;
//jvdbg("createNew buff SxdWav");
memset(&format,0,sizeof(format));
format.eZip=SAMPLE_PCM;
format.uFormat.stPCM.ulNbSamples=nb_samples;
format.uFormat.stPCM.uwResolution=uwResolution;
format.uFormat.stPCM.uwNbChannels=uwNbChannels;
format.uFormat.stPCM.ulFreq=ulFreq;
memset(&Callback,0,sizeof(Callback));
Callback.eType=BUFFER_ASYNCHRONE;
Callback.uCallback.CallbackASynchrone=callback;
return SND_fn_lCreateNewBufferExSxdWave(&format,&Callback,par,user_id);
#endif
}
long SND_fn_lGetPosBufferExSxdWave(long id_buffer)
{
return SND_C_POS_UNKNOWN;
}
long SND_fn_lPushBufferExSxdWave(long id_buffer,SND_tdstStackBuffer* pStack)
{
return C_PLAY_FAILED;
}
void fn_vForceReleaseClientBuffers(void)
{
p_tdstBufferClient buffer_client;
int i;
//force release of client buffers
SNDLST2_M_DynamicForEachElementOf(&buffers_clients.pList,buffer_client,i)
{
if ((buffer_client!=NULL)&&((long)buffer_client!=-1))
{
if (!(buffer_client->dwFlags&FLAG_VIRTUAL)) //forceRelease 01/09/98
{
buffer_client->dwFlags|=FLAG_VIRTUAL;
if (buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop) //precaution 01/09/98
{
IDirectSoundBuffer_Stop(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop);
IDirectSoundBuffer_Release(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop);
buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop=NULL;
} //Loop
} //!FLAG_VIRTUAL
} //valid buffer_client
} //SNDLST2_M_DynamicForEachElementOf
}
void fn_vForceRestoreClientBuffers(void)
{
p_tdstBufferClient buffer_client;
int i;
unsigned char ucDSvolume;
//reactivate client buffers
SNDLST2_M_DynamicForEachElementOf(&buffers_clients.pList,buffer_client,i)
{
if (fn_lCreateDxBufferForClientBuffer(buffer_client, //create directsound buffer
NULL , //SoundParam* par,
&buffer_client->uParam.stAsynchrone)!=C_PLAY_FAILED)
{
//jvdbg("BufferClientReactivated");
if (buffer_client->dwFlags&FLAG_PAUSED) //paused => pause again
{
buffer_client->dwFlags&=~(FLAG_PAUSED|FLAG_VIRTUAL);
SND_fn_vPauseBufferSxdWave((long)buffer_client);
}
if (buffer_client->dwFlags&FLAG_SETVIRTVOL) /* restore volume */
{
buffer_client->dwFlags&=~FLAG_SETVIRTVOL;
//if (buffer->Attack)
// IDirectSoundBuffer_SetVolume(buffer->Attack,uwVolume);
if (buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop)
{
ucDSvolume=M_AdaptVolume(((buffer_client->dwFlags&C_VIRTUAL_VOL_MASK)>>C_VIRTUAL_VOL_SHIFT)
,buffer_client->tdstPseudoRes.uRes.stSample.uwNbChannels
,TRUE);
IDirectSoundBuffer_SetVolume(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,vol_2_hth_dB[ucDSvolume]);
}
} //FLAG_SETVIRTVOL
if (buffer_client->dwFlags&FLAG_SETVIRTFREQ) /* restore frequency */
{
buffer_client->dwFlags&=~FLAG_SETVIRTFREQ;
if (buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop)
IDirectSoundBuffer_SetFrequency(buffer_client->tdstPseudoRes.uRes.stSample.uData.stMem.lpBufferLoop,
buffer_client->ulFreq);
} //FLAG_SETVIRTFREQ
} //else jvdbg("Pb reactivate buffer client!!!!");
}
}

View File

@@ -0,0 +1,227 @@
/*---------------------------------------------------------------
FILE: micro3d.c
ROLE: management of Microphone+Doppler effect for DSound3d
MODIFICATIONS: - J.Vibert - 01/12/98 - extracted from sndxdwav.c
----------------------------------------------------------------*/
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include "SNDinc.h"
#if defined(_DLL_COMPILATION_MODE) && defined(_DLL_MODULE)
#include "snddll.h"
#endif
#include "priv3dFl.h"
extern SndBool stereo_reverse;
extern SndBool driver_SND_OK;
extern LPDIRECTSOUND3DLISTENER lpListener3D;
long idMainMicro=C_CREATEMICRO_FAILED;
void SND_fn_vCreateMicroSxdWave(MicroParam* par,long idMicro)
{
#ifndef DISABLE_WAVE
DS3DLISTENER parameters;
SndVector dir_pv;
if (driver_SND_OK == FALSE) {
return ;
}
if (lpListener3D == NULL) return;
//only 1 micro supported
if (idMainMicro != C_CREATEMICRO_FAILED) return;
// VERSION computation of MICRO
parameters.dwSize = sizeof(DS3DLISTENER);
if (par!=NULL)
{
dir_pv.x = SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.z);
dir_pv.x -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.y);
dir_pv.y = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.z);
dir_pv.y -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.x);
dir_pv.z = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.y);
dir_pv.z -= SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.x);
if (!stereo_reverse) {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
} else {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
}
}
else
{
memset(&parameters.vPosition,0,sizeof(parameters.vPosition));
memset(&parameters.vVelocity,0,sizeof(parameters.vVelocity));
memset(&parameters.vOrientFront,0,sizeof(parameters.vOrientFront));
memset(&parameters.vOrientTop,0,sizeof(parameters.vOrientTop));
//05/11/98
parameters.vOrientFront.x=1.0f;
parameters.vOrientTop.z=1.0f;
}
parameters.flDistanceFactor = DISTANCE_FACTOR;
parameters.flRolloffFactor = ROLLOFF_FACTOR;
parameters.flDopplerFactor = DOPPLER_FACTOR;
IDirectSound3DListener_SetAllParameters(lpListener3D,&parameters,DS3D_DEFERRED);
idMainMicro =idMicro;
#endif
}
void SND_fn_vSetMicroParamSxdWave(long idMicro,MicroParam* par)
{
#ifndef DISABLE_WAVE
DS3DLISTENER parameters;
SndVector dir_pv;
// compute normal vector for this micro
if (driver_SND_OK == FALSE) {
return ;
}
if (lpListener3D == NULL) return;
if (idMicro != idMainMicro) return;
//jvdbg("SetMicroParamSxdWav");
dir_pv.x = SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.z);
dir_pv.x -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.y);
dir_pv.y = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.z);
dir_pv.y -= SND_fn_rMulRealRealSnd(par->dirtan.z,par->dirnor.x);
dir_pv.z = SND_fn_rMulRealRealSnd(par->dirtan.x,par->dirnor.y);
dir_pv.z -= SND_fn_rMulRealRealSnd(par->dirtan.y,par->dirnor.x);
parameters.dwSize = sizeof(DS3DLISTENER);
if (!stereo_reverse) {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
} else {
parameters.vPosition.x = (float)M_RealToDoubleSnd(par->pos.y);
parameters.vPosition.y = (float)M_RealToDoubleSnd(par->pos.x);
parameters.vPosition.z = (float)M_RealToDoubleSnd(par->pos.z);
parameters.vVelocity.dvX = (float)M_RealToDoubleSnd(par->vit.y);
parameters.vVelocity.dvY = (float)M_RealToDoubleSnd(par->vit.x);
parameters.vVelocity.dvZ = (float)M_RealToDoubleSnd(par->vit.z);
parameters.vOrientFront.x = (float)M_RealToDoubleSnd(par->dirnor.y);
parameters.vOrientFront.y = (float)M_RealToDoubleSnd(par->dirnor.x);
parameters.vOrientFront.z = (float)M_RealToDoubleSnd(par->dirnor.z);
parameters.vOrientTop.x = (float)M_RealToDoubleSnd(dir_pv.y);
parameters.vOrientTop.y = (float)M_RealToDoubleSnd(dir_pv.x);
parameters.vOrientTop.z = (float)M_RealToDoubleSnd(dir_pv.z);
}
/*
_RPT3(_CRT_WARN,"MIC POS %f %f %f\n",
parameters.vPosition.x,
parameters.vPosition.y,
parameters.vPosition.z);
_RPT3(_CRT_WARN,"FRT POS %f %f %f\n",
parameters.vOrientFront.x,
parameters.vOrientFront.y,
parameters.vOrientFront.z);
_RPT3(_CRT_WARN,"TOP POS %f %f %f\n",
parameters.vOrientTop.x,
parameters.vOrientTop.y,
parameters.vOrientTop.z);
_RPT3(_CRT_WARN,"TOP TAN %f %f %f\n",
(float)M_RealToDoubleSnd(par->dirtan.x),
(float)M_RealToDoubleSnd(par->dirtan.y),
(float)M_RealToDoubleSnd(par->dirtan.z));
*/
parameters.flDistanceFactor = DISTANCE_FACTOR;
parameters.flRolloffFactor = ROLLOFF_FACTOR;
parameters.flDopplerFactor = DOPPLER_FACTOR;
IDirectSound3DListener_SetAllParameters(lpListener3D,&parameters,DS3D_DEFERRED);
//jvdbg("after setAllParam");
#endif
}
void SND_fn_vDestroyMicroSxdWave(long sxdId)
{
#ifndef DISABLE_WAVE
if (driver_SND_OK == FALSE) {
return ;
}
jvdbg("DestroyMicroSxdWave");
idMainMicro = C_CREATEMICRO_FAILED;
#endif
}
//------------------------------------------------------------
// SetDopplerFactorSxdWave:change Doppler effect range
// input:new factor for Doppler effect
// 1.0=normal effect=physically realistic
// 0.0=no doppler effect
// output: none
//------------------------------------------------------------
void SND_fn_vSetDopplerFactorSxdWave(SndReal factor)
{
D3DVALUE flDopplerFactor;
if (driver_SND_OK == FALSE) {
return ;
}
if (lpListener3D == NULL) return;
/*
DS3D_MINDOPPLERFACTOR=0.0 to DS3D_MAXDOPPLERFACTOR=10.0
realistic=DS3D_DEFAULTDOPPLERFACTOR=1.0
*/
flDopplerFactor=(float)M_RealToDoubleSnd(factor);
if (flDopplerFactor<DS3D_MINDOPPLERFACTOR)
flDopplerFactor=DS3D_MINDOPPLERFACTOR;
else if (flDopplerFactor>DS3D_MAXDOPPLERFACTOR)
flDopplerFactor=DS3D_MAXDOPPLERFACTOR;
IDirectSound3DListener_SetDopplerFactor(lpListener3D,flDopplerFactor,DS3D_DEFERRED);
}

View File

@@ -0,0 +1,117 @@
/*---------------------------------------------------------------
FILE: priv3dFl.h
ROLE: private flags for DSound3d
MODIFICATIONS: - J.Vibert - 01/12/98 - extracted from sndxdwav.c
----------------------------------------------------------------*/
// suppress DEFINES (precaution to avoid random bug from visual)
#ifdef USE_DEBUGFILE
#undef USE_DEBUGFILE
#endif
#ifdef DBG_NB_BUF
#undef DBG_NB_BUF
#endif
#ifdef USE_TEST_CODE
#undef USE_TEST_CODE
#endif
#ifdef CREATE_ONLY
#undef CREATE_ONLY
#endif
#ifdef SIMU_CRITICAL_BUFF_NB
#undef SIMU_CRITICAL_BUFF_NB
#endif
#ifdef AVOID_FOCUS_PB
#undef AVOID_FOCUS_PB
#endif
//--------------------------------------------------------------------------
// DEFINES: comment or uncomment according to your needs
//--------------------------------------------------------------------------
//AVOID_FOCUS_PB=>if a bad window handle is used, allows to (still) hear sounds
//#define AVOID_FOCUS_PB
//USE_DEBUGFILE=>a call to jvdbg(char *) causes the string to be dumped into a file
//#define USE_DEBUGFILE
//DBG_NB_BUF=>include numbers of buffers in debugging file (if debugging file is activated)
#define DBG_NB_BUF
//CREATE_ONLY=>buffers are always created during the play function or simply assigned
//otherwise, the first one is created "normally" during the play, and the next ones are
// duplicated or assigned(or created if the first one was destroyed or if an error occurred)
//[should be tested again]
//#define CREATE_ONLY
//DANGER_BUFF_NB: number of buffers left below which we must be very careful with buffer allocation
#define DANGER_BUFF_NB 8
//SIMU_CRITICAL_BUFF_NB: simulate allocated buffers
//(convenient to test DANGER_BUFF_NB on cards with many buffers)
//#define SIMU_CRITICAL_BUFF_NB
#define SIMU_BUFF_NB 235 //number of simulated allocated buffers (if SIMU_CRITICAL_BUFF_NB)
//very careful after SIMU_BUFF_NB+DANGER_BUFF_NB buffers
#define CRITICAL_BUFF_NB DANGER_BUFF_NB
//to activate temporary test code
//#define USE_TEST_CODE
#define DISTANCE_FACTOR 1.f
#define ROLLOFF_FACTOR 1.0f
#define DOPPLER_FACTOR 1.1f
#define FLAG_PLAYING 1
#define FLAG_LOOPING 2
#define FLAG_PAUSED 4
#define FLAG_3D 8
#define FLAG_WAITINGCALLBACK 16
#define FLAG_WAITINGLOOP 32
#define FLAG_VIRTUAL 256 // virtual management of sounds between ForceReleaseBuffer and ForceRestoreBuffer
#define FLAG_SETVIRTVOL 512 // modification of volume while Buffer released=>must be updated later
#define FLAG_SETVIRTFREQ 1024// modification of frequency while Buffer released=>must be updated later
#define C_VIRTUAL_VOL_MASK 0xFF0000 //the volume index is coded with the flags
#define C_VIRTUAL_VOL_SHIFT 0x10
//indicate if the directsound buffers have been created
#define FLAG_BUFFATT 64
#define FLAG_BUFFLOOP 128
#define FLAG_BUFFS (FLAG_BUFFATT|FLAG_BUFFLOOP)
//indicate if the data have been loaded (the same as the preceding flags now, but used to be !=)
//must be below 256 in current version (byte => mem)
#define FLAG_ALLOCATED 32
#define FLAG_LOADEDATT 64
#define FLAG_LOADEDLOOP 128
#define FLAG_LOADEDBUFFS (FLAG_LOADEDATT|FLAG_LOADEDLOOP)
/* global flags to indicate some actions to perform on the next ForceRestore */
#define SND_FLAG_FORCEVOL 1
/*
NB_VOICES maximum number of 3D voices description (1 or 2 buffers per voice)
>Number of virtual voices, to allow more allocations of buffers
Maximum number of virtual voices chosen by the dll: 31
F1: about 65 samples
31 voices can be played on MaxiSound (but 248 buffers can be created)
=>with 96 voices we should be able to avoid dynamic buffer creation
with F1 on cards with sufficient amount of buffers (MaxiSound...)
#define NB_VOICES 100
*/
#define NB_VOICES 64
#ifdef USE_DEBUGFILE
void jvdbg(char *s);
#else
#define jvdbg(a)
#endif

View File

@@ -0,0 +1,542 @@
/*-----------------------------------------------------
FILE: Sndeax.c
AUTHOR: Dominique Dumont
DATE: November 16th 1998
ROLE: Management of EAX effects WITH DirectSound3D
-----------------------------------------------------*/
#include <windows.h>
#include <dsound.h>
#include "SNDinc.h" //for USE_EAX
#include "eax.h"
#include "sndeax.h"
//
#if defined(_DLL_COMPILATION_MODE) && defined(_DLL_MODULE)
#include "snddll.h"
#endif
//
#ifdef USE_EAX
/*-----------------------------------------------------------
TYPEDEFS
-----------------------------------------------------------*/
typedef struct
{
EAX_REVERBPROPERTIES props;
int iProgNumber;
} tdstPreset;
/*-----------------------------------------------------------
VARIABLES
-----------------------------------------------------------*/
LPDIRECTSOUNDBUFFER lpPermanent2ndBufferToAttackEax = NULL;
LPKSPROPERTYSET lpPropertySet = NULL;
float fReverbMix = EAX_REVERBMIX_USEDISTANCE;
BOOL bIsEaxOk = FALSE;
EAX_REVERBPROPERTIES myPresets[30] = {
EAX_PRESET_GENERIC, //0
EAX_PRESET_PADDEDCELL, //1
EAX_PRESET_ROOM,//2
EAX_PRESET_BATHROOM,//3
EAX_PRESET_LIVINGROOM,//4
EAX_PRESET_STONEROOM,//5
EAX_PRESET_AUDITORIUM,//6
EAX_PRESET_CONCERTHALL,//7
EAX_PRESET_CAVE,//8
EAX_PRESET_ARENA,//9
EAX_PRESET_HANGAR,//10
EAX_PRESET_CARPETEDHALLWAY, //1
EAX_PRESET_HALLWAY,//12
EAX_PRESET_STONECORRIDOR, //13
EAX_PRESET_ALLEY,//14
EAX_PRESET_FOREST,//15
EAX_PRESET_CITY,//16
EAX_PRESET_MOUNTAINS,//17
EAX_PRESET_QUARRY,//18
EAX_PRESET_PLAIN,//19
EAX_PRESET_PARKINGLOT,//20
EAX_PRESET_SEWERPIPE,//21
EAX_PRESET_UNDERWATER,//22
EAX_PRESET_DRUGGED,//23
EAX_PRESET_DIZZY,//24
EAX_PRESET_PSYCHOTIC};//25
tdstPreset *pUserPresets = NULL;
int iNbUserPresets;
BOOL bUserPresetsAreGood = FALSE;
#endif
//---------------------------------------------------------
// int fniReadEaxPrograms()
//---------------------------------------------------------
//
//
//---------------------------------------------------------
int fniReadEaxPrograms()
{
#ifdef USE_EAX
FILE * fEAX;
char line[300];
char fileLocation[310];
int iRet;
float myFloat;
char commande[100];
BOOL bOk;
int iPhase;
// mini init
if (pUserPresets != NULL)
{
SND_fn_vFreeSnd(pUserPresets);
}
iNbUserPresets = 0;
bUserPresetsAreGood = FALSE;
/////////////////////////////////////////////////////
// Computes the name of the program file and opens it
strncpy(fileLocation,SND_fn_szGetSoftDirectory(),300);
strcat(fileLocation,"\\eax.prg");
fEAX = fopen(fileLocation,"rt");
if (fEAX== NULL)
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"EAX PROGRAM FILE NOT PRESENT");
return 1;
}
bOk = TRUE;
iPhase = 4;
do
{
if(fgets(line,300,fEAX) != NULL)
{
if ((line[0] == ' ')||(line[0] == ';')||(line[0] == 10)||(line[0] == 13)||(line[0] == '\0'))
{
// Commentaire
}
else
{
// no comment :-)
iRet = sscanf(line,"%s : %f",commande,&myFloat);
if (strcmp(commande,"PRG")==0)
{
if (iPhase == 4)
{
// We must create a new program entry
if (iNbUserPresets)
{
pUserPresets=SND_fn_pvReAllocSnd(pUserPresets,sizeof(tdstPreset)*(iNbUserPresets+1));
}
else
{
pUserPresets=SND_fn_pvMallocSnd(sizeof(tdstPreset));
}
pUserPresets[iNbUserPresets].iProgNumber = (long)myFloat;
iPhase = 0;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 2;
}
}
else
if (strcmp(commande,"ENV")==0)
{
if (iPhase == 0)
{
pUserPresets[iNbUserPresets].props.environment = (long)myFloat;
iPhase = 1;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 3;
}
}
else
if (strcmp(commande,"VOL")==0)
{
if (iPhase == 1)
{
pUserPresets[iNbUserPresets].props.fVolume = myFloat;
iPhase = 2;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 4;
}
}
else
if (strcmp(commande,"DEC")==0)
{
if (iPhase == 2)
{
pUserPresets[iNbUserPresets].props.fDecayTime_sec = myFloat;
iPhase = 3;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 5;
}
}
else
if (strcmp(commande,"DAM")==0)
{
if (iPhase == 3)
{
pUserPresets[iNbUserPresets].props.fDamping = myFloat;
iNbUserPresets++;
iPhase = 4;
}
else
{
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
return 6;
}
}
}
}
else
{
bOk = FALSE;
}
}
while (bOk);
if (iPhase != 4)
{
bUserPresetsAreGood = FALSE;
SND_fn_vDisplayError(E_uwSndErrorReadingFile,"BAD EAX PROGRAM FILE");
}
else
{
bUserPresetsAreGood = TRUE;
}
fclose(fEAX);
#endif
return 0;
}
//---------------------------------------------------------
// BOOL fn_bIsEaxAvailable()
//---------------------------------------------------------
//
//
//---------------------------------------------------------
BOOL fn_bIsEaxAvailable()
{
#ifdef USE_EAX
return bIsEaxOk;
#else
return FALSE;
#endif
}
//---------------------------------------------------------
// void SND_fn_vInitEaxModule(LPDIRECTSOUND lpDSO)
//---------------------------------------------------------
// Initialize the eax module
// set the bIsEaxOk flag
//---------------------------------------------------------
void SND_fn_vInitEaxModule(LPDIRECTSOUND lpDSO)
{
#ifdef USE_EAX
WAVEFORMATEX pcmOut; // Format of the wave for secondary buffer if we need to make one.
DSBUFFERDESC dsbdSecondary; // description for creating secondary buffer if we need to make one.
HRESULT hr;
ULONG ulSupport = 0;
bIsEaxOk = FALSE;
if(lpPermanent2ndBufferToAttackEax == NULL)
{
// we don't have a secondary to work with so we will create one.
ZeroMemory( &dsbdSecondary, sizeof(DSBUFFERDESC));
ZeroMemory( &pcmOut, sizeof(WAVEFORMATEX));
// any format should do I just say 11kHz 16 bit mono
pcmOut.wFormatTag = WAVE_FORMAT_PCM;
pcmOut.nChannels = 1;
pcmOut.nSamplesPerSec = 11025;
pcmOut.nAvgBytesPerSec = 22050;
pcmOut.nBlockAlign = 2;
pcmOut.wBitsPerSample = 16;
pcmOut.cbSize = 0;
// size is just arbitary but not too small as I have seen problems with single sample buffers...
dsbdSecondary.dwSize = sizeof(DSBUFFERDESC);
dsbdSecondary.dwBufferBytes = 1024;
dsbdSecondary.dwFlags = DSBCAPS_CTRL3D | DSBCAPS_STATIC ;
dsbdSecondary.lpwfxFormat = &pcmOut;
if( FAILED(hr=IDirectSound_CreateSoundBuffer(lpDSO,&dsbdSecondary,&lpPermanent2ndBufferToAttackEax,NULL)))
{
// MessageBox( hWndDemo, "Create secondary for getting property set extention failed",
// "Create secondary failed", MB_OK | MB_ICONSTOP );
// if we can't make a secondary we can't do anything else so just exit out.
bIsEaxOk = FALSE;
return;
}
fReverbMix = EAX_REVERBMIX_USEDISTANCE;
}
// if there is already a property set interface free it up before making a new one for the curent buffer
if(lpPropertySet != NULL)
{
IKsPropertySet_Release(lpPropertySet);
lpPropertySet = NULL;
}
// QI for the property set interface
if( FAILED( hr = IDirectSoundBuffer_QueryInterface(lpPermanent2ndBufferToAttackEax,&IID_IKsPropertySet,(void**)&lpPropertySet)))
{
//MessageBox( hWndDemo, "Couldn't QI for Property set interface",
// "QI PropertySet failed", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if our listener related property set is avalible and supports everything.
if( FAILED( hr = IKsPropertySet_QuerySupport(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties,
DSPROPERTY_EAX_ALL, &ulSupport)))
{
//MessageBox( hWndDemo, "Query support call failure",
// "Query support Error", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if we can get and set them.
if ((ulSupport &(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)) != (KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET))
{
//MessageBox( hWndDemo, "can't get and set all properties in Property set interface",
// "No EAX Support", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if our Buffer related property set is avalible and supports everything.
if( FAILED( hr = IKsPropertySet_QuerySupport(lpPropertySet,&DSPROPSETID_EAXBUFFER_ReverbProperties,DSPROPERTY_EAXBUFFER_ALL, &ulSupport)))
{
//MessageBox( hWndDemo, "Query support call failure",
// "Query support Error", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// check if we can get and set them.
if ((ulSupport &(KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET)) != (KSPROPERTY_SUPPORT_GET|KSPROPERTY_SUPPORT_SET))
{
//MessageBox( hWndDemo, "can't get and set all properties in Property set interface",
// "No EAX Support", MB_OK | MB_ICONSTOP );
bIsEaxOk = FALSE;
return;
}
else
{
// everything is avalible.
bIsEaxOk = TRUE;
fniReadEaxPrograms();
}
}
}
}
} //Queryinterface OK
#endif
}
//---------------------------------------------------------
// EAX_REVERBPROPERTIES *fnpGetUserProgram(WORD w)
//---------------------------------------------------------
// Search for the good preset and return his address
//
//---------------------------------------------------------
EAX_REVERBPROPERTIES *fnpGetUserProgram(WORD w)
{
#ifdef USE_EAX
int i;
if (bUserPresetsAreGood == TRUE)
{
for(i=0;i<iNbUserPresets;i++)
{
if (pUserPresets[i].iProgNumber == w)
{
return &(pUserPresets[i].props);
}
}
}
#endif
return NULL;
}
//---------------------------------------------------------
// void SND_fn_vSetPreset(unsigned long ulNewPreset)
//---------------------------------------------------------
// Set a new preset for the primary buffer
//
//---------------------------------------------------------
void SND_fn_vSetPreset(unsigned long ulNewPreset)
{
#ifdef USE_EAX
HRESULT hr;
if (bIsEaxOk == FALSE) return;
if(lpPropertySet != NULL)
{
if ((ulNewPreset & 0xFFFF) == 0)
{
if (FAILED(hr = IKsPropertySet_Set(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties, DSPROPERTY_EAX_ALL,
NULL,0,&myPresets[(ulNewPreset>>16)],sizeof(EAX_REVERBPROPERTIES))))
{
//ERROR "Could not Set Environment",
return;
}
}
else
{
EAX_REVERBPROPERTIES *pTemp;
pTemp = fnpGetUserProgram((unsigned short)(ulNewPreset & 0xFFFF));
if (pTemp != NULL)
{
if (FAILED(hr = IKsPropertySet_Set(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties, DSPROPERTY_EAX_ALL,
NULL,0,pTemp,sizeof(EAX_REVERBPROPERTIES))))
{
//ERROR "Could not Set Environment",
return;
}
}
else
{
//ERROR "Preset doesn't exist",
// but we apply the factory preset
if (FAILED(hr = IKsPropertySet_Set(lpPropertySet,&DSPROPSETID_EAX_ReverbProperties, DSPROPERTY_EAX_ALL,
NULL,0,&myPresets[(ulNewPreset>>16)],sizeof(EAX_REVERBPROPERTIES))))
{
//ERROR "Could not Set Environment",
return;
}
}
}
}
#endif
}
//---------------------------------------------------------
// void SND_fn_vDesInitEaxModule()
//---------------------------------------------------------
// Close the eax module
//
//---------------------------------------------------------
void SND_fn_vDesInitEaxModule()
{
#ifdef USE_EAX
if(lpPropertySet != NULL)
{
IKsPropertySet_Release(lpPropertySet);
lpPropertySet = NULL;
}
if ( NULL != lpPermanent2ndBufferToAttackEax)
{
IDirectSoundBuffer_Release(lpPermanent2ndBufferToAttackEax);
lpPermanent2ndBufferToAttackEax = NULL;
}
if (pUserPresets != NULL)
{
SND_fn_vFreeSnd(pUserPresets);
}
iNbUserPresets = 0;
#endif
}
/*-------------------------------------------------
fn_bGetInterfEAX
ROLE: Gets the EAX interface
last modification: 24/03/98
by: Dom Dum
---------------------------------------------------*/
BOOL fn_bGetInterfEAX(LPDIRECTSOUNDBUFFER Buffer2D,LPKSPROPERTYSET *pBufferEAX)
{
#ifdef USE_EAX
if (fn_bIsEaxAvailable())
{
if( FAILED(IDirectSoundBuffer_QueryInterface(Buffer2D,&IID_IKsPropertySet,(void**)pBufferEAX)))
{
return FALSE;
}
else
{
return TRUE;
}
}
else
#endif
return TRUE;
}
/*-------------------------------------------------
BOOL set_param_eax(LPKSPROPERTYSET *pBufferEAX,unsigned char ucReverb,BOOL bReverbable)
---------------------------------------------------*/
BOOL set_param_eax(LPKSPROPERTYSET pBufferEAX,unsigned char ucReverb,BOOL bReverbable)
{
#ifdef USE_EAX
float tempReverb;
if (bIsEaxOk == FALSE) return TRUE;
if(pBufferEAX != NULL)
{
if (bReverbable== FALSE)
{
tempReverb = 0; // no reverb 1.0 = FULL REVERB
}
else
{
tempReverb = ((float)ucReverb/127.0f);
}
if (FAILED(IKsPropertySet_Set(pBufferEAX,&DSPROPSETID_EAXBUFFER_ReverbProperties, DSPROPERTY_EAXBUFFER_REVERBMIX,
NULL,0,&tempReverb,sizeof(float))))
{
//ERROR "Could not Set Environment",
return FALSE;
}
}
#endif
return TRUE;
}

View File

@@ -0,0 +1,125 @@
#ifdef M_SET_ALIGNMENT
#pragma pack(push)
#pragma pack(M_SET_ALIGNMENT)
#endif
#undef DLL_IMPEXP
#define DLL_IMPEXP __declspec(dllexport)
//sections et options du SND_CPA.INI
#define DX3D_SECTION "Directx3D Options"
#define DX3D_NBVOICES_KEY "Nb Voices"
#define DX3D_GUID_KEY "GUID for "
#define DX3D_SPEAKERS_KEY "Speakers Configuration"
//typedef publiques
typedef struct {
SndBool bGuidNULL;
GUID Guid;
char description[128];
char module[128];
DSCAPS caps;
} stGUIDAvailable;
typedef stGUIDAvailable* pstGUIDAvailable;
//--------------------------------------------------- SAMPLE DX3D
typedef struct _tdstSampleMemoryDX3D tdstSampleMemoryDX3D;
typedef union _tduDataSampleDX3D tduDataSampleDX3D;
typedef struct _tdstTypeSampleMemDX3D tdstTypeSampleMemDX3D;
typedef union _tduRefResDX3D tduRefResDX3D;
typedef struct _tdstBlockResourceMemDX3D tdstBlockResourceMemDX3D;
typedef union _tduResMemDX3D tduResMemDX3D;
union _tduRefResDX3D {
tdxId Id;
tdstBlockResourceMemDX3D *pstPtr;
} ;
//DANGER:
//we must have sizeof(tdstBlockResourceMem)<sizeof(tdstBlockResourceMemDX3D)
//to avoid memory overflow after use of cast from tdstSampleMemory* to tdstSampleMemoryDX3D*
//parameters of a resource(sample) in memory
struct _tdstSampleMemoryDX3D {
LPDIRECTSOUNDBUFFER lpBufferLoop;
char *pcDataAttack;
char *pcDataLoop;
long lSizeAttackBuff;
long lSizeLoopBuff;
unsigned char ucLoadedFlags;
/*
//LPDIRECTSOUNDBUFFER lpBufferAttack;
//LPDIRECTSOUND3DBUFFER lpBufferAttack3D;
//LPDIRECTSOUND3DBUFFER lpBufferLoop3D;
//extra data to avoid averflow
//when tdstSampleMemory* is cast into tdstSampleMemoryDX3D*
tduSampleMemBuff *data;
*/
} ;
//union de la description du sample
union _tduDataSampleDX3D{
tdstSampleMemoryDX3D stMem ;
tdstSampleStreaming stStream ;
} ;
//param<61>tres d'une ressource sample (donn<6E>es en mem)
struct _tdstTypeSampleMemDX3D {
SndBool bPitchable; //peut-on changer le pitch du sample
SndBool bVolable; //peut-on changer son volume
SndBool bPanable; //peut le paner
SndBool bSpacable; //peut-on lui appliquer un effet space
SndBool bReverbable; //peut-on (ou doit-on) le reverber
SndBool bStream; //streming ou en m<>moire
SndBool bLoop; //loope-t-il
tduDataSampleDX3D uData; //description du sample
unsigned long ulInc0 ; //p<>riode en echantillons
unsigned long ulFreq; //p<>riode en echantillons
unsigned short uwResolution; //nb de bits (8 ou 16)
unsigned short uwNbChannels; //nb de canaux(mono, st<73>reo ...)
tdeTypeZip eZip;
} ;
union _tduResMemDX3D {
tdstTypeSampleMemDX3D stSample ;
tdstTypeMidiMem stMidi ;
tdstTypeCD stCD;
tdstTypeSequenceMem stSequence ;
tdstTypeSwitchMem stSwitch ;
tdstTypeSplitMem stSplit;
tdstTypeThemeMem stTheme;
} ;
//description d'une ressource (donn<6E>es en m<>moire)
struct _tdstBlockResourceMemDX3D {
tdxId Id; //id de la ressource
tdeTypeResource eType; //type
tdeTypeStorage eStorage; //storage ???
unsigned char ucVolume; //volume par dfaut
SndBool bIsLoaded ; //TRUE si en m<>oire
tduResMemDX3D uRes ; //description propre <20> la ressource
// M_LstChildDeclaration(tdstBlockResourceMem,tdstSndPolyResource); //insertion dans la liste ACP
SNDLST2_M_StaticChildDeclaration(tdstBlockResourceMemDX3D*,tdstSndPolyResource*) //insertion dans la liste ACP
};
#ifdef M_SET_ALIGNMENT
#pragma pack(pop)
#endif
DLL_IMPEXP int SND_CALL SND_fn_iGetGUIDList(pstGUIDAvailable lpGuidDescrption,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetWantedGUID(char* GUID_wanted,int size);
DLL_IMPEXP void SND_CALL SND_fn_vGetCurrentGUID(char* description,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedGUID(char* wanted,char* selected,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentGUID(char* wanted,char* selected,int size);
DLL_IMPEXP void SND_CALL SND_fn_vChangeWantedSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bChangeCurrentSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bGetWantedSpeakerConfigurationSxdWave(DWORD *config,DWORD *geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bGetCurrentSpeakerConfigurationSxdWave(DWORD *config,DWORD *geometry);
DLL_IMPEXP SndBool SND_CALL SND_fn_bIsDirect3DOptimum();
//concerver pour compatibilit<69>
DLL_IMPEXP void SND_CALL SND_fn_vChangeCurrentSpeakerConfigurationSxdWave(DWORD config,DWORD geometry);

View File

@@ -0,0 +1,42 @@
#include <windows.h>
#include <mmsystem.h>
#include "SNDinc.H"
#if defined(_DLL_COMPILATION_MODE)
#include "snddll.h"
#else
#endif
int SND_fn_iMixerInitSample(HWAVEOUT hWave)
{
return 0;
}
//==================================
// Get sample value
//==================================
// retourne la valeur du mixer
// sample en %
//
//==================================
DWORD SND_fn_dwGetSampleValue(void)
{
return 0;
}
//==================================
// Set sample value
// en %
//
//==================================
void SND_fn_vSetSampleValue(DWORD val)
{
}
int SND_fn_iMixerDesInitSample(void)
{
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by LabelDLL.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,690 @@
#include "SNDinc.H"
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include "sndres.h"
#if !defined(SNDDLL_MODULE) && defined(_DLL_COMPILATION_MODE)
//variable habituellement d<>finie par SNDPLAY
tduRefRes SND_RES_FANTOME={(unsigned long)SND_C_RES_FANTOME_PTR};
#endif
#define INCLUDE_FROM_SNDDLL_C
#include "SNDDLL.h"
HMODULE SND_hWavModule=NULL;
HMODULE SND_hCdModule=NULL;
HMODULE SND_hMpegModule=NULL;
HMODULE SND_hDbgModule=NULL;
HMODULE SND_hAdpcmModule=NULL;
HMODULE SND_hRecordModule=NULL;
char SNDDLL_g_DateVersion[]=__DATE__"-"__TIME__;
char SNDDLL_g_LabelVersion[]=
#include "SND/version.txt"
;
// Surclasser le lecteur de CD ---> _SUBCLASSCDPLAYER
// Cette methode utilise la DLL PMRstSub.Dll, d'ou l'include de librairie associe
//
// #define _SUBCLASSCDPLAYER
/*
#ifdef _SUBCLASSCDPLAYER
#include "c:\AdvWin32\DLLCDPLAYER\AdvWin32.H"
#pragma warning(disable: 4001)
#define DLLCLIENT
#include "c:\AdvWin32\DLLCDPLAYER\PMRstSub.H"
#define LIBNAME "c:\\AdvWin32\\DLLCDPLAYER\\PMRstSub\\Debug\\PMRstSub"
#pragma comment(lib, LIBNAME)
HINSTANCE SND_g_hinstDll;
#endif
*/
FARPROC _GetProcAddress(HMODULE module,char* name)
{
FARPROC tmp;
char texte[256],texte2[256];
DWORD ret;
if (!(tmp=GetProcAddress(module,name)))
{
ret=GetModuleFileName(module,texte,sizeof(texte));
sprintf(texte2,"Function cannot be loaded dynamically:\n%.20s\nfrom module %.80s",name,texte);
SND_fn_vDisplayError(E_uwSndSystemError,texte2);
//DebugBreak(); DebugBreak will produce an unhandled execption if Debug mode is used
}
return tmp;
}
BOOL bStaticFunctions_Loaded = FALSE;
BOOL bMpegFunctions_Loaded = FALSE;
BOOL bWavFunctions_Loaded = FALSE;
BOOL bCdFunctions_Loaded = FALSE;
BOOL bDbgFunctions_Loaded = FALSE;
BOOL bAdpcmFunctions_Loaded = FALSE;
BOOL bRecordFunctions_Loaded = FALSE;
#ifdef USE_STATIC_MODULE
//-----------------------------------------------------------
// SND_DllEntryPoints_StaticFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_StaticFunctions(HMODULE hDLLModule)
{
if (bStaticFunctions_Loaded)
return;
//Module SndERR.H
SND_DLL_GetProcAddress(SND_fn_vDisplayError,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDisplayErrorEx,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iErreurInit,hDLLModule);
SND_DLL_GetProcAddress(_snd_assert,hDLLModule);
SND_DLL_GetProcAddress(snd_erreur_init,hDLLModule);
//HMODULEs
SND_DLL_GetProcAddress(SND_fn_vGetHModuleMpeg,hDLLModule);
SND_hMpegModule=SND_fn_vGetHModuleMpeg();
SND_DLL_GetProcAddress(SND_fn_vGetHModuleWav,hDLLModule);
SND_hWavModule=SND_fn_vGetHModuleWav();
SND_DLL_GetProcAddress(SND_fn_vGetHModuleCd,hDLLModule);
SND_hCdModule=SND_fn_vGetHModuleCd();
SND_DLL_GetProcAddress(SND_fn_vGetHModuleAdpcm,hDLLModule);
SND_hAdpcmModule=SND_fn_vGetHModuleAdpcm();
SND_DLL_GetProcAddress(SND_fn_vGetHModuleRecord,hDLLModule);
SND_hRecordModule=SND_fn_vGetHModuleRecord();
#ifdef DBGDLL_MODULE
//Fonctions de d<>bogage
SND_DLL_GetProcAddress(dbgSND_fn_bGetAskedTheme,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_bGetThemePosition,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vGetInfoForObjectSound,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_lGetSizeOfSoundParam,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetResNameCallback,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_czGetResNameFromEdId,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_bSetResourceStaticVolume,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_rGetDopplerFactor,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSendRequestSound,hDLLModule);
#endif
// Module Sndmem.h
SND_DLL_GetProcAddress(SND_fn_vInitMallocSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitMallocSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pvMallocSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pvReAllocSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vFreeSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pvMallocSndEx,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pvReAllocSndEx,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vFreeSndEx,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResizeMemoryBlockSnd,hDLLModule);
// Module Sndfile.h
SND_DLL_GetProcAddress(SND_fn_bLoadDataInMem,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadDataInMemAndSwap,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetCurrentDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_dwFileSndLength,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_dwWriteFileSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vAddDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRemoveDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPurgeDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bGetOneDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iGetNumberOfDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iGetIdDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsDataDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResolveFileName,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_dwReadFileSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_dwSeekFileSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_hOpenFileReadSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vCloseFileSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetSoftDirectory,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_szGetSoftDirectory,hDLLModule);
//sndini
SND_DLL_GetProcAddress(SND_fn_bCanSetOptions,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bGetOptions,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetOptions,hDLLModule);
//module SNDldbin
SND_DLL_GetProcAddress(SND_fn_iGetNumberOfBanks,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iGetNumberOfEventInBank,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bStartLoadBanks,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bStartLoadBanks2,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bInitBank,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bInitBank2,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bEndLoadBanks,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pGetBinEvent,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pGetBinRes,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadBinaryBank,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bUnLoadBinaryBank,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vInitBankSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitBankSnd,hDLLModule);
// Module Sndspace.h
SND_DLL_GetProcAddress(SND_fn_ucPositionToDolby,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_ucDistanceToVolume,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_ucDistanceToVolumeEx,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rDopplerPitch,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_ucPositionToPan,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOff,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vGetDefaultRollOff,hDLLModule);
// Module SndReal.h
SND_DLL_GetProcAddress(SND_fn_rMulRealRealSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rMulRealRealQuickSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rDivRealRealSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rAbsRealSnd,hDLLModule);
// Module SndVect.h
SND_DLL_GetProcAddress(SND_fn_rNormeVectorSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rPseudoNormeVectorSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rScalaireVectorSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rPseudoScalaireNormeVectorSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vProduitVectorSnd,hDLLModule);
// Module SndThrd.h
SND_DLL_GetProcAddress(SND_fn_vInitThreadSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitThreadSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vEnterCriticalSectionThreadSnd_,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vQuitCriticalSectionThreadSnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vMouchardThreadsnd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vWaitForValueThreadSnd,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vStartCallbackThreadsnd,hDLLModule)
//Module SndTest.h
#ifndef SPEEDBUSTER
SND_DLL_GetProcAddress(SND_fn_bTestSnd_Pentium,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestSnd_MMX,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestSnd_WinMM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestSnd_WinNT,hDLLModule);
#endif
//appeler apr<70>s GetProcAddress(DisplayError) car risque d'erreur
SND_DLL_GetProcAddress(SND_fn_vGetHModuleDbg,hDLLModule);
SND_hDbgModule=SND_fn_vGetHModuleDbg();
bStaticFunctions_Loaded = TRUE;
}
#endif //ifdef USE_STATIC_MODULE
#ifdef USE_MPEG_MODULE
//-----------------------------------------------------------
// SND_DllEntryPoints_MpegFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_MpegFunctions(HMODULE hDLLModule)
{
if (bMpegFunctions_Loaded)
return;
#ifndef NO_ACP_LDBIN
SND_DLL_GetProcAddress(SND_fn_bCanFreeDataMPEG,hDLLModule);
#endif
#ifndef SNDDLL_MODULE //fonctions inutiles pour la LIB statiques
//Module SndMpeg.h
SND_DLL_GetProcAddress(SND_fn_lPlayMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iInitMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestInitMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitMPEG,hDLLModule);
#ifndef SPEEDBUSTER
SND_DLL_GetProcAddress(SND_fn_tdGetResForVoiceMPEG,hDLLModule);
#endif
// SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResScriptMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryMPEG,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vLoadResFromDiskMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vUnLoadResMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsResLoadedMPEG,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vSetResUnloadedMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayTransitionMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMPEG2,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopTransitionMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseTransitionMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeTransitionMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vReleaseDriverMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRestoreDriverMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetLengthMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSynchroMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferExMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lGetPosBufferExMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPushBufferExMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOffMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceMPEG,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeMPEG,hDLLModule);
#endif //SNDDLL_MODULE
bMpegFunctions_Loaded = TRUE;
}
#endif //ifdef USE_MPEG_MODULE
#ifdef USE_WAV_MODULE
//-----------------------------------------------------------
// SND_DllEntryPoints_WavFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_WavFunctions(HMODULE hDLLModule)
{
if (bWavFunctions_Loaded)
return;
//Module Sndxd.h
#ifndef SPEEDBUSTER
SND_DLL_GetProcAddress(SND_fn_lPlaySxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetSoundVolumeSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_ucGetSoundVolumeSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetStereoSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bGetStereoSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetReverseStereoSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bGetReverseStereoSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iInitSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestInitSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetDopplerFactorSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetEffectSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateMicroSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetMicroParamSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDestroyMicroSxd,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_tdGetResForVoiceSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetParamBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDeleteBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pvGetPtrBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferExSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lGetPosBufferExSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPushBufferExSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResScriptSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResBinarySxd,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vLoadResFromDiskSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vUnLoadResSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsResLoadedSxd,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vSetResUnloadedSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayTransitionExSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxd2,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopTransitionSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseTransitionSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeTransitionSxd,hDLLModule);
#ifndef NO_ACP_LDBIN
SND_DLL_GetProcAddress(SND_fn_bCanFreeDataSample,hDLLModule);
#endif
SND_DLL_GetProcAddress(SND_fn_vReleaseDriverSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRestoreDriverSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vForceReleaseDriverSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vForceRestoreDriverSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetLengthSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosBufferSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vGetTargetLabelSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetupTargetSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCanSetupTargetSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSynchroSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vParam3Dto2D,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOffSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetNbVoiceWishedSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lGetNbVoiceOptimumSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lGetNbVoiceWishedSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_eGetMainFormatSxd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeSxd,hDLLModule);
#endif
bWavFunctions_Loaded = TRUE;
}
#endif //ifdef USE_WAV_MODULE
#ifdef USE_RECORD_MODULE
//-----------------------------------------------------------
// SND_DllEntryPoints_RecFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_RecordFunctions(HMODULE hDLLModule)
{
if (bRecordFunctions_Loaded)
return;
#ifndef SPEEDBUSTER
SND_DLL_GetProcAddress(SND_fn_bTestFormatRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateBufferRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsBufferFullDuplexRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bStartRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsWorkingRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPushBufferToRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bManageMsgForRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iInitRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitRecord,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_ucGetInstantVuMeterRecord,hDLLModule);
#endif
bRecordFunctions_Loaded = TRUE;
}
#endif //ifdef USE_RECORD_MODULE
#ifdef USE_CD_MODULE
//-----------------------------------------------------------
// SND_DllEntryPoints_CdFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_CdFunctions(HMODULE hDLLModule)
{
if (bCdFunctions_Loaded)
return;
#ifndef SPEEDBUSTER
//Module Sndmidi.h
SND_DLL_GetProcAddress(SND_fn_bLoadResScriptMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsResLoadedMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestInitMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iInitMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayMidiWithFade,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vUnLoadResMidi,hDLLModule);
#ifndef NO_ACP_LDBIN
SND_DLL_GetProcAddress(SND_fn_bCanFreeDataMidi,hDLLModule);
#endif
SND_DLL_GetProcAddress(SND_fn_vReleaseDriverMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRestoreDriverMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetLengthMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSynchroMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayTransitionMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopTransitionMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeTransitionMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseTransitionMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeMidi2,hDLLModule);
//Module SndCD.h
SND_DLL_GetProcAddress(SND_fn_bLoadResScriptCd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryCd,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestInitCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iInitCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayCD,hDLLModule);
// SND_DLL_GetProcAddress(SND_fn_vConvertResDiskToMemCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vReleaseDriverCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRestoreDriverCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetLengthCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSynchroCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSynchroMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceMidi,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeCD,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeMidi,hDLLModule);
#endif
bCdFunctions_Loaded=TRUE;
}
#endif
#ifdef USE_DBG_MODULE
//-----------------------------------------------------------
// SND_DllEntryPoints_DbgFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_DbgFunctions(HMODULE hDLLModule)
{
if (bDbgFunctions_Loaded)
return;
//Module Snddbg.h
SND_DLL_GetProcAddress(SND_fn_vLaunchSupervisater,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vKillSupervisater,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetSupervisaterActive,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsSupervisaterActive,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSetProjectTitleForSuperVisater,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vAddEventToObject,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vKillEventToObject,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSetPosObject,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vAddMicro,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vKillMicro,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSetPosMicro,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vAddHistoric,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vKillVolumeLine,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vAddVolumeLine,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSetVolumeLine,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vLoadBank,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vUnLoadBank,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vAddVoiceSample,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSetParVoiceSample,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vDelVoiceSample,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vPauseVoiceSample,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vResumeVoiceSample,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vSetProcessTimeSample,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_pstGetSelectedResource,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_bDoesSupervisaterSelectResource,hDLLModule);
// SND_DLL_GetProcAddress(dbgSND_fn_vRajListesSxdVirtual,hDLLModule); obsolete
SND_DLL_GetProcAddress(dbgSND_fn_vRajListesSxdVirtual2,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vInitListesSxdVirtual,hDLLModule);
SND_DLL_GetProcAddress(dbgSND_fn_vRefreshSupervisater,hDLLModule);
bDbgFunctions_Loaded=TRUE;
}
#endif
#if defined(USE_ADPCM_MODULE) && !defined(DISABLE_ADPCM)
//-----------------------------------------------------------
// SND_DllEntryPoints_AdpcmFunctions(HMODULE hDLLModule)
//
// But : Calculer dynamiquement les adresses des fonctions fournies
// par le module EXE aux autres DLLs
// Entr<74>es : HANDLE du module dans lequel se trouve ces fonctions.
// Sorties : Neant
//------------------------------------------------------------
void SND_DllInitEntryPoints_AdpcmFunctions(HMODULE hDLLModule)
{
if (bAdpcmFunctions_Loaded)
return;
#ifndef NO_ACP_LDBIN
SND_DLL_GetProcAddress(SND_fn_bCanFreeDataADPCM,hDLLModule);
#endif
#ifndef SNDDLL_MODULE //fonctions inutiles pour la LIB statiques
//Module Sndxdapm.h
SND_DLL_GetProcAddress(SND_fn_lPlaySxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRemoveCallbackSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestIsPlayingSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vStopSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetLengthSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetSoundVolumeSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetStereoSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bGetStereoSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetReverseStereoSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bGetReverseStereoSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_iInitSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bTestInitSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDesInitSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetEffectSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vCreateMicroSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetMicroParamSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDestroyMicroSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetParamBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vDeleteBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_pvGetPtrBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_rGetPosBufferSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResScriptSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResBinarySxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResScriptAndConvertToWAVSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bLoadResBinaryAndConvertToWAVSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vUnLoadResSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsResLoadedSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPlayTransitionSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetParamTransitionSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bSetNextTransitionSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxdADPCM,hDLLModule);
#ifndef SPEEDBUSTER
SND_DLL_GetProcAddress(SND_fn_bDoTransitionWithFadeSxdADPCM2,hDLLModule);
#endif
SND_DLL_GetProcAddress(SND_fn_vStopTransitionSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vPauseTransitionSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vResumeTransitionSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vReleaseDriverSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vRestoreDriverSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vGetTargetLabelSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetupTargetSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCanSetupTargetSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSynchroSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lCreateNewBufferExSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lGetPosBufferExSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lPushBufferExSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_vSetDefaultRollOffSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bCheckVersionResourceSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsResourceLoopingSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_lGetNbVoiceWishedSxdADPCM,hDLLModule);
SND_DLL_GetProcAddress(SND_fn_bIsLibActiveSxdADPCM,hDLLModule);
#ifndef SPEEDBUSTER
SND_DLL_GetProcAddress(SND_fn_bSetResourceStaticVolumeSxdADPCM,hDLLModule);
#endif
#endif //SNDDLL_MODULE //fonctions inutiles pour la LIB statiques
bAdpcmFunctions_Loaded=TRUE;
}
#endif
#if defined(SNDDLL_MODULE)
#include "sndthrd.h"
#endif
#if defined(DLLCD_MODULE)
#endif
#if defined(DLLMPEG_MODULE)
#endif
#if defined(DLLWAV_MODULE)
#include "sndxd.h"
#endif
/*
BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason,LPVOID lpvReserved)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
// DLL is attaching to the address space
// of the current process.
#ifdef _SUBCLASSCDPLAYER
SND_g_hinstDll = hinstDll;
SubclassProgManFrame(GetCurrentThreadId());
#endif
break;
case DLL_THREAD_ATTACH:
// A new thread is being created
// in the current process.
break;
case DLL_THREAD_DETACH:
// A thread is exiting cleanly.
break;
case DLL_PROCESS_DETACH:
// The calling process is detaching the
// DLL from its address space.
break;
}
return(TRUE);
}
*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,189 @@
// DEBUGING for SOUNDxD
#include "SNDinc.h"
#include <windows.h>
#include <mmsystem.h>
#include "snddll.h"
#include "snddbg.h"
#include "sndplay.h"
#include "sndtheme.h"
#include "sndspace.h"
#include "sndld_hy.h"
HINSTANCE hSupervisaterDLL;
SND_tdstInitStruct pInitStructSaved;
//fonction export<72>e pour SNDDBG.DLL (interface DLL->LIB)
DLL_IMPEXP SndBool SND_CALL dbgSND_fn_bGetAskedTheme(tduRefRes*,SndBool*);
DLL_IMPEXP SndBool SND_CALL dbgSND_fn_bGetThemePosition(tduRefRes*,long* ,long* );
DLL_IMPEXP void SND_CALL dbgSND_fn_vGetInfoForObjectSound(long ,long ,char* ,long );
DLL_IMPEXP long SND_CALL dbgSND_fn_lGetSizeOfSoundParam(SoundParam* );
DLL_IMPEXP void SND_CALL SND_fn_vSetResNameCallback(tdpfnResNameCallback);
DLL_IMPEXP const char* SND_CALL SND_fn_czGetResNameFromEdId(unsigned long);
SndBool SND_CALL dbgSND_fn_bGetAskedTheme(tduRefRes* par1,SndBool* par2)
{
return SND_fn_bGetAskedTheme(par1,par2);
}
SndBool SND_CALL dbgSND_fn_bGetThemePosition(tduRefRes* par1,long* par2,long* par3)
{
return SND_fn_bGetThemePosition(par1,par2,par3);
}
void SND_CALL dbgSND_fn_vGetInfoForObjectSound(long par1,long par2,char* par3,long par4)
{
SND_fn_vGetInfoForObjectSound(par1,par2,par3,par4);
}
long SND_CALL dbgSND_fn_lGetSizeOfSoundParam(SoundParam* par)
{
return SND_M_lGetSizeOfSoundParam(par);
}
tdstBlockResourceMem* SND_fn_pstGetSelectedResource(void)
{
return dbgSND_fn_pstGetSelectedResource();
}
SndBool SND_fn_bDoesSupervisaterSelectResource(void)
{
return dbgSND_fn_bDoesSupervisaterSelectResource();
}
void SND_fn_vRefreshSupervisater(void)
{
dbgSND_fn_vRefreshSupervisater();
}
//**********************************************************************************
// EDITION HELPER FUNCTIONS
//**********************************************************************************
typedef const char * (*tdpfnResNameCallback)(unsigned long);
tdpfnResNameCallback gs_pfnResNameCallback=NULL;
//-----------------------------------------------------------------------------
// Name : SND_fn_vSetResNameCallback(tdpfnResNameCallback pfnResNameCallback)
//-----------------------------------------------------------------------------
// Description : Sets the callback used to return the resource's name.
//-----------------------------------------------------------------------------
// Input : tdpfnResNameCallback pfnResNameCallback;
// Output : void
//-----------------------------------------------------------------------------
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//-----------------------------------------------------------------------------
void SND_CALL SND_fn_vSetResNameCallback(tdpfnResNameCallback pfnResNameCallback)
{
gs_pfnResNameCallback=pfnResNameCallback;
}
//-----------------------------------------------------------------------------
// Name : SND_fn_czGetResNameFromEdId(unsigned long ulId)
//-----------------------------------------------------------------------------
// Description : Returns the name of a resource (as set in its editor section),
// given its editor id. Uses a callback set by the client.
// Return an empty string if the callback was not set.
//-----------------------------------------------------------------------------
// Input : unsigned long ulId
// Output : const char *
//-----------------------------------------------------------------------------
// Creation date : 04/02/98 Author : Fr<46>d<EFBFBD>ric D<>cr<63>au
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//-----------------------------------------------------------------------------
const char* SND_CALL SND_fn_czGetResNameFromEdId(unsigned long ulId)
{
if (gs_pfnResNameCallback==NULL)
return "ResName unavailable";
else return gs_pfnResNameCallback(ulId);
}
//-----------------------------------------------------------------------------
// Name : dbgSND_fn_bSetResourceStaticVolume(unsigned long EdId,unsigned char ucVolume)
//-----------------------------------------------------------------------------
// Description : Change the static volume for a specific resource,
// given its editor id.
// Return TRUE when volume has been changed.
//-----------------------------------------------------------------------------
// Input : unsigned long EdId= resource,s editor-id to change volume of
// unsigned char ucVolume= new volume for this resource
// Output : SndBool= TRUE when volume change succeded, FALSE when failed
//-----------------------------------------------------------------------------
SndBool SND_CALL dbgSND_fn_bSetResourceStaticVolume(unsigned long ulEdId,unsigned char ucVolume)
{
tdstBlockResourceMem* pstRes;
pstRes=SND_fn_pstGetResFromEdIdSnd(ulEdId);
if (pstRes!=NULL)
return SND_fn_bSetResourceStaticVolumeSnd(pstRes,ucVolume);
else
return FALSE;
}
//-----------------------------------------------------------------------------
// Name : dbgSND_fn_rGetDopplerFactor()
//-----------------------------------------------------------------------------
// Description : Gets the global doppler factor
//-----------------------------------------------------------------------------
// Input : None
// Output : the factor
//-----------------------------------------------------------------------------
// Creation date : 04/28/99 Author : Pascal Lalancette
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//-----------------------------------------------------------------------------
SndReal SND_CALL dbgSND_fn_rGetDopplerFactor(void)
{
return SND_fn_rGetDopplerFactor();
}
//-----------------------------------------------------------------------------
// Name : dbgSND_fn_vSendRequestSound()
//-----------------------------------------------------------------------------
// Description : SuperVisater ask the sound engine to play an event
//-----------------------------------------------------------------------------
// Input : None
// Output : the factor
//-----------------------------------------------------------------------------
// Creation date : 06/09/99 Author : Pascal Lalancette
//-----------------------------------------------------------------------------
// Modification date : Modification Author :
// Modifications :
//-----------------------------------------------------------------------------
void SND_CALL dbgSND_fn_vSendRequestSound(SND_tduRefEvt evt)
{
//long SND_fn_lSendRequestSound(SND_C_OBJET_SUPERVISATER, SND_C_TYPE_SUPERVISATER,evt,NULL, NULL);
SND_fn_lSendRequestSound(SND_C_OBJET_FANTOME, SND_C_TYPE_FANTOME, evt, 0, NULL);
}

View File

@@ -0,0 +1,472 @@
#include "SND\snddef.H"
#include "SNDinc.h"
#include "SND.h"
#include <io.h>
#include <fcntl.h>
#include "sndlst2.h"
typedef struct SOUNDDATA_DIRECTORY_ {
char szDirectory[256];
} SOUNDDATA_DIRECTORY;
#define NB_DIRECTORY_MAX 16
static SOUNDDATA_DIRECTORY g_SoundDataDirectoryTab[NB_DIRECTORY_MAX];
static int g_NbSoundDataDirectory=0;
static char g_SoundSoftDirectory[256]=".";
//---------------------------------------------------------------
// SetSoftDirectory:m<>morise une chaine d<>crivant le rep<65>rtoire des DLL
// Entr<74>e:czDir=chaine <20> m<>moriser
// Sortie:n<>ant
//---------------------------------------------------------------
void SND_CALL SND_fn_vSetSoftDirectory(char* czDir)
{
strcpy(g_SoundSoftDirectory,czDir);
}
//---------------------------------------------------------------
// SetDataDirectory:m<>morise une chaine d<>crivant le rep<65>rtoire des donn<6E>es sons
// Entr<74>e:czDir=chaine <20> m<>moriser
// Sortie:n<>ant
//---------------------------------------------------------------
char* SND_CALL SND_fn_szGetSoftDirectory(void)
{
return g_SoundSoftDirectory;
}
//---------------------------------------------------------------
// SetDataDirectory:m<>morise une chaine d<>crivant le rep<65>rtoire des donn<6E>es sons
// Entr<74>e:czDir=chaine <20> m<>moriser
// Sortie:n<>ant
//---------------------------------------------------------------
void SND_CALL SND_fn_vAddDataDirectory(const char* czDir)
{
#ifndef NO_ACP_SOUND
/* version 1:liste dynamic
pSOUNDDATA_DIRECTORY pDir;
pDir=SND_fn_pvMallocSnd(sizeof(SOUNDDATA_DIRECTORY));
strcpy(pDir->szDirectory,czDir);
SNDLST2_M_DynamicInitElement(pDir);
if (!g_bSoundDataDirectoryListInitialized)
{
g_bSoundDataDirectoryListInitialized=TRUE;
SNDLST2_M_DynamicInitAnchor(&g_SoundDataDirectoryList.pList);
}
SNDLST2_M_DynamicAddTail(&g_SoundDataDirectoryList.pList,pDir);
*/
/* version 2:tableau dynamic
if (g_NbSoundDataDirectory)
{
g_SoundDataDirectoryList=(SOUNDDATA_DIRECTORY*)SND_fn_pvReAllocSnd(g_SoundDataDirectoryList,sizeof(SOUNDDATA_DIRECTORY)*(g_NbSoundDataDirectory+1));
}
else
{
g_SoundDataDirectoryList=(SOUNDDATA_DIRECTORY*)SND_fn_pvMallocSnd(sizeof(SOUNDDATA_DIRECTORY)*1);
}
strcpy(g_SoundDataDirectoryList[g_NbSoundDataDirectory].szDirectory,czDir);
*/
if (!SND_fn_bIsDataDirectory(czDir))
{
if (g_NbSoundDataDirectory<NB_DIRECTORY_MAX)
{
strcpy(g_SoundDataDirectoryTab[g_NbSoundDataDirectory].szDirectory,czDir);
g_NbSoundDataDirectory++;
}
else
SND_fn_vDisplayError(E_uwSndMemoryAllocError,"Too many SoundData directories");
}
#endif
}
void SND_CALL SND_fn_vRemoveDataDirectory(const char* czDir)
{
int i;
for (i=0;i<g_NbSoundDataDirectory;i++)
{
if (!stricmp(g_SoundDataDirectoryTab[i].szDirectory,czDir))
break;
}
if (i!=g_NbSoundDataDirectory)
{
if (g_NbSoundDataDirectory)
{
g_NbSoundDataDirectory--;
memcpy(&g_SoundDataDirectoryTab[i],&g_SoundDataDirectoryTab[g_NbSoundDataDirectory],sizeof(SOUNDDATA_DIRECTORY));
//g_SoundDataDirectoryList=SND_fn_pvReAllocSnd(g_SoundDataDirectoryList,sizeof(SOUNDDATA_DIRECTORY)*g_NbSoundDataDirectory);
}
}
}
void SND_CALL SND_fn_vPurgeDataDirectory()
{
/*
if (g_NbSoundDataDirectory)
SND_fn_vFreeSnd(g_SoundDataDirectoryList);
*/
g_NbSoundDataDirectory=0;
}
//---------------------------------------------------------------
// GetOneDataDirectory:copie dans une chaine le n<> rep<65>rtoire des donn<6E>es sons memoris<69> plus t<>t
// Entr<74>e:n=indice du r<>pertoire
// czDir=chaine <20> m<>moriser
// iMaxChar=taille de czDir
// Sortie:FALSE si n invalide; TRUE si OK
//---------------------------------------------------------------
SndBool SND_CALL SND_fn_bGetOneDataDirectory(int id,char* czDir,int iMaxChar)
{
/*
pSOUNDDATA_DIRECTORY pDir;
int i;
SNDLST2_M_DynamicGetElementNumber(&g_SoundDataDirectoryList.pList,pDir,id,i);
if (pDir!=NULL)
{
strncpy(czDir,pDir->szDirectory,iMaxChar);
return TRUE;
}
else
return FALSE;
*/
if (id<g_NbSoundDataDirectory)
{
strncpy(czDir,g_SoundDataDirectoryTab[id].szDirectory,iMaxChar);
return TRUE;
}
else
return FALSE;
}
//---------------------------------------------------------------
// GetNumberOfDataDirectory:donne le nb de directiry de la liste
// Entr<74>e:n<>ant
// Sortie:nb d'<27>l<EFBFBD>ment
//---------------------------------------------------------------
int SND_CALL SND_fn_iGetNumberOfDataDirectory(void)
{
/*return SNDLST2_M_DynamicGetNumberOfElements(&g_SoundDataDirectoryList.pList);*/
return g_NbSoundDataDirectory;
}
//---------------------------------------------------------------
// GetIdDataDirectory:retourne l'id d'un r<>pertoire dans la liste (si il y est)
// Entr<74>e:r<>pertoire
// Sortie:id du rep<65>rtoire dans la liste (-1 si non pr<70>sent dans la liste)
//---------------------------------------------------------------
int SND_CALL SND_fn_iGetIdDataDirectory(const char* szDir)
{
/*
pSOUNDDATA_DIRECTORY pDir;
int i;
SNDLST2_M_DynamicForEachElementOf(&g_SoundDataDirectoryList.pList,pDir,i)
{
if (!_stricmp(pDir->szDirectory,szDir))
return i;
}
return -1;
*/
int i;
for (i=0;i<g_NbSoundDataDirectory;i++)
{
if (!_stricmp(g_SoundDataDirectoryTab[i].szDirectory,szDir))
return i;
}
return -1;
}
//---------------------------------------------------------------
// IsDataDirectory:indique si un r<>pertoire fait partie de la liste
// Entr<74>e:r<>pertoire
// Sortie:TRUE si r<>pertoire pr<70>sent dans la liste, FALSE sinon
//---------------------------------------------------------------
SndBool SND_CALL SND_fn_bIsDataDirectory(const char* szDir)
{
if (SND_fn_iGetIdDataDirectory(szDir)!=-1)
return TRUE;
else
return FALSE;
}
//---------------------------------------------------------------
// Resolve FileName:convertit un nom relatif en nom absolu en cherchant dans la liste
// Entr<74>e:RelativeName=nom court
// Sortie:Absolute=nom complet (avec chemin r<>solu)
//---------------------------------------------------------------
void SND_CALL SND_fn_vResolveFileName(char* RelativeName,char* AbsoluteName)
{
#ifndef NO_ACP_SOUND
int i;
char name[256];
tdhSndFile hFile;
char texte[256];
/*
pSOUNDDATA_DIRECTORY pDir;
SNDLST2_M_DynamicForEachElementOf(&g_SoundDataDirectoryList.pList,pDir,i)
{
strcpy(name,pDir->szDirectory);
strcat(name,RelativeName);
if ((hFile=SND_fn_hOpenFileReadSnd(name))!=OPENFILESND_FAILED)
{
SND_fn_vCloseFileSnd(hFile);
strcpy(AbsoluteName,name);
return;
}
}
*/
for (i=0;i<g_NbSoundDataDirectory;i++)
{
strcpy(name,g_SoundDataDirectoryTab[i].szDirectory);
strcat(name,RelativeName);
if ((hFile=SND_fn_hOpenFileReadSnd(name))!=OPENFILESND_FAILED)
{
SND_fn_vCloseFileSnd(hFile);
strncpy(AbsoluteName,name,256);
return;
}
}
sprintf(texte,"File %s cannot be found in any DataDirectory",RelativeName);
SND_fn_vDisplayError(E_uwSndCannotOpenFile,texte);
strncpy(AbsoluteName,RelativeName,256);
#endif
}
//----------- Fonctions priv<69>es
//---------------------------------------------------------------
// SetCurrentDirectory:modifie le r<>pertoire courant
// Entr<74>e:czDir=nouveau rep<65>rtoire
// Sortie:TRUE si OK
//---------------------------------------------------------------
SndBool SND_CALL SND_fn_bSetCurrentDirectory(char* czDir)
{
return SetCurrentDirectory(czDir);
}
//---------------------------------------------------------------
// SetDataDirectory:m<>morise une chaine d<>crivant le rep<65>rtoire des donn<6E>es sons
// Entr<74>e:czDir=chaine <20> m<>moriser
// Sortie:n<>ant
//---------------------------------------------------------------
SndBool SND_CALL SND_fn_bGetCurrentDirectory(char* czDir,int iMaxChar)
{
return GetCurrentDirectory(iMaxChar,czDir);
}
//----------------------------------------------------------------------
// LoadDataInMemAndSwap;charge n octets d'une fichier
// Entr<74>es:
// adr = cible de donn<6E>es <20> charger
// nb_bytes = nb d'octets <20> charger
// name = nom absolu du fichier (ou dans r<>pertoire courant)
// offset = offset des donn<6E>es dans le fichier
// swap = TRUE s'il faut byte swapp<70> chaque WORD
// Sortie : True, False suivant la reussite ou non
//---------------------------------------------------------------------
SndBool SND_CALL SND_fn_bLoadDataInMemAndSwap(void* adr,unsigned long ulNbBytes,char* czFileName,unsigned long ulOffset,SndBool bSwap)
{
tdhSndFile hSndFile;
unsigned long ulNbReadBytes = 0;
WORD *pWord;
char Char;
int i;
if ((hSndFile = SND_fn_hOpenFileReadSnd(czFileName))!=OPENFILESND_FAILED)
{
SND_fn_dwSeekFileSnd(hSndFile,ulOffset,FILE_BEGIN);
ulNbReadBytes = SND_fn_dwReadFileSnd(hSndFile,ulNbBytes,adr);
SND_fn_vCloseFileSnd(hSndFile);
}
else
{
return FALSE;
}
//--byte swap
if (bSwap)
{
for (pWord=adr,i=ulNbBytes/2;i>0;pWord++,i--)
{
Char=*(char*)pWord;
*(char*)pWord=*((char*)pWord+1);
*((char*)pWord+1)=Char;
}
}
if (ulNbReadBytes != ulNbBytes)
return FALSE;
else
return TRUE;
}
SndBool SND_CALL SND_fn_bLoadDataInMem(void* adr,unsigned long ulNbBytes,char* czFileName,unsigned long ulOffset)
{
return SND_fn_bLoadDataInMemAndSwap(adr,ulNbBytes,czFileName,ulOffset,FALSE);
}
#ifdef FILE_MODE_C_STANDARD
unsigned long SND_fn_dwFileSndLength(tdhSndFile hSndFile)
{
return (_filelength(hSndFile));
}
tdhSndFile SND_fn_hOpenFileReadSnd(char * czFileName)
{
//tdhSndFile h = 0;
return (_open(czFileName,_O_RDONLY))
/*
if (h = _open(czFileName,dwOpenMode) == -1)
return (OPENFILESND_FAILED);
else
return h;
*/
}
unsigned long SND_fn_dwReadFileSnd(tdhSndFile hSndFile,unsigned long dwNbBytes,void * ptr)
{
return (_read(hSndFile,ptr,dwNbBytes));
}
unsigned long SND_fn_dwWriteFileSnd(tdhSndFile hSndFile,unsigned long dwNbBytes,void * ptr)
{
return (_write(hSndFile,ptr,dwNbBytes));
}
unsigned long SND_fn_dwSeekFileSnd(tdhSndFile hSndFile,unsigned long dwOffset,unsigned long dwOrigin)
{
return (_lseek(hSndFile,dwOffset,dwOrigin));
}
void SND_fn_vCloseFileSnd(tdhSndFile hSndFile)
{
_close(hSndFile);
}
#endif
#ifdef FILE_MODE_C_WIN95
unsigned long SND_CALL SND_fn_dwFileSndLength(tdhSndFile hSndFile)
{
return ((unsigned long)GetFileSize(hSndFile,NULL));
}
//-----------------------------------------------------------------------------
// Ouvre un fichier
// Entr<74>es:csFileName=nom du fichier
// dwOpenMode=OPENFILESND_READ ou OPENFILESND_WRITE
// Retour:handle sur un fichier (OPENFILESND_FAILED si <20>chec)
//-----------------------------------------------------------------------------
tdhSndFile SND_CALL SND_fn_hOpenFileReadSnd(char * czFilename)
{
tdhSndFile h;
LPVOID lpMsgBuf;
char texte[256],texte2[80];
DWORD err;
h = CreateFile(
(LPCTSTR)czFilename, // pointer to name of the file
GENERIC_READ, // access (read-write) mode
FILE_SHARE_READ, // share mode
NULL, // pointer to security descriptor
OPEN_EXISTING, // how to create
0,//FILE_ATTRIBUTE_ARCHIVE, // file attributes
NULL); // handle to file with attributes to copy
if (h==INVALID_HANDLE_VALUE)
{
GetCurrentDirectory(sizeof(texte2),texte2);
err=GetLastError();
if (err!=ERROR_FILE_NOT_FOUND)
{//strange message
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL
);
// Display the string.
strcpy(texte,czFilename);strcat(texte," -> ");strncat(texte,lpMsgBuf,sizeof(texte)-strlen(texte)-1);
//no more error: caller must display in own warning
//SND_fn_vDisplayError(E_uwSndCannotOpenFile,texte);
// Free the buffer.
LocalFree( lpMsgBuf );
}
}
return h;
}
unsigned long SND_CALL SND_fn_dwReadFileSnd(tdhSndFile hSndFile,unsigned long dwNbBytes,void * ptr)
{
SndBool bResult;
DWORD dwNbBytesRead = 0,err;
bResult = ReadFile(
hSndFile, // handle of file to read
ptr, // address of buffer that receives data
dwNbBytes, // number of bytes to read
&dwNbBytesRead, // address of number of bytes read
NULL); // address of structure for data
if (!bResult)
err=GetLastError();
return (dwNbBytesRead);
}
unsigned long SND_CALL SND_fn_dwWriteFileSnd(tdhSndFile hSndFile,unsigned long dwNbBytes,void * ptr)
{
SndBool bResult;
DWORD dwNbBytesWritten = 0;
bResult = WriteFile(
hSndFile, // handle of file to read
ptr, // address of buffer that receives data
dwNbBytes, // number of bytes to read
&dwNbBytesWritten, // address of number of bytes read
NULL); // address of structure for data
return (dwNbBytesWritten);
}
unsigned long SND_CALL SND_fn_dwSeekFileSnd(tdhSndFile hSndFile,unsigned long dwOffset,unsigned long dwOrigin)
{
return (SetFilePointer(hSndFile, dwOffset, NULL, dwOrigin));
}
void SND_CALL SND_fn_vCloseFileSnd(tdhSndFile hSndFile)
{
CloseHandle(hSndFile);
}
#endif

View File

@@ -0,0 +1,435 @@
/************************************************
Managing INI files
************************************************/
#include "SNDinc.h"
#include <windows.h>
#include "sndres.h"
#include "sndspace.h"
#include "sndini.h"
#include "snddll.h"
#include "sndtest.h"
typedef SndBool (*pfnTestFct)(void);
char SND_INI_FILENAME[]="SND_CPA.INI";
//static char C_STRING_DEFAULT[]="Default";
static char C_STRING_NONE[]="None";
static char SECTION_OPTIONS[]="Options";
static char SUPERVISATER_ON_OFF[]="SUPERVISATER_ON_OFF";
static char OPTION_ON[]="ON";
#ifdef _DLL_COMPILATION_MODE
static char OPTION_OFF[]="OFF";
static char SECTION_TESTDLL[]="DLL_Test";
static char SECTION_SXDDLL[]="DLL_Sxd";
static char SECTION_CDDLL[]="DLL_Cd";
static char SECTION_MPEGDLL[]="DLL_MPEG";
static char SECTION_ADPCMDLL[]="DLL_Adpcm";
static char SECTION_RECORDDLL[]="DLL_Record";
static char SOUND_ON_OFF[]="Sound_ON_OFF";
static char MPEG_ON_OFF[]="MPEG_ON_OFF";
static char CD_ON_OFF[]="CD_ON_OFF";
static char WAV_ON_OFF[]="WAV_ON_OFF";
static char ADPCM_ON_OFF[]="ADPCM_ON_OFF";
static char RECORD_ON_OFF[]="RECORD_ON_OFF";
static char DLL_FILE[]="File%x";
static char DLL_TEST[]="Test%x";
static char DLL_DEFAULT[]="Default";
static char DLL_UNCONDITIONNAL[]="Unconditionnal";
static char DLLNAME_FORMAT[]="%s\\%s%c%c%c.dll";
#endif //_DLL_COMPILATION_MODE
static char SXD_DIST_SATUR[]="SXD_DIST_SATUR";
//static char SXD_DIST_FADE[]="SXD_DIST_FADE";
static char SXD_DIST_BACK[]="SXD_DIST_BACK";
static char szDllDirectory[256]=".";
#ifdef NO_ACP_LDBIN
#define TAG_CHARGEMENT 's'
#else
#define TAG_CHARGEMENT 'b'
#endif
//#ifdef _MSC_VER
#define TAG_COMPILATION 'v'
//#else
//#define TAG_COMPILATION 'w'
//#endif
#ifdef _DEBUG
#define TAG_MODE 'd'
#else
#define TAG_MODE 'r'
#endif
// les options DLLs ON doivent <20>tre explicites
#ifdef _DLL_COMPILATION_MODE
// l'option SOUND ON est implicite
static BOOL bSound_ON=TRUE;
//flag= DLL active ou non
static BOOL bMPEG_ON=FALSE;
static BOOL bCD_ON=FALSE;
static BOOL bWAV_ON=FALSE;
static BOOL bADPCM_ON=FALSE;
static BOOL bRECORD_ON=FALSE;
#endif //_DLL_COMPILATION_MODE
static BOOL bDBG_ON=FALSE;
static char ini_file[256]="";
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestSoundIsOFF();
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestMPEGIsOFF();
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestCDIsOFF();
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestWAVIsOFF();
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestDBGIsOFF();
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestADPCMIsOFF();
__declspec(dllexport) BOOL SND_CALL SND_fn_bTestRECORDIsOFF();
__declspec(dllexport) HMODULE SND_CALL SND_fn_vGetHModuleMpeg(void);
__declspec(dllexport) HMODULE SND_CALL SND_fn_vGetHModuleWav(void);
__declspec(dllexport) HMODULE SND_CALL SND_fn_vGetHModuleCd(void);
__declspec(dllexport) HMODULE SND_CALL SND_fn_vGetHModuleDbg(void);
__declspec(dllexport) HMODULE SND_CALL SND_fn_vGetHModuleAdpcm(void);
__declspec(dllexport) HMODULE SND_CALL SND_fn_vGetHModuleRecord(void);
HMODULE SND_CALL SND_fn_vGetHModuleDbg(void)
{
return SND_hDbgModule;
}
HMODULE SND_CALL SND_fn_vGetHModuleMpeg(void)
{
return SND_hMpegModule;
}
HMODULE SND_CALL SND_fn_vGetHModuleWav(void)
{
return SND_hWavModule;
}
HMODULE SND_CALL SND_fn_vGetHModuleCd(void)
{
return SND_hCdModule;
}
HMODULE SND_CALL SND_fn_vGetHModuleAdpcm(void)
{
return SND_hAdpcmModule;
}
HMODULE SND_CALL SND_fn_vGetHModuleRecord(void)
{
return SND_hRecordModule;
}
#ifdef _DLL_COMPILATION_MODE
//chargelment d'une DLL par interpr<70>tation d'une section
HMODULE LoadDLL(char* nom_section,HMODULE* hModule,int nbModule)
{
char texte[256];
char file[256];
char key_name[256];
pfnTestFct pfTest=NULL;
int iDLL;
BOOL bMoreDLL;
int i;
HMODULE hTmp;
DWORD err;
GetPrivateProfileString(nom_section,DLL_UNCONDITIONNAL,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
if (strcmp(texte,C_STRING_NONE)!=0)
{//dll unconditionnal
sprintf(file,DLLNAME_FORMAT,szDllDirectory,texte,TAG_CHARGEMENT,TAG_COMPILATION,TAG_MODE);
if (!(hTmp=LoadLibrary(file)))
SND_fn_vDisplayError(E_uwSndDLLCannotLoadDLL,file);
return hTmp;
}
else
{//pas de unconditionnal
iDLL=0;bMoreDLL=TRUE;
while (bMoreDLL)
{
sprintf(key_name,DLL_TEST,iDLL);
GetPrivateProfileString(nom_section,key_name,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
if (strcmp(texte,C_STRING_NONE)!=0)
{//nouveau test
//recherche de la fonction dans les modules de test
for (i=0;i<nbModule;i++)
if ((pfTest=(pfnTestFct)GetProcAddress(hModule[i],texte))!=NULL) break;
//test
if (pfTest)
{
if ((*pfTest)())
{
sprintf(key_name,DLL_FILE,iDLL);
GetPrivateProfileString(nom_section,key_name,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
bMoreDLL=FALSE;
}
}
else
{
SND_fn_vDisplayError(E_uwSndDLLCannotFindFunction,texte);
}
iDLL++;
}
else
{
GetPrivateProfileString(nom_section,DLL_DEFAULT,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
bMoreDLL=FALSE;
}
}
if (strcmp(texte,C_STRING_NONE)!=0)
{//chargement de la dll
sprintf(file,DLLNAME_FORMAT,szDllDirectory,texte,TAG_CHARGEMENT,TAG_COMPILATION,TAG_MODE);
if (!(hTmp=LoadLibrary(file)))
{
err=GetLastError();
SND_fn_vDisplayError(E_uwSndDLLCannotLoadDLL,file);
}
return hTmp;
}
}
return NULL;
}
#endif
void SND_fn_vGetSxdDistanceOptions(RollOffParam *rolloff)
{
float d_dist_sat,d_dist_back;
char texte[256];
GetPrivateProfileString(SECTION_OPTIONS,SXD_DIST_SATUR,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
if (strcmp(texte,C_STRING_NONE)==0)
rolloff->rDistSatur=C_ROLLOFFPARAM_DEFAULT;
else
{
sscanf(texte,"%f",&d_dist_sat);
rolloff->rDistSatur=M_DoubleToRealSnd(d_dist_sat);
}
GetPrivateProfileString(SECTION_OPTIONS,SXD_DIST_BACK,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
if (strcmp(texte,C_STRING_NONE)==0)
rolloff->rDistBackGround=C_ROLLOFFPARAM_DEFAULT;
else
{
sscanf(texte,"%f",&d_dist_back);
rolloff->rDistBackGround=M_DoubleToRealSnd(d_dist_back);
}
}
SndBool SND_fn_bSupervisaterOptions(void)
{
char texte[256];
GetPrivateProfileString(SECTION_OPTIONS,SUPERVISATER_ON_OFF,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
if (strcmp(texte,OPTION_ON)==0)
return TRUE;
else
return FALSE;
}
void SND_fn_vInitOptions(SND_tdstInitStruct *pInitStruct)
{
char texte[256];
char file[256];
//liste des DLL de test
#define NB_DLLTEST_MAX 10
//SndReal dist_sat=0,dist_back=0;
RollOffParam rolloff;
#ifdef _DLL_COMPILATION_MODE
HMODULE hDLLTest[NB_DLLTEST_MAX];
BOOL bMoreDLL;
char key_name[256];
int iDLLTest;
int i;
#endif
strncpy(szDllDirectory,SND_fn_szGetSoftDirectory(),sizeof(szDllDirectory)-1);
strncpy(ini_file,szDllDirectory,sizeof(ini_file)-1);
strncat(ini_file,"\\",sizeof(ini_file)-strlen(ini_file)-1);
strncat(ini_file,SND_INI_FILENAME,sizeof(ini_file)-strlen(ini_file)-1);
if (!SND_fn_bTestSnd_Win32())
SND_fn_vDisplayError(E_uwSndInitNotDoneError,"Windows needed");
GetPrivateProfileString(NULL,NULL,C_STRING_NONE,texte,sizeof(texte)-1,ini_file);
#ifdef _DLL_COMPILATION_MODE
//en mode DLL, l'absence de ficheir INI est grave (Warning)
//en mode statique, l'absence de fichier INI est b<>nine
if ((texte[0]==0) || (strcmp(texte,C_STRING_NONE)==0))
{
sprintf(texte,"The INI file doesn't exist (%s)",ini_file);
SND_fn_vDisplayError(E_uwSndINIFileNotFound,texte);
}
//lecture des options
GetPrivateProfileString(SECTION_OPTIONS,SOUND_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_OFF)==0)
{
bSound_ON=FALSE;
bADPCM_ON=FALSE;
bMPEG_ON=FALSE;
bCD_ON=FALSE;
bWAV_ON=FALSE;
bRECORD_ON=FALSE;
bDBG_ON=FALSE;
}
else
{
GetPrivateProfileString(SECTION_OPTIONS,MPEG_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_ON)==0)
bMPEG_ON=TRUE;
GetPrivateProfileString(SECTION_OPTIONS,CD_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_ON)==0)
bCD_ON=TRUE;
GetPrivateProfileString(SECTION_OPTIONS,WAV_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_ON)==0)
bWAV_ON=TRUE;
GetPrivateProfileString(SECTION_OPTIONS,ADPCM_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_ON)==0)
bADPCM_ON=TRUE;
GetPrivateProfileString(SECTION_OPTIONS,RECORD_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_ON)==0)
bRECORD_ON=TRUE;
}
//chargement des DLL test
iDLLTest=0;bMoreDLL=TRUE;
hDLLTest[iDLLTest++]=pInitStruct->hProcessInstance;
while (bMoreDLL && (iDLLTest<NB_DLLTEST_MAX))
{
sprintf(key_name,DLL_FILE,iDLLTest-1);
GetPrivateProfileString(SECTION_TESTDLL,key_name,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,C_STRING_NONE)!=0)
{
sprintf(file,DLLNAME_FORMAT,szDllDirectory,texte,TAG_CHARGEMENT,TAG_COMPILATION,TAG_MODE);
if (!(hDLLTest[iDLLTest]=LoadLibrary(file)))
SND_fn_vDisplayError(E_uwSndDLLCannotLoadDLL,file);
iDLLTest++;
}
else
bMoreDLL=FALSE;
}
//chargement de la DLL WAV
if (bWAV_ON)
SND_hWavModule=LoadDLL(SECTION_SXDDLL,hDLLTest,iDLLTest);
else
SND_hWavModule=NULL;
//chargement de la DLL CD
if (bCD_ON)
SND_hCdModule=LoadDLL(SECTION_CDDLL,hDLLTest,iDLLTest);
else
SND_hCdModule=NULL;
//chargement de la DLL MPEG
if (bMPEG_ON)
SND_hMpegModule=LoadDLL(SECTION_MPEGDLL,hDLLTest,iDLLTest);
else
SND_hMpegModule=NULL;
//chargement de la DLL ADPCM
if (bADPCM_ON)
SND_hAdpcmModule=LoadDLL(SECTION_ADPCMDLL,hDLLTest,iDLLTest);
else
SND_hAdpcmModule=NULL;
//chargement de la DLL RECORD
if (bRECORD_ON)
SND_hRecordModule=LoadDLL(SECTION_RECORDDLL,hDLLTest,iDLLTest);
else
SND_hRecordModule=NULL;
//init des pointeurs
SND_DllInitEntryPoints_WavFunctions(SND_hWavModule);
SND_DllInitEntryPoints_CdFunctions(SND_hCdModule);
SND_DllInitEntryPoints_MpegFunctions(SND_hMpegModule);
SND_DllInitEntryPoints_AdpcmFunctions(SND_hAdpcmModule);
#ifdef USE_RECORD_MODULE
SND_DllInitEntryPoints_RecordFunctions(SND_hRecordModule);
#endif
//dechargement des DLLs de test
for (i=1;i<iDLLTest;i++)
FreeLibrary(hDLLTest[i]);
#endif //DLL_COMPILATION
//init des options pour SXD
SND_fn_vGetSxdDistanceOptions(&rolloff);
SND_fn_vSetDefaultRollOff(&rolloff);
//SND_fn_vSetDistanceForVolume(&dist_sat,&dist_back);
GetPrivateProfileString(SECTION_OPTIONS,SUPERVISATER_ON_OFF,C_STRING_NONE,texte,sizeof(texte),ini_file);
if (strcmp(texte,OPTION_ON)==0)
bDBG_ON=TRUE;
//chargement de la DLL Supervisater(DBG)
if (bDBG_ON)
{
strncpy(file,szDllDirectory,sizeof(file));
strncat(file,"\\SNDdbgV.DLL",sizeof(file)-strlen(file)-1);
SND_hDbgModule=LoadLibrary(file);
}
else
SND_hDbgModule=NULL;
SND_DllInitEntryPoints_DbgFunctions(SND_hDbgModule);
if (bDBG_ON)
SND_fn_vSetSupervisaterActive();
}
void SND_fn_vDesInitOptions(void)
{
#ifdef _DLL_COMPILATION_MODE
if (SND_hWavModule) FreeLibrary(SND_hWavModule);
if (SND_hCdModule) FreeLibrary(SND_hCdModule);
if (SND_hMpegModule) FreeLibrary(SND_hMpegModule);
if (SND_hDbgModule) FreeLibrary(SND_hDbgModule);
if (SND_hAdpcmModule) FreeLibrary(SND_hAdpcmModule);
if (SND_hRecordModule) FreeLibrary(SND_hRecordModule);
#endif
}
// SND_fn_bGetOptions:extrait une info du fichier INI
// Entr<74>es:sction:nom de la section (chapitre)
// key=key_name
// value=poiteur o<> mettre la valeur de la key
// size_value=nombre d'octets que value peut recevoir
// Sortie:TRUE si valeur pour la key
SndBool SND_CALL SND_fn_bGetOptions(char* section,char* key,char* value,int size_value)
{
GetPrivateProfileString(section,key,C_STRING_NONE,value,size_value,ini_file);
if (strcmp(value,C_STRING_NONE)==0)
return FALSE;
else
return TRUE;
}
void SND_CALL SND_fn_vSetOptions(char* section,char* key,char* value)
{
WritePrivateProfileString(section,key,value,ini_file);
}
//pour compatibilit<69> ascendante
SndBool SND_CALL SND_fn_bCanSetOptions(void)
{
return TRUE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,989 @@
#include "SNDinc.h"
#include "sndevent.h"
#include "sndres.h"
#include "sndplay.h"
#ifdef _DLL_COMPILATION_MODE
#include "snddll.h"
#else
#include "sndmpeg.h"
#include "sndmidi.h"
#include "sndxd.h"
#include "sndxdapm.h"
#endif
//*****************************************************
//******* Global variables **************
//*****************************************************
#ifndef NO_ACP_LDBIN
#include "sndld_bn.h"
/*
#ifndef NO_ACP_LDBIN
typedef struct _tdstSndBankDescriptorElement *p_tdstSndBankDescriptorElement;
SNDLST2_M_DynamicUseListOf(p_tdstSndBankDescriptorElement);
struct _tdstSndBankDescriptorElement
{
int iId; //Id of bank
unsigned long iLevel; //level (for StartLoadBank2
char czFileName[13]; //file name of bank
//signed long ulDataSize; //size of
tdeBankState eState; //current of bank (loading, to be loaded...)
tdstSndBankHead* pData; //pointer to main data (malloc)
void *pDataPrimary; //pointer to primary data (CPA list for Theme, Seq...)
void *pDataMPEG; //pointer to MPEG data
void *pDataMidi; //pointer to Midi data
void *pDataSample; //pointer to Sampel data
SNDLST2_M_DynamicElementDeclaration(p_tdstSndBankDescriptorElement)
} tdstSndBankDescriptorElement;
typedef struct tdstSndBankDescriptorList_{
SNDLST2_M_DynamicAnchorDeclaration(p_tdstSndBankDescriptorElement) pList;
} tdstSndBankDescriptorList;
*/
tdstSndBankDescriptorList SND_g_dBankDescriptionList;
//SND_g_dBankDescriptionList describes loaded banks
//struct tdstSndBankDescriptorElement describes a bank
SndBool fn_bInitBinEvent(SND_tdstBlockEvent *pEvent);
// get file name for bank #_iBankNum
void fn_vGetBankFileName(unsigned long _ulBankNum,char *czFileName,int sizeFileName)
{
char texte[256];
sprintf(texte,"bnk_%d.BNM",_ulBankNum);
strncpy(czFileName,texte,sizeFileName);
}
// return the *SndBankDescriptorElement of bank #_iBankNum if loaded else returns NULL
p_tdstSndBankDescriptorElement fn_pstGetBankDescriptor(int _iBankNum)
{
p_tdstSndBankDescriptorElement pBankDescr;
int i;
SNDLST2_M_DynamicForEachElementOf(&SND_g_dBankDescriptionList.pList,pBankDescr,i)
{
if (pBankDescr->iId==_iBankNum)
//found
return pBankDescr;
}
//not found
return NULL;
}
//add a new SndBankDescriptorElement in SndBankDescriptorList for bank #_iBankNum
p_tdstSndBankDescriptorElement fn_pstAddBankDescriptor(int _iBankNum,int level)
{
p_tdstSndBankDescriptorElement pBankDescr;
pBankDescr=SND_fn_pvMallocSnd(sizeof(tdstSndBankDescriptorElement));
memset(pBankDescr,0,sizeof(tdstSndBankDescriptorElement));
SNDLST2_M_DynamicInitElement(pBankDescr);
SNDLST2_M_DynamicAddTail(&SND_g_dBankDescriptionList.pList,pBankDescr);
pBankDescr->iId=_iBankNum;
fn_vGetBankFileName(_iBankNum,pBankDescr->czFileName,sizeof(pBankDescr->czFileName));
pBankDescr->eState=BANK_NOT_LOADED;
pBankDescr->pData=NULL;
pBankDescr->pDataPrimary=NULL;
pBankDescr->pDataMPEG=NULL;
pBankDescr->pDataMidi=NULL;
pBankDescr->pDataSample=NULL;
if (level==BANK_ALL_LEVEL)
pBankDescr->iLevel=0xFFFFFFFF;
else
pBankDescr->iLevel=(1<<level);
return pBankDescr;
}
// load all data from a bianry bank (descriptor, raw data...), but do not resolve pointers
// return TRUE if succesfull
SndBool fn_bLoadDataBankWithoutResolve(p_tdstSndBankDescriptorElement pBankDescr)
{
// Data: |Head |Lists | Prim Data |MPEG |Midi | Sample |
tdstSndBankHead stBankHead;
unsigned long ulPersistentDataSize;
unsigned long ulSizeMPEG,ulSizeMidi,ulSizeSample,ulSizeADPCM,ulSizeStreaming;
char czFilePath[256];
tdhSndFile hFile;
unsigned long ulOffset,ulOffsetPersistentDataInMem;
SND_tdstBlockEvent *pEvent;
tduBlockResource *pRes;
// Set the bank descriptor state:
pBankDescr->eState=BANK_LOADING;
// Get the complete bank file name:
SND_fn_vResolveFileName(pBankDescr->czFileName,czFilePath);
// Load the bank's head from file to memory:
hFile=SND_fn_hOpenFileReadSnd(czFilePath);
if (hFile==OPENFILESND_FAILED)
{
SND_fn_vDisplayError(E_uwSndCannotOpenFile,czFilePath);
return FALSE;
}
SND_fn_dwReadFileSnd(hFile,sizeof(tdstSndBankHead),&stBankHead);
//get version
pBankDescr->lBNMCheckVersion=SND_BNM_GETVERSION(&stBankHead);
// Compute all the blocks sizes:
ulSizeMPEG=stBankHead.ulOffsetMidi-stBankHead.ulOffsetMPEG;
ulSizeMidi=stBankHead.ulOffsetSample-stBankHead.ulOffsetMidi;
#ifdef SNDBANK_FORMAT2
ulSizeSample=stBankHead.ulOffsetADPCM-stBankHead.ulOffsetSample;
if (pBankDescr->lBNMCheckVersion==SND_BNM_VERSIONCHECK_1)
{
ulSizeADPCM=0;
ulSizeStreaming=0;
}
else
{
ulSizeADPCM=stBankHead.ulOffsetStreaming-stBankHead.ulOffsetADPCM;
ulSizeStreaming=stBankHead.ulTotalSize-stBankHead.ulOffsetStreaming;
}
#else
ulSizeSample=stBankHead.ulTotalSize-stBankHead.ulOffsetSample;
#endif //SNDBANK_FORMAT2
// Compute the persistant data size:
ulPersistentDataSize=stBankHead.ulOffsetMPEG; // Head+Lists+Primary data
if (!SND_fn_bCanFreeDataMPEG())
ulPersistentDataSize+=ulSizeMPEG;
if (!SND_fn_bCanFreeDataMidi())
ulPersistentDataSize+=ulSizeMidi;
if (!SND_fn_bCanFreeDataSample())
ulPersistentDataSize+=ulSizeSample;
#ifdef SNDBANK_FORMAT2
if (!SND_fn_bCanFreeDataADPCM())
ulPersistentDataSize+=ulSizeADPCM;
//streaming data are never loaded
#endif //SNDBANK_FORMAT2
// Allocate the corresponding memory:
pBankDescr->pData=(tdstSndBankHead*)SND_fn_pvMallocSnd(ulPersistentDataSize);
// Copy the previously read bank head to its final place:
memcpy(pBankDescr->pData,&stBankHead,sizeof(tdstSndBankHead));
// Load the Lists & Prim data right after the header:
SND_fn_dwReadFileSnd(hFile
,stBankHead.ulOffsetMPEG-sizeof(tdstSndBankHead)
,(void*)(((char*)pBankDescr->pData)+sizeof(tdstSndBankHead)));
pBankDescr->pDataPrimary=(void*)(((char*)pBankDescr->pData)+sizeof(tdstSndBankHead));
ulOffsetPersistentDataInMem=stBankHead.ulOffsetMPEG;
//Load MPEG datas where necessary
if (!SND_fn_bCanFreeDataMPEG())
{
pBankDescr->pDataMPEG=(void*)((char*)pBankDescr->pData+ulOffsetPersistentDataInMem);
ulOffsetPersistentDataInMem+=ulSizeMPEG;
}
else
//allocate a temporary pointer (will be free by ResolvePointer
if (ulSizeMPEG)
pBankDescr->pDataMPEG=SND_fn_pvMallocSnd(ulSizeMPEG);
else
pBankDescr->pDataMPEG=NULL;
if (ulSizeMPEG)
SND_fn_dwReadFileSnd(hFile
,ulSizeMPEG
,pBankDescr->pDataMPEG);
//Load Midi datas where necessary
if (!SND_fn_bCanFreeDataMidi())
{
pBankDescr->pDataMidi=(void*)((char*)pBankDescr->pData+ulOffsetPersistentDataInMem);
ulOffsetPersistentDataInMem+=ulSizeMidi;
}
else
//allocate a temporary pointer (will be free by ResolvePointer
if (ulSizeMidi)
pBankDescr->pDataMidi=SND_fn_pvMallocSnd(ulSizeMidi);
else
pBankDescr->pDataMidi=NULL;
if (ulSizeMidi)
SND_fn_dwReadFileSnd(hFile
,ulSizeMidi
,pBankDescr->pDataMidi);
//Load Sample datas where necessary
if (!SND_fn_bCanFreeDataSample())
{
pBankDescr->pDataSample=(void*)((char*)pBankDescr->pData+ulOffsetPersistentDataInMem);
ulOffsetPersistentDataInMem+=ulSizeSample;
}
else
//allocate a temporary pointer (will be free by ResolvePointer
if (ulSizeSample)
pBankDescr->pDataSample=SND_fn_pvMallocSnd(ulSizeSample);
else
pBankDescr->pDataSample=NULL;
if (ulSizeSample)
SND_fn_dwReadFileSnd(hFile
,ulSizeSample
,pBankDescr->pDataSample);
#ifdef SNDBANK_FORMAT2
//Load ADPCM datas where necessary
if (!SND_fn_bCanFreeDataADPCM())
{
pBankDescr->pDataADPCM=(void*)((char*)pBankDescr->pData+ulOffsetPersistentDataInMem);
ulOffsetPersistentDataInMem+=ulSizeADPCM;
}
else
//allocate a temporary pointer (will be free by ResolvePointer
if (ulSizeADPCM)
pBankDescr->pDataADPCM=SND_fn_pvMallocSnd(ulSizeADPCM);
else
pBankDescr->pDataADPCM=NULL;
if (ulSizeADPCM)
SND_fn_dwReadFileSnd(hFile
,ulSizeADPCM
,pBankDescr->pDataADPCM);
#endif //SNDBANK_FORMAT2
//all datas have been loaded
SND_fn_vCloseFileSnd(hFile);
// Convert the bank descriptor parent structs from disk to mem:
ulOffset=(unsigned long )SNDLST2_M_StaticGetFirstElement(&(pBankDescr->pData->stEventList));
pEvent=(SND_tdstBlockEvent *)((unsigned long )(pBankDescr->pData)+ulOffset);
SNDLST2_M_StaticSetFirstElement(&(pBankDescr->pData->stEventList),pEvent);
ulOffset=(unsigned long )SNDLST2_M_StaticGetFirstElement(&(pBankDescr->pData->stResList));
pRes=(tduBlockResource *)((unsigned long )(pBankDescr->pData)+ulOffset);
SNDLST2_M_StaticSetFirstElement(&(pBankDescr->pData->stResList),pRes);
pBankDescr->pDataPrimary=(void*)(((char*)SNDLST2_M_StaticGetFirstElement(&(pBankDescr->pData->stResList))
+sizeof(tduBlockResource)*SNDLST2_M_StaticGetNumberOfElements(&(pBankDescr->pData->stResList))));
//things to do later:
//-init raw datas (call to LoadRes)
//-correct reference to resources and events (convert bin id to pointer)
//-free temporary bloc if necessary
return TRUE;
}
//resolve all pointer used by a binary bank just loaded
SndBool fn_bResolveBankPointer(p_tdstSndBankDescriptorElement pBankDescr)
{
tdstSndBankHead *pBankHead;
unsigned long ulSizeMPEG,ulSizeMidi,ulSizeSample,ulSizeADPCM;
void *pCurBloc=NULL;
int iPos;
tdstBlockResourceDisk stBRDisk;
SndBool bToLoad;
SndBool bBankOK=TRUE;
SND_tdstBlockEvent *pEvent;
tduBlockResource *pRes;
pBankHead=pBankDescr->pData;
// Data: |Head |Lists | Prim Data |MPEG |Midi | Sample |
// Compute all the blocks sizes:
ulSizeMPEG=pBankHead->ulOffsetMidi-pBankHead->ulOffsetMPEG;
ulSizeMidi=pBankHead->ulOffsetSample-pBankHead->ulOffsetMidi;
#ifdef SNDBANK_FORMAT2
ulSizeSample=pBankHead->ulOffsetADPCM-pBankHead->ulOffsetSample;
ulSizeADPCM=pBankHead->ulTotalSize-pBankHead->ulOffsetADPCM;
#else
ulSizeSample=pBankHead->ulTotalSize-pBankHead->ulOffsetSample;
#endif //SNDBANK_FORMAT2
// Init Events and resources in this
SNDLST2_M_StaticForEachElementOf( &(pBankHead->stEventList), pEvent, iPos)
fn_bInitBinEvent(pEvent);
SNDLST2_M_StaticForEachElementOf( &(pBankDescr->pData->stResList), pRes, iPos)
{
// copy the bloc resource disk in the temporary structure:
memcpy(&stBRDisk,pRes,sizeof(tdstBlockResourceDisk));
// Get the appropriate bloc pointer depending on the resource type:
bToLoad=TRUE;
switch (stBRDisk.eType)
{
case TYPE_SAMPLE:
if (stBRDisk.uRes.stSample.bStream)
{//streaming -> no data loaded
pCurBloc=NULL;
}
else
{
switch (stBRDisk.uRes.stSample.eZip)
{
case SAMPLE_PCM:
pCurBloc=pBankDescr->pDataSample;
break;
case SAMPLE_MPEG:
pCurBloc=pBankDescr->pDataMPEG;
break;
#ifdef SNDBANK_FORMAT2
case SAMPLE_ADPCM:
pCurBloc=pBankDescr->pDataADPCM;
break;
#endif //SNDBANK_FORMAT2
default:
SND_fn_vDisplayError(E_uwSndInvalidStaticParamForResource,"");
break;
}
}
break;
case TYPE_MIDI:
pCurBloc=pBankDescr->pDataMidi;
break;
case TYPE_CDAUDIO:
case TYPE_SEQUENCE:
case TYPE_SWITCH_OLD:
case TYPE_SWITCH:
case TYPE_SPLIT:
case TYPE_THEME:
case TYPE_RANDOM:
pCurBloc=pBankDescr->pDataPrimary;
break;
default: // ERROR! UNKNOWN RES TYPE;
SND_fn_vDisplayError(E_uwSndInvalidTypeOfResource,"");
pRes->stMem.eType=TYPE_INVALID;
bToLoad=FALSE;
bBankOK=FALSE;
// return FALSE;
break;
}
// call the load function:
if (bToLoad)
SND_fn_bLoadResBinarySnd(&stBRDisk,&pRes->stMem,pCurBloc);
} // End of update of references in resources.
// Free temporary blocs if necessary
if (SND_fn_bCanFreeDataMPEG() && pBankDescr->pDataMPEG)
SND_fn_vFreeSnd(pBankDescr->pDataMPEG);
pBankDescr->pDataMPEG=NULL;
if (SND_fn_bCanFreeDataMidi() && pBankDescr->pDataMidi)
SND_fn_vFreeSnd(pBankDescr->pDataMidi);
pBankDescr->pDataMidi=NULL;
if (SND_fn_bCanFreeDataSample() && pBankDescr->pDataSample)
SND_fn_vFreeSnd(pBankDescr->pDataSample);
pBankDescr->pDataSample=NULL;
#ifdef SNDBANK_FORMAT2
if (SND_fn_bCanFreeDataADPCM() && pBankDescr->pDataADPCM)
SND_fn_vFreeSnd(pBankDescr->pDataADPCM);
pBankDescr->pDataADPCM=NULL;
#endif //SNDBANK_FORMAT2
pBankDescr->pDataPrimary=NULL;
return bBankOK;
}
//resolve pointers used by an event
SndBool fn_bInitBinEvent(SND_tdstBlockEvent *pEvent)
{
switch (pEvent->eType)
{
case EVT_SON_STOP_ALL:
break;
case EVT_SON_PLAY:
if (pEvent->uParams.stPlay.uResource.Id!=SND_INVALID_BINID)
pEvent->uParams.stPlay.uResource.pstPtr=SND_fn_pGetBinRes(pEvent->uParams.stPlay.uResource.Id);
else
pEvent->uParams.stPlay.uResource.pstPtr=NULL;
break;
case EVT_SON_STOP:
if (pEvent->uParams.stStop.uEvt.Id!=SND_INVALID_BINID)
pEvent->uParams.stStop.uEvt.pstPtr=SND_fn_pGetBinEvent(pEvent->uParams.stStop.uEvt.Id);
else
pEvent->uParams.stStop.uEvt.pstPtr=NULL;
break;
case EVT_SON_STOP_N_GO:
if (pEvent->uParams.stStopNGo.uEvtStop.Id!=SND_INVALID_BINID)
pEvent->uParams.stStopNGo.uEvtStop.pstPtr=SND_fn_pGetBinEvent(pEvent->uParams.stStopNGo.uEvtStop.Id);
else
pEvent->uParams.stStop.uEvt.pstPtr=NULL;
if (pEvent->uParams.stStopNGo.uEvtGo.Id!=SND_INVALID_BINID)
pEvent->uParams.stStopNGo.uEvtGo.pstPtr=SND_fn_pGetBinEvent(pEvent->uParams.stStopNGo.uEvtGo.Id);
else
pEvent->uParams.stStopNGo.uEvtGo.pstPtr=NULL;
break;
case EVT_SON_STOP_N_GO_CROSSFADE:
if (pEvent->uParams.stStopNGoFade.uEvtStop.Id!=SND_INVALID_BINID)
pEvent->uParams.stStopNGoFade.uEvtStop.pstPtr=SND_fn_pGetBinEvent(pEvent->uParams.stStopNGoFade.uEvtStop.Id);
else
pEvent->uParams.stStopNGoFade.uEvtStop.pstPtr=NULL;
if (pEvent->uParams.stStopNGoFade.uEvtGo.Id!=SND_INVALID_BINID)
pEvent->uParams.stStopNGoFade.uEvtGo.pstPtr=SND_fn_pGetBinEvent(pEvent->uParams.stStopNGoFade.uEvtGo.Id);
else
pEvent->uParams.stStopNGoFade.uEvtGo.pstPtr=NULL;
break;
case EVT_SON_PITCH:
case EVT_SON_VOLUME:
case EVT_SON_PAN:
if (pEvent->uParams.stExtraParam.uResource.Id!=SND_INVALID_BINID)
pEvent->uParams.stExtraParam.uResource.pstPtr=SND_fn_pGetBinRes(pEvent->uParams.stExtraParam.uResource.Id);
else
pEvent->uParams.stExtraParam.uResource.pstPtr=NULL;
break;
case EVT_SON_EXTRA:
if (pEvent->uParams.stExtraAll.uResource.Id!=SND_INVALID_BINID)
pEvent->uParams.stExtraAll.uResource.pstPtr=SND_fn_pGetBinRes(pEvent->uParams.stExtraAll.uResource.Id);
else
pEvent->uParams.stExtraAll.uResource.pstPtr=NULL;
break;
case EVT_SON_EFFET:
case EVT_SON_CHANGE_VOLUME:
//nothing to do
break;
default: // ERROR! UNKNOWN RES TYPE;
SND_fn_vDisplayError(E_uwSndInvalidTypeOfEvent,"");
return FALSE;
break;
}
return TRUE;
}
#endif //LDBIN
#ifndef SND_HYBRID_VERSION
//***********************************************************************
//***********************************************************************
//** Public functions *****
//***********************************************************************
//***********************************************************************
// GetNumberOfBanks: returns the number of loaded banks
unsigned long SND_fn_ulGetEventBinIdFromPointer(SND_tdstBlockEvent *_pEvent)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr;
int i,iEventCount,iEventNumber;
unsigned long ulEventId;
if (_pEvent==NULL) return 0xFFFFFFFF;
SNDLST2_M_DynamicForEachElementOf(&SND_g_dBankDescriptionList.pList,pBankDescr,i)
{
// Is event in this bank
SNDLST2_M_StaticWhatElementNumber(_pEvent,&pBankDescr->pData->stEventList,iEventNumber);
iEventCount=SNDLST2_M_StaticGetNumberOfElements(&pBankDescr->pData->stEventList);
if ((iEventNumber<0)||(iEventNumber>=iEventCount)) continue;
// Event found, get bank id:
ulEventId=pBankDescr->iId;
ulEventId<<=16; // Store Bank Id in upper part of the unsigned long
ulEventId+=iEventNumber; // Store Res Pos in lower part of the unsigned long
return ulEventId;
}
#endif //NO_ACP_LDBIN
//not found
return 0xFFFFFFFF;
}
#endif //SND_HYBRID_VERSION
int SND_CALL SND_fn_iGetNumberOfBanks(void)
{
#ifndef NO_ACP_LDBIN
return SNDLST2_M_DynamicGetNumberOfElements(&SND_g_dBankDescriptionList.pList);
#else
return 0;
#endif
}
//GetNumberOfEventInBank: returns the number of events in a bank
int SND_CALL SND_fn_iGetNumberOfEventInBank(int bank)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr;
pBankDescr=fn_pstGetBankDescriptor(bank);
if (pBankDescr)
return SNDLST2_M_StaticGetNumberOfElements(&pBankDescr->pData->stEventList);
else
return 0;
#else
return 0;
#endif
}
// InitBankSnd: to be called once before binary functions could be used
void SND_CALL SND_fn_vInitBankSnd(char *czPathName)
{
#ifndef NO_ACP_LDBIN
SNDLST2_M_DynamicInitAnchor(&SND_g_dBankDescriptionList.pList);
#endif
}
// DesInitBankSnd: to be called once when binary functions are no more used
// will unLoad all loaded banks
void SND_CALL SND_fn_vDesInitBankSnd(void)
{
#ifndef NO_ACP_LDBIN
int i;
p_tdstSndBankDescriptorElement pBank,pBankNext;
SNDLST2_M_DynamicForEachMovingElementOf(&SND_g_dBankDescriptionList.pList,pBank,pBankNext,i)
{
SND_fn_bUnLoadBinaryBank(pBank->iId);
}
#endif
}
// GetBinEvent: return the pointer to a binary event
// If event is not loaded, returns NULL
#ifndef SND_HYBRID_VERSION
SND_tdstBlockEvent* SND_CALL SND_fn_pGetBinEvent(unsigned long _ulBinId)
{
#ifndef NO_ACP_LDBIN
unsigned long ulBankId,ulEventPos;
tdstSndBankHead* pBank;
SND_tdstBlockEvent *pEvent;
p_tdstSndBankDescriptorElement pBankDescr;
int i;
if (_ulBinId==0xFFFFFFFF)
return NULL;
ulBankId=_ulBinId>>16;
ulEventPos=_ulBinId&0xFFFF;
// Get Right bank:
pBankDescr=fn_pstGetBankDescriptor(ulBankId);
if (pBankDescr!=NULL)
{//found !!
pBank=pBankDescr->pData;
snd_assert(pBank!=NULL);
if ((long)ulEventPos<SNDLST2_M_StaticGetNumberOfElements(&pBank->stEventList))
{
SNDLST2_M_StaticGetElementNumber(&pBank->stEventList,pEvent,(long)ulEventPos,i);
}
else
pEvent=NULL;
return(pEvent);
}
else
return NULL;
#else
return NULL;
#endif
}
#endif
// GetBinRes: returns the pointer to a binary resource
// If ressource is not loaded, returns NULL
tdstBlockResourceMem* SND_CALL SND_fn_pGetBinRes(unsigned long _ulBinId)
{
#ifndef NO_ACP_LDBIN
unsigned long ulBankId,ulResPos;
tdstSndBankHead* pBank;
tduBlockResource *pRes;
p_tdstSndBankDescriptorElement pBankDescr;
int i;
if (_ulBinId==0xFFFFFFFF)
return NULL;
ulBankId=_ulBinId>>16;
ulResPos=_ulBinId&0xFFFF;
// Get Right bank:
pBankDescr=fn_pstGetBankDescriptor(ulBankId);
if (pBankDescr!=NULL)
{//found !!
pBank=pBankDescr->pData;
snd_assert(pBank!=NULL);
if ((long)ulResPos<SNDLST2_M_StaticGetNumberOfElements(&pBank->stResList))
{
SNDLST2_M_StaticGetElementNumber(&pBank->stResList,pRes,(long)ulResPos,i);
}
else
pRes=NULL;
return(&pRes->stMem);
}
else
return NULL;
#else
return NULL;
#endif
}
// StartLoadBanks:Called when the list of loaded bank is about to change
// After this call, the user must call SND_fn_bInitBank for each bank he want to be loaded
// At the end, calling EndLoadBanks will load necessary banks, and unload unnecessary banks
SndBool SND_CALL SND_fn_bStartLoadBanks(void)
{
return SND_fn_bStartLoadBanks2(BANK_ALL_LEVEL);
}
// StartLoadBanks:Called when the list of loaded bank is about to change in one level
// After this call, the user must call SND_fn_bInitBank for each bank he want to be loaded in this level
// At the end, calling EndLoadBanks will load necessary banks, and unload unnecessary banks in this level
// Bank from other level will no change
SndBool SND_CALL SND_fn_bStartLoadBanks2(int level)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr;
int i;
SNDLST2_M_DynamicForEachElementOf(&SND_g_dBankDescriptionList.pList,pBankDescr,i)
{
if (level==BANK_ALL_LEVEL)
pBankDescr->iLevel=0;//all its set to 0
else
{
snd_assert(level<32);
pBankDescr->iLevel&=~(1<<level);//bit #level set to 0
}
if (!pBankDescr->iLevel)
pBankDescr->eState=BANK_WAITING;
}
return TRUE;
#else //SND_LDBIN
return FALSE;
#endif
}
// InitBank: marks bank as "TO_BE_LOADED"
// The bank will be loaded only at EndLoadBank call
SndBool SND_CALL SND_fn_bInitBank(int _iBankNum)
{
return SND_fn_bInitBank2(_iBankNum,BANK_ALL_LEVEL);
}
// InitBank: marks bank as "TO_BE_LOADED"
// The bank will be loaded only at EndLoadBank call
SndBool SND_CALL SND_fn_bInitBank2(int _iBankNum,int level)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr;
pBankDescr=fn_pstGetBankDescriptor(_iBankNum);
if (pBankDescr==NULL)
{//bank was yet loaded (?)
pBankDescr=fn_pstAddBankDescriptor(_iBankNum,level);
}
else
{
if (level==BANK_ALL_LEVEL)
pBankDescr->iLevel=0xFFFFFFFF;//all bits set to 1
else
{
snd_assert(level<32);
pBankDescr->iLevel&=(1<<level);//bit #level set to 1
}
}
switch(pBankDescr->eState)
{
case BANK_WAITING:
case BANK_LOADED:
// bank is yet in memory
pBankDescr->eState=BANK_LOADED;
break;
case BANK_TO_BE_LOADED:
//confirm bank to be loaded
break;
case BANK_NOT_LOADED:
//babl to be loaded
pBankDescr->eState=BANK_TO_BE_LOADED;
break;
default:
snd_assert(FALSE);
break;
}
return TRUE;
#else //SNDLDBIN
return FALSE;
#endif
}
// Ends the changes of loaded banks list
// loads wished banks if not yet loaded
// unloads unwished banks if loaded
// keeps wished banks if yet loaded
SndBool SND_CALL SND_fn_bEndLoadBanks(void)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr,pBankDescrNext;
int i;
//first: load or unload datas
SNDLST2_M_DynamicForEachMovingElementOf(&SND_g_dBankDescriptionList.pList,pBankDescr,pBankDescrNext,i)
{
switch (pBankDescr->eState)
{
case BANK_WAITING:
// We must unload this bank:
SND_fn_bUnLoadBinaryBank(pBankDescr->iId);
break;
case BANK_TO_BE_LOADED:
// We must finish this bank's load:
if (!fn_bLoadDataBankWithoutResolve(pBankDescr))
{
SND_fn_bUnLoadBinaryBank(pBankDescr->iId);
}
else
pBankDescr->eState=BANK_LOADING;
break;
case BANK_LOADED:
//nothing to do
break;
default:
snd_assert(FALSE);
break;
}
}
//second: resolve pointer
SNDLST2_M_DynamicForEachElementOf(&SND_g_dBankDescriptionList.pList,pBankDescr,i)
{
switch (pBankDescr->eState)
{
case BANK_LOADING:
// We must unload this bank:
fn_bResolveBankPointer(pBankDescr);
pBankDescr->eState=BANK_LOADED;
break;
case BANK_LOADED:
//nothing to do
break;
default:
snd_assert(FALSE);
break;
}
}
return TRUE;
#else //SNDLDBIN
return FALSE;
#endif
}
// LoadBinaryBank: simply loads a binary bank (only one pass)
SndBool SND_CALL SND_fn_bLoadBinaryBank(int _iBank)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr;
pBankDescr=fn_pstGetBankDescriptor(_iBank);
if (pBankDescr==NULL)
pBankDescr=fn_pstAddBankDescriptor(_iBank,BANK_ALL_LEVEL);
if (pBankDescr->eState!=BANK_LOADED)
{
pBankDescr->eState=BANK_TO_BE_LOADED;
if (fn_bLoadDataBankWithoutResolve(pBankDescr))
{
pBankDescr->eState=BANK_LOADING;
if (fn_bResolveBankPointer(pBankDescr))
pBankDescr->eState=BANK_LOADED;
else
{
SND_fn_bUnLoadBinaryBank(_iBank);
return FALSE;
}
}
else
{
SND_fn_bUnLoadBinaryBank(_iBank);
return FALSE;
}
}
return TRUE;
#else
return FALSE;
#endif
}
// UnLoadBinaryBank: simply unload a binary bank (only one pass)
// destroy BankDescriptorElement
SndBool SND_CALL SND_fn_bUnLoadBinaryBank(int _iBank)
{
#ifndef NO_ACP_LDBIN
p_tdstSndBankDescriptorElement pBankDescr;
tduBlockResource *pRes;
int iPos;
pBankDescr=fn_pstGetBankDescriptor(_iBank);
if (pBankDescr==NULL)
return FALSE;
if (pBankDescr->pData!=NULL)
{
SNDLST2_M_StaticForEachElementOf( &(pBankDescr->pData->stResList), pRes, iPos)
{
SND_fn_vStopBeforeUnLoadResSnd(&pRes->stMem);
}
SNDLST2_M_StaticForEachElementOf( &(pBankDescr->pData->stResList), pRes, iPos)
{
SND_fn_vUnLoadResSnd(&pRes->stMem);
}
// free the bank:
SND_fn_vFreeSnd(pBankDescr->pData);
}
SNDLST2_M_DynamicIsolate(pBankDescr);
SND_fn_vFreeSnd(pBankDescr);
return TRUE;
#else
return FALSE;
#endif
}
#ifndef NO_ACP_LDBIN
EvtGrpDesc *SND_gs_pEventGroupData=NULL;
unsigned long SND_gs_ulEventGroupCount=0;
EvtGrpDesc *SND_fn_pstGetEventGroupData(void)
{
return SND_gs_pEventGroupData;
}
void SND_fn_vSetEventGroupData(EvtGrpDesc *_pData)
{
SND_gs_pEventGroupData=_pData;
}
unsigned long SND_fn_ulGetEventGroupCount(void)
{
return SND_gs_ulEventGroupCount;
}
void SND_fn_vSetEventGroupCount(unsigned long _ulCount)
{
SND_gs_ulEventGroupCount=_ulCount;
}
#ifndef SND_HYBRID_VERSION
// BINARY VERSION INIT:
SndBool SND_fn_bInitDataLoadSnd(const char *_szFileTitle)
{
return TRUE;
}
#endif //SND_HYBRID_VERSION
#endif //NO_ACP_LDBIN
unsigned long SND_fn_ulGetBinIdFromEditorId(unsigned long _ulEvtId)
{
#ifndef NO_ACP_LDBIN
unsigned long ulEvtGrpId,ulEvtId;
EvtGrpDesc *pEventGroupElement,*pLastEventGroupElement;
unsigned long *pData,*pLastData;
// Make sure convertion table has been loaded:
if (SND_gs_pEventGroupData==NULL) return SND_INVALID_BINID;
ulEvtGrpId=(_ulEvtId)>>16;
ulEvtId=_ulEvtId&0xFFFF;
pEventGroupElement=SND_gs_pEventGroupData;
pLastEventGroupElement=pEventGroupElement+SND_gs_ulEventGroupCount;
while (pEventGroupElement<pLastEventGroupElement)
{
if (pEventGroupElement->ulId==ulEvtGrpId)
{
// Event group found : scan it:
pData=(unsigned long*)(((char*)pEventGroupElement)+pEventGroupElement->ulOffset);
pLastData=pData+pEventGroupElement->ulNbEvents*2;
while (pData<pLastData)
{
if ((*pData)==ulEvtId) return (*(pData+1));
pData+=2;
}
return SND_INVALID_BINID;
}
pEventGroupElement++;
}
#endif //NO_ACP_LDBIN
return SND_INVALID_BINID;
}
SND_tdxHandleToSoundEvent SND_fn_hGetSoundEventHandleFromEditorId(unsigned long _ulEvtId)
{
#ifndef NO_ACP_LDBIN
unsigned long ulBinId;
ulBinId=SND_fn_ulGetBinIdFromEditorId(_ulEvtId);
return ((SND_tdxHandleToSoundEvent)SND_fn_pGetBinEvent(ulBinId));
#else NO_ACP_LDBIN
return NULL;
#endif //NO_ACP_LDBIN
}
#ifdef NO_ACP_LDBIN
unsigned long SND_fn_ulGetEventBinIdFromSectionName(const char *szSectionName)
{
return SND_INVALID_BINID;
}
#endif
#ifndef SND_HYBRID_VERSION
// Get ptr onto resource from ist editor-id
// return NULL when resource cannot be solved
tdstBlockResourceMem* SND_fn_pstGetResFromEdIdSnd(unsigned long ulEdId)
{
p_tdstSndBankDescriptorElement pBankDescr;
tduBlockResource* pRes;
int i,j;
SNDLST2_M_DynamicForEachElementOf(&SND_g_dBankDescriptionList.pList,pBankDescr,i)
{
SNDLST2_M_StaticForEachElementOf(&(pBankDescr->pData->stResList),pRes,j)
{
if (pRes->stMem.Id==ulEdId)
return &(pRes->stMem);
}
}
return NULL;
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,23 @@
/*
//////////////////////////////////////////////////////
// SNDRND.CXX - Librairie SOUNDxd version 2.0 //
//////////////////////////////////////////////////////
// G<>n<EFBFBD>ration de nombres al<61>atoires //
//////////////////////////////////////////////////////
*/
#include "SNDinc.h"
#include "sndrnd.h"
#include <stdlib.h>
//---------------------------------------------------------
// G<>n<EFBFBD>ration d'un SndReal al<61>atoire de valeur comprise entre 0.0 et max
//---------------------------------------------------------
SndReal SND_fn_rGetRandomSnd(SndReal max)
{
return SND_fn_rMulRealRealQuickSnd(
SND_fn_rDivRealRealSnd(rand(),RAND_MAX)
,max);
}

View File

@@ -0,0 +1,160 @@
#include "SNDinc.h"
#include <windows.h>
#include <mmsystem.h>
#include "sndtest.h"
//---test WinMM-driver capabilities
#ifdef __WATCOMC__
#define CPUID "db 0x0F"\
"db 0x0a2"\
void IsPentiumOrMMX(BOOL *bIsPentiumOrBetter, BOOL *IsMMX);
#pragma aux IsPentiumOrMMX=\
"pushfd"\
"pop eax"\
"mov ebx,eax"\
"xor eax,00200000h"\
"push eax"\
"popfd"\
"pushfd"\
"pop eax"\
"push ebx"\
"popfd"\
"and eax,00200000h"\
"and ebx,00200000h"\
"cmp eax,ebx"\
"jne IsPent"\
"mov dword ptr [esi],00h "\
"mov dword ptr [edi],00h"\
"jmp Done"\
"IsPent :"\
"mov dword ptr [esi],01h "\
"mov eax,01h"\
CPUID\
"test edx,00800000h"\
"jnz IsMmx"\
"mov dword ptr [edi],00h"\
"jmp Done"\
"IsMmx:"\
"mov dword ptr [edi],01h"\
"Done:"\
parm [esi] [edi]\
modify [ebx eax edx]
#else
#define CPUID __asm _emit 0x0F __asm _emit 0x0a2
void IsPentiumOrMMX(BOOL *bIsPentiumOrBetter, BOOL *IsMMX)
{
__asm{
pushfd
mov esi,bIsPentiumOrBetter
mov edi,IsMMX
pop eax
mov ebx,eax
xor eax,00200000h
push eax
popfd
pushfd
pop eax
push ebx
popfd
and eax,00200000h
and ebx,00200000h
cmp eax,ebx
jne IsPent
mov dword ptr [esi],00h
mov dword ptr [edi],00h
jmp Done
IsPent:
mov dword ptr [esi],01h
mov eax,01h
CPUID
test edx,00800000h
jnz IsMmx
mov dword ptr [edi],00h
jmp Done
IsMmx:
mov dword ptr [edi],01h
Done:
}
}
#endif
BOOL SND_CALL SND_fn_bTestSnd_Pentium(void)
{
BOOL bMMX,bP5;
IsPentiumOrMMX(&bP5,&bMMX);
return bP5;
}
BOOL SND_CALL SND_fn_bTestSnd_MMX(void)
{
BOOL bMMX,bP5;
IsPentiumOrMMX(&bP5,&bMMX);
return (bP5 && bMMX);
}
BOOL SND_CALL SND_fn_bTestSnd_WinMM(WAVEFORMATEX *format)
{
MMRESULT res;
WAVEOUTCAPS DevCaps;
long winmm_const[12]={WAVE_FORMAT_1M08,WAVE_FORMAT_1S08
,WAVE_FORMAT_1M16,WAVE_FORMAT_1S16
,WAVE_FORMAT_2M08,WAVE_FORMAT_2S08
,WAVE_FORMAT_2M16,WAVE_FORMAT_2S16
,WAVE_FORMAT_4M08,WAVE_FORMAT_4S08
,WAVE_FORMAT_4M16,WAVE_FORMAT_4S16};
long id_winmm_const;
if ((res=waveOutGetDevCaps(WAVE_MAPPER,&DevCaps,sizeof(DevCaps)))==MMSYSERR_NOERROR)
{
id_winmm_const=(format->nChannels-1)
+(2*(format->wBitsPerSample/8-1))
+((format->nSamplesPerSec<=11025)?0:((format->nSamplesPerSec<=22050)?4:8));
if (DevCaps.dwFormats & winmm_const[id_winmm_const])
return TRUE;
}
return FALSE;
}
BOOL SND_CALL SND_fn_bTestSnd_Win32(void)
{
OSVERSIONINFO ver;
memset(&ver,0,sizeof(OSVERSIONINFO));
ver.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
GetVersionEx(&ver);
if (ver.dwPlatformId==VER_PLATFORM_WIN32s)
return FALSE;
return TRUE;
}
BOOL SND_CALL SND_fn_bTestSnd_WinNT(void)
{
OSVERSIONINFO ver;
memset(&ver,0,sizeof(OSVERSIONINFO));
ver.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
GetVersionEx(&ver);
if (ver.dwPlatformId==VER_PLATFORM_WIN32_NT)
return TRUE;
return FALSE;
}

View File

@@ -0,0 +1,450 @@
#include "SND\snddef.h"
#include "SNDinc.h"
#include "snd.h"
#include <windows.h>
#include <process.h>
#include "sndthrd.h"
typedef struct {
SND_td_pfn_vSoundCallback pfnFunction;
long lParam;
} stThreadCallbackParam;
static HANDLE g_hMutexSnd=NULL;
static BOOL g_bFlagSnd=FALSE; //mis <20> TRUE quand un WaitForSingleObjet <20> r<>ussi (sera <20> TRUE pour 2 WaitForSingle r<>antrant)
static BOOL g_bAnOtherThreadWaiting=FALSE; //mis <20> TRUE quand une Thread est sur WaitForSingleObject
static char szLastFileCalling[128]={""};
static int szLastLineCalling=0;
static DWORD dwLastThreadCalling=0;
static BOOL g_bInitDone=FALSE;
static CRITICAL_SECTION CriticalSectionForError;
static HANDLE hEventForError=NULL;
static char szLastFileCallingEvent[128]={""};
static int szLastLineCallingEvent=0;
static DWORD dwLastThreadCallingEvent=0;
void SND_fn_vInitCriticalSectionForErrorDisplay();
void SND_fn_vDesInitCriticalSectionForErrorDisplay();
//---------------------------------------
// Init la gestion de section critique
//---------------------------------------
void SND_CALL SND_fn_vInitThreadSnd(void)
{
g_hMutexSnd=CreateMutex(NULL,TRUE,NULL);
g_bFlagSnd=FALSE;
g_bInitDone=TRUE;
g_bAnOtherThreadWaiting=FALSE;
SND_fn_vInitCriticalSectionForErrorDisplay();
}
//---------------------------------------
// DesInit la gestion de section critique
//---------------------------------------
void SND_CALL SND_fn_vDesInitThreadSnd(void)
{
HANDLE tmp_g_hMutexSnd;
SND_fn_vDesInitCriticalSectionForErrorDisplay();
tmp_g_hMutexSnd=g_hMutexSnd;
g_hMutexSnd=NULL;
ReleaseMutex(tmp_g_hMutexSnd);
CloseHandle(tmp_g_hMutexSnd);
}
//-----------------------------------------
// Note le dernier appel <20> EnterCriticalSection
//------------------------------------------
void SND_CALL SND_fn_vMouchardThreadsnd(char* file,int line)
{
strncpy(szLastFileCalling,file,sizeof(szLastFileCalling));
szLastLineCalling=line;
dwLastThreadCalling=GetCurrentThreadId();
}
//-----------------------------------------
// Note le dernier lockeur de l'Event
//------------------------------------------
void SND_CALL SND_fn_vMouchardThreadsndEvent(char* file,int line)
{
strncpy(szLastFileCallingEvent,file,sizeof(szLastFileCallingEvent));
szLastLineCallingEvent=line;
dwLastThreadCallingEvent=GetCurrentThreadId();
}
//-----------------------------------------
// Entr<74>e en section critique (bloquant <20> l'infini)
//------------------------------------------
void SND_CALL SND_fn_vEnterCriticalSectionThreadSnd_(void)
{
DWORD dwRet;
DWORD dwErr;
DWORD delay;
char texte[256];
if (!g_bInitDone)
SND_fn_vDisplayError(E_uwSndInitNotDoneError,"");
if (g_hMutexSnd!=NULL)
{
delay=INFINITE;
if ((dwRet=WaitForSingleObject(g_hMutexSnd,delay))==WAIT_OBJECT_0)
{
g_bAnOtherThreadWaiting=FALSE;
g_bFlagSnd=TRUE;
return;
}
g_bAnOtherThreadWaiting=FALSE;
dwErr=GetLastError();
sprintf(texte,"Last call by thread %x (line %d of %s)",dwLastThreadCalling,szLastLineCalling,szLastFileCalling);
SND_fn_vDisplayError(E_uwSndThreadDeadLockError,texte);
return;
}
SND_fn_vDisplayError(E_uwSndThreadMultiThreadDetectedError,texte);
}
/*
void SND_CALL SND_fn_vEnterCriticalSectionWithMsgPumpThreadSnd()
{
DWORD dwRet;
DWORD delay;
#ifdef DEBUG_SON
static BOOL bReentraceDetected=FALSE;
#endif
char texte[256];
MSG msg;
if (!g_bInitDone)
SND_fn_vDisplayError(E_uwSndInitNotDoneError,"");
if (g_hMutexSnd!=NULL)
{
#ifdef DEBUG_SON
dwRet=WaitForSingleObject(g_hMutexSnd,0);
if (dwRet==WAIT_OBJECT_0)
{//l'objet a pu <20>tre lock<63>
if (g_bFlagSnd)
{//reentrance detected
if (!bReentraceDetected)
{//first reentrance (single case)
bReentraceDetected=TRUE;
sprintf(texte,"Last call by thread %x (line %d of %s)",dwLastThreadCalling,szLastLineCalling,szLastFileCalling,szLastLineCalling);
DebugBreak();
SND_fn_vDisplayError(E_uwSndThreadReentranceDetectedError,
texte);
}
else
//critical reentrance detected !!!!!!!!!!!!!!!!!!!!!!!!!!
//if you don't stop this, a stack overflow may occur
DebugBreak();
}
g_bFlagSnd=TRUE;
return;
}
//l'objet n'est pas disponible
#endif //DEBUG_SON
delay=10;
//for debugging
sprintf(texte,"Last call by thread %x (line %d of %s)",dwLastThreadCalling,szLastLineCalling,szLastFileCalling);
while (TRUE)
{
dwRet=WaitForSingleObject(g_hMutexSnd,delay);
if (dwRet==WAIT_OBJECT_0)
{
g_bAnOtherThreadWaiting=FALSE;
g_bFlagSnd=TRUE;
return;
}
while (PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
//to allow other applications to run
Sleep(10);
}
// g_bAnOtherThreadWaiting=FALSE;
}
//SND_fn_vDisplayError(E_uwSndThreadMultiThreadDetectedError,texte);
}
*/
// Attente du mutex pendant un temps limit<69>
// si mutex dispo, lockage et return TRUE
// si mutex non dispo au bout du temps, return FALSE
// Pas de protection contre la r<>entrance (cas particulier de DisplayError)
// Appel<65>e uniquement pour Release Driver
SndBool SND_CALL SND_fn_bTryToEnterCriticalSectionThreadSnd()
{
DWORD dwRet;
DWORD dwErr;
DWORD delay;
// static BOOL bReentraceDetected=FALSE;
char texte[256];
if (!g_bInitDone)
SND_fn_vDisplayError(E_uwSndInitNotDoneError,"");
if (g_hMutexSnd!=NULL)
{
#ifdef DEBUG_SON
dwRet=WaitForSingleObject(g_hMutexSnd,0);
if (dwRet==WAIT_OBJECT_0)
{//l'objet a pu <20>tre lock<63>
g_bFlagSnd=TRUE;
return TRUE;
}
//l'objet n'est pas disponible
#endif //DEBUG_SON
delay=100;
sprintf(texte,"Last call by thread %x (line %d of %s)",dwLastThreadCalling,szLastLineCalling,szLastFileCalling);
dwRet=WaitForSingleObject(g_hMutexSnd,delay);
if (dwRet==WAIT_OBJECT_0)
{
g_bAnOtherThreadWaiting=FALSE;
g_bFlagSnd=TRUE;
return TRUE;
}
g_bAnOtherThreadWaiting=FALSE;
#ifdef DEBUG_SON
/*
DebugBreak();
if (Erm_fn_iMessageBox(HWND_DESKTOP,"Do you want to retry fo infinite Time ?","Possible DeadLock",MB_YESNO)==IDYES)
if ((dwRet=WaitForSingleObject(g_hMutexSnd,INFINITE))==WAIT_OBJECT_0)
{
g_bFlagSnd=TRUE;
return TRUE;
}
*/
#endif
dwErr=GetLastError();
SND_fn_vDisplayError(E_uwSndSystemError,"DeadLock occured when waiting for Sound Mutex !\nProgram will continue although");
return FALSE;
}
SND_fn_vDisplayError(E_uwSndThreadMultiThreadDetectedError,texte);
return FALSE;
}
//---------------------------------------
// Sortie d'une section critique
//--------------------------------------
void SND_CALL SND_fn_vQuitCriticalSectionThreadSnd(void)
{
g_bFlagSnd=FALSE;
ReleaseMutex(g_hMutexSnd);
}
//----------------------------------------
// Attente bloquante (mais discr<63>te) qu'un pointeur prenne la bonne valeur
//----------------------------------------------
void SND_CALL SND_fn_vWaitForValueThreadSnd(long* ptr,long val)
{
int cmpt=0;
while ((*ptr!=val) && (cmpt<10))
{
cmpt++;
Sleep(100);
}
if (*ptr==val)
return;
else
{
SND_fn_vDisplayError(E_uwSndThreadDeadLockError,"");
}
}
void SND_fn_vInitCriticalSectionForErrorDisplay(void)
{
InitializeCriticalSection(&CriticalSectionForError);
hEventForError=CreateEvent(NULL,TRUE,FALSE,NULL);
}
void SND_fn_vDesInitCriticalSectionForErrorDisplay(void)
{
HANDLE tmp_hEventForError=hEventForError;
LeaveCriticalSection(&CriticalSectionForError);
DeleteCriticalSection(&CriticalSectionForError);
hEventForError=NULL;
ResetEvent(tmp_hEventForError);
CloseHandle(tmp_hEventForError);
}
void SND_CALL SND_fn_vEnterCriticalSectionForErrorDisplay(void)
{
EnterCriticalSection(&CriticalSectionForError);
SetEvent(hEventForError);
SND_fn_vMouchardThreadsndEvent(__FILE__,__LINE__);
}
void SND_CALL SND_fn_vQuitCriticalSectionForErrorDisplay(void)
{
ResetEvent(hEventForError);
LeaveCriticalSection(&CriticalSectionForError);
}
//attente semi-bloquante sp<73>cifique aux fonction Release/RestoreDriver
SndBool SND_CALL SND_fn_bEnterCriticalSectionForDriverThreadSnd(void)
{
DWORD dwRet;
DWORD delay;
// static BOOL bReentraceDetected=FALSE;
char texte[256];
HANDLE a_hMutex[2];
if (!g_bInitDone)
SND_fn_vDisplayError(E_uwSndInitNotDoneError,"");
if (g_hMutexSnd!=NULL && hEventForError!=NULL)
{
sprintf(texte,"Last call by thread %x (line %d of %s)",dwLastThreadCalling,szLastLineCalling,szLastFileCalling);
//tentative de lock avec abandon si le mutex de DisplayError se lib<69>re
delay=INFINITE;
a_hMutex[0]=g_hMutexSnd;
a_hMutex[1]=hEventForError;
dwRet=WaitForMultipleObjects(2,a_hMutex,FALSE,delay);
if (dwRet==WAIT_OBJECT_0)
{//le mutex SND a pu <20>tre lock<63>
if (WaitForSingleObject(hEventForError,0)!=WAIT_OBJECT_0)
{
g_bAnOtherThreadWaiting=FALSE;
g_bFlagSnd=TRUE;
return TRUE;
}
else
{//event DisplayError non dispnible
ReleaseMutex(g_hMutexSnd);
return FALSE;
}
}
if (dwRet==WAIT_OBJECT_0+1)
{//error en cours de display->abandon
return FALSE;
}
return FALSE;
}
return FALSE;
/*
DWORD dwRet;
DWORD delay;
static BOOL bReentraceDetected=FALSE;
char texte[256];
HANDLE a_hMutex[2];
if (!g_bInitDone)
SND_fn_vDisplayError(E_uwSndInitNotDoneError,"");
if (g_hMutexSnd!=NULL && SND_g_hErrorDisplayMutexSnd!=NULL)
{
sprintf(texte,"Last call by thread %x (line %d of %s)",dwLastThreadCalling,szLastLineCalling,szLastFileCalling);
//1<>:tentative de lock non bloquante du mutex g<>n<EFBFBD>
delay=0;
dwRet=WaitForSingleObject(g_hMutexSnd,delay);
if (dwRet==WAIT_OBJECT_0)
{//Mutex SND lock<63> avec succ<63>s: tout est OK
g_bAnOtherThreadWaiting=FALSE;
g_bFlagSnd=TRUE;
return TRUE;
}
//2<>:tentative de lock avec abandon si le mutex de DisplayError se lib<69>re
delay=INFINITE;
a_hMutex[0]=g_hMutexSnd;
a_hMutex[1]=SND_g_hErrorDisplayMutexSnd;
dwRet=WaitForMultipleObjects(2,a_hMutex,FALSE,delay);
if (dwRet==WAIT_OBJECT_0)
{//le mutex SND a pu <20>tre lock<63>
ReleaseMutex(SND_g_hErrorDisplayMutexSnd);
g_bAnOtherThreadWaiting=FALSE;
g_bFlagSnd=TRUE;
return TRUE;
}
if (dwRet==WAIT_OBJECT_0+1)
{//error en cours de display->abandon
return FALSE;
}
return FALSE;
}
return FALSE;
*/
}
void __cdecl SND_fn_vCallbackThread( stThreadCallbackParam* pstParam)
{
(*(pstParam->pfnFunction))(pstParam->lParam);
SND_fn_vFreeSnd(pstParam);
}
//appel non bloquant d'une fonction de callback (cr<63>ation d'une thread si possible)
/*
void SND_CALL SND_fn_vStartCallbackThreadsnd(SND_td_pfn_vSoundCallback pfn,long param)
{
stThreadCallbackParam* pstParam;
pstParam=SND_fn_pvMallocSnd(sizeof(stThreadCallbackParam));
pstParam->pfnFunction=pfn;
pstParam->lParam=param;
#if defined(__WATCOMC__) && (__WATCOMC__<1100)
_beginthread( SND_fn_vCallbackThread, NULL, 0, (void*)pstParam );
#else
_beginthread( SND_fn_vCallbackThread, 0, (void*)pstParam );
#endif
}
*/

View File

@@ -0,0 +1,12 @@
#include "SNDinc.h"
#include <windows.h>
#include <stdio.h>
//#include "_SndEng.h"
HWND hwndMainSnd=NULL;
HINSTANCE SND_g_hResourceHandle=NULL;
HINSTANCE SND_hGlobalInst=NULL;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,258 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// French (France) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE LANG_FRENCH, SUBLANG_FRENCH
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_SUPERVISATER DIALOG DISCARDABLE 0, 0, 449, 289
STYLE DS_MODALFRAME | WS_CAPTION
CAPTION "Micros & Objects debuging report"
FONT 8, "Arial"
BEGIN
CONTROL "List2",IDC_LISTMICRO,"SysListView32",LVS_REPORT |
LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,10,0,432,45
CONTROL "List3",IDC_LISTOBJECT,"SysListView32",LVS_REPORT |
LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,10,50,432,125
PUSHBUTTON "Auto-Refresh",IDC_AUTOREFRESH,50,181,75,15
PUSHBUTTON "Refresh",IDC_REFRESH,160,180,65,15
CONTROL "Delete Objects when no event",IDC_DELETEOBJECTS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,245,180,155,10
PUSHBUTTON "Events Supervisater",IDC_SUPERVISATER,150,210,70,15,
WS_DISABLED
PUSHBUTTON "Resources states",IDC_RESOURCES,85,210,60,15
PUSHBUTTON "Close SUPERVISATER",IDC_CLOSE,190,235,80,15
PUSHBUTTON "Events historic",IDC_HISTORIC,20,210,60,15
PUSHBUTTON "Other",IDC_INFORMATIONS,225,210,60,14
PUSHBUTTON "Virtual voices",IDC_VISUVIRT,290,210,60,14
PUSHBUTTON "Go to ForeGround",IDC_TOPMOST,10,260,350,19
END
IDD_HISTORIC DIALOGEX 0, 0, 522, 351
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
CAPTION "Historic of Sound Events"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_LISTE,"SysListView32",LVS_REPORT |
LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING |
WS_BORDER | WS_TABSTOP,5,5,510,170
PUSHBUTTON "Purge Totale",IDC_PURGETOTALE,161,250,80,15
PUSHBUTTON "Events Supervisater",IDC_SUPERVISATER,150,270,70,16
PUSHBUTTON "Resources states",IDC_RESOURCES,85,270,60,16
PUSHBUTTON "Close SUPERVISATER",IDC_CLOSE,180,295,80,16
LTEXT "Static",IDC_CURRENTTIME,55,250,70,10,0,WS_EX_CLIENTEDGE
LTEXT "Current Time:",IDC_STATIC,5,250,45,10
CONTROL "display evt",IDC_FILTREEVT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,10,200,49,10
EDITTEXT IDC_FILTREEVTVAL,65,200,60,12,ES_AUTOHSCROLL
CONTROL "display obj",IDC_FILTREOBJ,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,135,200,49,10
EDITTEXT IDC_FILTREOBJVAL,191,200,60,12,ES_AUTOHSCROLL
CONTROL "display type",IDC_FILTREEVTTYPE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,260,200,55,10
EDITTEXT IDC_FILTREEVTTYPEVAL,320,200,60,12,ES_AUTOHSCROLL
PUSHBUTTON "Purge > 20 secondes",IDC_PURGE20,281,250,95,15
CONTROL "display only the most recent ones",IDC_MOSTRECENT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,215,120,11
EDITTEXT IDC_NBMOSTRECENT,133,214,35,12,ES_AUTOHSCROLL
CONTROL "DebugBreak on next evt",IDC_DEBUGBREAK,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,185,215,95,10
PUSHBUTTON "Events historic",IDC_HISTORIC,20,270,60,16,WS_DISABLED
PUSHBUTTON "Other",IDC_INFORMATIONS,225,270,60,15
CONTROL "Select resource for Editor",IDC_SELECTRESOURCE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,10,180,130,10
LTEXT "Selected resource:",IDC_STATIC,145,180,60,10
LTEXT "Static",IDC_SELECTEDRESOURCE,205,180,90,10
PUSHBUTTON "Virtual voices",IDC_VISUVIRT,290,270,60,15
CONTROL "Dispay only first occurence of events",
IDC_FIRSTEVENTONLY,"Button",BS_AUTOCHECKBOX |
BS_LEFTTEXT | WS_TABSTOP,10,230,140,10
CONTROL "Dispay only first occurence of resources",
IDC_FIRSTRESONLY,"Button",BS_AUTOCHECKBOX | BS_LEFTTEXT |
WS_TABSTOP,240,230,145,10
PUSHBUTTON "Go to ForeGround",IDC_TOPMOST,5,325,350,20
END
IDD_VISUSND DIALOG DISCARDABLE 0, 0, 457, 423
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Wave voices visualisater"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_LISTE,"SysListView32",LVS_REPORT | WS_BORDER |
WS_TABSTOP,5,25,445,280
PUSHBUTTON "Auto-Refresh",IDC_AUTOREFRESH,45,321,75,16
PUSHBUTTON "Refresh",IDC_REFRESH,255,320,65,16
PUSHBUTTON "Events Supervisater",IDC_SUPERVISATER,155,350,70,16
PUSHBUTTON "Resources states",IDC_RESOURCES,91,350,60,16,
WS_DISABLED
PUSHBUTTON "Close SUPERVISATER",IDC_CLOSE,185,370,80,16
PUSHBUTTON "Events historic",IDC_HISTORIC,25,350,60,16
PUSHBUTTON "Other",IDC_INFORMATIONS,231,350,60,15
PUSHBUTTON "Virtual voices",IDC_VISUVIRT,295,350,60,15
LTEXT "Process time for all WAVE voices:",IDC_STATIC,5,5,110,
10
LTEXT "Static",IDC_PROCESSTIME,120,5,45,10
PUSHBUTTON "Go to ForeGround",IDC_TOPMOST,5,395,350,20
END
IDD_DIVERS DIALOG DISCARDABLE 0, 0, 397, 255
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Other informations"
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Current Theme:",IDC_STATIC,15,10,50,10
LTEXT "none",IDC_CURRENT_THEME,80,10,70,10
LTEXT "Current Part:",IDC_STATIC,170,10,40,10
LTEXT "none",IDC_CURRENT_PART,220,10,45,10
LTEXT "Current Bridge:",IDC_STATIC,280,10,50,10
LTEXT "none",IDC_CURRENT_BRIDGE,335,10,40,10
CONTROL "List1",IDC_LISTE,"SysListView32",LVS_REPORT | WS_BORDER |
WS_TABSTOP,15,60,155,125
CTEXT "Volume Lines",IDC_STATIC,25,45,130,10
PUSHBUTTON "Events Supervisater",IDC_SUPERVISATER,130,200,70,16
PUSHBUTTON "Resources states",IDC_RESOURCES,65,200,60,16
PUSHBUTTON "Close SUPERVISATER",IDC_CLOSE,295,160,80,16
PUSHBUTTON "Events historic",IDC_HISTORIC,0,200,60,16
PUSHBUTTON "Other",IDC_INFORMATIONS,205,200,60,15,WS_DISABLED
LTEXT "Asked Theme:",IDC_STATIC,15,25,50,15
LTEXT "none",IDC_ASKED_THEME,75,25,75,10
LTEXT "State:",IDC_STATIC,170,25,25,10
LTEXT "unknown",IDC_STATE_THEME,200,25,165,10
PUSHBUTTON "Virtual voices",IDC_VISUVIRT,270,200,60,15
PUSHBUTTON "Go to ForeGround",IDC_TOPMOST,5,230,350,20
END
IDD_VISUVIRT DIALOG DISCARDABLE 0, 0, 422, 295
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Virtual Visualisater"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "List1",IDC_LISTVV,"SysListView32",LVS_REPORT |
WS_BORDER | WS_TABSTOP,5,25,395,190
PUSHBUTTON "Events Supervisater",IDC_SUPERVISATER,150,225,70,16
PUSHBUTTON "Resources states",IDC_RESOURCES,86,225,60,16
PUSHBUTTON "Close SUPERVISATER",IDC_CLOSE,180,245,80,16
PUSHBUTTON "Events historic",IDC_HISTORIC,20,225,60,16
PUSHBUTTON "Other",IDC_INFORMATIONS,226,225,60,15
PUSHBUTTON "Virtual voices",IDC_VISUVIRT,290,225,60,15,WS_DISABLED
COMBOBOX IDC_LISTEMODULE,7,7,228,130,CBS_DROPDOWN | WS_VSCROLL |
WS_TABSTOP
LTEXT "Nb voix virtuelles/nb voix maxi.:",IDC_STATIC,245,10,
100,10
LTEXT "0",IDC_NBVOIX,350,10,45,10
PUSHBUTTON "Go to ForeGround",IDC_TOPMOST,5,270,350,20
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_SUPERVISATER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 442
TOPMARGIN, 7
BOTTOMMARGIN, 282
END
IDD_HISTORIC, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 515
TOPMARGIN, 7
BOTTOMMARGIN, 344
END
IDD_VISUSND, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 450
TOPMARGIN, 7
BOTTOMMARGIN, 416
END
IDD_DIVERS, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 390
TOPMARGIN, 7
BOTTOMMARGIN, 248
END
IDD_VISUVIRT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 415
TOPMARGIN, 7
BOTTOMMARGIN, 288
END
END
#endif // APSTUDIO_INVOKED
#endif // French (France) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1 @@
#include <windows.h>

View File

@@ -0,0 +1,60 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by debuging.rc
//
#define IDD_SUPERVISATER 101
#define IDD_HISTORIC 102
#define IDD_VISUSND 103
#define IDD_DIVERS 104
#define IDD_VISUVIRT 105
#define IDC_LISTMICRO 1001
#define IDC_LISTOBJECT 1002
#define IDC_AUTOREFRESH 1003
#define IDC_REFRESH 1004
#define IDC_DELETEOBJECTS 1005
#define IDC_HISTORIC 1007
#define IDC_RESOURCES 1008
#define IDC_CLOSE 1009
#define IDC_LISTE 1010
#define IDC_PURGETOTALE 1011
#define IDC_SUPERVISATER 1012
#define IDC_CURRENTTIME 1013
#define IDC_FILTREEVT 1014
#define IDC_FILTREEVTVAL 1015
#define IDC_FILTREOBJ 1016
#define IDC_FILTREOBJVAL 1017
#define IDC_FILTREEVTTYPE 1018
#define IDC_FILTREEVTTYPEVAL 1019
#define IDC_PURGE20 1020
#define IDC_MOSTRECENT 1022
#define IDC_NBMOSTRECENT 1023
#define IDC_DEBUGBREAK 1024
#define IDC_CURRENT_THEME 1025
#define IDC_CURRENT_PART 1026
#define IDC_CURRENT_BRIDGE 1027
#define IDC_INFORMATIONS 1029
#define IDC_ASKED_THEME 1030
#define IDC_STATE_THEME 1031
#define IDC_SELECTRESOURCE 1032
#define IDC_SELECTEDRESOURCE 1033
#define IDC_LISTVV 1035
#define IDC_VISUVIRT 1037
#define IDC_PROCESSTIME 1038
#define IDC_LISTEMODULE 1041
#define IDC_NBVOIX 1042
#define IDC_FIRSTEVENTONLY 1043
#define IDC_FIRSTRESONLY 1044
#define IDC_BUTTON1 1045
#define IDC_TOPMOST 1045
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 107
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1046
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

View File

@@ -0,0 +1,611 @@
// EventsHistoryPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "EventsHistoryPage.h"
//included for _chdir
#include <direct.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEventsHistoryPage property page
IMPLEMENT_DYNCREATE(CEventsHistoryPage, CPropertyPage)
CEventsHistoryPage::CEventsHistoryPage() : CPropertyPage(CEventsHistoryPage::IDD)
{
//{{AFX_DATA_INIT(CEventsHistoryPage)
m_bShowBankWithId = FALSE;
m_bShowEventWithId = FALSE;
m_lBankId = 0;
m_lEventId = 0;
m_bDebugBreak = FALSE;
m_bFirstOccurence = FALSE;
m_bWatchMode = FALSE;
m_LCBPath = _T("");
//}}AFX_DATA_INIT
}
CEventsHistoryPage::~CEventsHistoryPage()
{
}
void CEventsHistoryPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CEventsHistoryPage)
DDX_Control(pDX, IDC_WATCH_LIST, m_WatchList);
DDX_Control(pDX, IDC_EVENTS_HISTORY_LIST, m_EventsList);
DDX_Check(pDX, IDC_CHECK_BANK, m_bShowBankWithId);
DDX_Check(pDX, IDC_CHECK_EVENT, m_bShowEventWithId);
DDX_Text(pDX, IDC_EDIT_BANK_ID, m_lBankId);
DDV_MinMaxLong(pDX, m_lBankId, 0, 256);
DDX_Text(pDX, IDC_EDIT_EVENT_ID, m_lEventId);
DDV_MinMaxLong(pDX, m_lEventId, 0, 1024);
DDX_Check(pDX, IDC_CHECK_DEBUG_ON_EVENT, m_bDebugBreak);
DDX_Check(pDX, IDC_CHECK_FIRST_OCCUR, m_bFirstOccurence);
DDX_Check(pDX, IDC_CHECK_WATCH, m_bWatchMode);
DDX_Text(pDX, IDC_EDIT_LCB_PATH, m_LCBPath);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CEventsHistoryPage, CPropertyPage)
//{{AFX_MSG_MAP(CEventsHistoryPage)
ON_BN_CLICKED(IDC_RESET_BUTTON, OnResetButton)
ON_BN_CLICKED(IDC_CHECK_FIRST_OCCUR, OnCheckFirstOccur)
ON_BN_CLICKED(IDC_CHECK_BANK, OnCheckBank)
ON_BN_CLICKED(IDC_CHECK_EVENT, OnCheckEvent)
ON_EN_CHANGE(IDC_EDIT_BANK_ID, OnChangeEditBankId)
ON_EN_CHANGE(IDC_EDIT_EVENT_ID, OnChangeEditEventId)
ON_BN_CLICKED(IDC_HELP_WATCH, OnHelpWatch)
ON_BN_CLICKED(IDC_CHECK_WATCH, OnCheckWatch)
ON_BN_CLICKED(IDC_EMPTY_WATCH, OnEmptyWatch)
ON_BN_CLICKED(IDC_BROWSE_FOR_LCB, OnBrowseForLcb)
ON_BN_CLICKED(IDC_PAUSE_BUTTON, OnPauseButton)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CEventsHistoryPage message handlers
BOOL CEventsHistoryPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Initialise the ClistCtrl containing Events descriptions
LV_COLUMN* lvc;
lvc = (LV_COLUMN*)malloc(sizeof(LV_COLUMN));
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = 75; // width of the column, in pixels
lvc->pszText = "Time"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_EventsList.InsertColumn(0, lvc);
lvc->pszText = "Event Name"; // column heading
lvc->cx = 125; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_EventsList.InsertColumn(1, lvc);
lvc->pszText = "Event Id"; // column heading
lvc->cx = 60; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_EventsList.InsertColumn(2, lvc);
lvc->pszText = "Bank Name"; // column heading
lvc->cx = 100; // width of the column, in pixels
lvc->iSubItem = 3; // index of subitem associated with column
m_EventsList.InsertColumn(3, lvc);
lvc->pszText = "Bank Id"; // column heading
lvc->cx = 60; // width of the column, in pixels
lvc->iSubItem = 4; // index of subitem associated with column
m_EventsList.InsertColumn(4, lvc);
lvc->cx = 100; // width of the column, in pixels
lvc->pszText = "Event Type"; // column heading
lvc->iSubItem = 5; // index of subitem associated with column
m_EventsList.InsertColumn(5, lvc);
free( lvc );
//Set the limit length of the edit box
((CEdit *)(GetDlgItem(IDC_EDIT_BANK_ID)))->LimitText(3);
((CEdit *)(GetDlgItem(IDC_EDIT_EVENT_ID)))->LimitText(3);
//Set LCB Edit box
((CEdit *)(GetDlgItem(IDC_EDIT_LCB_PATH)))->SetReadOnly( TRUE );
//Add the LCB Path
if (pSuperVisApp->m_cLCBPath == "NoLCBPath")
m_LCBPath = "No LCB file found in the registry. Select One.";
else
m_LCBPath = pSuperVisApp->m_cLCBPath + pSuperVisApp->m_cLCBFileTitle + ".lcb";
//Init du "pause" mode
m_bPauseProcess = FALSE;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CEventsHistoryPage::RefreshEventsHistoList()
{
long i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Clear the list
m_EventsList.DeleteAllItems();
//Cycle through the pointer Array to filter
for (i = 0; i < pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.GetSize(); i ++ )
{
FilterAndDisplayEvent(i);
}
}
void CEventsHistoryPage::FilterAndDisplayEvent(long lIndex)
{
char buffer[25];
unsigned long ulBankId;
unsigned long ulEventId;
EventsHistElement *evtHisto, *evtHistoFirstOccurTest;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
evtHisto = (EventsHistElement *)(pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.GetAt(lIndex));
ulBankId = (0xFFFF0000 & evtHisto->evt_Id) >> 16;
ulEventId= (0x0000FFFF & evtHisto->evt_Id);
//
//Check if we have have to filter the events
//******************************************
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA, 0, 0);
//If the watch checkBox is checked we need to filter
if(m_bWatchMode)
{
BOOL bIsInWatchList = FALSE;
int i;
int iCount = m_WatchList.GetCount();
//if list is empty with dont display anything
if (iCount == 0)
return;
for (i = 0; i < iCount; i++)
{
//Look through the watch list for the same Event ID
if (evtHisto->evt_Id == (tdxId)m_WatchList.GetItemData(i))
bIsInWatchList = TRUE;
}
//if the event wasnt in the watch list we leave
if(!bIsInWatchList)
return;
}
else
{
if (m_bShowEventWithId)
{
if (m_lEventId != (long)ulEventId)
return;
}
if (m_bShowBankWithId)
{
if (m_lBankId != (long)ulBankId)
return;
}
}
if(m_bFirstOccurence)
{
long i;
//look in the Events array from 0 to the current event we are filtering.
//We dont want to compare it with himself , hence the " -1 " in the loop.
for(i = 0; i < lIndex ; i++)
{
evtHistoFirstOccurTest = (EventsHistElement *)(pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.GetAt(i));
if (evtHisto->evt_Id == evtHistoFirstOccurTest->evt_Id)
return;
}
}
//Check if we have to debugbreak before displaying the events
if(m_bDebugBreak)
{
DebugBreak();
}
//Display time
sprintf(buffer,"%02d:%02d:%02d:%03d",
evtHisto->time.wHour,
evtHisto->time.wMinute,
evtHisto->time.wSecond,
evtHisto->time.wMilliseconds);
m_EventsList.InsertItem( 0, buffer );
//Set the item data with the eventsArray index, to be used later for drag&drop, pop-memnu, etc.
m_EventsList.SetItemData( 0, (DWORD)lIndex );
//Event Name
m_EventsList.SetItem(0, 1, LVIF_TEXT, (LPCSTR)evtHisto->cEvtName, 0, 0, 0, NULL );
//Event ID
sprintf(buffer, "%lu", ulEventId);
m_EventsList.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Bank Name
m_EventsList.SetItem(0, 3, LVIF_TEXT, (LPCSTR)evtHisto->cEvtBankName, 0, 0, 0, NULL );
//Bank ID
sprintf(buffer, "%lu", ulBankId);
m_EventsList.SetItem(0, 4, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Type
switch(evtHisto->evt_eType){
case EVT_SON_STOP_ALL:
sprintf(buffer, "EVT_SON_STOP_ALL");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_STOP_N_GO:
sprintf(buffer, "EVT_SON_STOP_N_GO");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_EFFET:
sprintf(buffer, "EVT_SON_EFFET");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_PITCH:
sprintf(buffer, "EVT_SON_PITCH");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_VOLUME:
sprintf(buffer, "EVT_SON_VOLUME");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_PAN:
sprintf(buffer, "EVT_SON_PAN");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_PLAY:
sprintf(buffer, "EVT_SON_PLAY");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case EVT_SON_STOP:
sprintf(buffer, "EVT_SON_STOP");
m_EventsList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
}
}
void CEventsHistoryPage::OnResetButton()
{
int i;
EventsHistElement* temp;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Free the events history array
for (i= 0; i < pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.GetSize() ;i++)
{
temp = (EventsHistElement *)(pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.GetAt(i));
delete temp;
}
pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.RemoveAll();
//Empty the CListCtrl
m_EventsList.DeleteAllItems();
}
void CEventsHistoryPage::OnCheckFirstOccur()
{
//Update the variable
UpdateData(TRUE);
RefreshEventsHistoList();
}
void CEventsHistoryPage::OnCheckBank()
{
//Update the variable
UpdateData(TRUE);
if (m_bShowBankWithId)
{
GetDlgItem(IDC_CHECK_WATCH)->EnableWindow(FALSE);
}
else
{
GetDlgItem(IDC_CHECK_WATCH)->EnableWindow(TRUE);
}
RefreshEventsHistoList();
}
void CEventsHistoryPage::OnCheckEvent()
{
//Update the variable
UpdateData(TRUE);
if (m_bShowEventWithId)
{
GetDlgItem(IDC_CHECK_WATCH)->EnableWindow(FALSE);
}
else
{
GetDlgItem(IDC_CHECK_WATCH)->EnableWindow(TRUE);
}
RefreshEventsHistoList();
}
void CEventsHistoryPage::OnChangeEditBankId()
{
//Keep the bank Id in the 0 - 256 range
UpdateData(TRUE);
if (m_lBankId > 256)
{
m_lBankId = 256;
UpdateData(FALSE);
}
RefreshEventsHistoList();
}
void CEventsHistoryPage::OnChangeEditEventId()
{
//Keep the Event Id in the 0 - 1024 range
UpdateData(TRUE);
if (m_lEventId > 1024)
{
m_lEventId = 1024;
UpdateData(FALSE);
}
RefreshEventsHistoList();
}
void CEventsHistoryPage::OnHelpWatch()
{
MessageBox("The Watch List allow to show a selected group of events. Right-click on the Events List Historic to add a new events ","Watch List Help",MB_OK);
}
void CEventsHistoryPage::OnCheckWatch()
{
UpdateData(TRUE);
if(m_bWatchMode)
{
//If we are in Watch List mode we disable the normal mode
GetDlgItem(IDC_CHECK_BANK)->EnableWindow(FALSE);
GetDlgItem(IDC_EDIT_BANK_ID)->EnableWindow(FALSE);
GetDlgItem(IDC_CHECK_EVENT)->EnableWindow(FALSE);
GetDlgItem(IDC_EDIT_EVENT_ID)->EnableWindow(FALSE);
}
else
{
GetDlgItem(IDC_CHECK_BANK)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT_BANK_ID)->EnableWindow(TRUE);
GetDlgItem(IDC_CHECK_EVENT)->EnableWindow(TRUE);
GetDlgItem(IDC_EDIT_EVENT_ID)->EnableWindow(TRUE);
}
RefreshEventsHistoList();
}
void CEventsHistoryPage::SendEventInWatchList()
{
unsigned long ulBankId;
unsigned long ulEventId;
int iArrayIndex;
EventsHistElement *evtHisto;
char buffer[50];
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
// The index of the selected item
int i = m_EventsList.GetNextItem( -1, LVNI_ALL | LVNI_SELECTED);
//retrieve the array index
iArrayIndex = m_EventsList.GetItemData(i);
//Retrieve the event
evtHisto = (EventsHistElement *)(pSuperVisApp->m_SuperVisThread->m_apEventHistoArray.GetAt(iArrayIndex));
ulBankId = (0xFFFF0000 & evtHisto->evt_Id) >> 16;
ulEventId= (0x0000FFFF & evtHisto->evt_Id);
sprintf(buffer, "%s E%lu:B%lu",evtHisto->cEvtName, ulEventId, ulBankId);
int iWatchListIndex = m_WatchList.AddString( buffer );
//We associate the event ID with the itemdata of the listbox.
//Will be use to compare when a new event will be add in the
//events Historic list.
m_WatchList.SetItemData(iWatchListIndex, (DWORD)evtHisto->evt_Id);
}
void CEventsHistoryPage::OnEmptyWatch()
{
m_WatchList.ResetContent();
RefreshEventsHistoList();
}
void CEventsHistoryPage::OnBrowseForLcb()
{
BrowseForLcb();
}
BOOL CEventsHistoryPage::PreTranslateMessage(MSG* pMsg)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
if (pMsg->message == WM_USER_UPDATE_DATA){
UpdateData(TRUE);
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
void CEventsHistoryPage::OnPauseButton()
{
if(m_bPauseProcess)
{
m_bPauseProcess = FALSE;
GetDlgItem(IDC_PAUSE_BUTTON)->SetWindowText("&Pause Process");
//We refresh the list to add the event thatwe missed during pause.
RefreshEventsHistoList();
}
else
{
m_bPauseProcess = TRUE;
GetDlgItem(IDC_PAUSE_BUTTON)->SetWindowText("&Unpause Process");
}
}
BOOL CEventsHistoryPage::BrowseForLcb()
{
int iNbChar;
CString strFileName;
CString cCurrentPath = m_LCBPath.Left(m_LCBPath.ReverseFind('\\') + 1);
_chdir((LPCSTR)cCurrentPath);
CFileDialog dlg( TRUE,"lcb","*.lcb",
OFN_FILEMUSTEXIST,
_T("SoundEditor|LCB |"));
int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
//We have to extract the path, GetpathName include the filename
m_LCBPath = dlg.GetPathName();
((CSupervisApp* )AfxGetApp())->m_SuperVisThread->SuperVisSheet->m_MixerPage.m_LCBPath = m_LCBPath;
UpdateData(FALSE);
//To use with hybrid library
((CSupervisApp*)AfxGetApp())->m_cLCBFileTitle = dlg.GetFileTitle();
strFileName = dlg.GetFileName();
iNbChar = m_LCBPath.GetLength() - strFileName.GetLength();
((CSupervisApp* )AfxGetApp())->m_cLCBPath = m_LCBPath.Left( iNbChar );
return TRUE;
}
else if (nResponse == IDCANCEL)
{
return FALSE;
}
return TRUE;
}

View File

@@ -0,0 +1,95 @@
#if !defined(AFX_EVENTSHISTORYPAGE_H__FB8CCD4B_DD7D_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_EVENTSHISTORYPAGE_H__FB8CCD4B_DD7D_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// EventsHistoryPage.h : header file
//
#include "SNDinc.h"
#include "sndevent.h"
#include "MyListCtrl.h"
typedef struct EventsHistElement{
SYSTEMTIME time;
SND_tdstBlockEvent *evt_pstPtr;
tdxId evt_Id;
tdeTypeEvent evt_eType;
tdstBlockResourceMem *res_pstPtr;
long asso;
CString cEvtName;
CString cEvtBankName;
}EventsHistElement;
/////////////////////////////////////////////////////////////////////////////
// CEventsHistoryPage dialog
class CEventsHistoryPage : public CPropertyPage
{
DECLARE_DYNCREATE(CEventsHistoryPage)
// Construction
public:
BOOL BrowseForLcb();
BOOL m_bPauseProcess;
void SendEventInWatchList();
void FilterAndDisplayEvent(long lIndex);
void RefreshEventsHistoList();
CEventsHistoryPage();
~CEventsHistoryPage();
// Dialog Data
//{{AFX_DATA(CEventsHistoryPage)
enum { IDD = IDD_EVENTS_HISTORY_PAGE };
CListBox m_WatchList;
CMyListCtrl m_EventsList;
BOOL m_bShowBankWithId;
BOOL m_bShowEventWithId;
long m_lBankId;
long m_lEventId;
BOOL m_bDebugBreak;
BOOL m_bFirstOccurence;
BOOL m_bWatchMode;
CString m_LCBPath;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CEventsHistoryPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CEventsHistoryPage)
virtual BOOL OnInitDialog();
afx_msg void OnResetButton();
afx_msg void OnCheckFirstOccur();
afx_msg void OnCheckBank();
afx_msg void OnCheckEvent();
afx_msg void OnChangeEditBankId();
afx_msg void OnChangeEditEventId();
afx_msg void OnHelpWatch();
afx_msg void OnCheckWatch();
afx_msg void OnEmptyWatch();
afx_msg void OnBrowseForLcb();
afx_msg void OnPauseButton();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_EVENTSHISTORYPAGE_H__FB8CCD4B_DD7D_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,46 @@
// MicroAndObjectsPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MicroAndObjectsPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMicroAndObjectsPage property page
IMPLEMENT_DYNCREATE(CMicroAndObjectsPage, CPropertyPage)
CMicroAndObjectsPage::CMicroAndObjectsPage() : CPropertyPage(CMicroAndObjectsPage::IDD)
{
//{{AFX_DATA_INIT(CMicroAndObjectsPage)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CMicroAndObjectsPage::~CMicroAndObjectsPage()
{
}
void CMicroAndObjectsPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMicroAndObjectsPage)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMicroAndObjectsPage, CPropertyPage)
//{{AFX_MSG_MAP(CMicroAndObjectsPage)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMicroAndObjectsPage message handlers

View File

@@ -0,0 +1,50 @@
#if !defined(AFX_MICROANDOBJECTSPAGE_H__FA1253CF_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_MICROANDOBJECTSPAGE_H__FA1253CF_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MicroAndObjectsPage.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMicroAndObjectsPage dialog
class CMicroAndObjectsPage : public CPropertyPage
{
DECLARE_DYNCREATE(CMicroAndObjectsPage)
// Construction
public:
CMicroAndObjectsPage();
~CMicroAndObjectsPage();
// Dialog Data
//{{AFX_DATA(CMicroAndObjectsPage)
enum { IDD = IDD_MICRO_OBJECTS_PAGE };
// NOTE - ClassWizard will add data members here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CMicroAndObjectsPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMicroAndObjectsPage)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MICROANDOBJECTSPAGE_H__FA1253CF_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,692 @@
// MixerPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MixerPage.h"
//included for _chdir
#include <direct.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMixerPage property page
IMPLEMENT_DYNCREATE(CMixerPage, CPropertyPage)
CMixerPage::CMixerPage() : CPropertyPage(CMixerPage::IDD)
{
//{{AFX_DATA_INIT(CMixerPage)
m_cSelectedRes = _T("");
m_LCBPath = _T("");
m_bDebugBreak = FALSE;
m_bFirstOccurence = FALSE;
m_bShowBankWithId = FALSE;
m_bShowResWithId = FALSE;
m_lBankId = 0;
m_lResId = 0;
m_ulSelectedResVol = 0;
m_cSelectedResName = _T("");
//}}AFX_DATA_INIT
}
CMixerPage::~CMixerPage()
{
}
void CMixerPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CMixerPage)
DDX_Control(pDX, IDC_VOLUME_SLIDER, m_VolumeSlider);
DDX_Control(pDX, IDC_RES_LIST, m_ResList);
DDX_Text(pDX, IDC_EDIT_LCB_PATH, m_LCBPath);
DDX_Check(pDX, IDC_CHECK_DEBUG_ON_RES, m_bDebugBreak);
DDX_Check(pDX, IDC_CHECK_FIRST_RES_OCCUR, m_bFirstOccurence);
DDX_Check(pDX, IDC_CHECK_RES_BANK, m_bShowBankWithId);
DDX_Check(pDX, IDC_CHECK_RES, m_bShowResWithId);
DDX_Text(pDX, IDC_EDIT_RES_BANK_ID, m_lBankId);
DDV_MinMaxLong(pDX, m_lBankId, 0, 256);
DDX_Text(pDX, IDC_EDIT_RES_ID, m_lResId);
DDV_MinMaxLong(pDX, m_lResId, 0, 1024);
DDX_Text(pDX, IDC_EDIT_RES_VOL, m_ulSelectedResVol);
DDV_MinMaxLong(pDX, m_ulSelectedResVol, 0, 127);
DDX_Text(pDX, IDC_SEL_RES_NAME, m_cSelectedResName);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CMixerPage, CPropertyPage)
//{{AFX_MSG_MAP(CMixerPage)
ON_BN_CLICKED(IDC_SAVE, OnSave)
ON_BN_CLICKED(IDC_PAUSE_RES_BUTTON, OnPauseResButton)
ON_BN_CLICKED(IDC_RESET_RESLIST_BUTTON, OnResetReslistButton)
ON_BN_CLICKED(IDC_CHECK_DEBUG_ON_RES, OnCheckDebugOnRes)
ON_BN_CLICKED(IDC_CHECK_FIRST_RES_OCCUR, OnCheckFirstResOccur)
ON_BN_CLICKED(IDC_CHECK_RES, OnCheckRes)
ON_BN_CLICKED(IDC_CHECK_RES_BANK, OnCheckResBank)
ON_EN_CHANGE(IDC_EDIT_RES_BANK_ID, OnChangeEditResBankId)
ON_EN_CHANGE(IDC_EDIT_RES_ID, OnChangeEditResId)
ON_BN_CLICKED(IDC_BROWSE_FOR_LCB, OnBrowseForLcb)
ON_BN_CLICKED(IDC_VOL_MOINS, OnVolMoins)
ON_BN_CLICKED(IDC_VOL_PLUS, OnVolPlus)
ON_WM_VSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMixerPage message handlers
BOOL CMixerPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Initialise the ClistCtrl containing ressources descriptions
LV_COLUMN* lvc;
lvc = (LV_COLUMN*)malloc(sizeof(LV_COLUMN));
lvc->mask = LVCF_FMT |LVCF_SUBITEM
| LVCF_TEXT | LVCF_WIDTH; // members contain valid information
lvc->fmt = LVCFMT_LEFT; // Alignment of the column
lvc->cx = 75; // width of the column, in pixels
lvc->pszText = "Time"; // column heading
lvc->iSubItem = 0; // index of subitem associated with column
m_ResList.InsertColumn(0, lvc);
lvc->pszText = "Resource Name"; // column heading
lvc->cx = 125; // width of the column, in pixels
lvc->iSubItem = 1; // index of subitem associated with column
m_ResList.InsertColumn(1, lvc);
lvc->pszText = "Id"; // column heading
lvc->cx = 30; // width of the column, in pixels
lvc->iSubItem = 2; // index of subitem associated with column
m_ResList.InsertColumn(2, lvc);
lvc->pszText = "Bank Name"; // column heading
lvc->cx = 100; // width of the column, in pixels
lvc->iSubItem = 3; // index of subitem associated with column
m_ResList.InsertColumn(3, lvc);
lvc->pszText = "Bank Id"; // column heading
lvc->cx = 60; // width of the column, in pixels
lvc->iSubItem = 4; // index of subitem associated with column
m_ResList.InsertColumn(4, lvc);
lvc->cx = 100; // width of the column, in pixels
lvc->pszText = "Type"; // column heading
lvc->iSubItem = 5; // index of subitem associated with column
m_ResList.InsertColumn(5, lvc);
lvc->cx = 50; // width of the column, in pixels
lvc->pszText = "Volume"; // column heading
lvc->iSubItem = 6; // index of subitem associated with column
m_ResList.InsertColumn(6, lvc);
free( lvc );
//
//Initialisation ds controles du DialogBox
//
m_VolumeSlider.SetRange( 0, 127, FALSE);
m_VolumeSlider.SetPos(127);
//Set the limit length of the volume edit box
((CEdit *)(GetDlgItem(IDC_EDIT_RES_VOL)))->LimitText(3);
//Set LCB Edit box
((CEdit *)(GetDlgItem(IDC_EDIT_RES_VOL)))->SetReadOnly( TRUE );
((CEdit *)(GetDlgItem(IDC_SEL_RES_NAME)))->SetReadOnly( TRUE );
((CEdit *)(GetDlgItem(IDC_EDIT_LCB_PATH)))->SetReadOnly( TRUE );
m_cSelectedResName = "No Selected Resource";
//Disable the + and - buttonsa and the slider. The user wont be able to save nothing
((CEdit *)(GetDlgItem(IDC_VOL_MOINS)))->EnableWindow( FALSE );
((CEdit *)(GetDlgItem(IDC_VOL_PLUS)))->EnableWindow( FALSE );
((CEdit *)(GetDlgItem(IDC_VOLUME_SLIDER)))->EnableWindow( FALSE );
//Add the LCB Path
if (pSuperVisApp->m_cLCBPath == "NoLCBPath")
m_LCBPath = "No LCB file found in the registry. Select One.";
else
m_LCBPath = pSuperVisApp->m_cLCBPath + pSuperVisApp->m_cLCBFileTitle + ".lcb";
//Init du "pause" mode
m_bPauseProcess = FALSE;
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CMixerPage::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_USER_UPDATE_DATA)
{
//We send the updatedata(TRUE) here
//We cannot pass the CWnd across thread and this cause problem while using updatedata
UpdateData(TRUE);
}
return CPropertyPage::PreTranslateMessage(pMsg);
}
void CMixerPage::OnSave()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
if (!pSuperVisApp->m_SuperVisThread->m_IEditor->SaveDocument("x:\\cpa\\exe\\main\\gamedata\\world\\sound\\playmo_v.lcb"))
{
AfxMessageBox("Could not save the sound project");
return;
}
}
void CMixerPage::OnPauseResButton()
{
if(m_bPauseProcess)
{
m_bPauseProcess = FALSE;
GetDlgItem(IDC_PAUSE_RES_BUTTON)->SetWindowText("&Pause Process");
//We refresh the list to add the event thatwe missed during pause.
RefreshResList();
}
else
{
m_bPauseProcess = TRUE;
GetDlgItem(IDC_PAUSE_RES_BUTTON)->SetWindowText("&Unpause Process");
}
}
void CMixerPage::OnResetReslistButton()
{
long i;
ResourceElement* temp;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Free the events Resources array
for (i= 0; i < pSuperVisApp->m_SuperVisThread->m_apResources.GetSize() ;i++)
{
temp = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(i));
delete temp;
}
pSuperVisApp->m_SuperVisThread->m_apResources.RemoveAll();
//Empty the CListCtrl
m_ResList.DeleteAllItems();
}
void CMixerPage::RefreshResList()
{
long i;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Clear the list
m_ResList.DeleteAllItems();
long temp = pSuperVisApp->m_SuperVisThread->m_apResources.GetSize();
//Cycle through the pointer Array to filter
for (i = 0; i < pSuperVisApp->m_SuperVisThread->m_apResources.GetSize(); i ++ )
{
//Update the rsources list
FilterAndDisplayRes(i);
}
}
void CMixerPage::FilterAndDisplayRes(long lIndex)
{
char buffer[25];
unsigned long ulBankId;
unsigned long ulResId;
ResourceElement *res, *ResFirstOccurTest;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
res = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(lIndex));
ulBankId = ((res->ulId >> 16) & 0x0000FFFF);
ulResId = res->ulId & 0x0000FFFF;
//
//Check if we have have to filter the events
//******************************************
//Retrieve data from the control
PostMessage(WM_USER_UPDATE_DATA, 0, 0);
if (m_bShowResWithId)
{
if (m_lResId != (long)ulResId)
return;
}
if (m_bShowBankWithId)
{
if (m_lBankId != (long)ulBankId)
return;
}
if(m_bFirstOccurence)
{
long i;
//look in the Ressource array from 0 to the current event we are filtering.
for(i = 0; i < lIndex ; i++)
{
ResFirstOccurTest = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(i));
if (res->ulId == ResFirstOccurTest->ulId)
return;
}
}
//Check if we have to debugbreak before displaying the events
if(m_bDebugBreak)
{
DebugBreak();
}
/*
long i;
unsigned long ulId;
//Get the group using the editor Id
IEventGroup Group;
CString cBankName;
for (i= 0; i < pSuperVisApp->m_SuperVisThread->m_IGroups->GetCount(); i++)
{
Group.AttachDispatch(pSuperVisApp->m_SuperVisThread->m_IGroups->Item(i));
ulId = Group.GetId();
if(ulId == ulBankId)
{
cBankName = Group.GetName();
break;
}
}
//Get the resources list
IResources Resources;
Resources.AttachDispatch(Group.GetResources());
IResource Resource;
CString cResName;
for (i= 0; i < Resources.GetCount(); i++)
{
Resource.AttachDispatch(Resources. Item (i));
ulId = Resource.GetId();
if(ulId == ulResId)
{
cResName = Resource.GetName();
break;
}
}
*/
//Display time
sprintf(buffer,"%02d:%02d:%02d:%03d",
res->time.wHour,
res->time.wMinute,
res->time.wSecond,
res->time.wMilliseconds);
m_ResList.InsertItem( 0, buffer );
//Set the item data with the Resources Array index, to be used later for drag&drop, pop-memnu, etc.
m_ResList.SetItemData( 0, (DWORD)lIndex );
//resource Name
m_ResList.SetItem(0, 1, LVIF_TEXT, (LPCSTR)res->cResName, 0, 0, 0, NULL );
//Event ID
sprintf(buffer, "%lu", ulResId);
m_ResList.SetItem(0, 2, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Bank Name
m_ResList.SetItem(0, 3, LVIF_TEXT, (LPCSTR)res->cResBankName, 0, 0, 0, NULL );
//Bank ID
sprintf(buffer, "%lu", ulBankId);
m_ResList.SetItem(0, 4, LVIF_TEXT, buffer, 0, 0, 0, NULL );
//Type
switch(res->tdeType){
case TYPE_INVALID:
sprintf(buffer, "TYPE_INVALID");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_SAMPLE:
sprintf(buffer, "TYPE_SAMPLE");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_MIDI:
sprintf(buffer, "TYPE_MIDI");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_CDAUDIO:
sprintf(buffer, "TYPE_CDAUDIO");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_SEQUENCE:
sprintf(buffer, "TYPE_SEQUENCE");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_SWITCH_OLD:
sprintf(buffer, "TYPE_SWITCH_OLD");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_SPLIT:
sprintf(buffer, "TYPE_SPLIT");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_THEME_OLD:
sprintf(buffer, "TYPE_THEME_OLD");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
case TYPE_SWITCH:
sprintf(buffer, "TYPE_SWITCH");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_THEME_OLD2:
sprintf(buffer, "TYPE_THEME_OLD2");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_RANDOM:
sprintf(buffer, "TYPE_RANDOM");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_THEME:
sprintf(buffer, "TYPE_THEME");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
case TYPE_FOR_ALIGNEMENT:
sprintf(buffer, "TYPE_FOR_ALIGNEMENT");
m_ResList.SetItem(0, 5, LVIF_TEXT, buffer, 0, 0, 0, NULL );
break;
}
//Volume
sprintf(buffer, "%u", res->ucVolume);
m_ResList.SetItem(0, 6, LVIF_TEXT, buffer, 0, 0, 0, NULL );
}
void CMixerPage::OnCheckDebugOnRes()
{
//Update the variable
UpdateData(TRUE);
}
void CMixerPage::OnCheckFirstResOccur()
{
//Update the variable
UpdateData(TRUE);
RefreshResList();
}
void CMixerPage::OnCheckRes()
{
//Update the variable
UpdateData(TRUE);
RefreshResList();
}
void CMixerPage::OnCheckResBank()
{
//Update the variable
UpdateData(TRUE);
RefreshResList();
}
void CMixerPage::OnChangeEditResBankId()
{
//Keep the bank Id in the 0 - 256 range
UpdateData(TRUE);
if (m_lBankId > 256)
{
m_lBankId = 256;
UpdateData(FALSE);
}
RefreshResList();
}
void CMixerPage::OnChangeEditResId()
{
//Keep the Event Id in the 0 - 1024 range
UpdateData(TRUE);
if (m_lResId > 1024)
{
m_lResId = 1024;
UpdateData(FALSE);
}
RefreshResList();
}
void CMixerPage::OnBrowseForLcb()
{
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_EventsHistoryPage.BrowseForLcb();
UpdateData(FALSE);
}
void CMixerPage::SetEditBoxVolume(unsigned long _ulIndex)
{
unsigned long ulBankId;
unsigned long ulResId;
ResourceElement* temp;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
//Enable the + and - buttons.
((CEdit *)(GetDlgItem(IDC_VOL_MOINS)))->EnableWindow( TRUE );
((CEdit *)(GetDlgItem(IDC_VOL_PLUS)))->EnableWindow( TRUE );
((CEdit *)(GetDlgItem(IDC_VOLUME_SLIDER)))->EnableWindow( TRUE );
//Save the Array Index to be used by the OnVolMoins() and OnVolPlus() messages
m_ulSelectedResourceArrayIndex = _ulIndex;
temp = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(_ulIndex));
ulBankId = ((temp->ulId >> 16) & 0x0000FFFF);
ulResId = temp->ulId & 0x0000FFFF;
long i;
unsigned long ulId;
//Get the group using the editor Id
IEventGroup Group;
for (i= 0; i < pSuperVisApp->m_SuperVisThread->m_IGroups->GetCount(); i++)
{
Group.AttachDispatch(pSuperVisApp->m_SuperVisThread->m_IGroups->Item(i));
ulId = Group.GetId();
if(ulId == ulBankId)
break;
}
//Get the resources list
IResources Resources;
Resources.AttachDispatch(Group.GetResources());
for (i= 0; i < Resources.GetCount(); i++)
{
pSuperVisApp->m_SuperVisThread->m_Resource.AttachDispatch(Resources. Item (i));
ulId = pSuperVisApp->m_SuperVisThread->m_Resource.GetId();
if(ulId == ulResId)
{
m_ulSelectedResVol = pSuperVisApp->m_SuperVisThread->m_Resource.GetVolume();
m_VolumeSlider.SetPos(127 - m_ulSelectedResVol);
m_cSelectedResName = temp->cResName;
break;
}
}
UpdateData(FALSE);
}
void CMixerPage::OnVolMoins()
{
ResourceElement* temp;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
m_ulSelectedResVol--;
m_VolumeSlider.SetPos(127 - m_ulSelectedResVol);
//Set the volume in SounEditor using OLE
pSuperVisApp->m_SuperVisThread->m_Resource.SetVolume((int)m_ulSelectedResVol);
//Edit the Sound in realtime....
temp = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(m_ulSelectedResourceArrayIndex));
temp->res->ucVolume = (unsigned char)m_ulSelectedResVol;
UpdateData(FALSE);
}
void CMixerPage::OnVolPlus()
{
ResourceElement* temp;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
m_ulSelectedResVol++;
m_VolumeSlider.SetPos(127 - m_ulSelectedResVol);
//Set the volume in SounEditor using OLE
pSuperVisApp->m_SuperVisThread->m_Resource.SetVolume((int)m_ulSelectedResVol);
//Edit the Sound in realtime....
temp = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(m_ulSelectedResourceArrayIndex));
temp->res->ucVolume = (unsigned char)m_ulSelectedResVol;
UpdateData(FALSE);
}
void CMixerPage::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
if (nSBCode == SB_THUMBTRACK){
if (pScrollBar == (CScrollBar *)&m_VolumeSlider){
ResourceElement* temp;
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
m_ulSelectedResVol = 127 - m_VolumeSlider.GetPos();
//Set the volume in SounEditor using OLE
pSuperVisApp->m_SuperVisThread->m_Resource.SetVolume((int)m_ulSelectedResVol);
//Edit the Sound in realtime....
temp = (ResourceElement *)(pSuperVisApp->m_SuperVisThread->m_apResources.GetAt(m_ulSelectedResourceArrayIndex));
temp->res->ucVolume = (unsigned char)m_ulSelectedResVol;
UpdateData(FALSE);
}
}
CPropertyPage::OnVScroll(nSBCode, nPos, pScrollBar);
}

View File

@@ -0,0 +1,97 @@
#if !defined(AFX_MIXERPAGE_H__FA1253CE_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_MIXERPAGE_H__FA1253CE_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MixerPage.h : header file
//
#include "sndres.h"
#include "MyResListCtrl.h"
//#include "soundeditor.h" // Added by ClassView
//Ressource structure use by the Supervisater
typedef struct RessourceElement{
SYSTEMTIME time;
unsigned long ulId;
tdeTypeResource tdeType;
unsigned char ucVolume;
CString cResBankName;
CString cResName;
tdstBlockResourceMem *res;
}ResourceElement;
/////////////////////////////////////////////////////////////////////////////
// CMixerPage dialog
class CMixerPage : public CPropertyPage
{
DECLARE_DYNCREATE(CMixerPage)
// Construction
public:
unsigned long m_ulSelectedResourceArrayIndex;
// IResource m_Resource;
void SetEditBoxVolume(unsigned long _ulIndex);
void FilterAndDisplayRes(long _lIndex);
void RefreshResList();
BOOL m_bPauseProcess;
CMixerPage();
~CMixerPage();
// Dialog Data
//{{AFX_DATA(CMixerPage)
enum { IDD = IDD_MIXER_PAGE };
CSliderCtrl m_VolumeSlider;
CMyResListCtrl m_ResList;
CString m_cSelectedRes;
CString m_LCBPath;
BOOL m_bDebugBreak;
BOOL m_bFirstOccurence;
BOOL m_bShowBankWithId;
BOOL m_bShowResWithId;
long m_lBankId;
long m_lResId;
long m_ulSelectedResVol;
CString m_cSelectedResName;
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CMixerPage)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CMixerPage)
virtual BOOL OnInitDialog();
afx_msg void OnSave();
afx_msg void OnPauseResButton();
afx_msg void OnResetReslistButton();
afx_msg void OnCheckDebugOnRes();
afx_msg void OnCheckFirstResOccur();
afx_msg void OnCheckRes();
afx_msg void OnCheckResBank();
afx_msg void OnChangeEditResBankId();
afx_msg void OnChangeEditResId();
afx_msg void OnBrowseForLcb();
afx_msg void OnVolMoins();
afx_msg void OnVolPlus();
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MIXERPAGE_H__FA1253CE_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,154 @@
// MyListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MyListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl
CMyListCtrl::CMyListCtrl()
{
}
CMyListCtrl::~CMyListCtrl()
{
}
BEGIN_MESSAGE_MAP(CMyListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CMyListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl message handlers
void CMyListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the current mouse location and convert it to client
// coordinates.
DWORD pos = GetMessagePos();
CPoint pt(LOWORD(pos), HIWORD(pos));
ScreenToClient(&pt);
// Get indexes of the first and last visible items in listview
// control.
int index = GetTopIndex();
int last_visible_index = index + GetCountPerPage();
if (last_visible_index > GetItemCount())
last_visible_index = GetItemCount();
// Loop until number visible items has been reached.
while (index <= last_visible_index)
{
// Get the bounding rectangle of an item. If the mouse
// location is within the bounding rectangle of the item,
// you know you have found the item that was being clicked.
CRect r;
GetItemRect(index, &r, LVIR_BOUNDS);
if (r.PtInRect(pt))
{
UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
SetItemState(index, flag, flag);
break;
}
// Get the next item in listview control.
index++;
}
*pResult = 0;
}
void CMyListCtrl::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the current mouse location and convert it to client
// coordinates.
DWORD pos = GetMessagePos();
CPoint pt(LOWORD(pos), HIWORD(pos));
ScreenToClient(&pt);
// Get indexes of the first and last visible items in listview
// control.
int index = GetTopIndex();
int last_visible_index = index + GetCountPerPage();
if (last_visible_index > GetItemCount())
last_visible_index = GetItemCount();
// Loop until number visible items has been reached.
while (index <= last_visible_index)
{
// Get the bounding rectangle of an item. If the mouse
// location is within the bounding rectangle of the item,
// you know you have found the item that was being clicked.
CRect r;
GetItemRect(index, &r, LVIR_BOUNDS);
if (r.PtInRect(pt))
{
//Select item
UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
SetItemState(index, flag, flag);
//Show PopUp Menu
CMenu menu;
VERIFY(menu.LoadMenu(IDR_MENU1));
CMenu* pPopup = menu.GetSubMenu(0);
//Modify the menu with the ressource name. The Command is handled in CPropertySheet::OnCmdMsg.
//pPopup->ModifyMenu( 0, MF_BYPOSITION | MF_STRING, ID_WATCH, "Voila, ca marche!!" );
ASSERT(pPopup != NULL);
pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
LOWORD(pos),
HIWORD(pos),
AfxGetMainWnd());
break;
}
// Get the next item in listview control.
index++;
}
*pResult = 0;
}

View File

@@ -0,0 +1,49 @@
#if !defined(AFX_MYLISTCTRL_H__C9F294B0_E16D_11D2_9F47_00104B6833D0__INCLUDED_)
#define AFX_MYLISTCTRL_H__C9F294B0_E16D_11D2_9F47_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyListCtrl window
class CMyListCtrl : public CListCtrl
{
// Construction
public:
CMyListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CMyListCtrl)
afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYLISTCTRL_H__C9F294B0_E16D_11D2_9F47_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,89 @@
// MyResListCtrl.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "MyResListCtrl.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyResListCtrl
CMyResListCtrl::CMyResListCtrl()
{
}
CMyResListCtrl::~CMyResListCtrl()
{
}
BEGIN_MESSAGE_MAP(CMyResListCtrl, CListCtrl)
//{{AFX_MSG_MAP(CMyResListCtrl)
ON_NOTIFY_REFLECT(NM_CLICK, OnClick)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyResListCtrl message handlers
void CMyResListCtrl::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
// Get the current mouse location and convert it to client
// coordinates.
DWORD pos = GetMessagePos();
CPoint pt(LOWORD(pos), HIWORD(pos));
ScreenToClient(&pt);
// Get indexes of the first and last visible items in listview
// control.
int index = GetTopIndex();
int last_visible_index = index + GetCountPerPage();
if (last_visible_index > GetItemCount())
last_visible_index = GetItemCount();
// Loop until number visible items has been reached.
while (index <= last_visible_index)
{
// Get the bounding rectangle of an item. If the mouse
// location is within the bounding rectangle of the item,
// you know you have found the item that was being clicked.
CRect r;
GetItemRect(index, &r, LVIR_BOUNDS);
if (r.PtInRect(pt))
{
UINT flag = LVIS_SELECTED | LVIS_FOCUSED;
SetItemState(index, flag, flag);
//We add the new volume in the Volume EditBox
CSupervisApp* pSuperVisApp = (CSupervisApp*)AfxGetApp();
pSuperVisApp->m_SuperVisThread->SuperVisSheet->m_MixerPage.SetEditBoxVolume((unsigned long)GetItemData(index));
break;
}
// Get the next item in listview control.
index++;
}
*pResult = 0;
}

View File

@@ -0,0 +1,48 @@
#if !defined(AFX_MYRESLISTCTRL_H__0C3228FA_F275_11D2_9F68_00104B6833D0__INCLUDED_)
#define AFX_MYRESLISTCTRL_H__0C3228FA_F275_11D2_9F68_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MyResListCtrl.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CMyResListCtrl window
class CMyResListCtrl : public CListCtrl
{
// Construction
public:
CMyResListCtrl();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyResListCtrl)
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyResListCtrl();
// Generated message map functions
protected:
//{{AFX_MSG(CMyResListCtrl)
afx_msg void OnClick(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MYRESLISTCTRL_H__0C3228FA_F275_11D2_9F68_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,46 @@
// RessourcesHistoricPage.cpp : implementation file
//
#include "stdafx.h"
#include "supervis.h"
#include "RessourcesHistoricPage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRessourcesHistoricPage property page
IMPLEMENT_DYNCREATE(CRessourcesHistoricPage, CPropertyPage)
CRessourcesHistoricPage::CRessourcesHistoricPage() : CPropertyPage(CRessourcesHistoricPage::IDD)
{
//{{AFX_DATA_INIT(CRessourcesHistoricPage)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CRessourcesHistoricPage::~CRessourcesHistoricPage()
{
}
void CRessourcesHistoricPage::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRessourcesHistoricPage)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRessourcesHistoricPage, CPropertyPage)
//{{AFX_MSG_MAP(CRessourcesHistoricPage)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRessourcesHistoricPage message handlers

View File

@@ -0,0 +1,50 @@
#if !defined(AFX_RESSOURCESHISTORICPAGE_H__FA1253D0_DE04_11D2_9F40_00104B6833D0__INCLUDED_)
#define AFX_RESSOURCESHISTORICPAGE_H__FA1253D0_DE04_11D2_9F40_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// RessourcesHistoricPage.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CRessourcesHistoricPage dialog
class CRessourcesHistoricPage : public CPropertyPage
{
DECLARE_DYNCREATE(CRessourcesHistoricPage)
// Construction
public:
CRessourcesHistoricPage();
~CRessourcesHistoricPage();
// Dialog Data
//{{AFX_DATA(CRessourcesHistoricPage)
enum { IDD = IDD_RESSOURCES_HISTORIC };
// NOTE - ClassWizard will add data members here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA
// Overrides
// ClassWizard generate virtual function overrides
//{{AFX_VIRTUAL(CRessourcesHistoricPage)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CRessourcesHistoricPage)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RESSOURCESHISTORICPAGE_H__FA1253D0_DE04_11D2_9F40_00104B6833D0__INCLUDED_)

View File

@@ -0,0 +1,6 @@
// stdafx.cpp : source file that includes just the standard includes
// supervis.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"

View File

@@ -0,0 +1,41 @@
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__2CEA4ECD_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_)
#define AFX_STDAFX_H__2CEA4ECD_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxole.h> // MFC OLE classes
#include <afxodlgs.h> // MFC OLE dialog classes
#include <afxdisp.h> // MFC OLE automation classes
#endif // _AFX_NO_OLE_SUPPORT
#ifndef _AFX_NO_DB_SUPPORT
#include <afxdb.h> // MFC ODBC database classes
#endif // _AFX_NO_DB_SUPPORT
#ifndef _AFX_NO_DAO_SUPPORT
#include <afxdao.h> // MFC DAO database classes
#endif // _AFX_NO_DAO_SUPPORT
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__2CEA4ECD_D8B0_11D2_9F3A_00104B6833D0__INCLUDED_)

Some files were not shown because too many files have changed in this diff Show More