| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- /*
- ** Command & Conquer Red Alert(tm)
- ** Copyright 2025 Electronic Arts Inc.
- **
- ** This program is free software: you can redistribute it and/or modify
- ** it under the terms of the GNU General Public License as published by
- ** the Free Software Foundation, either version 3 of the License, or
- ** (at your option) any later version.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- /***************************************************************************
- ** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S **
- ***************************************************************************
- * *
- * Project Name : Westwood 32 bit Library *
- * *
- * File Name : AUDIO.H *
- * *
- * Programmer : Phil W. Gorrow *
- * *
- * Start Date : March 10, 1995 *
- * *
- * Last Update : March 10, 1995 [PWG] *
- * *
- *-------------------------------------------------------------------------*
- * Functions: *
- * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
- #include "wwstd.h"
- /*=========================================================================*/
- /* AUD file header type */
- /*=========================================================================*/
- #define AUD_FLAG_STEREO 1
- #define AUD_FLAG_16BIT 2
- // PWG 3-14-95: This structure used to have bit fields defined for Stereo
- // and Bits. These were removed because watcom packs them into a 32 bit
- // flag entry even though they could have fit in a 8 bit entry.
- #pragma pack(1);
- typedef struct {
- short int Rate; // Playback rate (hertz).
- long Size; // Size of data (bytes).
- long UncompSize; // Size of data (bytes).
- unsigned char Flags; // Holds flags for info
- // 1: Is the sample stereo?
- // 2: Is the sample 16 bits?
- unsigned char Compression; // What kind of compression for this sample?
- } AUDHeaderType;
- /*=========================================================================*/
- /* There can be a different sound driver for sound effects, digitized */
- /* samples, and musical scores. Each one must be of these specified */
- /* types. */
- /*=========================================================================*/
- typedef enum {
- SAMPLE_NONE, // No digitized sounds will be played.
- SAMPLE_SB, // Sound Blaster digitized driver.
- SAMPLE_SBPRO, // Sound Blaster Pro digitized driver.
- SAMPLE_PAS, // Pro-Audio Spectrum digitized driver.
- SAMPLE_ADLIBG, // Adlib-Gold digitized driver.
- SAMPLE_TANDY, // Tandy 'compatible' driver.
- SAMPLE_PCSPKR, // PC speaker digitized driver (The Audio Solution driver).
- SAMPLE_ADLIB, // Adlib digitized driver (The Audio Solution driver).
- SAMPLE_TEMP=0x1000,
- SAMPLE_LAST
- } Sample_Type;
- typedef enum {
- SCORE_NONE, // No scores will be played.
- SCORE_ALFX, // Westwood's ALFX adlib compatable driver.
- SCORE_WWPCSPKR, // Westwood's PC-speaker driver (obsolete).
- SCORE_WWTANDY, // Westwood's PC-speaker driver with Tandy mod (obsolete).
- SCORE_PCSPKR, // PC speaker XMIDI driver.
- SCORE_TANDY, // Tandy XMIDI driver.
- SCORE_MT32, // MT-32 / LAPC-1 Roland XMIDI driver.
- SCORE_CANVAS, // Sound Canvas SC-55.
- SCORE_ADLIB, // Adlib XMIDI driver.
- SCORE_ADLIBG, // Adlib Gold XMIDI driver.
- SCORE_PASFM, // Pro Audio Spectrum XMIDI driver.
- SCORE_SBFM, // Sound Blaster XMIDI driver.
- SCORE_SBP1FM, // Sound Blaster Pro (YM3812) XMIDI driver.
- SCORE_SBP2FM, // Sound Blaster Pro (OPL3) XMIDI driver (Can't use with SFX_ALFX).
- SCORE_TEMP=0x1000,
- SCORE_LAST
- } Score_Type;
- typedef enum {
- SFX_NONE, // No sound effects will be played.
- SFX_ALFX, // Westwood's ALFX adlib compatable driver.
- SFX_WWPCSPKR, // Westwood's PC-speaker driver.
- SFX_WWTANDY, // Westwood's PC-speaker driver with Tandy mod.
- SFX_PCSPKR, // PC speaker XMIDI driver.
- SFX_TANDY, // Tandy XMIDI driver.
- SFX_MT32, // MT-32 / LAPC-1 Roland XMIDI driver.
- SFX_CANVAS, // Sound Canvas SC-55.
- SFX_ADLIB, // Adlib XMIDI driver.
- SFX_ADLIBG, // Adlib Gold XMIDI driver.
- SFX_PASFM, // Pro Audio Spectrum XMIDI driver.
- SFX_SBFM, // Sound Blaster XMIDI driver.
- SFX_SBP1FM, // Sound Blaster Pro (YM3812) XMIDI driver.
- SFX_SBP2FM, // Sound Blaster Pro (OPL3) XMIDI driver.
- SFX_TEMP=0x1000,
- SFX_LAST
- } SFX_Type;
- typedef enum RateEnum {
- PLAYBACK_RATE_SLOW =11025,
- PLAYBACK_RATE_NORMAL =(11025 * 2),
- PLAYBACK_RATE_FAST =(11025 * 4),
- } RateType;
- /*=========================================================================*/
- /* The following prototypes are for the file: SOUNDIO.CPP */
- /*=========================================================================*/
- int File_Stream_Sample(char const *filename, BOOL real_time_start = FALSE);
- int File_Stream_Sample_Vol(char const *filename, int volume, BOOL real_time_start = FALSE);
- void cdecl _saveregs Sound_Callback(void);
- void cdecl far __saveregs __loadds maintenance_callback(void);
- void *Load_Sample(char const *filename);
- long Load_Sample_Into_Buffer(char const *filename, void *buffer, long size);
- long Sample_Read(int fh, void *buffer, long size);
- void Free_Sample(void const *sample);
- BOOL Sound_Init(int sfx, int score, int sample, RateType rate, int bits_per_sample, int max_samples, int reverse_channels);
- BOOL Audio_Init(int sample, int address, int inter, int dma, RateType rate, int bits_per_sample, int max_samples, int reverse_channels = FALSE);
- void Sound_End(void);
- void Stop_Sample(int handle);
- BOOL Sample_Status(int handle);
- BOOL Is_Sample_Playing(void const * sample);
- void Stop_Sample_Playing(void const * sample);
- int Play_Sample(void const *sample, int priority=0xFF, int volume=0xFF, signed short panloc = 0x0);
- int Play_Sample_Handle(void const *sample, int priority, int volume, signed short panloc, int id);
- int Set_Sound_Vol(int volume);
- int Set_Score_Vol(int volume);
- void Fade_Sample(int handle, int ticks);
- int Get_Free_Sample_Handle(int priority);
- int Get_Digi_Handle(void);
- long Sample_Length(void const *sample);
- extern int Misc;
- extern SFX_Type SoundType;
- extern Sample_Type SampleType;
|