void init_clay(t_clay *clay, const char *rom_path) { clay->cpu.memRead = mmu_mem_read; clay->cpu.memWrite = mmu_mem_write; clay->cpu.ioRead = io_handler_read; clay->cpu.ioWrite = io_handler_write; mmu_init(&clay->mmu, rom_path); z80ctc_init(&clay->ctc); ay_3_8912_init(&clay->ay); if (audio_output_init(&clay->audio_out, 44100*2, &clay->ay, (audio_output_sample_callback)ay_3_8912_sample_stereo)) // 2 sec sound buffer fprintf(stderr, "An error occured while initializing the sound sampler.\n"); }
static bool load_audio_output(struct audio_output *ao, const char *name) { const struct config_param *param; bool success; GError *error = NULL; param = find_named_config_block(CONF_AUDIO_OUTPUT, name); if (param == NULL) { g_printerr("No such configured audio output: %s\n", name); return false; } success = audio_output_init(ao, param, &error); if (!success) { g_printerr("%s\n", error->message); g_error_free(error); } return success; }