aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
committerDavid Robillard <d@drobilla.net>2009-05-13 16:04:14 +0000
commit7834ed85fe96dc32d5d9f9ce8a2b5f3197bde600 (patch)
tree881bb99ba0c1842b834edceb82ec7aee6e87b9a6 /src
parent47dffb2f2a20d8366ac708aaad88dd67c7ec7995 (diff)
downloadmachina-7834ed85fe96dc32d5d9f9ce8a2b5f3197bde600.tar.gz
machina-7834ed85fe96dc32d5d9f9ce8a2b5f3197bde600.tar.bz2
machina-7834ed85fe96dc32d5d9f9ce8a2b5f3197bde600.zip
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/lad/trunk/machina@1999 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/Action.cpp8
-rw-r--r--src/engine/ActionFactory.cpp6
-rw-r--r--src/engine/Edge.cpp8
-rw-r--r--src/engine/Engine.cpp18
-rw-r--r--src/engine/Evolver.cpp18
-rw-r--r--src/engine/JackDriver.cpp36
-rw-r--r--src/engine/LearnRequest.cpp8
-rw-r--r--src/engine/Loader.cpp16
-rw-r--r--src/engine/Machine.cpp56
-rw-r--r--src/engine/MachineBuilder.cpp22
-rw-r--r--src/engine/MidiAction.cpp8
-rw-r--r--src/engine/Mutation.cpp22
-rw-r--r--src/engine/Node.cpp34
-rw-r--r--src/engine/Problem.cpp46
-rw-r--r--src/engine/RaulJackDriver.cpp38
-rw-r--r--src/engine/RaulJackDriver.hpp14
-rw-r--r--src/engine/Recorder.cpp8
-rw-r--r--src/engine/SMFDriver.cpp14
-rw-r--r--src/engine/machina/Action.hpp6
-rw-r--r--src/engine/machina/ActionFactory.hpp6
-rw-r--r--src/engine/machina/Driver.hpp10
-rw-r--r--src/engine/machina/Edge.hpp8
-rw-r--r--src/engine/machina/Engine.hpp8
-rw-r--r--src/engine/machina/Evolver.hpp12
-rw-r--r--src/engine/machina/JackDriver.hpp14
-rw-r--r--src/engine/machina/LearnRequest.hpp10
-rw-r--r--src/engine/machina/Loader.hpp6
-rw-r--r--src/engine/machina/Machine.hpp18
-rw-r--r--src/engine/machina/MachineBuilder.hpp12
-rw-r--r--src/engine/machina/MidiAction.hpp10
-rw-r--r--src/engine/machina/Mutation.hpp6
-rw-r--r--src/engine/machina/Node.hpp12
-rw-r--r--src/engine/machina/Problem.hpp22
-rw-r--r--src/engine/machina/Recorder.hpp8
-rw-r--r--src/engine/machina/SMFDriver.hpp12
-rw-r--r--src/engine/machina/Schrodinbit.hpp6
-rw-r--r--src/engine/machina/types.hpp6
-rw-r--r--src/gui/EdgeView.cpp8
-rw-r--r--src/gui/EdgeView.hpp8
-rw-r--r--src/gui/GladeXml.hpp6
-rw-r--r--src/gui/MachinaCanvas.cpp20
-rw-r--r--src/gui/MachinaCanvas.hpp8
-rw-r--r--src/gui/MachinaGUI.cpp86
-rw-r--r--src/gui/MachinaGUI.hpp16
-rw-r--r--src/gui/NodePropertiesWindow.cpp12
-rw-r--r--src/gui/NodePropertiesWindow.hpp8
-rw-r--r--src/gui/NodeView.cpp14
-rw-r--r--src/gui/NodeView.hpp8
-rw-r--r--src/gui/main.cpp6
-rw-r--r--src/machina.cpp14
-rw-r--r--src/midi2machina.cpp10
51 files changed, 398 insertions, 398 deletions
diff --git a/src/engine/Action.cpp b/src/engine/Action.cpp
index c13e9c8..5504297 100644
--- a/src/engine/Action.cpp
+++ b/src/engine/Action.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -25,7 +25,7 @@ void
Action::write_state(Redland::Model& model)
{
using namespace Raul;
-
+
if (!_id)
set_id(model.world().blank_id());
diff --git a/src/engine/ActionFactory.cpp b/src/engine/ActionFactory.cpp
index 6632b3c..0b926d6 100644
--- a/src/engine/ActionFactory.cpp
+++ b/src/engine/ActionFactory.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/src/engine/Edge.cpp b/src/engine/Edge.cpp
index e380a30..fe8df22 100644
--- a/src/engine/Edge.cpp
+++ b/src/engine/Edge.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -52,7 +52,7 @@ Edge::write_state(Redland::Model& model)
model.add_statement(_id,
"machina:head",
head->id());
-
+
model.add_statement(_id,
"machina:probability",
AtomRDF::atom_to_node(model.world(), Atom(_probability.get())));
diff --git a/src/engine/Engine.cpp b/src/engine/Engine.cpp
index f25c4d4..0cd9e77 100644
--- a/src/engine/Engine.cpp
+++ b/src/engine/Engine.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -38,9 +38,9 @@ Engine::load_machine(const Glib::ustring& uri)
m->activate();
_driver->set_machine(m);
}
-
+
// .. and drop it in this thread (to prevent deallocation in the RT thread)
-
+
return m;
}
@@ -56,9 +56,9 @@ Engine::import_machine(const Glib::ustring& uri)
m->activate();
_driver->machine()->nodes().append(m->nodes());
}
-
+
// Discard m
-
+
return _driver->machine();
}
@@ -73,9 +73,9 @@ Engine::import_midi(const Glib::ustring& uri, double q, Raul::TimeDuration durat
SharedPtr<Machine> m = file_driver->learn(uri, q, duration);
m->activate();
_driver->machine()->nodes().append(m->nodes());
-
+
// Discard m
-
+
return _driver->machine();
}
diff --git a/src/engine/Evolver.cpp b/src/engine/Evolver.cpp
index af126d6..0ca4c27 100644
--- a/src/engine/Evolver.cpp
+++ b/src/engine/Evolver.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -33,9 +33,9 @@ namespace Machina {
Evolver::Evolver(TimeUnit unit, const string& target_midi, SharedPtr<Machine> seed)
: _problem(new Problem(unit, target_midi, seed))
, _seed_fitness(-FLT_MAX)
-{
+{
SharedPtr<Eugene::HybridMutation<Machine> > m(new HybridMutation<Machine>());
-
+
m->append_mutation(1/6.0f, boost::shared_ptr< Eugene::Mutation<Machine> >(
new Mutation::Compress()));
m->append_mutation(1/6.0f, boost::shared_ptr< Eugene::Mutation<Machine> >(
@@ -58,7 +58,7 @@ Evolver::Evolver(TimeUnit unit, const string& target_midi, SharedPtr<Machine> se
_ga = SharedPtr<MachinaGA>(new MachinaGA(_problem, s, crossover, m,
20, 20, 2, 1.0, 0.0));
}
-
+
void
Evolver::seed(SharedPtr<Machine> parent)
@@ -68,7 +68,7 @@ Evolver::seed(SharedPtr<Machine> parent)
_problem->seed(parent);
_seed_fitness = _problem->fitness(*parent.get());
}
-
+
void
Evolver::_run()
@@ -85,7 +85,7 @@ Evolver::_run()
_ga->iteration();
float new_best = _ga->best_fitness();
-
+
/*cout << _problem->fitness_less(old_best, *_ga->best().get()) << endl;
cout << "best: " << _ga->best().get() << endl;
cout << "best fitness: " << _problem->fitness(*_ga->best().get()) << endl;
@@ -98,7 +98,7 @@ Evolver::_run()
old_best = new_best;
cout << "*** NEW BEST: " << new_best << endl;
}
-
+
//cout << "}" << endl;
}
}
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 9993866..ef74a61 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -58,12 +58,12 @@ JackDriver::attach(const std::string& client_name)
if (jack_client()) {
//_cycle_time.set_tick_rate(1/(double)sample_rate());
-
+
_input_port = jack_port_register(jack_client(),
"in",
JACK_DEFAULT_MIDI_TYPE, JackPortIsInput,
0);
-
+
if (!_input_port)
std:: cerr << "WARNING: Failed to create MIDI input port." << std::endl;
@@ -71,7 +71,7 @@ JackDriver::attach(const std::string& client_name)
"out",
JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput,
0);
-
+
if (!_output_port)
std::cerr << "WARNING: Failed to create MIDI output port." << std::endl;
@@ -93,7 +93,7 @@ JackDriver::detach()
jack_port_unregister(jack_client(), _input_port);
_input_port = NULL;
}
-
+
if (_output_port) {
jack_port_unregister(jack_client(), _output_port);
_output_port = NULL;
@@ -109,7 +109,7 @@ JackDriver::set_machine(SharedPtr<Machine> machine)
return;
cout << "DRIVER MACHINE: " << machine.get() << endl;
- SharedPtr<Machine> last_machine = _last_machine; // Keep a reference
+ SharedPtr<Machine> last_machine = _last_machine; // Keep a reference
_machine_changed.reset(0);
assert(!last_machine.unique());
_machine = machine;
@@ -136,7 +136,7 @@ JackDriver::process_input(SharedPtr<Machine> machine, const TimeSlice& time)
for (jack_nframes_t i=0; i < event_count; ++i) {
jack_midi_event_t ev;
jack_midi_event_get(&ev, jack_buffer, i);
-
+
_recorder->write(_record_time + TimeStamp(_record_time.unit(), ev.time, 0),
ev.size, ev.buffer);
}
@@ -165,9 +165,9 @@ JackDriver::process_input(SharedPtr<Machine> machine, const TimeSlice& time)
}
} else if (ev.buffer[0] == 0x80) {
-
+
const SharedPtr<LearnRequest> learn = machine->pending_learn();
-
+
if (learn) {
if (learn->started()) {
learn->exit_action()->set_event(ev.size, ev.buffer);
@@ -193,7 +193,7 @@ JackDriver::write_event(Raul::TimeStamp time,
return;
if (_cycle_time.beats_to_ticks(time) + _cycle_time.offset_ticks() < _cycle_time.start_ticks()) {
- std::cerr << "ERROR: Missed event by "
+ std::cerr << "ERROR: Missed event by "
<< _cycle_time.start_ticks()
- (_cycle_time.beats_to_ticks(time) + _cycle_time.offset_ticks())
<< " ticks"
@@ -262,14 +262,14 @@ JackDriver::on_process(jack_nframes_t nframes)
}
_machine_changed.post(); // Signal we're done with it
}
-
+
if (!machine) {
_last_machine = machine;
return;
}
-
+
machine->set_sink(shared_from_this());
-
+
if (_recording.get())
_record_time += length_beats;
@@ -296,13 +296,13 @@ JackDriver::on_process(jack_nframes_t nframes)
} else if (machine->is_finished()) {
const TimeStamp finish_offset = _cycle_time.offset_ticks() + run_dur_frames;
assert(finish_offset < length_ticks);
-
+
machine->reset(machine->time());
_cycle_time.set_slice(TimeStamp(_frames_unit, 0, 0),
TimeDuration(_frames_unit, nframes - finish_offset.ticks()));
_cycle_time.set_offset(finish_offset);
-
+
// Machine ran for entire cycle
} else {
if (machine->is_finished()) {
@@ -323,7 +323,7 @@ end:
/* Remember the last machine run, in case a switch happens and
* we need to finalize it next cycle. */
_last_machine = machine;
-
+
if (_stop.pending()) {
_cycle_time.set_slice(TimeStamp(_frames_unit, 0, 0),
TimeStamp(_frames_unit, 0, 0));
diff --git a/src/engine/LearnRequest.cpp b/src/engine/LearnRequest.cpp
index 782cfff..5573fb7 100644
--- a/src/engine/LearnRequest.cpp
+++ b/src/engine/LearnRequest.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -29,7 +29,7 @@ LearnRequest::finish(TimeStamp time)
_node->set_exit_action(_exit_action);
//TimeDuration duration = Raul::Quantizer::quantize(_quantization, time - _start_time);
-
+
//_node->set_duration(duration);
}
diff --git a/src/engine/Loader.cpp b/src/engine/Loader.cpp
index 6d1409d..1f0140c 100644
--- a/src/engine/Loader.cpp
+++ b/src/engine/Loader.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -76,7 +76,7 @@ Loader::load(const Glib::ustring& uri)
cout << "[Loader] Loading " << machine_uri << " from " << document_uri << endl;
machine = SharedPtr<Machine>(new Machine(TimeUnit::beats(MACHINA_PPQN)));
-
+
typedef std::map<string, SharedPtr<Node> > Created;
Created created;
@@ -85,7 +85,7 @@ Loader::load(const Glib::ustring& uri)
/* Get initial nodes */
Query query = Query(_rdf_world, ustring(
- "SELECT DISTINCT ?node ?duration WHERE {\n") +
+ "SELECT DISTINCT ?node ?duration WHERE {\n") +
machine_uri + " :initialNode ?node .\n"
"?node :duration ?duration .\n"
"}\n");
@@ -118,14 +118,14 @@ Loader::load(const Glib::ustring& uri)
SharedPtr<Node> node(new Node(
TimeStamp(TimeUnit(TimeUnit::BEATS, MACHINA_PPQN), (double)(*i)["duration"]),
false));
- machine->add_node(node);
+ machine->add_node(node);
created[node_id] = node;
}
}
/* Find out which nodes are selectors */
-
+
query = Query(_rdf_world, ustring(
"SELECT DISTINCT ?node WHERE {\n") +
machine_uri + " :node ?node .\n"
@@ -184,7 +184,7 @@ Loader::load(const Glib::ustring& uri)
for (Query::Results::iterator i = results.begin(); i != results.end(); ++i) {
const char* src_uri = (*i)["src"];
- const char* dst_uri = (*i)["dst"];
+ const char* dst_uri = (*i)["dst"];
float prob = (*i)["prob"];
Created::iterator src_i = created.find(src_uri);
diff --git a/src/engine/Machine.cpp b/src/engine/Machine.cpp
index 7dcac34..fdeb6c6 100644
--- a/src/engine/Machine.cpp
+++ b/src/engine/Machine.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -38,7 +38,7 @@ Machine::Machine(TimeUnit unit)
{
}
-
+
/** Copy a Machine.
*
* Creates a deep copy which is the 'same' machine, but with
@@ -53,13 +53,13 @@ Machine::Machine(const Machine& copy)
, _sink(copy._sink)
{
map< SharedPtr<Node>, SharedPtr<Node> > replacements;
-
+
for (Nodes::const_iterator n = copy._nodes.begin(); n != copy._nodes.end(); ++n) {
SharedPtr<Machina::Node> node(new Machina::Node(*n->get()));
_nodes.push_back(node);
replacements[*n] = node;
}
-
+
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
for (Node::Edges::const_iterator e = (*n)->edges().begin(); e != (*n)->edges().end(); ++e) {
(*e)->set_tail(*n);
@@ -82,13 +82,13 @@ Machine::operator=(const Machine& other)
_nodes.clear();
map< SharedPtr<Node>, SharedPtr<Node> > replacements;
-
+
for (Nodes::const_iterator n = other._nodes.begin(); n != other._nodes.end(); ++n) {
SharedPtr<Machina::Node> node(new Machina::Node(*n->get()));
_nodes.push_back(node);
replacements[*n] = node;
}
-
+
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
for (Node::Edges::const_iterator e = (*n)->edges().begin(); e != (*n)->edges().end(); ++e) {
(*e)->set_tail(*n);
@@ -111,7 +111,7 @@ Machine::set_sink(SharedPtr<Raul::MIDISink> sink)
{
_sink = sink;
}
-
+
/** Always returns a node, unless there are none */
SharedPtr<Node>
@@ -119,7 +119,7 @@ Machine::random_node()
{
if (_nodes.empty())
return SharedPtr<Node>();
-
+
size_t i = rand() % _nodes.size();
// FIXME: O(n) worst case :(
@@ -136,7 +136,7 @@ SharedPtr<Edge>
Machine::random_edge()
{
SharedPtr<Node> tail = random_node();
-
+
for (size_t i = 0; i < _nodes.size() && tail->edges().empty(); ++i)
tail = random_node();
@@ -156,7 +156,7 @@ void
Machine::remove_node(SharedPtr<Node> node)
{
_nodes.erase(_nodes.find(node));
-
+
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n)
(*n)->remove_edges_to(node);
}
@@ -176,7 +176,7 @@ Machine::reset(Raul::TimeStamp time)
assert(! node->is_active());
}
-
+
for (size_t i=0; i < MAX_ACTIVE_NODES; ++i)
_active_nodes.at(i).reset();
}
@@ -190,12 +190,12 @@ Machine::reset(Raul::TimeStamp time)
*/
SharedPtr<Node>
Machine::earliest_node() const
-{
+{
SharedPtr<Node> earliest;
-
+
for (size_t i=0; i < MAX_ACTIVE_NODES; ++i) {
SharedPtr<Node> node = _active_nodes.at(i);
-
+
if (node) {
assert(node->is_active());
if (!earliest || node->exit_time() < earliest->exit_time()) {
@@ -209,7 +209,7 @@ Machine::earliest_node() const
/** Enter a state at the current _time.
- *
+ *
* Returns true if node was entered, or false if the maximum active nodes has been reached.
*/
bool
@@ -250,7 +250,7 @@ Machine::exit_node(SharedPtr<Raul::MIDISink> sink, SharedPtr<Node> node)
// Activate successors to this node
// (that aren't aready active right now)
-
+
if (node->is_selector()) {
const double rand_normal = rand() / (double)RAND_MAX; // [0, 1]
@@ -258,7 +258,7 @@ Machine::exit_node(SharedPtr<Raul::MIDISink> sink, SharedPtr<Node> node)
for (Node::Edges::const_iterator s = node->edges().begin();
s != node->edges().end(); ++s) {
-
+
if (!(*s)->head()->is_active()
&& rand_normal > range_min
&& rand_normal < range_min + (*s)->probability()) {
@@ -293,7 +293,7 @@ Machine::exit_node(SharedPtr<Raul::MIDISink> sink, SharedPtr<Node> node)
/** Run the machine for a (real) time slice.
*
* Returns the duration of time the machine actually ran.
- *
+ *
* Caller can check is_finished() to determine if the machine still has any
* active states. If not, time() will return the exact time stamp the
* machine actually finished on (so it can be restarted immediately
@@ -317,10 +317,10 @@ Machine::run(const Raul::TimeSlice& time)
bool entered = false;
if ( ! _nodes.empty()) {
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
-
+
if ((*n)->is_active())
(*n)->exit(sink, _time);
-
+
if ((*n)->is_initial()) {
if (enter_node(sink, (*n)))
entered = true;
@@ -333,7 +333,7 @@ Machine::run(const Raul::TimeSlice& time)
return TimeStamp(_time.unit(), 0, 0);
}
}
-
+
TimeStamp this_time(_time.unit(), 0, 0);
while (true) {
@@ -363,7 +363,7 @@ Machine::run(const Raul::TimeSlice& time)
}
}
-
+
//assert(this_time <= time.length_beats());
return this_time;
}
@@ -394,7 +394,7 @@ Machine::write_state(Redland::Model& model)
size_t count = 0;
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
-
+
(*n)->write_state(model);
if ((*n)->is_initial()) {
@@ -411,12 +411,12 @@ Machine::write_state(Redland::Model& model)
count = 0;
for (Nodes::const_iterator n = _nodes.begin(); n != _nodes.end(); ++n) {
-
+
for (Node::Edges::const_iterator e = (*n)->edges().begin();
e != (*n)->edges().end(); ++e) {
-
+
(*e)->write_state(model);
-
+
model.add_statement(model.base_uri(),
Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:edge"),
(*e)->id());
diff --git a/src/engine/MachineBuilder.cpp b/src/engine/MachineBuilder.cpp
index f3d6387..28f7364 100644
--- a/src/engine/MachineBuilder.cpp
+++ b/src/engine/MachineBuilder.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -103,7 +103,7 @@ MachineBuilder::connect_nodes(SharedPtr<Machine> m,
delay_node->add_edge(SharedPtr<Edge>(new Edge(delay_node, head)));
m->add_node(delay_node);
}
-
+
return delay_node;
}
@@ -120,7 +120,7 @@ MachineBuilder::event(Raul::TimeStamp time_offset,
return;
if ((buf[0] & 0xF0) == MIDI_CMD_NOTE_ON) {
-
+
SharedPtr<Node> node(new Node(TimeStamp(unit)));
node->set_enter_action(SharedPtr<Action>(new MidiAction(ev_size, buf)));
@@ -159,7 +159,7 @@ MachineBuilder::event(Raul::TimeStamp time_offset,
_active_nodes.push_back(node);
} else if ((buf[0] & 0xF0) == MIDI_CMD_NOTE_OFF) {
-
+
for (ActiveList::iterator i = _active_nodes.begin(); i != _active_nodes.end(); ++i) {
SharedPtr<MidiAction> action = PtrCast<MidiAction>((*i)->enter_action());
if (!action)
@@ -202,7 +202,7 @@ MachineBuilder::event(Raul::TimeStamp time_offset,
// Just monophonic
} else {
-
+
// Trim useless delay node if possible (these appear after poly sections)
if (is_delay_node(_connect_node) && _connect_node->duration().is_zero()
&& _connect_node->edges().size() == 1
@@ -223,7 +223,7 @@ MachineBuilder::event(Raul::TimeStamp time_offset,
_connect_node = resolved;
_machine->add_node(resolved);
}
- }
+ }
// Polyphonic, add this state to poly list
} else {
@@ -231,7 +231,7 @@ MachineBuilder::event(Raul::TimeStamp time_offset,
_connect_node = resolved;
_connect_node_end_time = t;
}
-
+
if (resolved->is_active())
resolved->exit(SharedPtr<Raul::MIDISink>(), t);
@@ -240,7 +240,7 @@ MachineBuilder::event(Raul::TimeStamp time_offset,
break;
}
}
-
+
}
}
@@ -273,7 +273,7 @@ MachineBuilder::resolve()
}
// Add initial note if necessary
- if (_machine->nodes().size() > 0
+ if (_machine->nodes().size() > 0
&& _machine->nodes().find(_initial_node) == _machine->nodes().end())
_machine->add_node(_initial_node);
diff --git a/src/engine/MidiAction.cpp b/src/engine/MidiAction.cpp
index c57a9c0..127c931 100644
--- a/src/engine/MidiAction.cpp
+++ b/src/engine/MidiAction.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -101,7 +101,7 @@ MidiAction::write_state(Redland::Model& model)
model.add_statement(_id,
Redland::Node(model.world(), Redland::Node::RESOURCE, "rdf:type"),
Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:MidiAction"));
-
+
// FIXME: Assumes note on/note off
model.add_statement(_id,
Redland::Node(model.world(), Redland::Node::RESOURCE, "machina:midiNote"),
diff --git a/src/engine/Mutation.cpp b/src/engine/Mutation.cpp
index 62abad5..1d3d794 100644
--- a/src/engine/Mutation.cpp
+++ b/src/engine/Mutation.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -37,7 +37,7 @@ Compress::mutate(Machine& machine)
for (Machine::Nodes::iterator i = machine.nodes().begin(); i != machine.nodes().end() ;) {
Machine::Nodes::iterator next = i;
++next;
-
+
if ((*i)->edges().empty())
machine.remove_node(*i);
@@ -54,7 +54,7 @@ AddNode::mutate(Machine& machine)
// Create random node
SharedPtr<Node> node(new Node(machine.time().unit()));
node->set_selector(true);
-
+
SharedPtr<Node> note_node = machine.random_node();
if (!note_node)
return;
@@ -68,12 +68,12 @@ AddNode::mutate(Machine& machine)
node->set_enter_action(ActionFactory::note_on(note));
node->set_exit_action(ActionFactory::note_off(note));
machine.add_node(node);
-
+
// Insert after some node
SharedPtr<Node> tail = machine.random_node();
if (tail && tail != node/* && !node->connected_to(tail)*/)
tail->add_edge(boost::shared_ptr<Edge>(new Edge(tail, node)));
-
+
// Insert before some other node
SharedPtr<Node> head = machine.random_node();
if (head && head != node/* && !head->connected_to(node)*/)
@@ -91,7 +91,7 @@ RemoveNode::mutate(Machine& machine)
machine.remove_node(node);
}
-
+
void
AdjustNode::mutate(Machine& machine)
{
@@ -110,12 +110,12 @@ AdjustNode::mutate(Machine& machine)
}
}
-
+
void
SwapNodes::mutate(Machine& machine)
{
//cout << "SWAP NODE" << endl;
-
+
if (machine.nodes().size() <= 1)
return;
@@ -165,7 +165,7 @@ RemoveEdge::mutate(Machine& machine)
tail->remove_edge(tail->random_edge());
}
-
+
void
AdjustEdge::mutate(Machine& machine)
{
diff --git a/src/engine/Node.cpp b/src/engine/Node.cpp
index 9ca4157..2c3ddda 100644
--- a/src/engine/Node.cpp
+++ b/src/engine/Node.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -65,7 +65,7 @@ Node::random_edge()
SharedPtr<Edge> ret;
if (_edges.empty())
return ret;
-
+
size_t i = rand() % _edges.size();
// FIXME: O(n) worst case :(
@@ -88,13 +88,13 @@ Node::edges_changed()
// Normalize edge probabilities if we're a selector
double prob_sum = 0;
-
+
for (Edges::iterator i = _edges.begin(); i != _edges.end(); ++i)
prob_sum += (*i)->probability();
for (Edges::iterator i = _edges.begin(); i != _edges.end(); ++i)
(*i)->set_probability((*i)->probability() / prob_sum);
-
+
_changed = true;
}
@@ -106,7 +106,7 @@ Node::set_selector(bool yn)
if (yn)
edges_changed();
-
+
_changed = true;
}
@@ -131,13 +131,13 @@ void
Node::enter(SharedPtr<MIDISink> sink, TimeStamp time)
{
assert(!_is_active);
-
+
_changed = true;
_is_active = true;
_enter_time = time;
cerr << "ENTERING " << this << endl;
-
+
if (sink && _enter_action)
_enter_action->execute(sink, time);
}
@@ -147,12 +147,12 @@ void
Node::exit(SharedPtr<MIDISink> sink, TimeStamp time)
{
assert(_is_active);
-
+
cerr << "EXITING " << this << endl;
-
+
if (sink && _exit_action)
_exit_action->execute(sink, time);
-
+
_changed = true;
_is_active = false;
_enter_time = 0;
@@ -166,7 +166,7 @@ Node::add_edge(SharedPtr<Edge> edge)
for (Edges::const_iterator i = _edges.begin(); i != _edges.end(); ++i)
if ((*i)->head() == edge->head())
return;
-
+
_edges.push_back(edge);
edges_changed();
}
@@ -179,7 +179,7 @@ Node::remove_edge(SharedPtr<Edge> edge)
edges_changed();
}
-
+
bool
Node::connected_to(SharedPtr<Node> node)
{
@@ -203,7 +203,7 @@ Node::remove_edges_to(SharedPtr<Node> node)
i = next;
}
-
+
edges_changed();
}
@@ -212,7 +212,7 @@ void
Node::write_state(Redland::Model& model)
{
using namespace Raul;
-
+
if (!_id)
set_id(model.world().blank_id());
@@ -231,7 +231,7 @@ Node::write_state(Redland::Model& model)
if (_enter_action) {
_enter_action->write_state(model);
-
+
model.add_statement(_id,
"machina:enterAction",
_enter_action->id());
diff --git a/src/engine/Problem.cpp b/src/engine/Problem.cpp
index 6de61a3..8ecc16d 100644
--- a/src/engine/Problem.cpp
+++ b/src/engine/Problem.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -33,7 +33,7 @@ using namespace std;
namespace Machina {
-
+
Problem::Problem(TimeUnit unit, const std::string& target_midi, SharedPtr<Machine> seed)
: _unit(unit)
, _target(*this)
@@ -42,9 +42,9 @@ Problem::Problem(TimeUnit unit, const std::string& target_midi, SharedPtr<Machin
Raul::SMFReader smf;
const bool opened = smf.open(target_midi);
assert(opened);
-
+
smf.seek_to_track(2); // FIXME: ?
-
+
uint8_t buf[4];
uint32_t ev_size;
uint32_t delta_time;
@@ -80,7 +80,7 @@ Problem::fitness(const Machine& const_machine) const
map<Machine*, float>::const_iterator cached = _fitness.find(&machine);
if (cached != _fitness.end())
return cached->second;
-
+
SharedPtr<Evaluator> eval(new Evaluator(*this));
//machine.reset();
@@ -89,15 +89,15 @@ Problem::fitness(const Machine& const_machine) const
machine.set_sink(eval);
// FIXME: timing stuff here isn't right at all...
-
+
static const unsigned ppqn = MACHINA_PPQN;
Raul::TimeSlice time(ppqn, ppqn, 120.0);
time.set_slice(TimeStamp(_unit, 0, 0), TimeDuration(_unit, 2 * ppqn));
-
+
machine.run(time);
if (eval->n_notes() == 0)
return 0.0f; // bad dog
-
+
TimeStamp end(_unit, time.start_ticks().ticks() + 2 * ppqn);
time.set_slice(end, TimeStamp(_unit, 0, 0));
@@ -109,7 +109,7 @@ Problem::fitness(const Machine& const_machine) const
}
eval->compute();
-
+
// count
#if 0
float f = 0;
@@ -123,12 +123,12 @@ Problem::fitness(const Machine& const_machine) const
}
#endif
//cout << ")";
-
+
// distance
//float f = distance(eval->_notes, _target._notes);
-
+
float f = 0.0;
-
+
for (Evaluator::Patterns::const_iterator i = eval->_patterns.begin(); i != eval->_patterns.end(); ++i) {
// Reward for matching patterns
if (_target._patterns.find(i->first) != _target._patterns.end()) {
@@ -142,7 +142,7 @@ Problem::fitness(const Machine& const_machine) const
f -= (i->second / (float)eval->_patterns.size() * (float)(invlen*invlen*invlen)) * 4;
}
}
-
+
// Punish for missing patterns
for (Evaluator::Patterns::const_iterator i = _target._patterns.begin(); i != _target._patterns.end(); ++i) {
if (eval->_patterns.find(i->first) == _target._patterns.end()) {
@@ -156,7 +156,7 @@ Problem::fitness(const Machine& const_machine) const
return f;
}
-
+
void
Problem::Evaluator::write_event(Raul::TimeStamp time,
@@ -166,10 +166,10 @@ Problem::Evaluator::write_event(Raul::TimeStamp time,
if ((ev[0] & 0xF0) == MIDI_CMD_NOTE_ON) {
const uint8_t note = ev[1];
-
+
if (_first_note == 0)
_first_note = note;
-
+
/*++_note_frequency[note];
++n_notes();*/
//_notes.push_back(note);
@@ -193,7 +193,7 @@ Problem::Evaluator::write_event(Raul::TimeStamp time,
++_counts[note];
++_n_notes;
-
+
}
}
@@ -209,7 +209,7 @@ Problem::Evaluator::compute()
}
}*/
}
-
+
boost::shared_ptr<Problem::Population>
Problem::initial_population(size_t gene_size, size_t pop_size) const
@@ -262,7 +262,7 @@ Problem::initial_population(size_t gene_size, size_t pop_size) const
cur = head;
}
}
-
+
ret->push_back(m);
/*cout << "initial # nodes: " << m.nodes().size();
@@ -279,10 +279,10 @@ Problem::distance(const std::vector<uint8_t>& source,
const std::vector<uint8_t>& target) const
{
// Derived from http://www.merriampark.com/ldcpp.htm
-
+
assert(source.size() < UINT16_MAX);
assert(target.size() < UINT16_MAX);
-
+
// Step 1
const uint16_t n = source.size();
diff --git a/src/engine/RaulJackDriver.cpp b/src/engine/RaulJackDriver.cpp
index 6c60085..b37a1d4 100644
--- a/src/engine/RaulJackDriver.cpp
+++ b/src/engine/RaulJackDriver.cpp
@@ -1,15 +1,15 @@
/* This file is part of Raul.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Raul 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.
- *
+ *
* Raul 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -41,7 +41,7 @@ JackDriver::JackDriver()
}
-JackDriver::~JackDriver()
+JackDriver::~JackDriver()
{
detach();
}
@@ -50,12 +50,12 @@ JackDriver::~JackDriver()
/** Connect to Jack.
*/
void
-JackDriver::attach(const string& client_name, string server_name)
+JackDriver::attach(const string& client_name, string server_name)
{
// Already connected
if (_client)
return;
-
+
jack_set_error_function(error_cb);
if (server_name.length() > 0)
@@ -75,7 +75,7 @@ JackDriver::attach(const string& client_name, string server_name)
jack_set_buffer_size_callback(_client, jack_buffer_size_cb, this);
jack_set_xrun_callback(_client, jack_xrun_cb, this);
jack_set_process_callback(_client, jack_process_cb, this);
-
+
//_is_dirty = true;
_buffer_size = jack_get_buffer_size(_client);
}
@@ -83,7 +83,7 @@ JackDriver::attach(const string& client_name, string server_name)
void
-JackDriver::detach()
+JackDriver::detach()
{
if (_client) {
deactivate();
@@ -120,17 +120,17 @@ JackDriver::deactivate()
void
-JackDriver::jack_port_registration_cb(jack_port_id_t /*port_id*/, int /*registered*/, void* /*jack_driver*/)
+JackDriver::jack_port_registration_cb(jack_port_id_t /*port_id*/, int /*registered*/, void* /*jack_driver*/)
{
/* whatever. */
}
int
-JackDriver::jack_graph_order_cb(void* jack_driver)
+JackDriver::jack_graph_order_cb(void* jack_driver)
{
JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver);
-
+
assert(me);
me->on_graph_order_changed();
@@ -142,7 +142,7 @@ int
JackDriver::jack_xrun_cb(void* jack_driver)
{
JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver);
-
+
assert(me);
me->_xruns++;
@@ -150,16 +150,16 @@ JackDriver::jack_xrun_cb(void* jack_driver)
me->reset_delay();
me->on_xrun();
-
+
return 0;
}
int
-JackDriver::jack_buffer_size_cb(jack_nframes_t buffer_size, void* jack_driver)
+JackDriver::jack_buffer_size_cb(jack_nframes_t buffer_size, void* jack_driver)
{
JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver);
-
+
assert(me);
me->reset_xruns();
me->reset_delay();
@@ -169,16 +169,16 @@ JackDriver::jack_buffer_size_cb(jack_nframes_t buffer_size, void* jack_driver)
return 0;
}
-
+
int
JackDriver::jack_process_cb(jack_nframes_t nframes, void* jack_driver)
{
JackDriver* me = reinterpret_cast<JackDriver*>(jack_driver);
-
+
assert(me);
me->on_process(nframes);
-
+
return 0;
}
@@ -234,7 +234,7 @@ JackDriver::set_buffer_size(jack_nframes_t size)
_buffer_size = size;
return true;
}
-
+
if (jack_set_buffer_size(_client, size)) {
//_app->status_message("[JACK] ERROR: Unable to set buffer size");
return false;
diff --git a/src/engine/RaulJackDriver.hpp b/src/engine/RaulJackDriver.hpp
index f1b92f1..6ab0116 100644
--- a/src/engine/RaulJackDriver.hpp
+++ b/src/engine/RaulJackDriver.hpp
@@ -1,15 +1,15 @@
/* This file is part of Raul.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Raul 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.
- *
+ *
* Raul 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -36,7 +36,7 @@ class JackDriver
public:
JackDriver();
virtual ~JackDriver();
-
+
void attach(const std::string& client_name, std::string server_name="");
void detach();
@@ -46,17 +46,17 @@ public:
bool is_activated() const { return _is_activated; }
bool is_attached() const { return (_client != NULL); }
bool is_realtime() const { return _client && jack_is_realtime(_client); }
-
+
void start_transport() { jack_transport_start(_client); }
void stop_transport() { jack_transport_stop(_client); }
-
+
void rewind_transport() {
jack_position_t zero;
zero.frame = 0;
zero.valid = (jack_position_bits_t)0;
jack_transport_reposition(_client, &zero);
}
-
+
jack_nframes_t buffer_size();
bool set_buffer_size(jack_nframes_t size);
diff --git a/src/engine/Recorder.cpp b/src/engine/Recorder.cpp
index 03ea7d0..2ae8b85 100644
--- a/src/engine/Recorder.cpp
+++ b/src/engine/Recorder.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -45,7 +45,7 @@ Recorder::_whipped()
_builder->set_time(t);
_builder->event(TimeStamp(_unit), size, buf);
}
-}
+}
SharedPtr<Machine>
diff --git a/src/engine/SMFDriver.cpp b/src/engine/SMFDriver.cpp
index f482652..3cab320 100644
--- a/src/engine/SMFDriver.cpp
+++ b/src/engine/SMFDriver.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -52,7 +52,7 @@ SMFDriver::learn(const string& filename, unsigned track, double q, Raul::TimeDur
SharedPtr<Machine> m(new Machine(max_duration.unit()));
SharedPtr<MachineBuilder> builder = SharedPtr<MachineBuilder>(new MachineBuilder(m, q));
Raul::SMFReader reader;
-
+
if (!reader.open(filename)) {
cerr << "Unable to open MIDI file " << filename << endl;
return SharedPtr<Machine>();
@@ -82,7 +82,7 @@ SMFDriver::learn(const string& filename, double q, Raul::TimeStamp max_duration)
SharedPtr<Machine> m(new Machine(max_duration.unit()));
SharedPtr<MachineBuilder> builder = SharedPtr<MachineBuilder>(new MachineBuilder(m, q));
Raul::SMFReader reader;
-
+
if (!reader.open(filename)) {
cerr << "Unable to open MIDI file " << filename << endl;
return SharedPtr<Machine>();
@@ -112,11 +112,11 @@ SMFDriver::learn_track(SharedPtr<MachineBuilder> builder,
const bool found_track = reader.seek_to_track(track);
if (!found_track)
return;
-
+
uint8_t buf[4];
uint32_t ev_size;
uint32_t ev_delta_time;
-
+
uint64_t t = 0;
double unquantized_t = 0;
diff --git a/src/engine/machina/Action.hpp b/src/engine/machina/Action.hpp
index 09c3878..f7a702f 100644
--- a/src/engine/machina/Action.hpp
+++ b/src/engine/machina/Action.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/src/engine/machina/ActionFactory.hpp b/src/engine/machina/ActionFactory.hpp
index 0cf4154..1e613bb 100644
--- a/src/engine/machina/ActionFactory.hpp
+++ b/src/engine/machina/ActionFactory.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/src/engine/machina/Driver.hpp b/src/engine/machina/Driver.hpp
index f412574..f1f0587 100644
--- a/src/engine/machina/Driver.hpp
+++ b/src/engine/machina/Driver.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -32,10 +32,10 @@ public:
SharedPtr<Machine> machine() { return _machine; }
virtual void set_machine(SharedPtr<Machine> machine) { _machine = machine; }
-
+
virtual void set_bpm(double bpm) = 0;
virtual void set_quantization(double q) = 0;
-
+
virtual void activate() {}
virtual void deactivate() {}
diff --git a/src/engine/machina/Edge.hpp b/src/engine/machina/Edge.hpp
index 5851090..41f5d00 100644
--- a/src/engine/machina/Edge.hpp
+++ b/src/engine/machina/Edge.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -53,7 +53,7 @@ public:
private:
Raul::DoubleBuffer<float> _probability;
-
+
WeakPtr<Node> _tail;
SharedPtr<Node> _head;
};
diff --git a/src/engine/machina/Engine.hpp b/src/engine/machina/Engine.hpp
index 92384a8..b77f637 100644
--- a/src/engine/machina/Engine.hpp
+++ b/src/engine/machina/Engine.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -36,7 +36,7 @@ public:
, _loader(_rdf_world)
{
}
-
+
Redland::World& rdf_world() { return _rdf_world; }
SharedPtr<Driver> driver() { return _driver; }
diff --git a/src/engine/machina/Evolver.hpp b/src/engine/machina/Evolver.hpp
index 1b847db..d5006f6 100644
--- a/src/engine/machina/Evolver.hpp
+++ b/src/engine/machina/Evolver.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -35,14 +35,14 @@ class Problem;
class Evolver : public Raul::Thread {
public:
Evolver(Raul::TimeUnit unit, const string& target_midi, SharedPtr<Machine> seed);
-
+
void seed(SharedPtr<Machine> parent);
bool improvement() { return _improvement; }
SharedPtr<const Machine> best() { return _ga->best(); }
-
+
typedef Eugene::GAImpl<Machine> MachinaGA;
-
+
private:
void _run();
diff --git a/src/engine/machina/JackDriver.hpp b/src/engine/machina/JackDriver.hpp
index 5982f87..2a5a695 100644
--- a/src/engine/machina/JackDriver.hpp
+++ b/src/engine/machina/JackDriver.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -50,16 +50,16 @@ public:
void attach(const std::string& client_name);
void detach();
-
+
void activate() { Raul::JackDriver::activate(); }
void deactivate() { Raul::JackDriver::deactivate(); }
void set_machine(SharedPtr<Machine> machine);
-
+
void write_event(Raul::TimeStamp time,
size_t size,
const unsigned char* event) throw (std::logic_error);
-
+
void set_bpm(double bpm) { _bpm.set(bpm); }
void set_quantization(double q) { _quantization.set(q); }
@@ -80,7 +80,7 @@ private:
jack_port_t* _input_port;
jack_port_t* _output_port;
-
+
Raul::TimeUnit _frames_unit;
Raul::TimeUnit _beats_unit;
Raul::TimeSlice _cycle_time;
diff --git a/src/engine/machina/LearnRequest.hpp b/src/engine/machina/LearnRequest.hpp
index edc76c9..d106395 100644
--- a/src/engine/machina/LearnRequest.hpp
+++ b/src/engine/machina/LearnRequest.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -45,9 +45,9 @@ public:
void start(double q, Raul::TimeStamp time)
{ _started = true; _start_time = time; _quantization = q; }
-
+
void finish(TimeStamp time);
-
+
bool started() { return _started; }
const SharedPtr<Node>& node() { return _node; }
diff --git a/src/engine/machina/Loader.hpp b/src/engine/machina/Loader.hpp
index 2c9fa1c..4a6ba38 100644
--- a/src/engine/machina/Loader.hpp
+++ b/src/engine/machina/Loader.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/src/engine/machina/Machine.hpp b/src/engine/machina/Machine.hpp
index 468b9bc..3fd7073 100644
--- a/src/engine/machina/Machine.hpp
+++ b/src/engine/machina/Machine.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -24,7 +24,7 @@
#include "raul/WeakPtr.hpp"
#include "raul/List.hpp"
#include "raul/TimeSlice.hpp"
-#include "redlandmm/Model.hpp"
+#include "redlandmm/Model.hpp"
#include "types.hpp"
#include "LearnRequest.hpp"
#include "Node.hpp"
@@ -43,11 +43,11 @@ public:
// Kluge to appease Eugene
bool operator==(const Machine& other) { return false; }
-
+
// Main context
void activate() { _is_activated = true; }
void deactivate() { _is_activated = false; }
-
+
bool is_empty() { return _nodes.empty(); }
bool is_finished() { return _is_finished; }
bool is_activated() { return _is_activated; }
@@ -61,7 +61,7 @@ public:
// Audio context
void reset(Raul::TimeStamp time);
TimeDuration run(const Raul::TimeSlice& time);
-
+
// Any context
inline Raul::TimeStamp time() const { return _time; }
@@ -76,9 +76,9 @@ public:
SharedPtr<Edge> random_edge();
void set_sink(SharedPtr<Raul::MIDISink> sink);
-
+
private:
-
+
// Audio context
SharedPtr<Node> earliest_node() const;
bool enter_node(SharedPtr<Raul::MIDISink> sink, SharedPtr<Node> node);
diff --git a/src/engine/machina/MachineBuilder.hpp b/src/engine/machina/MachineBuilder.hpp
index 2c9d0a2..4353797 100644
--- a/src/engine/machina/MachineBuilder.hpp
+++ b/src/engine/machina/MachineBuilder.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -35,7 +35,7 @@ public:
void set_time(Raul::TimeStamp time) { _time = time; }
void event(Raul::TimeStamp time_offset, size_t size, unsigned char* buf);
-
+
void reset();
void resolve();
@@ -49,10 +49,10 @@ private:
connect_nodes(SharedPtr<Machine> m,
SharedPtr<Node> tail, Raul::TimeStamp tail_end_time,
SharedPtr<Node> head, Raul::TimeStamp head_start_time);
-
+
typedef std::list<SharedPtr<Node> > ActiveList;
ActiveList _active_nodes;
-
+
typedef std::list<std::pair<Raul::TimeStamp, SharedPtr<Node> > > PolyList;
PolyList _poly_nodes;
diff --git a/src/engine/machina/MidiAction.hpp b/src/engine/machina/MidiAction.hpp
index 5ae507e..96087d6 100644
--- a/src/engine/machina/MidiAction.hpp
+++ b/src/engine/machina/MidiAction.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -31,7 +31,7 @@ namespace Machina {
class MidiAction : public Action {
public:
~MidiAction();
-
+
MidiAction(size_t size,
const unsigned char* event);
@@ -41,7 +41,7 @@ public:
bool set_event(size_t size, const byte* event);
void execute(SharedPtr<Raul::MIDISink> driver, Raul::TimeStamp time);
-
+
virtual void write_state(Redland::Model& model);
private:
diff --git a/src/engine/machina/Mutation.hpp b/src/engine/machina/Mutation.hpp
index de31fc3..7c407c6 100644
--- a/src/engine/machina/Mutation.hpp
+++ b/src/engine/machina/Mutation.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/src/engine/machina/Node.hpp b/src/engine/machina/Node.hpp
index 4258476..535a49d 100644
--- a/src/engine/machina/Node.hpp
+++ b/src/engine/machina/Node.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -78,12 +78,12 @@ public:
inline bool changed() { return _changed; }
inline void set_changed() { _changed = true; }
-
+
typedef Raul::List<SharedPtr<Edge> > Edges;
Edges& edges() { return _edges; }
-
+
SharedPtr<Edge> random_edge();
-
+
private:
Node& operator=(const Node& other); // undefined
diff --git a/src/engine/machina/Problem.hpp b/src/engine/machina/Problem.hpp
index c0c1662..58393e1 100644
--- a/src/engine/machina/Problem.hpp
+++ b/src/engine/machina/Problem.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -33,11 +33,11 @@ public:
void seed(SharedPtr<Machine> parent) { _seed = parent; }
float fitness(const Machine& machine) const;
-
+
bool fitness_less_than(float a, float b) const { return a < b; }
void clear_fitness_cache() { _fitness.clear(); }
-
+
boost::shared_ptr<Population>
initial_population(size_t gene_size, size_t pop_size) const;
@@ -57,9 +57,9 @@ private:
const uint8_t* ev) throw (std::logic_error);
void compute();
const Problem& _problem;
-
+
size_t n_notes() const { return _n_notes; }
-
+
float _note_frequency[128];
size_t _n_notes;
double _length;
@@ -75,11 +75,11 @@ private:
const Problem& _problem;
size_t n_notes() const { return _notes.size(); }
-
+
std::vector<uint8_t> _notes;
float _counts[128];
};*/
-
+
struct Evaluator : public Raul::MIDISink {
Evaluator(const Problem& problem) : _problem(problem), _order(4), _n_notes(0), _first_note(0) {
for (uint8_t i=0; i < 128; ++i)
@@ -93,7 +93,7 @@ private:
size_t n_notes() const { return _n_notes; }
uint8_t first_note() const { return _first_note; }
-
+
const uint32_t _order;
std::string _read;
@@ -109,7 +109,7 @@ private:
Evaluator _target;
SharedPtr<Machine> _seed;
-
+
/// for levenshtein distance
mutable std::vector< std::vector<uint16_t> > _matrix;
diff --git a/src/engine/machina/Recorder.hpp b/src/engine/machina/Recorder.hpp
index 6a91ba6..16c3b73 100644
--- a/src/engine/machina/Recorder.hpp
+++ b/src/engine/machina/Recorder.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -40,7 +40,7 @@ public:
private:
virtual void _whipped();
-
+
TimeUnit _unit;
Raul::EventRingBuffer _record_buffer;
SharedPtr<MachineBuilder> _builder;
diff --git a/src/engine/machina/SMFDriver.hpp b/src/engine/machina/SMFDriver.hpp
index 5e1e9f8..bc814d8 100644
--- a/src/engine/machina/SMFDriver.hpp
+++ b/src/engine/machina/SMFDriver.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -48,12 +48,12 @@ public:
Raul::TimeDuration max_duration);
void run(SharedPtr<Machine> machine, Raul::TimeStamp max_time);
-
+
void write_event(Raul::TimeStamp time,
size_t ev_size,
const unsigned char* ev) throw (std::logic_error)
{ _writer->write_event(time, ev_size, ev); }
-
+
void set_bpm(double /*bpm*/) { }
void set_quantization(double /*quantization*/) { }
@@ -61,7 +61,7 @@ public:
private:
SharedPtr<Raul::SMFWriter> _writer;
-
+
void learn_track(SharedPtr<MachineBuilder> builder,
Raul::SMFReader& reader,
unsigned track,
diff --git a/src/engine/machina/Schrodinbit.hpp b/src/engine/machina/Schrodinbit.hpp
index 6065cfc..c156f09 100644
--- a/src/engine/machina/Schrodinbit.hpp
+++ b/src/engine/machina/Schrodinbit.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/src/engine/machina/types.hpp b/src/engine/machina/types.hpp
index d74fce9..de7d73f 100644
--- a/src/engine/machina/types.hpp
+++ b/src/engine/machina/types.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/src/gui/EdgeView.cpp b/src/gui/EdgeView.cpp
index 46d3e77..643e1ac 100644
--- a/src/gui/EdgeView.cpp
+++ b/src/gui/EdgeView.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -71,7 +71,7 @@ EdgeView::EdgeView(SharedPtr<Canvas> canvas,
show_handle(true);
}
-
+
double
EdgeView::length_hint() const
{
diff --git a/src/gui/EdgeView.hpp b/src/gui/EdgeView.hpp
index 5a36afa..7736096 100644
--- a/src/gui/EdgeView.hpp
+++ b/src/gui/EdgeView.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -35,7 +35,7 @@ public:
void show_label(bool show);
void update();
-
+
virtual double length_hint() const;
private:
diff --git a/src/gui/GladeXml.hpp b/src/gui/GladeXml.hpp
index 4ea7a7f..4133814 100644
--- a/src/gui/GladeXml.hpp
+++ b/src/gui/GladeXml.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/src/gui/MachinaCanvas.cpp b/src/gui/MachinaCanvas.cpp
index ba43b4e..d610f99 100644
--- a/src/gui/MachinaCanvas.cpp
+++ b/src/gui/MachinaCanvas.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -48,10 +48,10 @@ MachinaCanvas::node_clicked(WeakPtr<NodeView> item, GdkEventButton* event)
SharedPtr<NodeView> node = PtrCast<NodeView>(item.lock());
if (!node)
return;
-
+
if (event->state & GDK_CONTROL_MASK)
return;
-
+
// Middle click, learn
if (event->button == 2) {
_app->engine()->machine()->learn(Machina::LearnRequest::create(_app->maid(), node->node()));
@@ -110,7 +110,7 @@ MachinaCanvas::canvas_event(GdkEvent* event)
machine->add_node(node);
return true;
-
+
} else {
return Canvas::canvas_event(event);
}
@@ -123,7 +123,7 @@ MachinaCanvas::connect_node(boost::shared_ptr<NodeView> src,
{
SharedPtr<Machina::Edge> edge(new Machina::Edge(src->node(), head->node()));
src->node()->add_edge(edge);
-
+
boost::shared_ptr<Connection> c(new EdgeView(shared_from_this(),
src, head, edge));
src->add_connection(c);
@@ -173,7 +173,7 @@ MachinaCanvas::build(SharedPtr<const Machina::Machine> machine, bool show_labels
for (Machina::Machine::Nodes::const_iterator i = machine->nodes().begin();
i != machine->nodes().end(); ++i) {
-
+
const SharedPtr<NodeView> view = create_node_view(*i);
views.insert(std::make_pair((*i), view));
}
@@ -191,7 +191,7 @@ MachinaCanvas::build(SharedPtr<const Machina::Machine> machine, bool show_labels
cerr << "WARNING: Edge to node with no view" << endl;
continue;
}
-
+
boost::shared_ptr<Connection> c(new EdgeView(shared_from_this(),
view, head_view, (*e)));
view->add_connection(c);
@@ -199,7 +199,7 @@ MachinaCanvas::build(SharedPtr<const Machina::Machine> machine, bool show_labels
add_connection(c);
}
}
-
+
arrange();
}
diff --git a/src/gui/MachinaCanvas.hpp b/src/gui/MachinaCanvas.hpp
index 86be5d5..e71e382 100644
--- a/src/gui/MachinaCanvas.hpp
+++ b/src/gui/MachinaCanvas.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -33,7 +33,7 @@ class MachinaCanvas : public Canvas
{
public:
MachinaCanvas(MachinaGUI* app, int width, int height);
-
+
void connect_node(SharedPtr<NodeView> port1,
SharedPtr<NodeView> port2);
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index baba33f..251ef23 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -90,7 +90,7 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
xml->get_widget("add_edge_but", _add_edge_button);
xml->get_widget("remove_edge_but", _remove_edge_button);
xml->get_widget("adjust_edge_but", _adjust_edge_button);
-
+
_canvas_scrolledwindow->add(*_canvas);
_canvas_scrolledwindow->signal_event().connect(sigc::mem_fun(this,
&MachinaGUI::scrolled_window_event));
@@ -99,14 +99,14 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
_canvas_scrolledwindow->property_hadjustment().get_value()->set_step_increment(10);
_canvas_scrolledwindow->property_vadjustment().get_value()->set_step_increment(10);
-
+
_record_button->signal_toggled().connect(sigc::mem_fun(this, &MachinaGUI::record_toggled));
_stop_button->signal_clicked().connect(sigc::mem_fun(this, &MachinaGUI::stop_clicked));
_play_button->signal_toggled().connect(sigc::mem_fun(this, &MachinaGUI::play_toggled));
_zoom_normal_button->signal_clicked().connect(sigc::bind(
sigc::mem_fun(this, &MachinaGUI::zoom), 1.0));
-
+
_zoom_full_button->signal_clicked().connect(
sigc::mem_fun(_canvas.get(), &MachinaCanvas::zoom_full));
@@ -141,7 +141,7 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
sigc::mem_fun(this, &MachinaGUI::quantize_changed));
_quantize_spinbutton->signal_changed().connect(
sigc::mem_fun(this, &MachinaGUI::quantize_changed));
-
+
_mutate_button->signal_clicked().connect(sigc::bind(
sigc::mem_fun(this, &MachinaGUI::random_mutation), SharedPtr<Machine>()));
_compress_button->signal_clicked().connect(sigc::hide_return(sigc::bind(
@@ -160,7 +160,7 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
sigc::mem_fun(this, &MachinaGUI::mutate), SharedPtr<Machine>(), 6));
connect_widgets();
-
+
_canvas->show();
_main_window->present();
@@ -175,10 +175,10 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
sigc::mem_fun(_maid.get(), &Raul::Maid::cleanup),
true),
1000);
-
+
// Idle callback to update node states
Glib::signal_timeout().connect(sigc::mem_fun(this, &MachinaGUI::idle_callback), 100);
-
+
#ifdef HAVE_EUGENE
_load_target_button->signal_clicked().connect(sigc::mem_fun(this, &MachinaGUI::load_target_clicked));
_evolve_button->signal_clicked().connect(sigc::mem_fun(this, &MachinaGUI::evolve_toggled));
@@ -187,19 +187,19 @@ MachinaGUI::MachinaGUI(SharedPtr<Machina::Engine> engine)
_evolve_button->set_sensitive(false);
_load_target_button->set_sensitive(false);
#endif
-
+
_canvas->build(engine->machine(), _menu_view_labels->get_active());
}
-MachinaGUI::~MachinaGUI()
+MachinaGUI::~MachinaGUI()
{
}
#ifdef HAVE_EUGENE
bool
-MachinaGUI::evolve_callback()
+MachinaGUI::evolve_callback()
{
if (_evolve) {
if (_evolver->improvement()) {
@@ -214,7 +214,7 @@ MachinaGUI::evolve_callback()
bool
-MachinaGUI::idle_callback()
+MachinaGUI::idle_callback()
{
const bool show_labels = _menu_view_labels->get_active();
@@ -233,7 +233,7 @@ MachinaGUI::scrolled_window_event(GdkEvent* event)
{
if (event->type == GDK_KEY_PRESS) {
if (event->key.keyval == GDK_Delete) {
-
+
ItemList selection = _canvas->selected_items();
_canvas->clear_selection();
@@ -249,7 +249,7 @@ MachinaGUI::scrolled_window_event(GdkEvent* event)
return true;
}
}
-
+
return false;
}
@@ -269,7 +269,7 @@ MachinaGUI::load_target_clicked()
dialog.set_local_only(false);
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
-
+
Gtk::FileFilter filt;
filt.add_pattern("*.mid");
filt.set_name("MIDI Files");
@@ -404,20 +404,20 @@ using namespace std;
void
-MachinaGUI::menu_file_quit()
+MachinaGUI::menu_file_quit()
{
_main_window->hide();
}
void
-MachinaGUI::menu_file_open()
+MachinaGUI::menu_file_open()
{
Gtk::FileChooserDialog dialog(*_main_window, "Open Machine", Gtk::FILE_CHOOSER_ACTION_OPEN);
dialog.set_local_only(false);
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
-
+
Gtk::FileFilter filt;
filt.add_pattern("*.machina.ttl");
filt.set_name("Machina Machines (Turtle/RDF)");
@@ -437,14 +437,14 @@ MachinaGUI::menu_file_open()
void
-MachinaGUI::menu_file_save()
+MachinaGUI::menu_file_save()
{
if (_save_uri == "" || _save_uri.substr(0, 5) != "file:") {
menu_file_save_as();
} else {
if (!raptor_uri_uri_string_is_file_uri((const unsigned char*)_save_uri.c_str()))
menu_file_save_as();
-
+
Redland::Model model(_engine->rdf_world());
model.set_base_uri(_save_uri);
_engine->machine()->write_state(model);
@@ -454,31 +454,31 @@ MachinaGUI::menu_file_save()
void
-MachinaGUI::menu_file_save_as()
+MachinaGUI::menu_file_save_as()
{
Gtk::FileChooserDialog dialog(*_main_window, "Save Machine",
Gtk::FILE_CHOOSER_ACTION_SAVE);
-
+
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
- dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
-
+ dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
+
if (_save_uri.length() > 0)
dialog.set_uri(_save_uri);
-
+
const int result = dialog.run();
-
+
assert(result == Gtk::RESPONSE_OK
|| result == Gtk::RESPONSE_CANCEL
|| result == Gtk::RESPONSE_NONE);
-
- if (result == Gtk::RESPONSE_OK) {
+
+ if (result == Gtk::RESPONSE_OK) {
string filename = dialog.get_filename();
if (filename.length() < 13 || filename.substr(filename.length()-12) != ".machina.ttl")
filename += ".machina.ttl";
Glib::ustring uri = Glib::filename_to_uri(filename);
-
+
bool confirm = false;
std::fstream fin;
fin.open(filename.c_str(), std::ios::in);
@@ -495,7 +495,7 @@ MachinaGUI::menu_file_save_as()
confirm = true;
}
fin.close();
-
+
if (confirm) {
Redland::Model model(_engine->rdf_world());
_save_uri = uri;
@@ -514,12 +514,12 @@ MachinaGUI::menu_import_midi()
Gtk::FILE_CHOOSER_ACTION_OPEN);
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK);
-
+
Gtk::FileFilter filt;
filt.add_pattern("*.mid");
filt.set_name("MIDI Files");
dialog.set_filter(filt);
-
+
Gtk::HBox* extra_widget = Gtk::manage(new Gtk::HBox());
Gtk::SpinButton* length_sb = Gtk::manage(new Gtk::SpinButton());
length_sb->set_increments(1, 10);
@@ -527,21 +527,21 @@ MachinaGUI::menu_import_midi()
length_sb->set_value(0);
extra_widget->pack_start(*Gtk::manage(new Gtk::Label("")), true, true);
extra_widget->pack_start(*Gtk::manage(new Gtk::Label("Maximum Length (0 = unlimited): ")), false, false);
- extra_widget->pack_start(*length_sb, false, false);
+ extra_widget->pack_start(*length_sb, false, false);
dialog.set_extra_widget(*extra_widget);
extra_widget->show_all();
-
+
const int result = dialog.run();
if (result == Gtk::RESPONSE_OK) {
SharedPtr<Machina::SMFDriver> file_driver(new Machina::SMFDriver());
-
+
double length_dbl = length_sb->get_value_as_int();
Raul::TimeStamp length(_unit, length_dbl);
SharedPtr<Machina::Machine> machine = file_driver->learn(dialog.get_filename(), 0.0, length);
-
+
if (machine) {
dialog.hide();
machine->activate();
@@ -552,7 +552,7 @@ MachinaGUI::menu_import_midi()
Gtk::MessageDialog msg_dialog(dialog, "Error loading MIDI file",
false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
msg_dialog.run();
- }
+ }
}
}
@@ -564,7 +564,7 @@ MachinaGUI::menu_export_midi()
Gtk::FILE_CHOOSER_ACTION_SAVE);
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
-
+
Gtk::FileFilter filt;
filt.add_pattern("*.mid");
filt.set_name("MIDI Files");
@@ -616,7 +616,7 @@ void
MachinaGUI::show_labels_toggled()
{
const bool show = _menu_view_labels->get_active();
-
+
for (ItemList::iterator i = _canvas->items().begin(); i != _canvas->items().end(); ++i) {
const SharedPtr<NodeView> nv = PtrCast<NodeView>(*i);
if (nv)
@@ -633,7 +633,7 @@ MachinaGUI::show_labels_toggled()
void
-MachinaGUI::menu_help_about()
+MachinaGUI::menu_help_about()
{
_about_window->set_transient_for(*_main_window);
_about_window->show();
@@ -641,7 +641,7 @@ MachinaGUI::menu_help_about()
void
-MachinaGUI::menu_help_help()
+MachinaGUI::menu_help_help()
{
_help_dialog->set_transient_for(*_main_window);
_help_dialog->run();
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index b923d57..ef0a836 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -38,11 +38,11 @@ public:
boost::shared_ptr<MachinaCanvas> canvas() { return _canvas; }
boost::shared_ptr<Machina::Engine> engine() { return _engine; }
-
+
SharedPtr<Raul::Maid> maid() { return _maid; }
-
+
Gtk::Window* window() { return _main_window; }
-
+
void attach();
void quit() { _main_window->hide(); }
@@ -90,7 +90,7 @@ protected:
string _save_uri;
string _target_filename;
-
+
Raul::TimeUnit _unit;
boost::shared_ptr<MachinaCanvas> _canvas;
@@ -100,7 +100,7 @@ protected:
SharedPtr<Machina::Evolver> _evolver;
Gtk::Main* _gtk_main;
-
+
Gtk::Window* _main_window;
Gtk::Dialog* _help_dialog;
Gtk::AboutDialog* _about_window;
diff --git a/src/gui/NodePropertiesWindow.cpp b/src/gui/NodePropertiesWindow.cpp
index d74d4b5..bbb7244 100644
--- a/src/gui/NodePropertiesWindow.cpp
+++ b/src/gui/NodePropertiesWindow.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -70,7 +70,7 @@ NodePropertiesWindow::apply_clicked()
_node->set_changed();
}
-
+
void
NodePropertiesWindow::cancel_clicked()
{
@@ -79,7 +79,7 @@ NodePropertiesWindow::cancel_clicked()
_instance = NULL;
}
-
+
void
NodePropertiesWindow::ok_clicked()
{
@@ -114,7 +114,7 @@ NodePropertiesWindow::present(Gtk::Window* parent, SharedPtr<Machina::Node> node
Glib::RefPtr<Gnome::Glade::Xml> xml = GladeXml::create();
xml->get_widget_derived("node_properties_dialog", _instance);
-
+
if (parent)
_instance->set_transient_for(*parent);
}
diff --git a/src/gui/NodePropertiesWindow.hpp b/src/gui/NodePropertiesWindow.hpp
index 51ab42b..c86314f 100644
--- a/src/gui/NodePropertiesWindow.hpp
+++ b/src/gui/NodePropertiesWindow.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -37,7 +37,7 @@ private:
void apply_clicked();
void cancel_clicked();
void ok_clicked();
-
+
static NodePropertiesWindow* _instance;
SharedPtr<Machina::Node> _node;
diff --git a/src/gui/NodeView.cpp b/src/gui/NodeView.cpp
index 67516fb..c05cb5b 100644
--- a/src/gui/NodeView.cpp
+++ b/src/gui/NodeView.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -94,7 +94,7 @@ static ArtVpathDash* selector_dash()
selector_dash->n_dash = 2;
selector_dash->dash = art_new(double, 2);
selector_dash->dash[0] = 8;
- selector_dash->dash[1] = 8;
+ selector_dash->dash[1] = 8;
}
return selector_dash;
@@ -114,7 +114,7 @@ NodeView::update_state(bool show_labels)
{
static const uint32_t active_color = 0x408040FF;
static const uint32_t active_border_color = 0x00FF00FF;
-
+
if (_node->is_active()) {
if (_color != active_color) {
_old_color = _color;
@@ -125,9 +125,9 @@ NodeView::update_state(bool show_labels)
set_base_color(_old_color);
set_border_color(_default_border_color);
}
-
+
_ellipse.property_dash() = _node->is_selector() ? selector_dash() : 0;
-
+
set_border_width(_node->is_initial() ? 4.0 : 1.0);
if (show_labels)
diff --git a/src/gui/NodeView.hpp b/src/gui/NodeView.hpp
index 80f8968..6eba522 100644
--- a/src/gui/NodeView.hpp
+++ b/src/gui/NodeView.hpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -32,7 +32,7 @@ public:
double y);
SharedPtr<Machina::Node> node() { return _node; }
-
+
void show_label(bool show);
void update_state(bool show_labels);
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index e079eec..9862989 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
diff --git a/src/machina.cpp b/src/machina.cpp
index 62b502f..444c1af 100644
--- a/src/machina.cpp
+++ b/src/machina.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -56,10 +56,10 @@ main(int argc, char** argv)
cout << "Usage: " << argv[0] << " FILE" << endl;
return -1;
}
-
+
if ( ! Glib::thread_supported())
Glib::thread_init();
-
+
SharedPtr<JackDriver> driver(new JackDriver());
Redland::World rdf_world;
@@ -73,7 +73,7 @@ main(int argc, char** argv)
free(uri);
*/
engine.load_machine(argv[1]);
-
+
driver->attach("machina");
signal(SIGINT, catch_int);
@@ -81,7 +81,7 @@ main(int argc, char** argv)
while (!quit)
sleep(1);
-
+
driver->detach();
return 0;
diff --git a/src/midi2machina.cpp b/src/midi2machina.cpp
index 06a0554..f0b98a2 100644
--- a/src/midi2machina.cpp
+++ b/src/midi2machina.cpp
@@ -1,15 +1,15 @@
/* This file is part of Machina.
* Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
+ *
* Machina 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.
- *
+ *
* Machina 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 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.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
@@ -62,7 +62,7 @@ main(int argc, char** argv)
cout << "Failed to load MIDI file." << endl;
return -1;
}
-
+
/*
string out_filename = argv[1];
if (out_filename.find_last_of("/") != string::npos)
@@ -80,7 +80,7 @@ main(int argc, char** argv)
Redland::Model model(world);
machine->write_state(model);
model.serialise_to_file_handle(stdout);
-
+
return 0;
}