git-svn-id: https://svn.eduke32.com/eduke32@338 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-11-16 03:25:32 +00:00
parent bbbccb7b11
commit a75a1eb10c
5 changed files with 34 additions and 29 deletions

View file

@ -67,7 +67,7 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#define SILENCE_8BIT 0x80808080 #define SILENCE_8BIT 0x80808080
//#define SILENCE_16BIT_PAS 0 //#define SILENCE_16BIT_PAS 0
#ifdef WINDOWS #if defined(_WIN32)
#define MixBufferSize (MV_GetBufferSize(MV_RequestedMixRate)) #define MixBufferSize (MV_GetBufferSize(MV_RequestedMixRate))
#else #else
#define MixBufferSize 256 #define MixBufferSize 256
@ -272,7 +272,7 @@ parm [ edi ] [ eax ] [ ecx ] modify exact [ ecx edi ];
#define CDEC _cdecl #define CDEC _cdecl
#elif defined(WINDOWS) #elif defined(_WIN32)
#define CDEC __cdecl #define CDEC __cdecl

View file

@ -33,7 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "dsound.h" #include "dsound.h"
#include "osd.h"
#include "winlayer.h" #include "winlayer.h"
@ -181,7 +180,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
DSOUND_Shutdown(); DSOUND_Shutdown();
} }
printOSD("Initializing DirectSound...\n"); initprintf("Initializing DirectSound...\n");
if (!_DSOUND_CriticalSectionAlloced) if (!_DSOUND_CriticalSectionAlloced)
{ {
@ -191,7 +190,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
_DSOUND_CriticalSectionAlloced = TRUE; _DSOUND_CriticalSectionAlloced = TRUE;
} }
printOSD(" - Loading DSOUND.DLL\n"); initprintf(" - Loading DSOUND.DLL\n");
hDSoundDLL = LoadLibrary("DSOUND.DLL"); hDSoundDLL = LoadLibrary("DSOUND.DLL");
if (!hDSoundDLL) if (!hDSoundDLL)
{ {
@ -208,7 +207,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
return DSOUND_Error; return DSOUND_Error;
} }
printOSD(" - Creating DirectSound object\n"); initprintf(" - Creating DirectSound object\n");
hr = aDirectSoundCreate(NULL, &lpDS, NULL); hr = aDirectSoundCreate(NULL, &lpDS, NULL);
if (hr != DS_OK) if (hr != DS_OK)
{ {
@ -225,7 +224,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
return DSOUND_Error; return DSOUND_Error;
} }
printOSD(" - Creating primary buffer\n"); initprintf(" - Creating primary buffer\n");
ZeroMemory(&dsbuf, sizeof(dsbuf)); ZeroMemory(&dsbuf, sizeof(dsbuf));
dsbuf.dwSize = sizeof(DSBUFFERDESC); dsbuf.dwSize = sizeof(DSBUFFERDESC);
dsbuf.dwFlags = DSBCAPS_PRIMARYBUFFER; dsbuf.dwFlags = DSBCAPS_PRIMARYBUFFER;
@ -237,7 +236,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
return DSOUND_Error; return DSOUND_Error;
} }
printOSD(" - Setting primary buffer format\n" initprintf(" - Setting primary buffer format\n"
" Channels: %d\n" " Channels: %d\n"
" Sample rate: %dHz\n" " Sample rate: %dHz\n"
" Sample size: %d bits\n", " Sample size: %d bits\n",
@ -257,7 +256,7 @@ int DSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, int
return DSOUND_Error; return DSOUND_Error;
} }
printOSD(" - Creating secondary buffer\n"); initprintf(" - Creating secondary buffer\n");
ZeroMemory(&dsbuf, sizeof(dsbuf)); ZeroMemory(&dsbuf, sizeof(dsbuf));
dsbuf.dwSize = sizeof(DSBUFFERDESC); dsbuf.dwSize = sizeof(DSBUFFERDESC);
dsbuf.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_LOCSOFTWARE; dsbuf.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_LOCSOFTWARE;
@ -323,7 +322,7 @@ int DSOUND_Shutdown(void)
{ {
int i; int i;
if (DSOUND_Installed) printOSD("Uninitializing DirectSound...\n"); if (DSOUND_Installed) initprintf("Uninitializing DirectSound...\n");
DSOUND_Installed = FALSE; DSOUND_Installed = FALSE;
@ -347,7 +346,7 @@ int DSOUND_Shutdown(void)
if (lpDSBSecondary) if (lpDSBSecondary)
{ {
printOSD(" - Releasing secondary buffer\n"); initprintf(" - Releasing secondary buffer\n");
IDirectSoundBuffer_Stop(lpDSBSecondary); IDirectSoundBuffer_Stop(lpDSBSecondary);
IDirectSoundBuffer_Release(lpDSBSecondary); IDirectSoundBuffer_Release(lpDSBSecondary);
lpDSBSecondary = NULL; lpDSBSecondary = NULL;
@ -355,21 +354,21 @@ int DSOUND_Shutdown(void)
if (lpDSBPrimary) if (lpDSBPrimary)
{ {
printOSD(" - Releasing primary buffer\n"); initprintf(" - Releasing primary buffer\n");
IDirectSoundBuffer_Release(lpDSBPrimary); IDirectSoundBuffer_Release(lpDSBPrimary);
lpDSBPrimary = NULL; lpDSBPrimary = NULL;
} }
if (lpDS) if (lpDS)
{ {
printOSD(" - Releasing DirectSound object\n"); initprintf(" - Releasing DirectSound object\n");
IDirectSound_Release(lpDS); IDirectSound_Release(lpDS);
lpDS = NULL; lpDS = NULL;
} }
if (hDSoundDLL) if (hDSoundDLL)
{ {
printOSD(" - Unloading DSOUND.DLL\n"); initprintf(" - Unloading DSOUND.DLL\n");
FreeLibrary(hDSoundDLL); FreeLibrary(hDSoundDLL);
hDSoundDLL = NULL; hDSoundDLL = NULL;
} }
@ -581,11 +580,11 @@ int DSOUND_StopPlayback(void)
{ {
SetEvent(isrfinish); SetEvent(isrfinish);
printOSD("DirectSound: Waiting for sound thread to exit\n"); initprintf("DirectSound: Waiting for sound thread to exit\n");
if (WaitForSingleObject(isrthread, 300) == WAIT_OBJECT_0) if (WaitForSingleObject(isrthread, 300) == WAIT_OBJECT_0)
printOSD("DirectSound: Sound thread has exited\n"); initprintf("DirectSound: Sound thread has exited\n");
else else
printOSD("DirectSound: Sound thread failed to exit!\n"); initprintf("DirectSound: Sound thread failed to exit!\n");
/* /*
while (1) { while (1) {
if (!GetExitCodeThread(isrthread, &exitcode)) { if (!GetExitCodeThread(isrthread, &exitcode)) {

View file

@ -41,7 +41,6 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
#include "pitch.h" #include "pitch.h"
#include "multivoc.h" #include "multivoc.h"
#include "_multivc.h" #include "_multivc.h"
#include "osd.h"
#ifdef __MINGW32__ #ifdef __MINGW32__
#define min(a,b) (((a)<(b))?(a):(b)) #define min(a,b) (((a)<(b))?(a):(b))
@ -2794,7 +2793,7 @@ int MV_Init
MV_Shutdown(); MV_Shutdown();
} }
printOSD("Initializing MultiVoc...\n"); initprintf("Initializing MultiVoc...\n");
MV_SetErrorCode(MV_Ok); MV_SetErrorCode(MV_Ok);
@ -2812,7 +2811,7 @@ int MV_Init
// Set number of voices before calculating volume table // Set number of voices before calculating volume table
MV_MaxVoices = Voices; MV_MaxVoices = Voices;
printOSD(" - Maximum voices: %d\n", MV_MaxVoices); initprintf(" - Maximum voices: %d\n", MV_MaxVoices);
LL_Reset(&VoiceList, next, prev); LL_Reset(&VoiceList, next, prev);
LL_Reset(&VoicePool, next, prev); LL_Reset(&VoicePool, next, prev);
@ -2825,7 +2824,7 @@ int MV_Init
// Set the sampling rate // Set the sampling rate
MV_RequestedMixRate = MixRate; MV_RequestedMixRate = MixRate;
printOSD(" - Using %d byte mixing buffers\n", MixBufferSize); initprintf(" - Using %d byte mixing buffers\n", MixBufferSize);
// Allocate mix buffer within 1st megabyte // Allocate mix buffer within 1st megabyte
ptr = (char *)malloc(TotalBufferSize + 4); // FIXME: temporarily fixes bounds error somewhere... ptr = (char *)malloc(TotalBufferSize + 4); // FIXME: temporarily fixes bounds error somewhere...
@ -2924,7 +2923,7 @@ int MV_Shutdown
return(MV_Ok); return(MV_Ok);
} }
printOSD("Uninitializing MultiVoc...\n"); initprintf("Uninitializing MultiVoc...\n");
flags = DisableInterrupts(); flags = DisableInterrupts();

View file

@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "SDL.h" #include "SDL.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "osd.h"
#include "sdlayer.h" #include "sdlayer.h"
@ -115,9 +114,9 @@ int SDLSOUND_Init(int soundcard, int mixrate, int numchannels, int samplebits, i
SDLSOUND_Shutdown(); SDLSOUND_Shutdown();
} }
printOSD("Initializing SDL sound...\n"); initprintf("Initializing SDL sound...\n");
printOSD(" - Requested sound format\n" initprintf(" - Requested sound format\n"
" Channels: %d\n" " Channels: %d\n"
" Sample rate: %dHz\n" " Sample rate: %dHz\n"
" Sample size: %d bits\n", " Sample size: %d bits\n",
@ -146,7 +145,7 @@ int SDLSOUND_Shutdown(void)
{ {
int i; int i;
if (SDLSOUND_Installed) printOSD("Uninitializing SDL sound...\n"); if (SDLSOUND_Installed) initprintf("Uninitializing SDL sound...\n");
SDLSOUND_Installed = FALSE; SDLSOUND_Installed = FALSE;
@ -231,11 +230,11 @@ int DSOUND_StopPlayback(void)
{ {
SetEvent(isrfinish); SetEvent(isrfinish);
printOSD("DirectSound: Waiting for sound thread to exit\n"); initprintf("DirectSound: Waiting for sound thread to exit\n");
if (WaitForSingleObject(isrthread, 300) == WAIT_OBJECT_0) if (WaitForSingleObject(isrthread, 300) == WAIT_OBJECT_0)
printOSD("DirectSound: Sound thread has exited\n"); initprintf("DirectSound: Sound thread has exited\n");
else else
printOSD("DirectSound: Sound thread failed to exit!\n"); initprintf("DirectSound: Sound thread failed to exit!\n");
/* /*
while (1) { while (1) {
if (!GetExitCodeThread(isrthread, &exitcode)) { if (!GetExitCodeThread(isrthread, &exitcode)) {

View file

@ -2541,6 +2541,8 @@ int MV_Init(int soundcard,
MV_Shutdown(); MV_Shutdown();
} }
initprintf("Initializing MultiVoc...\n");
MV_SetErrorCode(MV_Ok); MV_SetErrorCode(MV_Ok);
MV_TotalMemory = Voices * sizeof(VoiceNode) + sizeof(HARSH_CLIP_TABLE_8); MV_TotalMemory = Voices * sizeof(VoiceNode) + sizeof(HARSH_CLIP_TABLE_8);
@ -2557,6 +2559,8 @@ int MV_Init(int soundcard,
// Set number of voices before calculating volume table // Set number of voices before calculating volume table
MV_MaxVoices = Voices; MV_MaxVoices = Voices;
initprintf(" - Maximum voices: %d\n", MV_MaxVoices);
LL_Reset((VoiceNode *)&VoiceList, next, prev); LL_Reset((VoiceNode *)&VoiceList, next, prev);
LL_Reset((VoiceNode *)&VoicePool, next, prev); LL_Reset((VoiceNode *)&VoicePool, next, prev);
@ -2565,6 +2569,8 @@ int MV_Init(int soundcard,
LL_Add((VoiceNode *)&VoicePool, &MV_Voices[ index ], next, prev); LL_Add((VoiceNode *)&VoicePool, &MV_Voices[ index ], next, prev);
} }
initprintf(" - Using %d byte mixing buffers\n", MixBufferSize);
// Allocate mix buffer within 1st megabyte // Allocate mix buffer within 1st megabyte
status = DPMI_GetDOSMemory((void **)&ptr, &MV_BufferDescriptor, status = DPMI_GetDOSMemory((void **)&ptr, &MV_BufferDescriptor,
2 * TotalBufferSize); 2 * TotalBufferSize);
@ -2669,6 +2675,8 @@ int MV_Shutdown(void)
return(MV_Ok); return(MV_Ok);
} }
initprintf("Uninitializing MultiVoc...\n");
flags = DisableInterrupts(); flags = DisableInterrupts();
MV_KillAllVoices(); MV_KillAllVoices();