#pragma once

#include "kpi_decoder.h"
#include "kpi_impl.h"
#include "bass/bass.h"

class KbBassmidiDecoder : public KbKpiUnknownImpl<IKpiDecoder>
{
private:
    KPI_MEDIAINFO m_MediaInfo;
    IKpiConfig *m_pConfig;
    IKpiFile   *m_pFile;
    HSTREAM     m_hStream;
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; }
    static void __fastcall Initialize(IKpiConfig *pConfig);
    static void __fastcall Uninitialize(void);
    KbBassmidiDecoder(IKpiConfig *pConfig);
    ~KbBassmidiDecoder(void);
};
