diff options
Diffstat (limited to 'src/devices/sound/ymf262.cpp')
-rw-r--r-- | src/devices/sound/ymf262.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/devices/sound/ymf262.cpp b/src/devices/sound/ymf262.cpp index f69c15da9d4..280168ef4c1 100644 --- a/src/devices/sound/ymf262.cpp +++ b/src/devices/sound/ymf262.cpp @@ -1351,7 +1351,7 @@ static void OPL3_initalize(OPL3 *chip) /* logerror("YMF262: freqbase=%f\n", chip->freqbase); */ /* Timer base time */ - chip->TimerBase = attotime::from_hz(chip->clock) * (8*36); + chip->TimerBase = chip->clock ? attotime::from_hz(chip->clock) * (8 * 36) : attotime::zero; /* make fnumber -> increment counter table */ for( i=0 ; i < 1024 ; i++ ) @@ -1401,6 +1401,15 @@ static void OPL3_initalize(OPL3 *chip) } +static void OPL3_clock_changed(OPL3 *chip, int clock, int rate) +{ + chip->clock = clock; + chip->rate = rate; + + /* init global tables */ + OPL3_initalize(chip); +} + static inline void FM_KEYON(OPL3_SLOT *SLOT, uint32_t key_set) { if( !SLOT->key ) @@ -2360,11 +2369,7 @@ static OPL3 *OPL3Create(device_t *device, int clock, int rate, int type) chip->device = device; chip->type = type; - chip->clock = clock; - chip->rate = rate; - - /* init global tables */ - OPL3_initalize(chip); + OPL3_clock_changed(chip, clock, rate); /* reset chip */ OPL3ResetChip(chip); @@ -2531,6 +2536,11 @@ void * ymf262_init(device_t *device, int clock, int rate) return chip; } +void ymf262_clock_changed(void *chip, int clock, int rate) +{ + OPL3_clock_changed((OPL3 *)chip, clock, rate); +} + void ymf262_post_load(void *chip) { OPL3 *opl3 = (OPL3 *)chip; for (int ch=0; ch<18; ch++) { |