summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-04-30 05:12:28 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-04-30 05:12:28 +0000
commit2465eb7e4eb5907030deee47df154111b40722d2 (patch)
tree5f8a4977110c61be9f0e3f9fefdeb359f8674ca1 /src/emu/sound
parentde178033502ab8693e7196cc59cf801cba1c7dc1 (diff)
Converted presave/postload functions to delegates. In a lot of
cases, we can get rid of the postload function entirely and just call directly to the target function. Drivers eventually should just override device_postload() instead of registering for callbacks.
Diffstat (limited to 'src/emu/sound')
-rw-r--r--src/emu/sound/2151intf.c9
-rw-r--r--src/emu/sound/2203intf.c5
-rw-r--r--src/emu/sound/2608intf.c5
-rw-r--r--src/emu/sound/2610intf.c5
-rw-r--r--src/emu/sound/2612intf.c5
-rw-r--r--src/emu/sound/fmopl.c5
-rw-r--r--src/emu/sound/k054539.c5
-rw-r--r--src/emu/sound/msm5232.c5
-rw-r--r--src/emu/sound/samples.c5
-rw-r--r--src/emu/sound/upd7759.c5
-rw-r--r--src/emu/sound/vlm5030.c5
-rw-r--r--src/emu/sound/ym2151.c7
-rw-r--r--src/emu/sound/ym2151.h3
-rw-r--r--src/emu/sound/ymz280b.c7
14 files changed, 26 insertions, 50 deletions
diff --git a/src/emu/sound/2151intf.c b/src/emu/sound/2151intf.c
index fcf7a703820..94526decd34 100644
--- a/src/emu/sound/2151intf.c
+++ b/src/emu/sound/2151intf.c
@@ -38,13 +38,6 @@ static STREAM_UPDATE( ym2151_update )
}
-static STATE_POSTLOAD( ym2151intf_postload )
-{
- ym2151_state *info = (ym2151_state *)param;
- ym2151_postload(machine, info->chip);
-}
-
-
static DEVICE_START( ym2151 )
{
static const ym2151_interface dummy = { 0 };
@@ -61,8 +54,6 @@ static DEVICE_START( ym2151 )
info->chip = ym2151_init(device,device->clock(),rate);
assert_always(info->chip != NULL, "Error creating YM2151 chip");
- device->machine().save().register_postload(ym2151intf_postload, info);
-
ym2151_set_irq_handler(info->chip,info->intf->irqhandler);
ym2151_set_port_write_handler(info->chip,info->intf->portwritehandler);
}
diff --git a/src/emu/sound/2203intf.c b/src/emu/sound/2203intf.c
index 6911fe32ba7..7a60892da78 100644
--- a/src/emu/sound/2203intf.c
+++ b/src/emu/sound/2203intf.c
@@ -106,9 +106,8 @@ static STREAM_UPDATE( ym2203_stream_update )
}
-static STATE_POSTLOAD( ym2203_intf_postload )
+static void ym2203_intf_postload (ym2203_state *info)
{
- ym2203_state *info = (ym2203_state *)param;
ym2203_postload(info->chip);
}
@@ -144,7 +143,7 @@ static DEVICE_START( ym2203 )
info->chip = ym2203_init(info,device,device->clock(),rate,timer_handler,IRQHandler,&psgintf);
assert_always(info->chip != NULL, "Error creating YM2203 chip");
- device->machine().save().register_postload(ym2203_intf_postload, info);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2203_intf_postload), info));
}
static DEVICE_STOP( ym2203 )
diff --git a/src/emu/sound/2608intf.c b/src/emu/sound/2608intf.c
index 5ae97272cfe..85351acb165 100644
--- a/src/emu/sound/2608intf.c
+++ b/src/emu/sound/2608intf.c
@@ -119,9 +119,8 @@ static STREAM_UPDATE( ym2608_stream_update )
}
-static STATE_POSTLOAD( ym2608_intf_postload )
+static void ym2608_intf_postload(ym2608_state *info)
{
- ym2608_state *info = (ym2608_state *)param;
ym2608_postload(info->chip);
}
@@ -167,7 +166,7 @@ static DEVICE_START( ym2608 )
timer_handler,IRQHandler,&psgintf);
assert_always(info->chip != NULL, "Error creating YM2608 chip");
- device->machine().save().register_postload(ym2608_intf_postload, info);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2608_intf_postload), info));
}
static DEVICE_STOP( ym2608 )
diff --git a/src/emu/sound/2610intf.c b/src/emu/sound/2610intf.c
index 05d44e53694..3c13dfda578 100644
--- a/src/emu/sound/2610intf.c
+++ b/src/emu/sound/2610intf.c
@@ -126,9 +126,8 @@ static STREAM_UPDATE( ym2610b_stream_update )
}
-static STATE_POSTLOAD( ym2610_intf_postload )
+static void ym2610_intf_postload(ym2610_state *info)
{
- ym2610_state *info = (ym2610_state *)param;
ym2610_postload(info->chip);
}
@@ -179,7 +178,7 @@ static DEVICE_START( ym2610 )
timer_handler,IRQHandler,&psgintf);
assert_always(info->chip != NULL, "Error creating YM2610 chip");
- device->machine().save().register_postload(ym2610_intf_postload, info);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2610_intf_postload), info));
}
static DEVICE_STOP( ym2610 )
diff --git a/src/emu/sound/2612intf.c b/src/emu/sound/2612intf.c
index 4e81f1675da..f6d95ad0452 100644
--- a/src/emu/sound/2612intf.c
+++ b/src/emu/sound/2612intf.c
@@ -90,9 +90,8 @@ static STREAM_UPDATE( ym2612_stream_update )
}
-static STATE_POSTLOAD( ym2612_intf_postload )
+static void ym2612_intf_postload(ym2612_state *info)
{
- ym2612_state *info = (ym2612_state *)param;
ym2612_postload(info->chip);
}
@@ -118,7 +117,7 @@ static DEVICE_START( ym2612 )
info->chip = ym2612_init(info,device,device->clock(),rate,timer_handler,IRQHandler);
assert_always(info->chip != NULL, "Error creating YM2612 chip");
- device->machine().save().register_postload(ym2612_intf_postload, info);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2612_intf_postload), info));
}
diff --git a/src/emu/sound/fmopl.c b/src/emu/sound/fmopl.c
index b4c215488ed..1b95bfda06d 100644
--- a/src/emu/sound/fmopl.c
+++ b/src/emu/sound/fmopl.c
@@ -1812,9 +1812,8 @@ static void OPLResetChip(FM_OPL *OPL)
}
-static STATE_POSTLOAD( OPL_postload )
+static void OPL_postload(FM_OPL *OPL)
{
- FM_OPL *OPL = (FM_OPL *)param;
int slot, ch;
for( ch=0 ; ch < 9 ; ch++ )
@@ -1957,7 +1956,7 @@ static void OPL_save_state(FM_OPL *OPL, device_t *device)
device->save_item(NAME(OPL->statusmask));
device->save_item(NAME(OPL->mode));
- device->machine().save().register_postload(OPL_postload, OPL);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(OPL_postload), OPL));
}
diff --git a/src/emu/sound/k054539.c b/src/emu/sound/k054539.c
index bf011cec5b3..b8fce4affe6 100644
--- a/src/emu/sound/k054539.c
+++ b/src/emu/sound/k054539.c
@@ -604,9 +604,8 @@ WRITE8_DEVICE_HANDLER( k054539_w )
regbase[offset] = data;
}
-static STATE_POSTLOAD( reset_zones )
+static void reset_zones(k054539_state *info)
{
- k054539_state *info = (k054539_state *)param;
int data = info->regs[0x22e];
info->cur_zone =
data == 0x80 ? info->ram :
@@ -674,7 +673,7 @@ static DEVICE_START( k054539 )
k054539_init_chip(device, info);
- device->machine().save().register_postload(reset_zones, info);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(reset_zones), info));
}
diff --git a/src/emu/sound/msm5232.c b/src/emu/sound/msm5232.c
index 414c9284c93..6bd50975c71 100644
--- a/src/emu/sound/msm5232.c
+++ b/src/emu/sound/msm5232.c
@@ -779,9 +779,8 @@ static STREAM_UPDATE( MSM5232_update_one )
/* MAME Interface */
-static STATE_POSTLOAD( msm5232_postload )
+static void msm5232_postload(msm5232_state *chip)
{
- msm5232_state *chip = (msm5232_state *)param;
msm5232_init_tables(chip);
}
@@ -799,7 +798,7 @@ static DEVICE_START( msm5232 )
chip->stream = device->machine().sound().stream_alloc(*device, 0, 11, rate, chip, MSM5232_update_one);
/* register with the save state system */
- device->machine().save().register_postload(msm5232_postload, chip);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(msm5232_postload), chip));
device->save_item(NAME(chip->EN_out16));
device->save_item(NAME(chip->EN_out8));
device->save_item(NAME(chip->EN_out4));
diff --git a/src/emu/sound/samples.c b/src/emu/sound/samples.c
index 67f3a6c94c3..4e3e08c1a56 100644
--- a/src/emu/sound/samples.c
+++ b/src/emu/sound/samples.c
@@ -423,9 +423,8 @@ static STREAM_UPDATE( sample_update_sound )
}
-static STATE_POSTLOAD( samples_postload )
+static void samples_postload(samples_info *info)
{
- samples_info *info = (samples_info *)param;
int i;
/* loop over channels */
@@ -493,7 +492,7 @@ static DEVICE_START( samples )
device->save_item(NAME(info->channel[i].loop), i);
device->save_item(NAME(info->channel[i].paused), i);
}
- device->machine().save().register_postload(samples_postload, info);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(samples_postload), info));
/* initialize any custom handlers */
if (intf->start)
diff --git a/src/emu/sound/upd7759.c b/src/emu/sound/upd7759.c
index f965257125c..7f611dc3ef9 100644
--- a/src/emu/sound/upd7759.c
+++ b/src/emu/sound/upd7759.c
@@ -592,9 +592,8 @@ static DEVICE_RESET( upd7759 )
}
-static STATE_POSTLOAD( upd7759_postload )
+static void upd7759_postload(upd7759_state *chip)
{
- upd7759_state *chip = (upd7759_state *)param;
chip->rom = chip->rombase + chip->romoffset;
}
@@ -628,7 +627,7 @@ static void register_for_save(upd7759_state *chip, device_t *device)
device->save_item(NAME(chip->sample));
device->save_item(NAME(chip->romoffset));
- device->machine().save().register_postload(upd7759_postload, chip);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(upd7759_postload), chip));
}
diff --git a/src/emu/sound/vlm5030.c b/src/emu/sound/vlm5030.c
index 229039e15cb..70de43431d2 100644
--- a/src/emu/sound/vlm5030.c
+++ b/src/emu/sound/vlm5030.c
@@ -517,9 +517,8 @@ static void vlm5030_setup_parameter(vlm5030_state *chip, UINT8 param)
}
-static STATE_POSTLOAD( vlm5030_restore_state )
+static void vlm5030_restore_state(vlm5030_state *chip)
{
- vlm5030_state *chip = (vlm5030_state *)param;
int i;
int interp_effect = FR_SIZE - (chip->interp_count%FR_SIZE);
@@ -726,7 +725,7 @@ static DEVICE_START( vlm5030 )
device->save_item(NAME(chip->target_pitch));
device->save_item(NAME(chip->target_k));
device->save_item(NAME(chip->x));
- device->machine().save().register_postload(vlm5030_restore_state, chip);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(vlm5030_restore_state), chip));
}
diff --git a/src/emu/sound/ym2151.c b/src/emu/sound/ym2151.c
index b103135a0a7..f3945cf39c1 100644
--- a/src/emu/sound/ym2151.c
+++ b/src/emu/sound/ym2151.c
@@ -1381,9 +1381,8 @@ int ym2151_read_status( void *_chip )
/*
* state save support for MAME
*/
-STATE_POSTLOAD( ym2151_postload )
+void ym2151_postload(YM2151 *YM2151_chip)
{
- YM2151 *YM2151_chip = (YM2151 *)param;
int j;
for (j=0; j<8; j++)
@@ -1485,10 +1484,10 @@ static void ym2151_state_save_register( YM2151 *chip, device_t *device )
device->save_item(NAME(chip->connect));
- device->machine().save().register_postload(ym2151_postload, chip);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(ym2151_postload), chip));
}
#else
-STATE_POSTLOAD( ym2151_postload )
+void ym2151_postload(YM2151 *chip)
{
}
diff --git a/src/emu/sound/ym2151.h b/src/emu/sound/ym2151.h
index e0a1a4ae53a..045296839b0 100644
--- a/src/emu/sound/ym2151.h
+++ b/src/emu/sound/ym2151.h
@@ -83,7 +83,4 @@ void ym2151_set_irq_handler(void *chip, void (*handler)(device_t *device, int ir
/* set port write handler on YM2151 chip number 'n'*/
void ym2151_set_port_write_handler(void *chip, write8_device_func handler);
-/* refresh chip when load state */
-STATE_POSTLOAD( ym2151_postload );
-
#endif /*__YM2151_H__*/
diff --git a/src/emu/sound/ymz280b.c b/src/emu/sound/ymz280b.c
index 6330745caa4..6d58cc99af3 100644
--- a/src/emu/sound/ymz280b.c
+++ b/src/emu/sound/ymz280b.c
@@ -196,16 +196,15 @@ INLINE void update_volumes(struct YMZ280BVoice *voice)
}
-static STATE_POSTLOAD( YMZ280B_state_save_update_step )
+static void YMZ280B_state_save_update_step(ymz280b_state *chip)
{
- ymz280b_state *chip = (ymz280b_state *)param;
int j;
for (j = 0; j < 8; j++)
{
struct YMZ280BVoice *voice = &chip->voice[j];
update_step(chip, voice);
if(voice->irq_schedule)
- machine.scheduler().timer_set(attotime::zero, update_irq_state_cb[j].func, update_irq_state_cb[j].name, 0, chip);
+ chip->device->machine().scheduler().timer_set(attotime::zero, update_irq_state_cb[j].func, update_irq_state_cb[j].name, 0, chip);
}
}
@@ -694,7 +693,7 @@ static DEVICE_START( ymz280b )
}
}
- device->machine().save().register_postload(YMZ280B_state_save_update_step, chip);
+ device->machine().save().register_postload(save_prepost_delegate(FUNC(YMZ280B_state_save_update_step), chip));
#if MAKE_WAVS
chip->wavresample = wav_open("resamp.wav", INTERNAL_SAMPLE_RATE, 2);