annotate src/sc_evaluator.hpp @ 0:add35537fdbb tip

Initial import
author irh <ian.r.hobson@gmail.com>
date Thu, 25 Aug 2011 11:05:55 +0100
parents
children
rev   line source
ian@0 1 // Copyright 2011, Ian Hobson.
ian@0 2 //
ian@0 3 // This file is part of gpsynth.
ian@0 4 //
ian@0 5 // gpsynth is free software: you can redistribute it and/or modify
ian@0 6 // it under the terms of the GNU General Public License as published by
ian@0 7 // the Free Software Foundation, either version 3 of the License, or
ian@0 8 // (at your option) any later version.
ian@0 9 //
ian@0 10 // gpsynth is distributed in the hope that it will be useful,
ian@0 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
ian@0 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ian@0 13 // GNU General Public License for more details.
ian@0 14 //
ian@0 15 // You should have received a copy of the GNU General Public License
ian@0 16 // along with gpsynth in the file COPYING.
ian@0 17 // If not, see http://www.gnu.org/licenses/.
ian@0 18
ian@0 19 // Evaluator for SuperCollider synth graphs. Sends converted synthdefs to
ian@0 20 // SuperCollider for rendering.
ian@0 21
ian@0 22 #pragma once
ian@0 23
ian@0 24 #include "evaluator.hpp"
ian@0 25 #include "file_comparer.hpp"
ian@0 26 #include "sc_grammar.hpp"
ian@0 27
ian@0 28 #include "boost/shared_ptr.hpp"
ian@0 29 #include "boost/thread/barrier.hpp"
ian@0 30 #include "boost/thread/condition_variable.hpp"
ian@0 31 #include "boost/thread/mutex.hpp"
ian@0 32
ian@0 33 #include <queue>
ian@0 34 #include <string>
ian@0 35
ian@0 36 namespace sc {
ian@0 37
ian@0 38 // forward declaration of worker
ian@0 39 class EvaluatorWorker;
ian@0 40 typedef boost::shared_ptr<EvaluatorWorker> EvaluatorWorkerPtr;
ian@0 41
ian@0 42 class Evaluator : public EvaluatorInterface {
ian@0 43 friend class EvaluatorWorker;
ian@0 44 const sc::Grammar& grammar_;
ian@0 45 const std::string sc_app_path_;
ian@0 46 const std::string sc_plugins_path_;
ian@0 47 const std::string sclang_path_;
ian@0 48 const std::string scsynth_path_;
ian@0 49 std::string work_folder_;
ian@0 50 std::string osc_folder_;
ian@0 51 std::string audio_folder_;
ian@0 52 std::string sc_folder_;
ian@0 53 std::string synthdef_folder_;
ian@0 54 std::queue<sg::Graph*> work_queue_;
ian@0 55 boost::mutex work_mutex_;
ian@0 56 boost::condition_variable queue_condition_;
ian@0 57 boost::condition_variable work_done_condition_;
ian@0 58 boost::shared_ptr<boost::barrier> work_done_barrier_;
ian@0 59 std::vector<EvaluatorWorkerPtr> workers_;
ian@0 60 std::size_t graphs_to_rate_;
ian@0 61 EvaluatorListenerInterface* listener_;
ian@0 62 int synth_name_zero_pad_length_;
ian@0 63
ian@0 64 public:
ian@0 65 Evaluator(const sc::Grammar& grammar,
ian@0 66 const std::string& sc_app_path,
ian@0 67 const dsp::FileComparer& target,
ian@0 68 int core_limit = 0);
ian@0 69 ~Evaluator();
ian@0 70 void RateGraphs(std::vector<sg::Graph>& graphs);
ian@0 71 void SetWorkFolder(const std::string& path);
ian@0 72 void SetListener(EvaluatorListenerInterface* listener) {
ian@0 73 listener_ = listener;
ian@0 74 }
ian@0 75 };
ian@0 76
ian@0 77 } // sc namespace