// CFTTAudio_Patch - [2020-04-13 11:57:46]
#ifndef _CFTTAUDIO_PATCH_H_
#define _CFTTAUDIO_PATCH_H_

#include "CFTTAudio_Bank.h"
#include "CFTTFile.h"

/*
001FB704 CFTTAudio_Patch::CFTTAudio_Patch()
001FB718 CFTTAudio_Patch::~CFTTAudio_Patch()
001FB46C CFTTAudio_Patch::InitStreamed(CFTTAudio_Bank *,TFTTAudio_PatchInfo const*,CFTTFile *)
001FB47A CFTTAudio_Patch::CreateMetadata(CAudioFormat *,CFTTFile *)
001FB608 CFTTAudio_Patch::InitNonStreamed(CFTTAudio_Bank *,TFTTAudio_PatchInfo const*,void *)
001FB72A CFTTAudio_Patch::PlatformReleaseBuffer()
001FB740 CFTTAudio_Patch::PlatformInitBuffer()
001FB84C CFTTAudio_Patch::ExtractMetadata()
*/
struct struct_short_pair {
  ushort field_0;
  ushort field_2;
};
struct CFTTAudio_struct_434 {
  int field_0;
  int field_4;
  int field_8;
  int field_C;
  struct_short_pair field_10[265];
};
int DecodeADPCMBlocks(short *s0, char *c1, int i2, CFTTAudio_Patch *cp3);

struct TFTTAudio_PatchInfo {  //È·¶¨Îª´óÐ¡12
  int unknow_0;
  int field_4;
  int field_8;
};

struct TFTTAudio_PatchConfig {
  int unknow_0;
  ushort ushort_4;
  ushort ushort_6;
  int field_8;
};

struct CAudioFormat {
  ushort ushort_0;  //.text:001FB494                 LDRH            R1, [R6]
  ushort ushort_2;  //.text:001FB500                 LDRH            R2, [R6,#2]
  int int_4;        //.text:001FB516                 LDRD.W          R3, R5, [R6,#4]
  int int_8;        //.text:001FB516                 LDRD.W          R3, R5, [R6,#4]
  ushort ushort_C;  //.text:001FB510                 LDRH            R2, [R6,#0xC]
  ushort ushort_E;  //.text:001FB50A                 LDRH            R1, [R6,#0xE]
};
// 0x7D0
struct CAudioFormat_EX : CAudioFormat {
  char field_10;
  char field_11;
  ushort field_12;
  ushort field_14;
};

struct struct_field_20 {
  ushort field_0;
  ushort field_2;
  ushort field_4;
  struct_short_pair field_6[8];
  ushort field_26;
};
class CFTTAudio_Patch {
public:
  CFTTAudio_Patch() __attribute__((always_inline));                              // 001FB704
  ~CFTTAudio_Patch();                                                            // 001FB718
  void InitStreamed(CFTTAudio_Bank *, TFTTAudio_PatchInfo const *, CFTTFile *);  // 001FB46C
  void CreateMetadata(CAudioFormat *, CFTTFile *);                               // 001FB47A
  void InitNonStreamed(CFTTAudio_Bank *, TFTTAudio_PatchInfo const *, void *);   // 001FB608
  void PlatformReleaseBuffer();                                                  // 001FB72A
  void PlatformInitBuffer();                                                     // 001FB740
  void ExtractMetadata();                                                        // 001FB84C
  CFTTFile *cfttFile_0;                                                          //.text:001FB368                 STR.W           R9, [R0,R6]
  CFTTAudio_Bank *field_4;                                                       //.text:001FB36E                 STR             R4, [R0,#4]

  int field_8;  //.text:001FA654                 LDR             R0, [R7, #8]
  uchar field_C;
  char field_D;
  char field_E;
  char field_F;
  int field_10;  //.text:001FA658                 LDR             R1, [R7,#0x10]
  char *bufer_14;

  int buferSize_18;  // volatile
  int field_1C;      //.text:001FA89C                 LDR             R1, [R5,#0x1C]

  struct_field_20 field_20;
  //  uint16 field_20[0x14];
  uint64 postion_48;

  int field_50 = 0;
  int field_54 = 0;
  const TFTTAudio_PatchInfo *field_58 = 0;
  CAudioFormat_EX *field_5C = 0;  //ÏñÊÇCAudioFormat
};

#endif  //_CFTTAUDIO_PATCH_H_