From f35ea946dd2d398a5b0d09ab0f086590dfb797cf Mon Sep 17 00:00:00 2001 From: theoddone33 Date: Mon, 27 May 2002 01:06:01 +0000 Subject: [PATCH] sound.cpp works --- include/acm.h | 9 +++++++-- include/ds.h | 15 +++++++++++++-- include/unix.h | 11 ++++++++++- src/sound/sound.cpp | 19 +++++++++++++++++-- 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/include/acm.h b/include/acm.h index ec24c8e..421e665 100644 --- a/include/acm.h +++ b/include/acm.h @@ -7,8 +7,11 @@ * Header file for interface to Audio Compression Manager functions * * $Log$ - * Revision 1.1 2002/05/03 03:28:12 root - * Initial revision + * Revision 1.2 2002/05/27 01:06:01 theoddone33 + * sound.cpp works + * + * Revision 1.1.1.1 2002/05/03 03:28:12 root + * Initial import. * * * 2 10/07/98 10:53a Dave @@ -36,8 +39,10 @@ #ifndef __FREESPACE_ACM_H__ #define __FREESPACE_ACM_H__ +#ifndef PLAT_UNIX #include #include +#endif #include "pstypes.h" int ACM_convert_ADPCM_to_PCM(WAVEFORMATEX *pwfxSrc, ubyte *src, int src_len, ubyte **dest, int max_dest_bytes, int *dest_len, unsigned int *src_bytes_used, unsigned short dest_bps=16); diff --git a/include/ds.h b/include/ds.h index 729db44..617760d 100644 --- a/include/ds.h +++ b/include/ds.h @@ -7,8 +7,11 @@ * Header file for interface to DirectSound * * $Log$ - * Revision 1.1 2002/05/03 03:28:12 root - * Initial revision + * Revision 1.2 2002/05/27 01:06:01 theoddone33 + * sound.cpp works + * + * Revision 1.1.1.1 2002/05/03 03:28:12 root + * Initial import. * * * 5 8/27/99 6:38p Alanl @@ -96,9 +99,11 @@ #ifndef __DS_H__ #define __DS_H__ +#ifndef PLAT_UNIX #include #include #include "vdsound.h" +#endif #include "pstypes.h" #define DS_HARDWARE (1<<0) @@ -132,10 +137,12 @@ typedef struct sound_info { } sound_info; extern int ds_initialized; +#ifndef PLAT_UNIX extern LPDIRECTSOUNDBUFFER pPrimaryBuffer; extern LPDIRECTSOUND pDirectSound; extern HRESULT (__stdcall *pfn_DirectSoundCaptureCreate)(LPGUID lpGUID, LPDIRECTSOUNDCAPTURE *lplpDSC, LPUNKNOWN pUnkOuter); +#endif int ds_init(int use_a3d, int use_eax); void ds_close(); @@ -191,11 +198,13 @@ void ds_do_frame(); // -------------------- // EAX (listener) reverb property set {4a4e6fc1-c341-11d1-b73a-444553540000} +#ifndef PLAT_UNIX DEFINE_GUID(DSPROPSETID_EAX_ReverbProperties, 0x4a4e6fc1, 0xc341, 0x11d1, 0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +#endif typedef enum { @@ -253,11 +262,13 @@ enum #define EAX_MAX_ENVIRONMENT (EAX_ENVIRONMENT_COUNT - 1) // EAX buffer reverb property set {4a4e6fc0-c341-11d1-b73a-444553540000} +#ifndef PLAT_UNIX DEFINE_GUID(DSPROPSETID_EAXBUFFER_ReverbProperties, 0x4a4e6fc0, 0xc341, 0x11d1, 0xb7, 0x3a, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00); +#endif typedef enum { diff --git a/include/unix.h b/include/unix.h index 374c1f4..d21d713 100644 --- a/include/unix.h +++ b/include/unix.h @@ -11,6 +11,7 @@ #define TRUE 1 #define FALSE 0 #define DWORD int +#define WORD short #define _MAX_FNAME 255 #define _MAX_PATH 255 #define MAX_PATH 255 @@ -53,6 +54,15 @@ typedef struct FILETIME_s { DWORD dwHighDateTime; } FILETIME, *PFILETIME; +typedef struct { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; +} WAVEFORMATEX; extern void strlwr (char *str); extern int filelength (int fd); extern int MulDiv (int, int, int); @@ -63,7 +73,6 @@ extern int MulDiv (int, int, int); #define closesocket(A) close(A) #define CopyMemory(A,B,C) memcpy(A,B,C) #define UINT unsigned int -#define WORD unsigned short #define SOCKET int #define SOCKADDR_IN struct sockaddr_in #define SOCKADDR struct sockaddr diff --git a/src/sound/sound.cpp b/src/sound/sound.cpp index d2ec5b6..6b7930d 100644 --- a/src/sound/sound.cpp +++ b/src/sound/sound.cpp @@ -7,6 +7,9 @@ * Low-level sound code * * $Log$ + * Revision 1.4 2002/05/27 01:06:01 theoddone33 + * sound.cpp works + * * Revision 1.3 2002/05/27 00:40:47 theoddone33 * Fix net_addr vs net_addr_t * @@ -312,12 +315,10 @@ #include "gamesnd.h" #include "alphacolors.h" -#ifndef PLAT_UNIX #include "ds.h" #include "ds3d.h" #include "acm.h" #include "dscap.h" -#endif #define SND_F_USED (1<<0) // Sounds[] element is used @@ -350,6 +351,7 @@ int ds_priority(int priority) { #ifdef PLAT_UNIX STUB_FUNCTION; + return 1; #else switch(priority){ case SND_PRIORITY_MUST_PLAY: @@ -423,7 +425,11 @@ int snd_init(int use_a3d, int use_eax) if ( num_tries++ > 5 ) { if ( !gave_warning ) { +#ifndef PLAT_UNIX MessageBox(NULL, XSTR("DirectSound could not be initialized. If you are running any applications playing sound in the background, you should stop them before continuing.",971), NULL, MB_OK); +#else + fprintf (stderr, "Sound could not be initialized\n"); +#endif gave_warning = 1; } else { goto Failure; @@ -433,8 +439,12 @@ int snd_init(int use_a3d, int use_eax) // Init the Audio Compression Manager if ( ACM_init() == -1 ) { +#ifndef PLAT_UNIX HWND hwnd = (HWND)os_get_window(); MessageBox(hwnd, XSTR("Could not properly initialize the Microsoft ADPCM codec.\n\nPlease see the readme.txt file for detailed instructions on installing the Microsoft ADPCM codec.",972), NULL, MB_OK); +#else + fprintf (stderr, "ACM_init failed\n"); +#endif // Warning(LOCATION, "Could not properly initialize the Microsoft ADPCM codec.\nPlease see the readme.txt file for detailed instructions on installing the Microsoft ADPCM codec."); } @@ -1266,7 +1276,12 @@ void snd_stop_all() // uint sound_get_ds() { +#ifdef PLAT_UNIX + STUB_FUNCTION; + return 0; +#else return (uint)pDirectSound; +#endif } // --------------------------------------------------------------------------------------- -- 2.39.2