Beispiel #1
0
int OPL_Init(unsigned int rate)
{
	opl_sample_rate = rate;
	opl_paused = 0;
	pause_offset = 0;

	// Queue structure of callbacks to invoke.

	callback_queue = OPL_Queue_Create();
	current_time = 0;


	mix_buffer = malloc(opl_sample_rate * sizeof(uint32_t));

	// Create the emulator structure:

	DBOPL_InitTables();
	Chip__Chip(&opl_chip);
	Chip__Setup(&opl_chip, opl_sample_rate);


	OPL_InitRegisters();

	init_stage_reg_writes = 0;

	return 1;
}
Beispiel #2
0
static int InitDriver(opl_driver_t *_driver, unsigned int port_base)
{
    // Initialize the driver.

    if (!_driver->init_func(port_base))
    {
        return 0;
    }

    // The driver was initialized okay, so we now have somewhere
    // to write to.  It doesn't mean there's an OPL chip there,
    // though.  Perform the detection sequence to make sure.
    // (it's done twice, like how Doom does it).

    driver = _driver;
    init_stage_reg_writes = 1;

    if (!OPL_Detect() || !OPL_Detect())
    {
        C_Printf(" OPL_Init: No OPL detected using '%s' driver.\n", _driver->name);
        _driver->shutdown_func();
        driver = NULL;
        return 0;
    }

    // Initialize all registers.

    OPL_InitRegisters();

    init_stage_reg_writes = 0;

    //C_Printf(" OPL_Init: Using driver '%s'.\n", driver->name);

    return 1;
}