00001 00011 /* Copyright (C) 1998-2003 Benjamin Gerard */ 00012 00013 #ifndef _YM_EMUL_H_ 00014 #define _YM_EMUL_H_ 00015 00016 #include "emu68/type68.h" 00017 00018 #ifdef __cplusplus 00019 extern "C" { 00020 #endif 00021 00022 #define YM_BASEPERL 0 00023 #define YM_BASEPERH 1 00024 #define YM_BASEVOL 8 00026 #define YM_PERL(N) (YM_BASEPERL+(N)*2) 00027 #define YM_PERH(N) (YM_BASEPERH+(N)*2) 00028 #define YM_VOL(N) (YM_BASEVOL+(N)) 00030 #define YM_NOISE 6 00031 #define YM_MIXER 7 00032 #define YM_ENVL 11 00033 #define YM_ENVH 12 00034 #define YM_ENVTYPE 13 00035 #define YM_ENVSHAPE 13 00038 typedef struct 00039 { 00040 /* Internal YM register */ 00041 u8 ctrl; 00042 u8 data[16]; 00044 /* Envelop specific */ 00045 unsigned int env_ct; 00046 unsigned int env_cont; 00047 unsigned int env_alt; 00048 unsigned int env_bit; 00049 unsigned int env_bitstp; 00051 /* Noise specific */ 00052 unsigned int noise_gen; 00053 unsigned int noise_ct; 00055 /* Sound specific */ 00056 signed int voice_ctA; 00057 signed int voice_ctB; 00058 signed int voice_ctC; 00059 unsigned int sq; 00060 } ym2149_t; 00061 00063 extern ym2149_t ym; 00064 00081 unsigned int YM_sampling_rate(unsigned int f); 00082 00096 int YM_reset(void); 00097 00112 int YM_init(void); 00113 00138 unsigned int YM_mix(cycle68_t cycle2mix); 00139 00156 u32 *YM_get_buffer(void); 00157 00167 void YM_subcycle(cycle68_t subcycle); 00168 00191 void YM_writereg(u8 reg, u8 v, cycle68_t cycle); 00192 00206 u8 YM_readreg(u8 reg, cycle68_t cycle); 00207 00220 int YM_get_activevoices(void); 00221 00234 void YM_set_activeVoices(int v); 00235 00238 #ifdef __cplusplus 00239 } 00240 #endif 00241 00242 #endif /* #ifndef _YM_EMUL_H_ */ 00243