LMMS
Loading...
Searching...
No Matches
Engine.h
Go to the documentation of this file.
1/*
2 * Engine.h - engine-system of LMMS
3 *
4 * Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef LMMS_ENGINE_H
26#define LMMS_ENGINE_H
27
28#include <QString>
29#include <QObject>
30
31#include "lmmsconfig.h"
32#include "lmms_export.h"
33#include "LmmsTypes.h"
34
35namespace lmms
36{
37
38class AudioEngine;
39class Mixer;
40class PatternStore;
41class ProjectJournal;
42class Song;
43class Ladspa2LMMS;
44
45namespace gui
46{
47class GuiApplication;
48}
49
50
51class LMMS_EXPORT Engine : public QObject
52{
53 Q_OBJECT
54public:
55 static void init( bool renderOnly );
56 static void destroy();
57
58 // core
60 {
61 return s_audioEngine;
62 }
63
64 static Mixer * mixer()
65 {
66 return s_mixer;
67 }
68
69 static Song * getSong()
70 {
71 return s_song;
72 }
73
75 {
76 return s_patternStore;
77 }
78
80 {
81 return s_projectJournal;
82 }
83
84#ifdef LMMS_HAVE_LV2
85 static class Lv2Manager * getLv2Manager()
86 {
87 return s_lv2Manager;
88 }
89#endif
90
92 {
93 return s_ladspaManager;
94 }
95
96 static float framesPerTick()
97 {
98 return s_framesPerTick;
99 }
100
101 static float framesPerTick(sample_rate_t sample_rate);
102
103 static void updateFramesPerTick();
104
105 static inline Engine * inst()
106 {
107 if( s_instanceOfMe == nullptr )
108 {
109 s_instanceOfMe = new Engine();
110 }
111 return s_instanceOfMe;
112 }
113
114 static void setDndPluginKey(void* newKey);
115 static void* pickDndPluginKey();
116
117signals:
118 void initProgress(const QString &msg);
119
120
121private:
122 // small helper function which sets the pointer to NULL before actually deleting
123 // the object it refers to
124 template<class T>
125 static inline void deleteHelper(T** ptr)
126 {
127 T* tmp = *ptr;
128 *ptr = nullptr;
129 delete tmp;
130 }
131
132 static float s_framesPerTick;
133
134 // core
136 static Mixer * s_mixer;
137 static Song * s_song;
140
141#ifdef LMMS_HAVE_LV2
143#endif
145 static void* s_dndPluginKey;
146
147 // even though most methods are static, an instance is needed for Qt slots/signals
149
151};
152
153
154} // namespace lmms
155
156#endif // LMMS_ENGINE_H
Definition AudioEngine.h:66
Definition Engine.h:52
static class Lv2Manager * s_lv2Manager
Definition Engine.h:142
static Engine * s_instanceOfMe
Definition Engine.h:148
static Mixer * s_mixer
Definition Engine.h:136
static Ladspa2LMMS * s_ladspaManager
Definition Engine.h:144
static ProjectJournal * s_projectJournal
Definition Engine.h:139
static void destroy()
Definition Engine.cpp:95
static void * s_dndPluginKey
Definition Engine.h:145
void initProgress(const QString &msg)
static float framesPerTick()
Definition Engine.h:96
static void deleteHelper(T **ptr)
Definition Engine.h:125
static AudioEngine * audioEngine()
Definition Engine.h:59
static class Lv2Manager * getLv2Manager()
Definition Engine.h:85
static Ladspa2LMMS * getLADSPAManager()
Definition Engine.h:91
static Song * getSong()
Definition Engine.h:69
static Mixer * mixer()
Definition Engine.h:64
static float s_framesPerTick
Definition Engine.h:132
static PatternStore * patternStore()
Definition Engine.h:74
static AudioEngine * s_audioEngine
Definition Engine.h:135
static Engine * inst()
Definition Engine.h:105
static ProjectJournal * projectJournal()
Definition Engine.h:79
static Song * s_song
Definition Engine.h:137
static PatternStore * s_patternStore
Definition Engine.h:138
Definition Ladspa2LMMS.h:37
Class to keep track of all LV2 plugins.
Definition Lv2Manager.h:82
Definition Mixer.h:139
Definition PatternStore.h:65
Definition ProjectJournal.h:44
Definition Song.h:65
Definition GuiApplication.h:50
const char * msg
Definition missing_descriptor.c:20
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35
std::uint32_t sample_rate_t
Definition LmmsTypes.h:42
ZCONST uch * init
Definition extract.c:2392