2023-08-28 21:06:21 +00:00
|
|
|
#pragma once
|
|
|
|
#include <JuceHeader.h>
|
|
|
|
#include "../parser/FileParser.h"
|
|
|
|
#include "../parser/FrameProducer.h"
|
|
|
|
#include "../parser/FrameConsumer.h"
|
2023-09-09 14:32:03 +00:00
|
|
|
#include "../concurrency/BlockingQueue.h"
|
2023-08-28 21:06:21 +00:00
|
|
|
|
|
|
|
class ShapeSound : public juce::SynthesiserSound, public FrameConsumer {
|
|
|
|
public:
|
|
|
|
ShapeSound(std::shared_ptr<FileParser> parser);
|
2023-09-09 14:32:03 +00:00
|
|
|
~ShapeSound() override;
|
2023-08-28 21:06:21 +00:00
|
|
|
|
|
|
|
bool appliesToNote(int note) override;
|
|
|
|
bool appliesToChannel(int channel) override;
|
|
|
|
void addFrame(std::vector<std::unique_ptr<Shape>>& frame) override;
|
|
|
|
double updateFrame(std::vector<std::unique_ptr<Shape>>& frame);
|
|
|
|
|
|
|
|
std::shared_ptr<FileParser> parser;
|
|
|
|
|
|
|
|
using Ptr = juce::ReferenceCountedObjectPtr<ShapeSound>;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2023-09-09 14:32:03 +00:00
|
|
|
BlockingQueue frames{10};
|
2023-08-28 21:06:21 +00:00
|
|
|
std::unique_ptr<FrameProducer> producer;
|
|
|
|
double frameLength = 0.0;
|
|
|
|
};
|