Changeset 13624
- Timestamp:
- Mar 8, 2000, 7:26:49 PM (25 years ago)
- Location:
- tags/trunk/src/dsound/new
- Files:
-
- 3 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified tags/trunk/src/dsound/new/OS2DSOUND.CPP ¶
r13607 r13624 1 /* $Id: OS2DSOUND.CPP,v 1. 1 2000-03-06 13:11:38mike Exp $ */1 /* $Id: OS2DSOUND.CPP,v 1.2 2000-03-08 18:26:47 mike Exp $ */ 2 2 3 3 /* … … 21 21 #include <dsound.h> 22 22 23 #include "os2dsound.h" 24 #include "os2sndbuffer.h" 25 #include "os2primbuff.h" 26 #include "os2notify.h" 23 #include "OS2DSound.h" 24 #include "OS2SndBuffer.h" 25 #include "OS2PrimBuff.h" 26 #include "OS23DListener.h" 27 #include "OS2Notify.h" 27 28 #include <misc.h> 28 29 -
TabularUnified tags/trunk/src/dsound/new/OS2NOTIFY.H ¶
r13607 r13624 9 9 #ifndef __OS2NOTIFY_H__ 10 10 #define __OS2NOTIFY_H__ 11 12 #include <mmsystem.h>13 11 14 12 #undef THIS … … 48 46 }; 49 47 50 //******************************************************************************51 //******************************************************************************52 HRESULT __stdcall SoundNotifyQueryInterface(THIS, REFIID riid, LPVOID * ppvObj);53 ULONG __stdcall SoundNotifyAddRef(THIS);54 ULONG __stdcall SoundNotifyRelease(THIS);55 HRESULT __stdcall SoundNotifySetNotificationPositions(THIS, DWORD cPositionNotifies, LPCDSBPOSITIONNOTIFY lpcPositionNotifies);56 57 48 #endif -
TabularUnified tags/trunk/src/dsound/new/OS2PrimBuff.cpp ¶
r13607 r13624 46 46 #include "OS2SndBuffer.h" 47 47 #include "OS2PrimBuff.h" 48 #include "OS23DListener.h" 48 49 49 50 #include "dart.h" 51 52 #undef THIS 53 #define THIS VOID*This 54 55 #undef THIS_ 56 #define THIS_ VOID*This, 50 57 51 58 //****************************************************************************** … … 85 92 fPrimary = TRUE; 86 93 Referenced = 0; 94 listener = NULL; 87 95 88 96 lpfxFormat = (WAVEFORMATEX *)malloc(/*bufferdesc.lpwfxFormat->cbSize +*/ sizeof(WAVEFORMATEX)); … … 128 136 HRESULT WIN32API PrimBufQueryInterface(THIS, REFIID riid, LPVOID * ppvObj) 129 137 { 138 dprintf(("DSOUND-PrimBuff: QueryInterface")); 139 130 140 if (This == NULL) { 131 return DSERR_INVALIDPARAM;141 return DSERR_INVALIDPARAM; 132 142 } 133 143 *ppvObj = NULL; 134 144 135 if (!IsEqualGUID(riid, IID_IDirectSoundBuffer)) 136 return E_NOINTERFACE; 137 138 *ppvObj = This; 139 140 PrimBufAddRef(This); 141 return DS_OK; 145 if (IsEqualGUID(riid, IID_IDirectSoundBuffer)) { 146 *ppvObj = This; 147 PrimBufAddRef(This); 148 return DS_OK; 149 } 150 151 152 if (IsEqualGUID(riid, IID_IDirectSound3DListener)) { 153 OS2PrimBuff *me = (OS2PrimBuff *)This; 154 OS2IDirectSound3DListener *listener; 155 156 listener = new OS2IDirectSound3DListener(me); 157 *ppvObj = listener; 158 listener->Vtbl.AddRef((IDirectSound3DListener *)listener); 159 return DS_OK; 160 } 161 162 return E_NOINTERFACE; 142 163 } 143 164 -
TabularUnified tags/trunk/src/dsound/new/OS2PrimBuff.h ¶
r13607 r13624 18 18 #define THIS_ VOID*This, 19 19 20 20 // a forward declaration is needed here 21 class OS2IDirectSound3DListener; 21 22 22 23 class OS2PrimBuff: public OS2IDirectSoundBuffer … … 29 30 int Referenced; 30 31 inline HRESULT GetLastError() { return lastError; }; 32 inline void Set3DListener(OS2IDirectSound3DListener *_listener) { 33 listener = _listener; }; 31 34 32 35 private: 36 protected: 37 33 38 void *vpMixBuffer; 34 39 void *vpMixSetup; … … 42 47 long channels;// Number of Channels 1 or 2 MONO/Stereo 43 48 44 protected: 49 OS2IDirectSound3DListener* listener; // pointer to the associated 3DListener object 50 45 51 HRESULT lastError; 46 52 -
TabularUnified tags/trunk/src/dsound/new/OS2SNDBUFFER.CPP ¶
r13607 r13624 1 /* $Id: OS2SNDBUFFER.CPP,v 1. 1 2000-03-06 13:11:39mike Exp $ */1 /* $Id: OS2SNDBUFFER.CPP,v 1.2 2000-03-08 18:26:47 mike Exp $ */ 2 2 3 3 /* … … 25 25 #include <dsound.h> 26 26 27 #include "os2dsound.h" 28 #include "os2sndbuffer.h" 29 #include "os2primbuff.h" 30 #include "os2notify.h" 27 #include "OS2DSound.h" 28 #include "OS2SndBuffer.h" 29 #include "OS2PrimBuff.h" 30 #include "OS23DListener.h" 31 #include "OS23DBuffer.h" 32 #include "OS2Notify.h" 31 33 #include <misc.h> 32 34 … … 226 228 return DS_OK; 227 229 } 230 231 if (IsEqualGUID(riid, IID_IDirectSound3DBuffer)) { 232 OS2IDirectSoundBuffer *me = (OS2IDirectSoundBuffer *)This; 233 OS2IDirectSound3DBuffer *buffer3D; 234 235 buffer3D = new OS2IDirectSound3DBuffer(me); 236 *ppvObj = buffer3D; 237 buffer3D->Vtbl.AddRef((IDirectSound3DBuffer *)buffer3D); 238 return DS_OK; 239 } 240 228 241 return E_NOINTERFACE; 229 242 } -
TabularUnified tags/trunk/src/dsound/new/OS2SNDBUFFER.H ¶
r13607 r13624 1 /* $Id: OS2SNDBUFFER.H,v 1. 1 2000-03-06 13:11:39mike Exp $ */1 /* $Id: OS2SNDBUFFER.H,v 1.2 2000-03-08 18:26:48 mike Exp $ */ 2 2 3 3 /* … … 12 12 #define __OS2SNDBUFFER_H__ 13 13 14 #include <mmsystem.h>15 16 14 #undef THIS 17 15 #define THIS VOID*This … … 20 18 #define THIS_ VOID*This, 21 19 22 // a forward declaration of the Notify class is needed here!20 // a forward declaration of some classes is needed here! 23 21 class OS2IDirectSoundNotify; 22 class OS2IDirectSound3DBuffer; 24 23 25 24 class OS2IDirectSoundBuffer … … 40 39 inline void SetNotify(OS2IDirectSoundNotify *_notify) { 41 40 notify = _notify; }; 41 inline void Set3DBuffer(OS2IDirectSound3DBuffer *_buffer3D) { 42 buffer3D = _buffer3D; }; 42 43 private: 43 44 … … 61 62 char *lpBuffer; // sound data 62 63 63 OS2IDirectSoundNotify* notify; // pointer to the associated Notify object (if exists) 64 OS2IDirectSound* parentDS; 64 OS2IDirectSoundNotify* notify; // pointer to the associated Notify object (if exists) 65 OS2IDirectSound3DBuffer* buffer3D; // pointer to the associated 3DBuffer object (if exists) 66 OS2IDirectSound* parentDS; 65 67 66 68 // Linked list management -
TabularUnified tags/trunk/src/dsound/new/dart.cpp ¶
r13615 r13624 25 25 static long lLastBuff; 26 26 static char *pDSoundBuff; 27 static BOOL fIsPlaying = FALSE; 27 28 28 29 USHORT usDeviceID; /* Amp Mixer device id */ … … 70 71 MCI_AMP_OPEN_PARMS AmpOpenParms; 71 72 //MCI_WAVE_SET_PARMS WaveSetParms; 72 ULONG rc; 73 ULONG rc, ulNew; 74 LONG lAdd = 5; 73 75 short device = 0; 74 76 75 77 dprintf(("DSOUND-DART: Dart_Open_Device")); 78 79 DosSetRelMaxFH(&lAdd, &ulNew); 76 80 77 81 *vpMixBuffer = &MixBuffers; … … 175 179 MCI_MIXSETUP_PARMS *MixSetup; 176 180 MCI_BUFFER_PARMS *BufferParms; 181 ULONG rc; 177 182 178 183 dprintf(("DSOUND-DART: Dart_Close_Device")); … … 182 187 BufferParms = (MCI_BUFFER_PARMS*)vpBuffParms; 183 188 184 if (MixBuffer->pBuffer) {185 mciSendCommand(usDeviceID,MCI_BUFFER,MCI_WAIT|MCI_DEALLOCATE_MEMORY, BufferParms,0);186 MixBuffer->pBuffer=NULL;187 188 if (usDeviceID) {189 mciSendCommand(usDeviceID,MCI_CLOSE,MCI_WAIT, NULL, 0);190 usDeviceID=0;191 189 rc = mciSendCommand(usDeviceID, MCI_BUFFER, MCI_WAIT | MCI_DEALLOCATE_MEMORY, BufferParms, 0); 190 if (rc != MCIERR_SUCCESS) { 191 dprintf(("DSOUND-DART: MCI_BUFFER (Close) %d", rc)); 192 } 193 rc = mciSendCommand(usDeviceID, MCI_CLOSE, MCI_WAIT, NULL, 0); 194 if (rc != MCIERR_SUCCESS) { 195 dprintf(("DSOUND-DART: MCI_CLOSE (Close) %d", rc)); 196 } 192 197 193 198 dprintf(("DSOUND-DART: Dart_Close_Device returning DS_OK")); … … 301 306 } 302 307 308 /* If the primary buffer was playing, we have to restart it!! */ 309 if (fIsPlaying) { 310 dprintf(("DSOUND-DART: Restarting playback!!!!")); 311 312 /* Mix the first buffer before playing */ 313 MixCallback(BUFFER_SIZE/NUM_DART_BUFFS); 314 memcpy(pMixBuffs[lLastBuff].pBuffer, &pDSoundBuff[lLastBuff*(BUFFER_SIZE/NUM_DART_BUFFS)], BUFFER_SIZE/NUM_DART_BUFFS); 315 316 USHORT sel = RestoreOS2FS(); 317 /* Note: the call to pmixWrite trashes the FS selector, we have to save */ 318 /* and then restore FS!!! Otherwise exception handling will be broken. */ 319 MixSetupParms.pmixWrite(MixSetupParms.ulMixHandle, MixBuffers, 2); 320 SetFS(sel); 321 fIsPlaying = TRUE; 322 } 323 303 324 return DS_OK; 304 325 } … … 311 332 dprintf(("DSOUND-DART: Dart_Stop")); 312 333 334 if (!fIsPlaying) 335 return DS_OK; 336 337 fIsPlaying = FALSE; 313 338 // rc = mciSendCommand(usDeviceID, MCI_PAUSE, MCI_WAIT, NULL, 0); 314 339 rc = mciSendCommand(usDeviceID, MCI_STOP, MCI_WAIT, NULL, 0); … … 349 374 MixSetupParms.pmixWrite(MixSetupParms.ulMixHandle, MixBuffers, 2); 350 375 SetFS(sel); 351 } 352 353 return DS_OK; 354 } 376 fIsPlaying = TRUE; 377 } 378 379 return DS_OK; 380 } -
TabularUnified tags/trunk/src/dsound/new/makefile ¶
r13607 r13624 1 # $Id: makefile,v 1. 1 2000-03-06 13:11:41mike Exp $1 # $Id: makefile,v 1.2 2000-03-08 18:26:48 mike Exp $ 2 2 3 3 # 4 # PD-Win32 API4 # Odin32 API 5 5 # 6 6 # dsound.dll makefile 7 7 # 8 8 9 # Directory macros. 9 10 PDWIN32_INCLUDE = ..\..\..\include 10 PDWIN32_LIB = ..\..\..\lib11 PDWIN32_BIN = ..\..\..\bin12 PDWIN32_TOOLS = ..\..\..\tools\bin11 PDWIN32_LIB = ..\..\..\lib 12 PDWIN32_BIN = ..\..\..\$(OBJDIR) 13 PDWIN32_TOOLS = ..\..\..\tools\bin 13 14 14 15 16 # Compiler, tools, and interference rules. 15 17 !include $(PDWIN32_INCLUDE)/pdwin32.mk 16 18 17 19 18 CFLAGS = $(CFLAGS) -I$(PDWIN32_INCLUDE) 19 C XXFLAGS = $(CXXFLAGS) -I$(PDWIN32_INCLUDE)20 # Flag overloads and local macros. 21 CLEANEXTRAS = dsoundrsrc.asm 20 22 21 23 24 # Object files. All objects should be prefixed with $(OBJDIR)! 25 OBJS = \ 26 $(OBJDIR)\dsound.obj \ 27 $(OBJDIR)\os2dsound.obj \ 28 $(OBJDIR)\initterm.obj \ 29 $(OBJDIR)\os2sndbuffer.obj \ 30 $(OBJDIR)\os2primbuff.obj \ 31 $(OBJDIR)\os2notify.obj \ 32 $(OBJDIR)\os23dlistener.obj \ 33 $(OBJDIR)\os23dbuffer.obj \ 34 $(OBJDIR)\dart.obj \ 35 $(OBJDIR)\dsmixer.obj \ 36 $(OBJDIR)\dsoundrsrc.obj 37 38 39 # Target name - name of the dll without extention and path. 22 40 TARGET = dsound 23 41 24 OBJS = dsound.obj os2dsound.obj initterm.obj os2sndbuffer.obj \25 os2primbuff.obj dart.obj os2notify.obj dsmixer.obj resource.obj26 42 27 all: $(TARGET).dll $(TARGET).lib 43 # All rule - build objs, target dll, copies dll to bin and makes libs. 44 all: $(OBJDIR) \ 45 $(OBJDIR)\$(TARGET).dll \ 46 $(PDWIN32_BIN)\$(TARGET).dll \ 47 lib 28 48 29 49 30 $(TARGET).dll: $(OBJS) $(TARGET).def 31 $(LD) $(LDFLAGS) -Fm -Fe$@ $(OBJS) $(TARGET).def \ 32 pmwinx.lib $(PDWIN32_LIB)/kernel32.lib \ 33 mmpm2.lib $(PDWIN32_LIB)/ole32.lib \ 34 $(PDWIN32_LIB)/odincrt.lib OS2386.LIB $(RTLLIB_O) 35 $(CP) $@ $(PDWIN32_BIN) 50 # Lib rule - build importlibrary (and evt. other libs) 51 lib: $(TARGET).lib $(PDWIN32_LIB)\$(TARGET).lib 36 52 37 53 38 lib: $(TARGET).lib $(PDWIN32_LIB)\$(TARGET).lib 39 40 $(PDWIN32_LIB)\$(TARGET).lib: $(TARGET).lib 41 $(CP) $** $@ 42 43 $(TARGET).lib: $(TARGET).def 44 $(IMPLIB) $(IMPLIBFLAGS) $@ $** 45 $(CP) $@ $(PDWIN32_LIB) 46 47 resource.asm: $(TARGET).rc 48 $(RC) $(RCFLAGS) -o resource.asm $(TARGET).rc 54 # Dll rule - builds the target dll. 55 $(OBJDIR)\$(TARGET).dll: $(OBJS) $(TARGET).def $(OBJDIR)\$(TARGET).lrf 56 $(LD2) $(LD2FLAGS) @$(OBJDIR)\$(TARGET).lrf 49 57 50 58 59 # Linker file - creates the parameter file passed on to the linker. 60 $(OBJDIR)\$(TARGET).lrf: makefile 61 @echo Creating file <<$@ 62 /OUT:$(OBJDIR)\$(TARGET).dll 63 /MAP:$(OBJDIR)\$(TARGET).map 64 $(OBJS) 65 pmwinx.lib 66 $(PDWIN32_LIB)/kernel32.lib 67 $(PDWIN32_LIB)/odincrt.lib 68 $(PDWIN32_LIB)/ole32.lib 69 mmpm2.lib 70 OS2386.LIB 71 $(RTLLIB_O) 72 $(TARGET).def 73 <<keep 74 75 76 # Dep rule - makes depenencies for C, C++ and Asm files. 51 77 dep: 52 78 $(DEPEND) -I$(PDWIN32_INCLUDE);$(PDWIN32_INCLUDE)\win \ 53 79 *.c *.cpp *.h *.asm *.inc $(PDWIN32_INCLUDE)\*.h 54 80 55 !ifndef NODEP56 !include .depend57 !endif58 81 82 # Includes the common rules. 83 !include $(PDWIN32_INCLUDE)/pdwin32.post 59 84 60 clean:61 $(RM) *.obj *.lib *.dll *.map *.pch \62 $(PDWIN32_BIN)\$(TARGET).dll $(PDWIN32_LIB)\$(TARGET).lib \63 resource.asm $(TARGET)exp.def64
Note:
See TracChangeset
for help on using the changeset viewer.