#pragma once

#include "kpi_decoder.h"
#include "kpi_impl.h"

class KbFmOplMidiDecoder : public KbKpiUnknownImpl<IKpiDecoder>
{
private:
    KPI_MEDIAINFO m_MediaInfo;
    BOOL          m_bCanOpen;
	signed long int VGMPbSmplCount;
	signed long int PlaySmpl;
	unsigned long int AbsVol;
	unsigned long int VGMPlaySt;
	unsigned long int VGMPlayEnd;
    DWORD         m_dwEndSample;   //MIDI 解析終了後に再生したサンプル数
    DWORD         m_dwSilentSample;//解析終了後の無音再生時間
public:
    DWORD  __fastcall Open(const KPI_MEDIAINFO *cpRequest, IKpiFile *pFile, IKpiFolder *pFolder);
    DWORD  WINAPI Select(DWORD dwNumber,
                         const KPI_MEDIAINFO **ppMediaInfo,
                         IKpiTagInfo *pTagInfo,
                         DWORD dwTagGetFlags);
    DWORD  WINAPI Render(BYTE *pBuffer, DWORD dwSizeSample);
    UINT64 WINAPI Seek(UINT64 qwPosSample, DWORD dwFlag);
    DWORD  WINAPI UpdateConfig(void *pvReserved){return 0;}
    KbFmOplMidiDecoder(IKpiConfig *pConfig);
    ~KbFmOplMidiDecoder(void);
};
