Skip to content

Commit 93b81fe

Browse files
committed
-taito/tc0060dca.cpp: Update stream before setting level.
-sound/msm5232.cpp: Cleaned up some inconsistent formatting.
1 parent f8324bf commit 93b81fe

File tree

3 files changed

+43
-39
lines changed

3 files changed

+43
-39
lines changed

src/devices/sound/msm5232.cpp

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -318,86 +318,84 @@ void msm5232_device::write(offs_t offset, uint8_t data)
318318
if (offset > 0x0d)
319319
return;
320320

321-
m_stream->update ();
321+
m_stream->update();
322322

323323
if (offset < 0x08) /* pitch */
324324
{
325-
int ch = offset&7;
325+
const int ch = offset & 7;
326326

327-
m_voi[ch].GF = ((data&0x80)>>7);
327+
m_voi[ch].GF = BIT(data, 7);
328328
if (ch == 7)
329329
gate_update();
330330

331-
if(data&0x80)
331+
if (data & 0x80)
332332
{
333-
if(data >= 0xd8)
333+
if (data >= 0xd8)
334334
{
335335
/*if ((data&0x7f) != 0x5f) logerror("MSM5232: WRONG PITCH CODE = %2x\n",data&0x7f);*/
336336
m_voi[ch].mode = 1; /* noise mode */
337337
m_voi[ch].eg_sect = 0; /* Key On */
338338
}
339339
else
340340
{
341-
if ( m_voi[ch].pitch != (data&0x7f) )
341+
if (m_voi[ch].pitch != (data & 0x7f))
342342
{
343343
int n;
344-
uint16_t pg;
345344

346-
m_voi[ch].pitch = data&0x7f;
345+
m_voi[ch].pitch = data & 0x7f;
347346

348-
pg = MSM5232_ROM[ data&0x7f ];
347+
const uint32_t pg = MSM5232_ROM[data & 0x7f];
349348

350349
m_voi[ch].TG_count_period = (pg & 0x1ff) * m_UpdateStep / 2;
351350

352-
n = (pg>>9) & 7; /* n = bit number for 16' output */
351+
n = (pg >> 9) & 7; /* n = bit number for 16' output */
353352
m_voi[ch].TG_out16 = 1<<n;
354353
/* for 8' it is bit n-1 (bit 0 if n-1<0) */
355354
/* for 4' it is bit n-2 (bit 0 if n-2<0) */
356355
/* for 2' it is bit n-3 (bit 0 if n-3<0) */
357-
n = (n>0)? n-1: 0;
358-
m_voi[ch].TG_out8 = 1<<n;
356+
n = (n > 0) ? (n - 1) : 0;
357+
m_voi[ch].TG_out8 = 1 << n;
359358

360-
n = (n>0)? n-1: 0;
361-
m_voi[ch].TG_out4 = 1<<n;
359+
n = (n > 0) ? (n - 1) : 0;
360+
m_voi[ch].TG_out4 = 1 << n;
362361

363-
n = (n>0)? n-1: 0;
364-
m_voi[ch].TG_out2 = 1<<n;
362+
n = (n > 0) ? (n - 1) : 0;
363+
m_voi[ch].TG_out2 = 1 << n;
365364
}
366365
m_voi[ch].mode = 0; /* tone mode */
367366
m_voi[ch].eg_sect = 0; /* Key On */
368367
}
369368
}
370369
else
371370
{
372-
if ( !m_voi[ch].eg_arm ) /* arm = 0 */
371+
if (!m_voi[ch].eg_arm) /* arm = 0 */
373372
m_voi[ch].eg_sect = 2; /* Key Off -> go to release */
374-
else /* arm = 1 */
373+
else /* arm = 1 */
375374
m_voi[ch].eg_sect = 1; /* Key Off -> go to decay */
376375
}
377376
}
378377
else
379378
{
380-
int i;
381379
switch(offset)
382380
{
383381
case 0x08: /* group1 attack */
384-
for (i=0; i<4; i++)
385-
m_voi[i].ar_rate = m_ar_tbl[data&0x7] * m_external_capacitance[i];
382+
for (int i = 0; i < 4; i++)
383+
m_voi[i].ar_rate = m_ar_tbl[data & 0x7] * m_external_capacitance[i];
386384
break;
387385

388386
case 0x09: /* group2 attack */
389-
for (i=0; i<4; i++)
390-
m_voi[i+4].ar_rate = m_ar_tbl[data&0x7] * m_external_capacitance[i+4];
387+
for (int i = 0; i < 4; i++)
388+
m_voi[i + 4].ar_rate = m_ar_tbl[data & 0x7] * m_external_capacitance[i+4];
391389
break;
392390

393391
case 0x0a: /* group1 decay */
394-
for (i=0; i<4; i++)
395-
m_voi[i].dr_rate = m_dr_tbl[data&0xf] * m_external_capacitance[i];
392+
for (int i = 0; i < 4; i++)
393+
m_voi[i].dr_rate = m_dr_tbl[data & 0xf] * m_external_capacitance[i];
396394
break;
397395

398396
case 0x0b: /* group2 decay */
399-
for (i=0; i<4; i++)
400-
m_voi[i+4].dr_rate = m_dr_tbl[data&0xf] * m_external_capacitance[i+4];
397+
for (int i = 0; i < 4; i++)
398+
m_voi[i + 4].dr_rate = m_dr_tbl[data & 0xf] * m_external_capacitance[i + 4];
401399
break;
402400

403401
case 0x0c: /* group1 control */
@@ -410,17 +408,17 @@ void msm5232_device::write(offs_t offset, uint8_t data)
410408

411409
m_control1 = data;
412410

413-
for (i=0; i<4; i++)
411+
for (int i = 0; i < 4; i++)
414412
{
415-
if ( (data&0x10) && (m_voi[i].eg_sect == 1) )
413+
if ((data & 0x10) && (m_voi[i].eg_sect == 1))
416414
m_voi[i].eg_sect = 0;
417-
m_voi[i].eg_arm = data&0x10;
415+
m_voi[i].eg_arm = data & 0x10;
418416
}
419417

420-
m_EN_out16[0] = (data&1) ? ~0:0;
421-
m_EN_out8[0] = (data&2) ? ~0:0;
422-
m_EN_out4[0] = (data&4) ? ~0:0;
423-
m_EN_out2[0] = (data&8) ? ~0:0;
418+
m_EN_out16[0] = (data & 1) ? ~0 : 0;
419+
m_EN_out8[0] = (data & 2) ? ~0 : 0;
420+
m_EN_out4[0] = (data & 4) ? ~0 : 0;
421+
m_EN_out2[0] = (data & 8) ? ~0 : 0;
424422

425423
break;
426424

@@ -435,11 +433,11 @@ void msm5232_device::write(offs_t offset, uint8_t data)
435433
m_control2 = data;
436434
gate_update();
437435

438-
for (i=0; i<4; i++)
436+
for (int i = 0; i < 4; i++)
439437
{
440-
if ( (data&0x10) && (m_voi[i+4].eg_sect == 1) )
441-
m_voi[i+4].eg_sect = 0;
442-
m_voi[i+4].eg_arm = data&0x10;
438+
if ((data & 0x10) && (m_voi[i + 4].eg_sect == 1))
439+
m_voi[i + 4].eg_sect = 0;
440+
m_voi[i + 4].eg_arm = data & 0x10;
443441
}
444442

445443
m_EN_out16[1] = (data&1) ? ~0:0;

src/mame/taito/tc0060dca.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ tc0060dca_device::tc0060dca_device(const machine_config &mconfig, const char *ta
2222
{
2323
}
2424

25+
void tc0060dca_device::set_level(u8 level)
26+
{
27+
m_stream->update();
28+
m_level = level;
29+
}
30+
2531
void tc0060dca_device::device_start()
2632
{
2733
m_stream = stream_alloc(8, 2, clock(), STREAM_DEFAULT_FLAGS);

src/mame/taito/tc0060dca.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class tc0060dca_device : public device_t, public device_sound_interface
1010
public:
1111
tc0060dca_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
1212

13-
void set_level(u8 level) { m_level = level; }
13+
void set_level(u8 level);
1414

1515
protected:
1616
// device_t override

0 commit comments

Comments
 (0)