static void *ym3526_start(int sndindex, int clock, const void *config) { static const struct YM3526interface dummy = { 0 }; int rate = Machine->sample_rate; struct ym3526_info *info; info = auto_malloc(sizeof(*info)); memset(info, 0, sizeof(*info)); info->intf = config ? config : &dummy; rate = clock/72; /* stream system initialize */ info->chip = YM3526Init(clock,rate); if (!info->chip) return NULL; info->stream = stream_create(0,1,rate,info,ym3526_stream_update); /* YM3526 setup */ YM3526SetTimerHandler (info->chip, TimerHandler_3526, info); YM3526SetIRQHandler (info->chip, IRQHandler_3526, info); YM3526SetUpdateHandler(info->chip, _stream_update_3526, info); info->timer[0] = timer_alloc_ptr(timer_callback_3526_0, info); info->timer[1] = timer_alloc_ptr(timer_callback_3526_1, info); return info; }
int YM3526_sh_start(const struct MachineSound *msound) { int i; int rate = Machine->sample_rate; intf_3526 = msound->sound_interface; if( intf_3526->num > MAX_3526 ) return 1; if (options.use_filter) rate = intf_3526->baseclock/72; /* Timer state clear */ memset(Timer_3526,0,sizeof(Timer_3526)); /* stream system initialize */ if ( YM3526Init(intf_3526->num,intf_3526->baseclock,rate) != 0) return 1; for (i = 0;i < intf_3526->num;i++) { /* stream setup */ char name[40]; int vol = intf_3526->mixing_level[i]; /* emulator create */ /* stream setup */ sprintf(name,"%s #%d",sound_name(msound),i); stream_3526[i] = stream_init(name,vol,rate,i,YM3526UpdateOne); /* YM3526 setup */ YM3526SetTimerHandler (i, TimerHandler_3526, i*2); YM3526SetIRQHandler (i, IRQHandler_3526, i); YM3526SetUpdateHandler(i, stream_update, stream_3526[i]); Timer_3526[i*2+0] = timer_alloc(timer_callback_3526); Timer_3526[i*2+1] = timer_alloc(timer_callback_3526); } return 0; }