summaryrefslogtreecommitdiff
path: root/src/live.hpp
blob: d7baa611f787146a441d45fe0d58dde28fc6d92a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * Copyright (c) 2020-2021 Vasile Vilvoiu <vasi@vilvoiu.ro>
 *
 * specgram is free software; you can redistribute it and/or modify
 * it under the terms of the MIT license. See LICENSE for details.
 */
#ifndef _LIVE_HPP_
#define _LIVE_HPP_

#include "configuration.hpp"
#include "renderer.hpp"
#include "color-map.hpp"
#include <SFML/Graphics.hpp>

class LiveOutput {
private:
    /* configuration */
    const Configuration configuration_;
    Renderer renderer_;

    /* live window */
    sf::RenderWindow window_;

    /* raw FFT history */
    std::vector<uint8_t> fft_area_;

public:
    LiveOutput() = delete;
    LiveOutput(const LiveOutput &c) = delete;
    LiveOutput(LiveOutput &&) = delete;
    LiveOutput & operator=(const LiveOutput&) = delete;

    LiveOutput(const Configuration& conf, const ColorMap& cmap, const ValueMap& vmap);

    std::vector<uint8_t> AddWindow(const RealWindow& win_values);
    bool HandleEvents();
    void Render();
};

#endif