Home Download Musics Developers
API Sources Tools File Format Technicals

ymemul.h

Go to the documentation of this file.
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 
00033 #define YM_BASEPERL  0  
00034 #define YM_BASEPERH  1  
00035 #define YM_BASEVOL   8  
00037 #define YM_PERL(N) (YM_BASEPERL+(N)*2) 
00038 #define YM_PERH(N) (YM_BASEPERH+(N)*2) 
00039 #define YM_VOL(N)  (YM_BASEVOL+(N))    
00041 #define YM_NOISE     6  
00042 #define YM_MIXER     7  
00043 #define YM_ENVL      11 
00044 #define YM_ENVH      12 
00045 #define YM_ENVTYPE   13 
00046 #define YM_ENVSHAPE  13 
00052 typedef struct
00053 {
00054   /* Internal YM register */
00055   u8 ctrl;        
00056   u8 data[16];    
00058   /* Envelop specific */
00059   unsigned int env_ct;      
00060   unsigned int env_cont;    
00061   unsigned int env_alt;     
00062   unsigned int env_bit;     
00063   unsigned int env_bitstp;  
00065   /* Noise specific */
00066   unsigned int noise_gen;  
00067   unsigned int noise_ct;   
00069   /* Sound specific */
00070     signed int voice_ctA;  
00071     signed int voice_ctB;  
00072     signed int voice_ctC;  
00073   unsigned int sq;         
00074 } ym2149_t;
00075 
00077 extern ym2149_t ym;
00078 
00095 unsigned int YM_sampling_rate(unsigned int f);
00096 
00110 int YM_reset(void);
00111 
00126 int YM_init(void);
00127 
00152 unsigned int YM_mix(cycle68_t cycle2mix);
00153 
00170 u32 *YM_get_buffer(void);
00171 
00181 void YM_subcycle(cycle68_t subcycle);
00182 
00205 void YM_writereg(u8 reg, u8 v, cycle68_t cycle);
00206 
00220 u8 YM_readreg(u8 reg, cycle68_t cycle);
00221 
00234 int YM_get_activevoices(void);
00235 
00248 void YM_set_activeVoices(int v);
00249 
00256 #ifdef __cplusplus
00257 }
00258 #endif
00259 
00260 #endif /* #ifndef _YM_EMUL_H_ */
00261