#pragma once

#include <GSLDateiV.h>
#include <Datei.h>

using namespace Framework;

struct WAVKopf
{
    char riff[ 4 ];
    unsigned int datGr;
    char wav[ 4 ];
};

struct WAVFormat
{
    char fmt[ 4 ];
    int fmtL�n;
    short tag;
    unsigned short channels;
    unsigned int sampleRate;
    unsigned int bytesPerSec;
    unsigned short blockAlign;
    unsigned short bitsPerSample;
};

struct WAVDBeg
{
    char data[ 4 ];
    int l�n;
};

class WAVDatei : public GSL::GSLSoundV
{
private:
    WAVKopf kpf;
    WAVFormat fmt;
    WAVDBeg dBeg;
    int pos;
    Datei d;

public:
    // Konstruktor
    WAVDatei();
    // nicht constant
    bool lade( char *pfad );
    // GSL
    void playSound() override
    {}
    void setPause( bool p ) override
    {}
    void stopSound() override
    {}
    void warteAufSound( int zeit ) override
    {}
    // Lautst�rke: 0 - 0xFFFF
    void setVolume( unsigned int links, unsigned int rechts ) override
    {}
    // zum Speichern
    void open() override;
    int getDaten( char *buffer, int l�n ) override;
    void close() override;
    bool istMono() const override;
    int getSampleRate() const override;
    __int64 getDatLength() const override;
    // Reference Counting
    Thread *getThis() override;
    Thread *release() override;
};