diff options
author | David Robillard <d@drobilla.net> | 2007-12-07 04:24:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-12-07 04:24:45 +0000 |
commit | 63afdfa494aa221eeba8965d233119931c177db8 (patch) | |
tree | e6b84fd8a3119e9fe062ff9895292c63c065a082 /src/engine/Problem.cpp | |
parent | ffb37e6de2934aa227c3483f8a00118e3604b5e5 (diff) | |
download | machina-63afdfa494aa221eeba8965d233119931c177db8.tar.gz machina-63afdfa494aa221eeba8965d233119931c177db8.tar.bz2 machina-63afdfa494aa221eeba8965d233119931c177db8.zip |
Less console output.
git-svn-id: http://svn.drobilla.net/lad/machina@959 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/Problem.cpp')
-rw-r--r-- | src/engine/Problem.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/engine/Problem.cpp b/src/engine/Problem.cpp index 654d0a3..6c6fdd3 100644 --- a/src/engine/Problem.cpp +++ b/src/engine/Problem.cpp @@ -41,6 +41,7 @@ Problem::Problem(const std::string& target_midi, SharedPtr<Machine> seed) uint32_t ev_size; uint32_t delta_time; while (smf.read_event(4, buf, &ev_size, &delta_time) >= 0) { + _target._length += delta_time / (double)smf.ppqn(); if ((buf[0] & 0xF0) == MIDI_CMD_NOTE_ON) { const uint8_t note = buf[1]; ++_target._note_frequency[note]; @@ -48,6 +49,8 @@ Problem::Problem(const std::string& target_midi, SharedPtr<Machine> seed) } } + cout << "Target length: " << _target._length << endl; + _target.compute(); } @@ -55,6 +58,8 @@ Problem::Problem(const std::string& target_midi, SharedPtr<Machine> seed) float Problem::fitness(const Machine& const_machine) const { + //cout << "f"; + // kluuudge Machine& machine = const_cast<Machine&>(const_machine); @@ -72,9 +77,11 @@ Problem::fitness(const Machine& const_machine) const time.set_start(0); time.set_length(2*ppqn); - while (time.start_ticks() < _target._n_notes * ppqn) { + while (eval->_n_notes < _target._n_notes) { machine.run(time); time.set_start(time.start_ticks() + 2*ppqn); + if (time.start_beats() >= _target._length) + break; } eval->compute(); |