// license:GPL-2.0+
// copyright-holders:Jarek Burczynski
#ifndef MAME_SOUND_YMF262_H
#define MAME_SOUND_YMF262_H

#pragma once

/* select number of output bits: 8 or 16 */
#define OPL3_SAMPLE_BITS 16

//typedef stream_sample_t OPL3SAMPLE;

#if (OPL3_SAMPLE_BITS==16)
typedef int16_t OPL3SAMPLE;
#endif
#if (OPL3_SAMPLE_BITS==8)
typedef int8_t OPL3SAMPLE;
#endif


typedef void (*OPL3_TIMERHANDLER)(void *dev, int timer, double interval_Sec);
typedef void (*OPL3_IRQHANDLER)(void *dev, int irq);
typedef void (*OPL3_UPDATEHANDLER)(void *dev, int min_interval_us);



void *ymf262_init(void *device, int clock, int rate);
void ymf262_post_load(void *chip);
void ymf262_shutdown(void *chip);
void ymf262_reset_chip(void *chip);
int  ymf262_write(void *chip, int a, int v);
unsigned char ymf262_read(void *chip, int a);
int  ymf262_timer_over(void *chip, int c);
//void YMF_SaveState(void *chip, std::ostream& stream );
//void YMF_LoadState(void *chip, std::istream& stream );
void ymf262_update_one(void *chip, OPL3SAMPLE *buffers, int length);

void ymf262_set_timer_handler(void *chip, OPL3_TIMERHANDLER TimerHandler, void *dev);
void ymf262_set_irq_handler(void *chip, OPL3_IRQHANDLER IRQHandler, void *dev);
void ymf262_set_update_handler(void *chip, OPL3_UPDATEHANDLER UpdateHandler, void *dev);
void ymf262_set_volume(void *chip, int l, int r);


#endif // MAME_SOUND_YMF262_H
