⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gbsnd.h

📁 ESS3890+SL原代码(1*16内存)
💻 H
字号:
/* Copyright 2001, ESS Technology, Inc./* SCCSID @(#)gbsnd.h	1.7 03/27/03 *//* Based on gbsnd.h	1.10 03/14/02 *//** VGB: portable GameBoy emulator ***************************//**                                                         **//**                         GBSND.c                         **//**                                                         **//** This file contains definitions and declarations for     **//** routines in GBSND.c.                                    **//**                                                         **//** Copyright (C) Marat Fayzullin 1995-2001                 **//**     The contents of this file are property of Marat     **//**     Fayzullin and should only be used as agreed with    **//**     him. The file is confidential. Absolutely no        **//**     distribution allowed.                               **//*************************************************************/#ifndef GBSND_H#define GBSND_H#define GBSND_BASE     131072 /* Base frequency             */#define GBSND_CHANNELS 4      /* Number of channels         */#define RECORD_NOTES   8 #define SND_CONSTANT 111861 /* Sound base frequency (Hz)     */#define SND_UPDATE   60     /* Sound update frequency (Hz)   */#ifndef BYTE_TYPE_DEFINED#define BYTE_TYPE_DEFINEDtypedef unsigned char byte;#endif#ifndef WORD_TYPE_DEFINED#define WORD_TYPE_DEFINEDtypedef unsigned short word;#endif#ifdef VGB/** GBSND ****************************************************//** This data structure stores GameBoy sound chip state.    **//*************************************************************/typedef struct{  byte *R;                      /* Current register contents from FF00h */  /* Sound parameters */  int Count[GBSND_CHANNELS];    /* Counter to the sound's end (ms) */  int Length[GBSND_CHANNELS];   /* Sound length (ms) */  int Freq[GBSND_CHANNELS];     /* Frequency (Hz) */  int Volume[GBSND_CHANNELS];   /* Volume (0..15) */  int ChVolume[GBSND_CHANNELS]; /* Master volume (0..14) */  /* Volume Envelopes */  int VCount[GBSND_CHANNELS];   /* Counter to the next step (ms) */  int VPeriod[GBSND_CHANNELS];  /* Time between steps (ms) */  int VDir[GBSND_CHANNELS];     /* Increment (+1) or decrement (-1) */  /* CH1 Frequency Sweep */  int FCount;                   /* Counter to the next step (ms) */  int FPeriod;                  /* Time between steps (ms) */  int FDir;                     /* Increment (+1) or decrement (-1) */  int FNumber;                  /* Frequency number 000h-7FFh */  int FStep;                    /* FNum[t+1]=FNum[t]+FNum[t]/(2^FStep) */  int First;                    /* First Sound() channel to use */    int rp;  int wp;  int freq[RECORD_NOTES][GBSND_CHANNELS];  int volume[RECORD_NOTES][GBSND_CHANNELS];  int SOUND_amplify;  int lasttimer;  int deltatime;  int savedvol[GBSND_CHANNELS];  int savedfreq[GBSND_CHANNELS];  int lastvol[GBSND_CHANNELS];} GBSND;GBSND *SNDChip;           /* GameBoy sound chip state         *//** ResetSND() ***********************************************//** Reset the sound chip and use sound channels from the    **//** one given in First.                                     **//*************************************************************/void ResetSND(register GBSND *D,byte *Regs,int First);/** WriteSND() ***********************************************//** Call this function to output a value V into the sound   **//** chip register A.                                        **//*************************************************************/byte WriteSND(register GBSND *D,register byte A,register byte V);/** LoopSND() ************************************************//** Call this function periodically to update volume        **//** envelopes. Use mS to pass the time since the last call  **//** of LoopSND() in milliseconds.                           **//*************************************************************/int LoopSND(register GBSND *D,int mS);/** SyncSND() ************************************************//** Flush all accumulated changes by issuing Sound() calls  **//** and set the synchronization on/off. The second argument **//** should be GBSND_SYNC/GBSND_ASYNC to set/reset sync, or  **//** GBSND_FLUSH to leave sync mode as it is. To emulate     **//** noise channel with MIDI drums, OR second argument with  **//** GBSND_DRUMS.                                            **//*************************************************************/void SyncSND();#endif#ifdef INEStypedef struct{  /* Sound parameters */  int  Volume[6];  int  Freq[6];      /* Sound volumes (0-255) and frequencies (Hz) */  int  VSweep[5];  int  FSweep[5];    /* Volume and frequency deltas                */  int  VCount[5];  int  FCount[5];    /* Volume envelope and frequency counters     */  int  VDecay[5];    /* Volume decay                               */  byte SND[32];      /* Sound chip registers                       */  int rp;  int wp;  int freq[RECORD_NOTES][GBSND_CHANNELS];  int volume[RECORD_NOTES][GBSND_CHANNELS];  int SOUND_amplify;  int lasttimer;  int deltatime;  int motor_cnt;  int volume_display;  /* For volume bar display */  int volume_display_stime;} NESSND;#ifndef CD_GAMENESSND  *NSNDChip;int *P_Lengths;int *Noise_freq;extern int key0;int SoundLoop(int);int InitSound(int Rate) ;void TrashSound(void);#endif /*CD_GAME*/#endif/** TrashSound() *********************************************//** Shut down sound.                                        **//*************************************************************/#endif /* GBSND_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -