/*
 * Main.h
 * By: Odis
 */
#include <Windows.h>
#include <dx/dsound.h>

#define FALSE 0
#define TRUE 1

#define PULSE_SECOND   4


typedef unsigned char bool;


/* all DSound Stuff here */
HMMIO wave;

extern LPDIRECTSOUND ds;
extern bool stopped;
extern bool loop;
extern int volume;

/* resource crap */
extern  HGLOBAL songmem;
extern  HRSRC res;

extern LPDIRECTSOUNDBUFFER song; /* Zelda_UnderWorldPressureCooker_OC_ReMix */

#define SONG_FILE "song3.wav"
#define SONG_BYTES 7585978

LPDIRECTSOUNDBUFFER load_wave_from_file( LPSTR file, DWORD bytes );
LPDIRECTSOUNDBUFFER load_wave_from_resource( HGLOBAL mem, DWORD bytes );
LPDIRECTSOUNDBUFFER init_buffer( DWORD bytes );
bool init_dx( void );
void set_volume( LPDIRECTSOUNDBUFFER buf, LONG amount );
void stop_wave( LPDIRECTSOUNDBUFFER buf );
void play_wave( LPDIRECTSOUNDBUFFER buf, bool loop );
void delete_wave( LPDIRECTSOUNDBUFFER buf );
void handle_dx( bool restart );

/* for streaming */
#define BUFFER_SIZE 46756 /* roughly 2.1 seconds or so */