diff options
author | 2025-02-23 02:36:55 +1100 | |
---|---|---|
committer | 2025-02-23 02:36:55 +1100 | |
commit | 93b81fed4b31d9aa3b9e227cfdb83d5b7a066b44 (patch) | |
tree | 45162c03d5177762f47ef287d000addc364caa3d | |
parent | f8324bf6da5e38935fff9fba993b389ea3e1854f (diff) |
-taito/tc0060dca.cpp: Update stream before setting level.
-sound/msm5232.cpp: Cleaned up some inconsistent formatting.
-rw-r--r-- | src/devices/sound/msm5232.cpp | 74 | ||||
-rwxr-xr-x | src/mame/taito/tc0060dca.cpp | 6 | ||||
-rwxr-xr-x | src/mame/taito/tc0060dca.h | 2 |
3 files changed, 43 insertions, 39 deletions
diff --git a/src/devices/sound/msm5232.cpp b/src/devices/sound/msm5232.cpp index 3761e442ae7..e709b3af16b 100644 --- a/src/devices/sound/msm5232.cpp +++ b/src/devices/sound/msm5232.cpp @@ -318,19 +318,19 @@ void msm5232_device::write(offs_t offset, uint8_t data) if (offset > 0x0d) return; - m_stream->update (); + m_stream->update(); if (offset < 0x08) /* pitch */ { - int ch = offset&7; + const int ch = offset & 7; - m_voi[ch].GF = ((data&0x80)>>7); + m_voi[ch].GF = BIT(data, 7); if (ch == 7) gate_update(); - if(data&0x80) + if (data & 0x80) { - if(data >= 0xd8) + if (data >= 0xd8) { /*if ((data&0x7f) != 0x5f) logerror("MSM5232: WRONG PITCH CODE = %2x\n",data&0x7f);*/ m_voi[ch].mode = 1; /* noise mode */ @@ -338,30 +338,29 @@ void msm5232_device::write(offs_t offset, uint8_t data) } else { - if ( m_voi[ch].pitch != (data&0x7f) ) + if (m_voi[ch].pitch != (data & 0x7f)) { int n; - uint16_t pg; - m_voi[ch].pitch = data&0x7f; + m_voi[ch].pitch = data & 0x7f; - pg = MSM5232_ROM[ data&0x7f ]; + const uint32_t pg = MSM5232_ROM[data & 0x7f]; m_voi[ch].TG_count_period = (pg & 0x1ff) * m_UpdateStep / 2; - n = (pg>>9) & 7; /* n = bit number for 16' output */ + n = (pg >> 9) & 7; /* n = bit number for 16' output */ m_voi[ch].TG_out16 = 1<<n; /* for 8' it is bit n-1 (bit 0 if n-1<0) */ /* for 4' it is bit n-2 (bit 0 if n-2<0) */ /* for 2' it is bit n-3 (bit 0 if n-3<0) */ - n = (n>0)? n-1: 0; - m_voi[ch].TG_out8 = 1<<n; + n = (n > 0) ? (n - 1) : 0; + m_voi[ch].TG_out8 = 1 << n; - n = (n>0)? n-1: 0; - m_voi[ch].TG_out4 = 1<<n; + n = (n > 0) ? (n - 1) : 0; + m_voi[ch].TG_out4 = 1 << n; - n = (n>0)? n-1: 0; - m_voi[ch].TG_out2 = 1<<n; + n = (n > 0) ? (n - 1) : 0; + m_voi[ch].TG_out2 = 1 << n; } m_voi[ch].mode = 0; /* tone mode */ m_voi[ch].eg_sect = 0; /* Key On */ @@ -369,35 +368,34 @@ void msm5232_device::write(offs_t offset, uint8_t data) } else { - if ( !m_voi[ch].eg_arm ) /* arm = 0 */ + if (!m_voi[ch].eg_arm) /* arm = 0 */ m_voi[ch].eg_sect = 2; /* Key Off -> go to release */ - else /* arm = 1 */ + else /* arm = 1 */ m_voi[ch].eg_sect = 1; /* Key Off -> go to decay */ } } else { - int i; switch(offset) { case 0x08: /* group1 attack */ - for (i=0; i<4; i++) - m_voi[i].ar_rate = m_ar_tbl[data&0x7] * m_external_capacitance[i]; + for (int i = 0; i < 4; i++) + m_voi[i].ar_rate = m_ar_tbl[data & 0x7] * m_external_capacitance[i]; break; case 0x09: /* group2 attack */ - for (i=0; i<4; i++) - m_voi[i+4].ar_rate = m_ar_tbl[data&0x7] * m_external_capacitance[i+4]; + for (int i = 0; i < 4; i++) + m_voi[i + 4].ar_rate = m_ar_tbl[data & 0x7] * m_external_capacitance[i+4]; break; case 0x0a: /* group1 decay */ - for (i=0; i<4; i++) - m_voi[i].dr_rate = m_dr_tbl[data&0xf] * m_external_capacitance[i]; + for (int i = 0; i < 4; i++) + m_voi[i].dr_rate = m_dr_tbl[data & 0xf] * m_external_capacitance[i]; break; case 0x0b: /* group2 decay */ - for (i=0; i<4; i++) - m_voi[i+4].dr_rate = m_dr_tbl[data&0xf] * m_external_capacitance[i+4]; + for (int i = 0; i < 4; i++) + m_voi[i + 4].dr_rate = m_dr_tbl[data & 0xf] * m_external_capacitance[i + 4]; break; case 0x0c: /* group1 control */ @@ -410,17 +408,17 @@ void msm5232_device::write(offs_t offset, uint8_t data) m_control1 = data; - for (i=0; i<4; i++) + for (int i = 0; i < 4; i++) { - if ( (data&0x10) && (m_voi[i].eg_sect == 1) ) + if ((data & 0x10) && (m_voi[i].eg_sect == 1)) m_voi[i].eg_sect = 0; - m_voi[i].eg_arm = data&0x10; + m_voi[i].eg_arm = data & 0x10; } - m_EN_out16[0] = (data&1) ? ~0:0; - m_EN_out8[0] = (data&2) ? ~0:0; - m_EN_out4[0] = (data&4) ? ~0:0; - m_EN_out2[0] = (data&8) ? ~0:0; + m_EN_out16[0] = (data & 1) ? ~0 : 0; + m_EN_out8[0] = (data & 2) ? ~0 : 0; + m_EN_out4[0] = (data & 4) ? ~0 : 0; + m_EN_out2[0] = (data & 8) ? ~0 : 0; break; @@ -435,11 +433,11 @@ void msm5232_device::write(offs_t offset, uint8_t data) m_control2 = data; gate_update(); - for (i=0; i<4; i++) + for (int i = 0; i < 4; i++) { - if ( (data&0x10) && (m_voi[i+4].eg_sect == 1) ) - m_voi[i+4].eg_sect = 0; - m_voi[i+4].eg_arm = data&0x10; + if ((data & 0x10) && (m_voi[i + 4].eg_sect == 1)) + m_voi[i + 4].eg_sect = 0; + m_voi[i + 4].eg_arm = data & 0x10; } m_EN_out16[1] = (data&1) ? ~0:0; diff --git a/src/mame/taito/tc0060dca.cpp b/src/mame/taito/tc0060dca.cpp index 90226d96b23..b90a9f09131 100755 --- a/src/mame/taito/tc0060dca.cpp +++ b/src/mame/taito/tc0060dca.cpp @@ -22,6 +22,12 @@ tc0060dca_device::tc0060dca_device(const machine_config &mconfig, const char *ta { } +void tc0060dca_device::set_level(u8 level) +{ + m_stream->update(); + m_level = level; +} + void tc0060dca_device::device_start() { m_stream = stream_alloc(8, 2, clock(), STREAM_DEFAULT_FLAGS); diff --git a/src/mame/taito/tc0060dca.h b/src/mame/taito/tc0060dca.h index a89016ddbd2..0cbfefc9a58 100755 --- a/src/mame/taito/tc0060dca.h +++ b/src/mame/taito/tc0060dca.h @@ -10,7 +10,7 @@ class tc0060dca_device : public device_t, public device_sound_interface public: tc0060dca_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - void set_level(u8 level) { m_level = level; } + void set_level(u8 level); protected: // device_t override |