version 1.7 | | version 1.8 |
---|
| | |
#include <stdlib.h> | | #include <stdlib.h> |
#include <stdio.h> | | #include <stdio.h> |
#include <string.h> | | #include <string.h> |
| | #define byte w32_byte |
#define WIN32_LEAN_AND_MEAN | | #define WIN32_LEAN_AND_MEAN |
#include <windows.h> | | #include <windows.h> |
#include <mmsystem.h> | | #include <mmsystem.h> |
#include <dsound.h> | | #include <dsound.h> |
| | #undef byte |
| | |
#include <math.h> | | #include <math.h> |
| | |
| | |
//added 2000/01/15 Matt Mueller -- remove some duplication (and fix a big memory leak, in the kill=0 one case) | | //added 2000/01/15 Matt Mueller -- remove some duplication (and fix a big memory leak, in the kill=0 one case) |
static int DS_release_slot(int slot,int kill){ | | static int DS_release_slot(int slot,int kill){ |
if (SoundSlots[slot].lpsb) { | | if (SoundSlots[slot].lpsb) { |
unsigned int s; | | DWORD s; |
IDirectSoundBuffer_GetStatus(SoundSlots[slot].lpsb, &s); | | IDirectSoundBuffer_GetStatus(SoundSlots[slot].lpsb, &s); |
if (s & DSBSTATUS_PLAYING){ | | if (s & DSBSTATUS_PLAYING){ |
if (kill) | | if (kill) |
| | |
| | |
{ | | { |
char *ptr1, *ptr2; | | char *ptr1, *ptr2; |
int len1, len2; | | DWORD len1, len2; |
| | |
IDirectSoundBuffer_Lock(SoundSlots[slot].lpsb, 0, Sounddat(soundnum)->length, | | IDirectSoundBuffer_Lock(SoundSlots[slot].lpsb, 0, Sounddat(soundnum)->length, |
(void **)&ptr1, &len1, (void **)&ptr2, &len2, 0); | | (void **)&ptr1, &len1, (void **)&ptr2, &len2, 0); |
memcpy(ptr1,Sounddat(soundnum)->data, MIN(len1, Sounddat(soundnum)->length)); | | memcpy(ptr1,Sounddat(soundnum)->data, MIN(len1, Sounddat(soundnum)->length)); |
| | |
} | | } |
{ | | { |
char *ptr1, *ptr2; | | char *ptr1, *ptr2; |
int len1, len2; | | DWORD len1, len2; |
IDirectSoundBuffer_Lock(SoundSlots[slot].lpsb, 0, SoundSlots[slot].length, | | IDirectSoundBuffer_Lock(SoundSlots[slot].lpsb, 0, SoundSlots[slot].length, |
(void **)&ptr1, &len1, (void **)&ptr2, &len2, 0); | | (void **)&ptr1, &len1, (void **)&ptr2, &len2, 0); |
memcpy(ptr1, SoundSlots[slot].samples, MIN(len1,(int)SoundSlots[slot].length)); | | memcpy(ptr1, SoundSlots[slot].samples, MIN(len1,(int)SoundSlots[slot].length)); |