sc68fordevelopers  2.2.1
ymemul.h
Go to the documentation of this file.
1 
11 /* Copyright (C) 1998-2003 Benjamin Gerard */
12 
13 #ifndef _YM_EMUL_H_
14 #define _YM_EMUL_H_
15 
16 #include "emu68/type68.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 #define YM_BASEPERL 0
23 #define YM_BASEPERH 1
24 #define YM_BASEVOL 8
26 #define YM_PERL(N) (YM_BASEPERL+(N)*2)
27 #define YM_PERH(N) (YM_BASEPERH+(N)*2)
28 #define YM_VOL(N) (YM_BASEVOL+(N))
30 #define YM_NOISE 6
31 #define YM_MIXER 7
32 #define YM_ENVL 11
33 #define YM_ENVH 12
34 #define YM_ENVTYPE 13
35 #define YM_ENVSHAPE 13
38 typedef struct
39 {
40  /* Internal YM register */
41  u8 ctrl;
42  u8 data[16];
44  /* Envelop specific */
45  unsigned int env_ct;
46  unsigned int env_cont;
47  unsigned int env_alt;
48  unsigned int env_bit;
49  unsigned int env_bitstp;
51  /* Noise specific */
52  unsigned int noise_gen;
53  unsigned int noise_ct;
55  /* Sound specific */
56  signed int voice_ctA;
57  signed int voice_ctB;
58  signed int voice_ctC;
59  unsigned int sq;
60 } ym2149_t;
61 
63 extern ym2149_t ym;
64 
81 unsigned int YM_sampling_rate(unsigned int f);
82 
96 int YM_reset(void);
97 
112 int YM_init(void);
113 
138 unsigned int YM_mix(cycle68_t cycle2mix);
139 
156 u32 *YM_get_buffer(void);
157 
167 void YM_subcycle(cycle68_t subcycle);
168 
191 void YM_writereg(u8 reg, u8 v, cycle68_t cycle);
192 
206 u8 YM_readreg(u8 reg, cycle68_t cycle);
207 
220 int YM_get_activevoices(void);
221 
234 void YM_set_activeVoices(int v);
235 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif /* #ifndef _YM_EMUL_H_ */
243 
u32 * YM_get_buffer(void)
Yamaha get buffer.
unsigned int env_bitstp
Envelop level step : [0 or 1].
Definition: ymemul.h:49
unsigned int u32
Must be an unsigned 32 bit integer.
Definition: type68.h:37
unsigned int env_alt
Alternate mask [0 or 0x1f].
Definition: ymemul.h:47
void YM_set_activeVoices(int v)
Set voices status.
unsigned int env_ct
Envelop period counter.
Definition: ymemul.h:45
unsigned int YM_sampling_rate(unsigned int f)
Set/get output buffer replay frequency.
signed int voice_ctB
Canal B sound period counter.
Definition: ymemul.h:57
unsigned char u8
Must be an unsigned 8 bit integer.
Definition: type68.h:31
YM-2149 internal data structure.
Definition: ymemul.h:38
unsigned int noise_ct
Noise generator period counter.
Definition: ymemul.h:53
int YM_get_activevoices(void)
Get voices status.
int YM_init(void)
Yamaha-2149 first one first initialization.
signed int voice_ctC
Canal C sound period counter.
Definition: ymemul.h:58
ym2149_t ym
YM-2149 emulator internal data.
void YM_writereg(u8 reg, u8 v, cycle68_t cycle)
Write in YM register.
signed int voice_ctA
Canal A sound period counter.
Definition: ymemul.h:56
unsigned int env_bit
Envelop level : 5 LSB are envelop level.
Definition: ymemul.h:48
int YM_reset(void)
Yamaha-2149 hardware reset.
unsigned int sq
Square level 0xABC.
Definition: ymemul.h:59
Type definitions.
u8 ctrl
Current control (working) register.
Definition: ymemul.h:41
unsigned int env_cont
Continue mask [0 or 0x1f].
Definition: ymemul.h:46
unsigned int YM_mix(cycle68_t cycle2mix)
Execute Yamaha-2149 emulation.
void YM_subcycle(cycle68_t subcycle)
Change YM cycle counter base.
u8 YM_readreg(u8 reg, cycle68_t cycle)
Read a YM-2119 register.
unsigned int cycle68_t
At least 32 bit integer.
Definition: type68.h:58
unsigned int noise_gen
Noise generator 17-bit shift register.
Definition: ymemul.h:52