2015-07-21 10:58:13 -03:00
|
|
|
// Copyright (C) 2015 Foam Kernow
|
|
|
|
|
//
|
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
2015-07-09 17:50:03 -03:00
|
|
|
#include <list>
|
|
|
|
|
#include <jellyfish/fluxa/sample.h>
|
|
|
|
|
#include "brain.h"
|
|
|
|
|
|
2015-07-11 07:28:35 -03:00
|
|
|
#ifndef SB_RENDERER
|
|
|
|
|
#define SB_RENDERER
|
|
|
|
|
|
2015-07-09 17:50:03 -03:00
|
|
|
namespace spiralcore {
|
|
|
|
|
|
|
|
|
|
class renderer {
|
|
|
|
|
public:
|
2015-07-21 14:13:39 -03:00
|
|
|
renderer(brain &source, brain &target) :
|
2015-07-11 08:29:51 -03:00
|
|
|
m_source(source),
|
2015-07-21 14:13:39 -03:00
|
|
|
m_target(target),
|
|
|
|
|
m_search_params(0,0,0,100,0,100)
|
2015-07-11 08:29:51 -03:00
|
|
|
{ init(source,target); }
|
2015-07-09 17:50:03 -03:00
|
|
|
|
2015-07-11 08:29:51 -03:00
|
|
|
void init(brain &source, brain &target);
|
2015-07-09 17:50:03 -03:00
|
|
|
void process(u32 nframes, float *buf);
|
|
|
|
|
|
2015-07-11 08:29:51 -03:00
|
|
|
void set_playing(bool s) { m_playing=s; }
|
|
|
|
|
void set_volume(float s) { m_volume=s; }
|
2015-07-21 18:28:48 -03:00
|
|
|
void set_invert(bool s) { m_invert=s; }
|
2015-07-11 08:29:51 -03:00
|
|
|
search_params *get_params() { return &m_search_params; }
|
2015-07-11 07:28:35 -03:00
|
|
|
|
2015-07-09 17:50:03 -03:00
|
|
|
static bool unit_test();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
// realtime stuff
|
|
|
|
|
class render_block {
|
|
|
|
|
public:
|
|
|
|
|
render_block(u32 index, u32 time) :
|
|
|
|
|
m_index(index), m_time(time), m_finished(false) {}
|
|
|
|
|
u32 m_index;
|
|
|
|
|
u32 m_time; // in samples
|
|
|
|
|
bool m_finished;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
brain &m_source;
|
|
|
|
|
brain &m_target;
|
2015-07-11 08:29:51 -03:00
|
|
|
|
|
|
|
|
search_params m_search_params;
|
|
|
|
|
float m_volume;
|
|
|
|
|
bool m_playing;
|
2015-07-21 18:28:48 -03:00
|
|
|
bool m_invert;
|
2015-07-09 17:50:03 -03:00
|
|
|
std::list<render_block> m_render_blocks;
|
|
|
|
|
u32 m_render_time;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
2015-07-11 07:28:35 -03:00
|
|
|
|
|
|
|
|
#endif
|