Y8950* y8950Create(Mixer* mixer) { Y8950* y8950; y8950 = (Y8950*)calloc(1, sizeof(Y8950)); y8950->mixer = mixer; y8950->timerRunning1 = 0; y8950->timerRunning2 = 0; y8950->timer1 = boardTimerCreate(onTimeout1, y8950); y8950->timer2 = boardTimerCreate(onTimeout2, y8950); y8950->ykIo = ykIoCreate(); y8950->handle = mixerRegisterChannel(mixer, MIXER_CHANNEL_MSXAUDIO, 0, y8950Sync, y8950SetSampleRate, y8950); y8950->opl = OPLCreate(OPL_TYPE_Y8950, FREQUENCY, SAMPLERATE, 256, y8950); OPLSetOversampling(y8950->opl, boardGetY8950Oversampling()); OPLResetChip(y8950->opl); y8950->rate = mixerGetSampleRate(mixer); return y8950; }
PhilipsMidi* philipsMidiCreate() { PhilipsMidi* midi = (PhilipsMidi*)calloc(1, sizeof(PhilipsMidi)); midi->midiIo = midiIoCreate(midiInCallback, midi); midi->semaphore = archSemaphoreCreate(1); midi->timerRecv = boardTimerCreate(onRecv, midi); midi->timerTrans = boardTimerCreate(onTrans, midi); return midi; }
static YM2148* ym2148Create() { YM2148* midi = (YM2148*)calloc(1, sizeof(YM2148)); midi->midiIo = midiIoCreate(midiInCallback, midi); midi->semaphore = archSemaphoreCreate(1); midi->timerRecv = boardTimerCreate(onRecv, midi); midi->timerTrans = boardTimerCreate(onTrans, midi); ym2148Reset(midi); return midi; }
static YM2148* ym2148Create() { YM2148* midi = (YM2148*)calloc(1, sizeof(YM2148)); midi->midiIo = midiIoCreate(midiInCallback, midi); midi->semaphore = archSemaphoreCreate(1); midi->timerRecv = boardTimerCreate(onRecv, midi); midi->timerTrans = boardTimerCreate(onTrans, midi); midi->timeRecv = boardSystemTime() + midi->charTime; boardTimerAdd(midi->timerRecv, midi->timeRecv); return midi; }
void boardCaptureInit() { cap.timer = boardTimerCreate(boardTimerCb, NULL); if (cap.state == CAPTURE_REC) { boardTimerAdd(cap.timer, boardSystemTime() + 1); } }
YM2151* ym2151Create(Mixer* mixer) { YM2151* ym2151; ym2151 = (YM2151*)calloc(1, sizeof(YM2151)); ym2151->mixer = mixer; ym2151->timerRunning1 = 0; ym2151->timerRunning2 = 0; ym2151->timer1 = boardTimerCreate(onTimeout1, ym2151); ym2151->timer2 = boardTimerCreate(onTimeout2, ym2151); ym2151->handle = mixerRegisterChannel(mixer, MIXER_CHANNEL_YAMAHA_SFG, 1, ym2151Sync, ym2151); ym2151->opl = YM2151Create(ym2151, FREQUENCY, SAMPLERATE); return ym2151; }
static Counter* counterCreate(I8254Out out, void* ref, UInt32 frequency) { Counter* counter = calloc(1, sizeof(Counter)); counter->frequency = frequency; counter->out = out; counter->ref = ref; counter->timer = boardTimerCreate(counterOnTimer, counter); counterReset(counter); return counter; }
Moonsound* moonsoundCreate(Mixer* mixer, void* romData, int romSize, int sramSize) { Moonsound* moonsound = new Moonsound; UInt32 systemTime = boardSystemTime(); moonsound->mixer = mixer; moonsound->timerStarted1 = 0; moonsound->timerStarted2 = 0; moonsound->timer1 = boardTimerCreate(onTimeout1, moonsound); moonsound->timer2 = boardTimerCreate(onTimeout2, moonsound); moonsound->handle = mixerRegisterChannel(mixer, MIXER_CHANNEL_MOONSOUND, 1, moonsoundSync, moonsoundSetSampleRate, moonsound); moonsound->ymf262 = new YMF262(0, systemTime, moonsound); moonsound->ymf262->setSampleRate(mixerGetSampleRate(mixer), boardGetMoonsoundOversampling()); moonsound->ymf262->setVolume(32767 * 9 / 10); moonsound->ymf278 = new YMF278(0, sramSize, romData, romSize, systemTime); moonsound->ymf278->setSampleRate(mixerGetSampleRate(mixer), boardGetMoonsoundOversampling()); moonsound->ymf278->setVolume(32767 * 9 / 10); return moonsound; }
Microchip24x00* microchip24x00Create(int size, const char* sramFilename) { Microchip24x00* rm = calloc(1, sizeof(Microchip24x00)); // Allocate memory rm->romMask = (size - 1) & 0xff; rm->romData = malloc(size); memset(rm->romData, 0xff, size); // Load rom data if present if (sramFilename != NULL) { strcpy(rm->sramFilename, sramFilename); sramLoad(rm->sramFilename, rm->romData, rm->romMask + 1, NULL, 0); } rm->timer = boardTimerCreate(onTimer, rm); microchip24x00Reset(rm); return rm; }