Reduce duplicates of channel struct

Add/Fix custom clock limit defines (for YMF278B)
This commit is contained in:
cam900 2022-12-04 19:58:58 +09:00
parent fd3f381bc3
commit 2ec4237076
69 changed files with 457 additions and 1151 deletions

View file

@ -24,6 +24,7 @@
#include <string.h>
#include <vector>
#include "config.h"
#include "../chip-utils.h"
#define ONE_SEMITONE 2200
@ -453,6 +454,18 @@ class DivDispatch {
*/
virtual bool getWantPreNote();
/**
* get minimum chip clock.
* @return clock in Hz, or 0 if custom clocks are not supported.
*/
virtual unsigned int getClockRangeMin();
/**
* get maximum chip clock.
* @return clock in Hz, or 0 if custom clocks are not supported.
*/
virtual unsigned int getClockRangeMax();
/**
* set the chip flags.
* @param flags a DivConfig containing chip flags.
@ -582,9 +595,9 @@ class DivDispatch {
// custom chip clock helper define. put in setFlags, but before rate is set.
#define CHECK_CUSTOM_CLOCK \
if (flags.getInt("customClock",0)>0) { \
chipClock=flags.getInt("customClock",1000000); \
if (chipClock>20000000) chipClock=20000000; \
if (chipClock<100000) chipClock=100000; \
chipClock=flags.getInt("customClock",getClockRangeMin()); \
if (chipClock>getClockRangeMax()) chipClock=getClockRangeMax(); \
if (chipClock<getClockRangeMin()) chipClock=getClockRangeMin(); \
}
// pitch calculation: