#include "cgaborator.h"
#include <cstdio>

#define BLOCK_SIZE 8192

int main() {

    auto fp = fopen("test.raw", "r");

    if (fp == nullptr){
        return 1;
    }

    auto ptr = gaborator_initialize(1024 * 64, 16000, 85, 110, 440, 7040, 128);

    float audioData[BLOCK_SIZE];

    while (true){
        auto read = fread(&audioData[0], sizeof(audioData[0]), sizeof(audioData) / sizeof(audioData[0]), fp);
        gaborator_transform(ptr, &audioData[0], sizeof(audioData) / sizeof(audioData[0]), [](uintptr_t, float*, size_t, size_t){

        }, 0);

        if (read < sizeof(audioData) / sizeof(audioData[0])) { //EOF
            break;
        }
    }

    gaborator_transform(ptr, nullptr, 0, [](uintptr_t, float*, size_t, size_t){

    }, 0);

    fclose(fp);

    gaborator_release(ptr);
    return 0;
}