/*****							  *****/
/*****   DirectSound僒億乕僩娭悢   *****/
/*****							  *****/

//#include <dsound.h>

typedef struct {
	short wave_size;//攇宍偺僒僀僘
	short oct_par;//僆僋僞乕僽傪幚尰偡傞妡偗棪(/8)
	short oct_size;//僆僋僞乕僽傪幚尰偡傞妡偗棪(/8)
} OCTWAVE;

extern OCTWAVE oct_wave[8];
extern short freq_tbl[12];
extern short pan_tbl[13];
extern char *wave_data;

// DirectSound偺奐巒
BOOL InitDirectSound(HWND hwnd);
BOOL LoadSoundObject( char *file_name, int no);
// DirectSound偺廔椆
void EndDirectSound(void);
void ReleaseSoundObject(int no);//僶僢僼傽偺奐曻
BOOL InitSoundObject(LPCSTR resname, int no);
// 僒僂儞僪偺嵞惗
void PlaySoundObject(int no, int mode);
void ChangeSoundVolume(int no, long volume);//9999偑MAX2195?偑砂腺
void ChangeSoundFrequency(int no, DWORD rate);//300偑MAX300偑砂腺
void ChangeSoundPan(int no, long pan);

BOOL MakeSoundObject8(char *wavep,char track, char pipi);

void ChangeOrganFrequency(unsigned char key,char track,DWORD a);//9999偑MAX偱2195?偑砂腺
void ChangeOrganVolume(int no, long volume,char track);//300偑MAX偱300偑砂腺
void ChangeOrganPan(unsigned char key, unsigned char pan,char track);//0偑仼偱6偑砂腺11偑仺
void PlayOrganObject(unsigned char key, int mode,char track,DWORD freq, bool pipi);
void PlayOrganKey(unsigned char key,char track,DWORD freq, int Nagasa = 80);
BOOL LoadWaveData100(const char *file);
BOOL InitWaveData100(void);
BOOL DeleteWaveData100(void);

BOOL MakeOrganyaWave(char track,char wave_no, char pipi);

//BOOL LoadDramObject(char *file_name, int no);
BOOL InitDramObject(char drum, int no);
void ReleaseDramObject(char track);
void ChangeDramFrequency(unsigned char key,char track);
void ChangeDramPan(unsigned char pan,char track);//512偑MAX偱256偑砂腺
void ChangeDramVolume(long volume,char track);//300偑MAX偱300偑砂腺
void PlayDramObject(unsigned char key, int mode,char track);


void Rxo_ShowDirectSoundObject(HWND hwnd);
void Rxo_StopAllSoundNow(void);

void Rxo_PlayKey(unsigned char key,char track,DWORD freq, int Phase);
void Rxo_StopKey(unsigned char key,char track, int Phase);

void S_SetOrganyaTimer(unsigned short timer);

void ExportOrganyaBuffer(unsigned long sample_rate, float* output_stream, size_t frames_total, size_t fade_frames);
void SetExportChannel(int track);
