123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- /* Catacomb Apocalypse Source Code
- * Copyright (C) 1993-2014 Flat Rock Software
- *
- * 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 2 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, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
- //
- // ID Engine
- // ID_SD.h - Sound Manager Header
- // v1.0d1
- // By Jason Blochowiak
- //
- #ifndef __TYPES__
- #include "ID_Types.h"
- #endif
- #ifndef __ID_SD__
- #define __ID_SD__
- #ifdef __DEBUG__
- #define __DEBUG_SoundMgr__
- #endif
- #define TickBase 70 // 70Hz per tick - used as a base for timer 0
- typedef enum {
- sdm_Off,
- sdm_PC,sdm_AdLib,
- } SDMode;
- typedef enum {
- smm_Off,smm_AdLib
- } SMMode;
- typedef struct
- {
- longword length;
- word priority;
- } SoundCommon;
- // PC Sound stuff
- #define pcTimer 0x42
- #define pcTAccess 0x43
- #define pcSpeaker 0x61
- #define pcSpkBits 3
- typedef struct
- {
- SoundCommon common;
- byte data[1];
- } PCSound;
- // Registers for the Sound Blaster card - needs to be offset by n0
- #define sbReset 0x206
- #define sbReadData 0x20a
- #define sbWriteCmd 0x20c
- #define sbWriteData 0x20c
- #define sbWriteStat 0x20c
- #define sbDataAvail 0x20e
- typedef struct
- {
- SoundCommon common;
- word hertz;
- byte bits,
- reference,
- data[1];
- } SampledSound;
- // Registers for the AdLib card
- // Operator stuff
- #define alChar 0x20
- #define alScale 0x40
- #define alAttack 0x60
- #define alSus 0x80
- #define alWave 0xe0
- // Channel stuff
- #define alFreqL 0xa0
- #define alFreqH 0xb0
- #define alFeedCon 0xc0
- // Global stuff
- #define alEffects 0xbd
- typedef struct
- {
- byte mChar,cChar,
- mScale,cScale,
- mAttack,cAttack,
- mSus,cSus,
- mWave,cWave,
- nConn,
- // These are only for Muse - these bytes are really unused
- voice,
- mode,
- unused[3];
- } Instrument;
- typedef struct
- {
- SoundCommon common;
- Instrument inst;
- byte block,
- data[1];
- } AdLibSound;
- //
- // Sequencing stuff
- //
- #define sqMaxTracks 10
- #define sqMaxMoods 1 // DEBUG
- #define sev_Null 0 // Does nothing
- #define sev_NoteOff 1 // Turns a note off
- #define sev_NoteOn 2 // Turns a note on
- #define sev_NotePitch 3 // Sets the pitch of a currently playing note
- #define sev_NewInst 4 // Installs a new instrument
- #define sev_NewPerc 5 // Installs a new percussive instrument
- #define sev_PercOn 6 // Turns a percussive note on
- #define sev_PercOff 7 // Turns a percussive note off
- #define sev_SeqEnd -1 // Terminates a sequence
- // Flags for MusicGroup.flags
- #define sf_Melodic 0
- #define sf_Percussive 1
- #if 1
- typedef struct
- {
- word length,
- values[1];
- } MusicGroup;
- #else
- typedef struct
- {
- word flags,
- count,
- offsets[1];
- } MusicGroup;
- #endif
- typedef struct
- {
- /* This part needs to be set up by the user */
- word mood,far *moods[sqMaxMoods];
- /* The rest is set up by the code */
- Instrument inst;
- boolean percussive;
- word far *seq;
- longword nextevent;
- } ActiveTrack;
- #define sqmode_Normal 0
- #define sqmode_FadeIn 1
- #define sqmode_FadeOut 2
- #define sqMaxFade 64 // DEBUG
- // Global variables
- extern boolean AdLibPresent,
- NeedsMusic; // For Caching Mgr
- extern SDMode SoundMode;
- extern SMMode MusicMode;
- extern longword TimeCount; // Global time in ticks
- extern SDMode oldsoundmode;
- // Function prototypes
- extern void SD_Startup(void),
- SD_Shutdown(void),
- SD_Default(boolean gotit,SDMode sd,SMMode sm),
- SD_PlaySound(soundnames sound),
- SD_StopSound(void),
- SD_WaitSoundDone(void),
- SD_StartMusic(MusicGroup far *music),
- SD_MusicOn(void),
- SD_MusicOff(void),
- SD_FadeOutMusic(void),
- SD_SetUserHook(void (*hook)(void));
- extern boolean SD_MusicPlaying(void),
- SD_SetSoundMode(SDMode mode),
- SD_SetMusicMode(SMMode mode);
- extern word SD_SoundPlaying(void);
- #ifdef _MUSE_ // MUSE Goes directly to the lower level routines
- extern void SDL_PCPlaySound(PCSound far *sound),
- SDL_PCStopSound(void),
- SDL_ALPlaySound(AdLibSound far *sound),
- SDL_ALStopSound(void);
- #endif
- #endif
|