Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
calculationadapter.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2015 Haye Hinrichsen, Christoph Wick
3  *
4  * This file is part of Entropy Piano Tuner.
5  *
6  * Entropy Piano Tuner is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * Entropy Piano Tuner is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * Entropy Piano Tuner. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 //=============================================================================
21 // Calculation adapter
22 //=============================================================================
23 
24 #include "calculationadapter.h"
25 
26 #include "../core.h"
27 #include "../settings.h"
28 
29 //-----------------------------------------------------------------------------
30 // Constructor
31 //-----------------------------------------------------------------------------
32 
37 
39  : mCore(core)
40 {
41 }
42 
43 
44 //-----------------------------------------------------------------------------
45 // start calccuation
46 //-----------------------------------------------------------------------------
47 
52 
53 void CalculationAdapter::startCalculation(const std::string &algorithmName)
54 {
57  calculator->start (algorithmName, piano);
58 
60 }
61 
62 
63 //-----------------------------------------------------------------------------
64 // Stop calccuation
65 //-----------------------------------------------------------------------------
66 
71 
73 {
75 }
76 
77 
78 //-----------------------------------------------------------------------------
79 // Get a list of available algorithms
80 //-----------------------------------------------------------------------------
81 
86 
87 std::vector<std::string> CalculationAdapter::getAvailableAlgorithms() const
88 {
89  std::vector<std::string> out;
90  for (auto src : CalculationManager::getSingleton().getAlgorithms())
91  out.push_back(src.first);
92  return out;
93 }
PianoManager * getPianoManager()
Definition: core.h:67
virtual void startCalculation(const std::string &algorithmName)
Function called by the GUI to start the calculation of the tuning curve.
static CalculationManager & getSingleton()
Core * mCore
Private pointer to the core.
Calculation-Manager.
static Settings & getSingleton()
Get a pointer to the singleton instance.
Definition: settings.cpp:46
Definition: piano.h:40
Piano & getPiano()
Definition: pianomanager.h:45
void start(const std::string &algorithmName, const Piano &piano)
Start the calculation thread. By calling this function, the current piano is passed by reference and ...
virtual void setLastUsedAlgorithm(const std::string &name)
Set the name of the last used algorithm.
Definition: settings.h:59
void stop()
Stop the calculation thread.
CORE : Class managing the core.
Definition: core.h:45
virtual void cancelCalculation()
Function called by the GUI to interrupt or stop the calculation thread.
CalculationAdapter(Core *core)
Constructor, copies a pointer pointing to the core.
std::vector< std::string > getAvailableAlgorithms() const
Get a list of available tuning algorithms.