#ifndef __Finch_Sound_h__
#define __Finch_Sound_h__
#import <OpenAL/al.h>
#import <OpenAL/alc.h>
#include <Foundation/Foundation.h>
enum SoundError {
    kSEInvalidNumberOfChannels = 1,
    kSEInvalidEndianity,
    kSEInvalidSampleResolution
};

class FinchSound
{
private:
    BOOL loop;
    ALuint source, buffer;
    float gain, pitch, duration;
	bool playing;
public:
	~FinchSound();
	// Designated initializer. The format
	// is AL_FORMAT_{MONO,STEREO}{8,16}.
	bool initWithData(const ALvoid* data, ALsizei size, ALenum format, ALsizei frequency, float seconds);
		
	// Convenience initializer, will decode the
	// sound for you using the Decoder class.
	bool initWithFile(NSString* name, NSError** error);

	// Just as the one above, logs errors using NSLog
	// instead of reporting through NSError.
	bool initWithFile(NSString* name);

	void play();
	bool isPlaying();
	void stop();
	void pause();
	void setLooping(bool yn);
	bool getLooping();

	void setGain(float val);
	float getGain();
	void setPitch(float val);
	float getPitch();

	float getDuration();
};
#endif
