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
prerequisites.h
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 #ifndef PREREQUISITES
21 #define PREREQUISITES
22 
23 // additional defines for windows (msvc)
24 #if defined(_WIN32) || defined(_WIN64)
25 #include <iso646.h>
26 using uint = unsigned int;
27 #endif
28 
29 // define snprintf for windows
30 #ifdef _MSC_VER
31 
32 #include <stdarg.h>
33 #include <stdio.h>
34 
35 #define snprintf c99_snprintf
36 
37 inline int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
38 {
39  int count = -1;
40 
41  if (size != 0)
42  count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
43  if (count == -1)
44  count = _vscprintf(format, ap);
45 
46  return count;
47 }
48 
49 inline int c99_snprintf(char* str, size_t size, const char* format, ...)
50 {
51  int count;
52  va_list ap;
53 
54  va_start(ap, format);
55  count = c99_vsnprintf(str, size, format, ap);
56  va_end(ap);
57 
58  return count;
59 }
60 
61 #endif // _MSC_VER
62 
63 
64 #include <stdlib.h>
65 
67 {
68  MODE_IDLE = 0,
72 
74 };
75 
76 inline int toFlag(OperationMode mode)
77 {
78  return 1 << mode;
79 }
80 
81 #endif // PREREQUISITES
82 
OperationMode
Operation mode of the tuner.
Definition: prerequisites.h:66
Mode where the entropy optimization is carried out.
Definition: prerequisites.h:70
Mode for recording the piano keys.
Definition: prerequisites.h:69
The count of modes.
Definition: prerequisites.h:73
int toFlag(OperationMode mode)
Definition: prerequisites.h:76
Mode for manually tuning the piano.
Definition: prerequisites.h:71
Do nothing.
Definition: prerequisites.h:68