void sid_sound_machine_close(sound_t *psid) { sid_engine.close(psid); /* free the temp. buffers */ if (buf1) { lib_free(buf1); buf1 = NULL; } if (buf2) { lib_free(buf2); buf2 = NULL; } }
sound_t *sid_sound_machine_open(int chipno) { sidengine = 0; if (resources_get_int("SidEngine", &sidengine) < 0) { return NULL; } sid_engine = fastsid_hooks; #ifdef HAVE_RESID if (sidengine == SID_ENGINE_RESID) { sid_engine = resid_hooks; } #endif return sid_engine.open(siddata[chipno]); }
void sid_state_write(unsigned int channel, sid_snapshot_state_t *sid_state) { sid_engine.state_write(sound_get_psid(channel), sid_state); }
char *sid_sound_machine_dump_state(sound_t *psid) { return sid_engine.dump_state(psid); }
void sid_sound_machine_prevent_clk_overflow(sound_t *psid, CLOCK sub) { sid_engine.prevent_clk_overflow(psid, sub); }
int sid_sound_machine_calculate_samples(sound_t **psid, SWORD *pbuf, int nr, int soc, int scc, int *delta_t) { int i; SWORD *tmp_buf1; SWORD *tmp_buf2; int tmp_nr = 0; int tmp_delta_t = *delta_t; if (soc == 1 && scc == 1) { return sid_engine.calculate_samples(psid[0], pbuf, nr, 1, delta_t); } if (soc == 1 && scc == 2) { tmp_buf1 = getbuf1(2 * nr); tmp_nr = sid_engine.calculate_samples(psid[0], tmp_buf1, nr, 1, &tmp_delta_t); tmp_nr = sid_engine.calculate_samples(psid[1], pbuf, nr, 1, delta_t); for (i = 0; i < tmp_nr; i++) { pbuf[i] = sound_audio_mix(pbuf[i], tmp_buf1[i]); } return tmp_nr; } if (soc == 1 && scc == 3) { tmp_buf1 = getbuf1(2 * nr); tmp_buf2 = getbuf2(2 * nr); tmp_nr = sid_engine.calculate_samples(psid[0], tmp_buf1, nr, 1, &tmp_delta_t); tmp_delta_t = *delta_t; tmp_nr = sid_engine.calculate_samples(psid[2], tmp_buf2, nr, 1, &tmp_delta_t); tmp_nr = sid_engine.calculate_samples(psid[1], pbuf, nr, 1, delta_t); for (i = 0; i < tmp_nr; i++) { pbuf[i] = sound_audio_mix(pbuf[i], tmp_buf1[i]); pbuf[i] = sound_audio_mix(pbuf[i], tmp_buf2[i]); } return tmp_nr; } if (soc == 2 && scc == 1) { tmp_nr = sid_engine.calculate_samples(psid[0], pbuf, nr, 2, delta_t); for (i = 0; i < tmp_nr; i++) { pbuf[(i * 2) + 1] = pbuf[i * 2]; } return tmp_nr; } if (soc == 2 && scc == 2) { tmp_nr = sid_engine.calculate_samples(psid[0], pbuf, nr, 2, &tmp_delta_t); tmp_nr = sid_engine.calculate_samples(psid[1], pbuf + 1, nr, 2, delta_t); return tmp_nr; } if (soc == 2 && scc == 3) { tmp_buf1 = getbuf1(2 * nr); tmp_nr = sid_engine.calculate_samples(psid[2], tmp_buf1, nr, 1, &tmp_delta_t); tmp_delta_t = *delta_t; tmp_nr = sid_engine.calculate_samples(psid[0], pbuf, nr, 2, &tmp_delta_t); tmp_nr = sid_engine.calculate_samples(psid[1], pbuf + 1, nr, 2, delta_t); for (i = 0; i < tmp_nr; i++) { pbuf[i * 2] = sound_audio_mix(pbuf[i * 2], tmp_buf1[i]); pbuf[(i * 2) + 1] = sound_audio_mix(pbuf[(i * 2) + 1], tmp_buf1[i]); } } return tmp_nr; }
void sid_sound_machine_reset(sound_t *psid, CLOCK cpu_clk) { sid_engine.reset(psid, cpu_clk); }
void sid_sound_machine_store(sound_t *psid, WORD addr, BYTE byte) { sid_engine.store(psid, addr, byte); }
BYTE sid_sound_machine_read(sound_t *psid, WORD addr) { return sid_engine.read(psid, addr); }
int sid_sound_machine_init(sound_t *psid, int speed, int cycles_per_sec) { return sid_engine.init(psid, speed, cycles_per_sec, 1000); }
int sid_sound_machine_init_vbr(sound_t *psid, int speed, int cycles_per_sec, int factor) { return sid_engine.init(psid, speed * factor / 1000, cycles_per_sec, factor); }
void sid_sound_machine_close(sound_t *psid) { sid_engine.close(psid); }