LMMS
Loading...
Searching...
No Matches
DummyInstrument.h
Go to the documentation of this file.
1/*
2 * DummyInstrument.h - instrument used as fallback if an instrument couldn't
3 * be loaded
4 *
5 * Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_DUMMY_INSTRUMENT_H
27#define LMMS_DUMMY_INSTRUMENT_H
28
29#include "Instrument.h"
30#include "InstrumentView.h"
31#include "Engine.h"
32
33#include <cstring>
34
35#include "AudioEngine.h"
36
37
38namespace lmms
39{
40
41
43{
44public:
45 DummyInstrument( InstrumentTrack * _instrument_track ) :
46 Instrument( _instrument_track, nullptr )
47 {
48 }
49
50 ~DummyInstrument() override = default;
51
52 void playNote( NotePlayHandle*, SampleFrame* buffer ) override
53 {
54 zeroSampleFrames(buffer, Engine::audioEngine()->framesPerPeriod());
55 }
56
57 void saveSettings( QDomDocument &, QDomElement & ) override
58 {
59 }
60
61 void loadSettings( const QDomElement & ) override
62 {
63 }
64
65 QString nodeName() const override
66 {
67 return "dummyinstrument";
68 }
69
70 gui::PluginView * instantiateView( QWidget * _parent ) override
71 {
72 return new gui::InstrumentViewFixedSize( this, _parent );
73 }
74} ;
75
76
77} // namespace lmms
78
79#endif // LMMS_DUMMY_INSTRUMENT_H
#define nullptr
Definition DistrhoDefines.h:75
void saveSettings(QDomDocument &, QDomElement &) override
Definition DummyInstrument.h:57
void loadSettings(const QDomElement &) override
Definition DummyInstrument.h:61
~DummyInstrument() override=default
gui::PluginView * instantiateView(QWidget *_parent) override
Create a view for the model.
Definition DummyInstrument.h:70
QString nodeName() const override
Definition DummyInstrument.h:65
void playNote(NotePlayHandle *, SampleFrame *buffer) override
Definition DummyInstrument.h:52
DummyInstrument(InstrumentTrack *_instrument_track)
Definition DummyInstrument.h:45
static AudioEngine * audioEngine()
Definition Engine.h:59
Instrument(InstrumentTrack *_instrument_track, const Descriptor *_descriptor, const Descriptor::SubPluginFeatures::Key *key=nullptr, Flags flags=Flag::NoFlags)
Definition Instrument.cpp:38
Definition InstrumentTrack.h:62
Definition NotePlayHandle.h:48
Definition SampleFrame.h:41
Instrument view with fixed LMMS-default size.
Definition InstrumentView.h:66
Definition PluginView.h:36
Definition AudioAlsa.cpp:35
void zeroSampleFrames(SampleFrame *buffer, size_t frames)
Definition SampleFrame.h:192