Tempo Tapper  1.0.0
A simple library to implement a tempo tapper
tempo_tapper_cpp.cxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 Patrick Pedersen
3 
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13 
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <https://www.gnu.org/licenses/>.
16  *
17  */
18 
30 #include <stdlib.h>
31 
32 #include <tempo_tapper_cpp.h>
33 
35 {
36  _tt = tt_new();
37 }
38 
39 tempo_tapper_cpp::~tempo_tapper_cpp()
40 {
41  free(_tt);
42 }
43 
45 {
46  return _tt != NULL;
47 }
48 
50 {
51  return tt_period_us(_tt);
52 }
53 
55 {
56  tt_tap(_tt);
57 }
58 
60 {
61  tt_reset(_tt);
62 }
63 
65 {
66  return tt_bpm(_tt);
67 }
tempo_tapper_cpp.h
C++ wrapper for the tempo tapper library.
tt_tap
void tt_tap(tempo_tapper *tapper)
"Taps" the tempo tapper
Definition: tempo_tapper_common.cxx:46
tempo_tapper_cpp::bpm
BPM_t bpm()
Wraps around tt_bpm()
Definition: tempo_tapper_cpp.cxx:64
tempo_tapper_cpp::reset
void reset()
Wraps around tt_reset()
Definition: tempo_tapper_cpp.cxx:59
tempo_tapper_cpp::is_init
bool is_init()
Returns if class has been (successfully) initialized.
Definition: tempo_tapper_cpp.cxx:44
tempo_tapper_cpp::tap
void tap()
Wraps around tt_tap()
Definition: tempo_tapper_cpp.cxx:54
tt_reset
void tt_reset(tempo_tapper *tapper)
Resets the tempo tapper.
Definition: tempo_tapper_common.cxx:83
tempo_tapper_cpp::tempo_tapper_cpp
tempo_tapper_cpp()
Wraps around tt_new()
Definition: tempo_tapper_cpp.cxx:34
tt_new
tempo_tapper * tt_new()
Creates a new tempo tapper instance.
Definition: tempo_tapper_common.cxx:61
tempo_tapper_cpp::period_us
unsigned long period_us()
Wraps around tt_period_us()
Definition: tempo_tapper_cpp.cxx:49
tt_bpm
BPM_t tt_bpm(tempo_tapper *tapper)
Returns the tempo in BPM.
Definition: tempo_tapper_common.cxx:72
tt_period_us
unsigned long tt_period_us(tempo_tapper *tapper)
Returns the period of a tempo in microseconds.
Definition: tempo_tapper_common.cxx:37