Jamba C++ API
7.5.0
Loading...
Searching...
No Matches
Timer.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018-2019 pongasoft
3
*
4
* Licensed under the Apache License, Version 2.0 or the MIT license,
5
* at your option. You may not use this file except in compliance with
6
* one of these licenses. You may obtain copies of the licenses at:
7
*
8
* https://www.apache.org/licenses/LICENSE-2.0
9
* https://opensource.org/licenses/MIT
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
* License for the specific language governing permissions and limitations under
15
* the License.
16
*
17
* @author Yan Pujante
18
*/
19
20
#pragma once
21
22
#include <base/source/timer.h>
23
#include <memory>
24
25
namespace
pongasoft::VST
{
26
30
class
AutoReleaseTimer
31
{
32
public
:
33
// Constructor
34
explicit
AutoReleaseTimer
(Steinberg::Timer *iTimer) :
fTimer
{iTimer} {}
35
36
// Destructor => auto release
37
~AutoReleaseTimer
()
38
{
39
stop
();
40
41
if
(
fTimer
)
42
fTimer
->release();
43
}
44
45
// stops the timer
46
inline
void
stop
()
47
{
48
if
(
fTimer
)
49
fTimer
->stop();
50
}
51
55
static
std::unique_ptr<AutoReleaseTimer>
create
(Steinberg::ITimerCallback* iCallback,
56
Steinberg::uint32 iIntervalMilliseconds)
57
{
58
return
std::make_unique<AutoReleaseTimer>(Steinberg::Timer::create(iCallback, iIntervalMilliseconds));
59
}
60
61
// disabling copy
62
AutoReleaseTimer
(
AutoReleaseTimer
const
&) =
delete
;
63
AutoReleaseTimer
&
operator=
(
AutoReleaseTimer
const
&) =
delete
;
64
65
private
:
66
Steinberg::Timer *
fTimer
;
67
};
68
69
}
pongasoft::VST::AutoReleaseTimer::~AutoReleaseTimer
~AutoReleaseTimer()
Definition
Timer.h:37
pongasoft::VST::AutoReleaseTimer::create
static std::unique_ptr< AutoReleaseTimer > create(Steinberg::ITimerCallback *iCallback, Steinberg::uint32 iIntervalMilliseconds)
Creates and return an auto release timer.
Definition
Timer.h:55
pongasoft::VST::AutoReleaseTimer::AutoReleaseTimer
AutoReleaseTimer(AutoReleaseTimer const &)=delete
pongasoft::VST::AutoReleaseTimer::stop
void stop()
Definition
Timer.h:46
pongasoft::VST::AutoReleaseTimer::operator=
AutoReleaseTimer & operator=(AutoReleaseTimer const &)=delete
pongasoft::VST::AutoReleaseTimer::fTimer
Steinberg::Timer * fTimer
Definition
Timer.h:66
pongasoft::VST::AutoReleaseTimer::AutoReleaseTimer
AutoReleaseTimer(Steinberg::Timer *iTimer)
Definition
Timer.h:34
pongasoft::VST
Definition
Clock.h:24
pongasoft
VST
Timer.h
Generated by
1.16.1