summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/es5506.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/sound/es5506.h')
-rw-r--r--src/devices/sound/es5506.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/devices/sound/es5506.h b/src/devices/sound/es5506.h
index 3228ce44e39..0d30537170c 100644
--- a/src/devices/sound/es5506.h
+++ b/src/devices/sound/es5506.h
@@ -34,11 +34,13 @@ protected:
LP_MASK = LP3 | LP4
};
- const unsigned FINE_VOLUME_BIT = 16;
- const unsigned VOLUME_INTEGER_BIT = 12;
- const unsigned VOLUME_INTEGER_SHIFT = FINE_VOLUME_BIT - VOLUME_INTEGER_BIT;
- const unsigned VOLUME_ACC_SHIFT = 23 - VOLUME_INTEGER_BIT;
- const unsigned ADDRESS_FRAC_BIT = 11;
+ // constants for volumes
+ const u32 FINE_VOLUME_BIT = 16;
+
+ const u32 VOLUME_ACC_SHIFT = 11;
+
+ // constants for address
+ const u32 ADDRESS_FRAC_BIT = 11;
// struct describing a single playing voice
struct es550x_voice
@@ -86,15 +88,16 @@ protected:
void update_irq_state();
void update_internal_irq_state();
- void compute_tables();
+ void compute_tables(u32 total_volume_bit = 16, u32 exponent_bit = 4, u32 mantissa_bit = 8, u32 mantissa_shift = 11);
+ void get_accum_mask(u32 address_integer, u32 address_frac);
virtual inline u32 get_bank(u32 control) { return 0; }
virtual inline u32 get_ca(u32 control) { return 0; }
virtual inline u32 get_lp(u32 control) { return 0; }
- inline u32 get_volume(u16 volume) { return m_volume_lookup[volume >> VOLUME_INTEGER_SHIFT]; }
- inline unsigned get_accum_shifted_val(unsigned val, int bias = 0) { return val << (m_accum_shift - bias); }
- inline unsigned get_accum_res(unsigned val, int bias = 0) { return val >> (m_accum_shift - bias); }
+ inline u32 get_volume(u16 volume) { return m_volume_lookup[volume >> m_volume_shift_int]; }
+ inline u32 get_accum_shifted_val(u32 val, int bias = 0) { return val << (m_accum_shift - bias); }
+ inline u32 get_accum_res(u32 val, int bias = 0) { return val >> (m_accum_shift - bias); }
inline u32 get_integer_addr(u32 accum, s32 bias = 0) { return ((accum + (bias << ADDRESS_FRAC_BIT)) & m_accum_mask) >> ADDRESS_FRAC_BIT; }
inline s32 interpolate(s32 sample1, s32 sample2, u32 accum);
@@ -116,6 +119,9 @@ protected:
u64 m_accum_shift;
u64 m_accum_mask;
+ u64 m_volume_shift;
+ u64 m_volume_shift_int;
+
u8 m_current_page; /* current register page */
u8 m_active_voices; /* number of active voices */
u16 m_mode; /* MODE register */
@@ -158,9 +164,9 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
- const unsigned VOLUME_BIT_ES5506 = 16;
- const unsigned VOLUME_SHIFT_ES5506 = FINE_VOLUME_BIT - VOLUME_BIT_ES5506;
- const unsigned ADDRESS_FRAC_BIT_ES5506 = ADDRESS_FRAC_BIT;
+ const u32 VOLUME_BIT_ES5506 = 16;
+ const u32 ADDRESS_INTEGER_BIT_ES5506 = 21;
+ const u32 ADDRESS_FRAC_BIT_ES5506 = 11;
virtual inline u32 get_bank(u32 control) override { return (control >> 14) & 3; }
virtual inline u32 get_ca(u32 control) override { return (control >> 10) & 7; }
@@ -203,9 +209,9 @@ protected:
// device-level overrides
virtual void device_start() override;
- const unsigned VOLUME_BIT_ES5505 = 8;
- const unsigned VOLUME_SHIFT_ES5505 = FINE_VOLUME_BIT - VOLUME_BIT_ES5505;
- const unsigned ADDRESS_FRAC_BIT_ES5505 = 9;
+ const u32 VOLUME_BIT_ES5505 = 8;
+ const u32 ADDRESS_INTEGER_BIT_ES5505 = 20;
+ const u32 ADDRESS_FRAC_BIT_ES5505 = 9;
virtual inline u32 get_lp(u32 control) override { return (control >> 10) & LP_MASK; }
virtual inline u32 get_ca(u32 control) override { return (control >> 8) & 3; }