#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 setLautstärke( unsigned int links, unsigned int rechts ) override
    {}
    // zum Speichern
    void öffnen() override;
    int getDaten( char *buffer, int län ) override;
    void schließen() override;
    bool istMono() const override;
    int getSampleRate() const override;
    __int64 getDatLänge() const override;
    // Reference Counting
    GSL::GSLSoundV *getThis() override;
    GSL::GSLSoundV *release() override;
};