LMMS
Loading...
Searching...
No Matches
Patman.h
Go to the documentation of this file.
1/*
2 * Patman.h - header for a GUS-compatible patch instrument plugin
3 *
4 * Copyright (c) 2007-2008 Javier Serrano Polo <jasp00/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
26#ifndef PATMAN_H
27#define PATMAN_H
28
29#include "Instrument.h"
30#include "InstrumentView.h"
31#include "Sample.h"
32#include "AutomatableModel.h"
33
34namespace lmms
35{
36
37namespace gui
38{
39class PixmapButton;
40class PatmanView;
41} // namespace gui
42
43
44#define MODES_16BIT ( 1 << 0 )
45#define MODES_UNSIGNED ( 1 << 1 )
46#define MODES_LOOPING ( 1 << 2 )
47#define MODES_PINGPONG ( 1 << 3 )
48#define MODES_REVERSE ( 1 << 4 )
49#define MODES_SUSTAIN ( 1 << 5 )
50#define MODES_ENVELOPE ( 1 << 6 )
51#define MODES_CLAMPED ( 1 << 7 )
52
53
55{
56 Q_OBJECT
57public:
59 ~PatmanInstrument() override;
60
61 void playNote( NotePlayHandle * _n,
62 SampleFrame* _working_buffer ) override;
63 void deleteNotePluginData( NotePlayHandle * _n ) override;
64
65
66 void saveSettings( QDomDocument & _doc, QDomElement & _parent ) override;
67 void loadSettings( const QDomElement & _this ) override;
68
69 void loadFile( const QString & _file ) override;
70
71 QString nodeName() const override;
72
73 float desiredReleaseTimeMs() const override
74 {
75 return 3.f;
76 }
77
78 gui::PluginView* instantiateView( QWidget * _parent ) override;
79
80
81public slots:
82 void setFile( const QString & _patch_file, bool _rename = true );
83
84
85private:
87 {
89 bool tuned;
90 std::shared_ptr<Sample> sample;
91 };
92
93 QString m_patchFile;
94 QVector<std::shared_ptr<Sample>> m_patchSamples;
97
98
108
109 LoadError loadPatch( const QString & _filename );
110 void unloadCurrentPatch();
111
112 void selectSample( NotePlayHandle * _n );
113
114
115 friend class gui::PatmanView;
116
117signals:
119
120} ;
121
122
123namespace gui
124{
125
126
128{
129 Q_OBJECT
130public:
131 PatmanView( Instrument * _instrument, QWidget * _parent );
132 ~PatmanView() override = default;
133
134
135public slots:
136 void openFile();
137 void updateFilename();
138
139
140protected:
141 void dragEnterEvent( QDragEnterEvent * _dee ) override;
142 void dropEvent( QDropEvent * _de ) override;
143 void paintEvent( QPaintEvent * ) override;
144
145
146private:
147 void modelChanged() override;
148
151
155
156} ;
157
158
159} // namespace gui
160
161} // namespace lmms
162
163#endif // PATMAN_H
Definition AutomatableModel.h:497
Definition Instrument.h:52
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 Patman.h:55
BoolModel m_tunedModel
Definition Patman.h:96
gui::PluginView * instantiateView(QWidget *_parent) override
Create a view for the model.
Definition Patman.cpp:418
void saveSettings(QDomDocument &_doc, QDomElement &_parent) override
Definition Patman.cpp:100
void setFile(const QString &_patch_file, bool _rename=true)
Definition Patman.cpp:180
void deleteNotePluginData(NotePlayHandle *_n) override
Definition Patman.cpp:170
QString nodeName() const override
Definition Patman.cpp:128
QString m_patchFile
Definition Patman.h:93
void loadFile(const QString &_file) override
Definition Patman.cpp:120
~PatmanInstrument() override
Definition Patman.cpp:92
void playNote(NotePlayHandle *_n, SampleFrame *_working_buffer) override
Definition Patman.cpp:136
void unloadCurrentPatch()
Definition Patman.cpp:376
QVector< std::shared_ptr< Sample > > m_patchSamples
Definition Patman.h:94
BoolModel m_loopedModel
Definition Patman.h:95
float desiredReleaseTimeMs() const override
Definition Patman.h:73
LoadError loadPatch(const QString &_filename)
Definition Patman.cpp:213
PatmanInstrument(InstrumentTrack *_track)
Definition Patman.cpp:82
void selectSample(NotePlayHandle *_n)
Definition Patman.cpp:387
LoadError
Definition Patman.h:100
@ NotGUS
Definition Patman.h:103
@ Layers
Definition Patman.h:105
@ Open
Definition Patman.h:102
@ IO
Definition Patman.h:106
@ Instruments
Definition Patman.h:104
@ OK
Definition Patman.h:101
void loadSettings(const QDomElement &_this) override
Definition Patman.cpp:110
Definition Sample.h:47
Definition SampleFrame.h:41
Instrument view with fixed LMMS-default size.
Definition InstrumentView.h:66
Definition Patman.h:128
PatmanInstrument * m_pi
Definition Patman.h:149
PixmapButton * m_tuneButton
Definition Patman.h:154
~PatmanView() override=default
QString m_displayFilename
Definition Patman.h:150
PixmapButton * m_loopButton
Definition Patman.h:153
void paintEvent(QPaintEvent *) override
Definition Patman.cpp:614
void modelChanged() override
Definition Patman.cpp:627
PixmapButton * m_openFileButton
Definition Patman.h:152
PatmanView(Instrument *_instrument, QWidget *_parent)
Definition Patman.cpp:432
void dropEvent(QDropEvent *_de) override
Definition Patman.cpp:597
void dragEnterEvent(QDragEnterEvent *_dee) override
Definition Patman.cpp:570
void openFile()
Definition Patman.cpp:491
void updateFilename()
Definition Patman.cpp:543
Definition PixmapButton.h:37
Definition PluginView.h:36
Definition AudioPortAudio.cpp:223
Definition AudioAlsa.cpp:35
std::shared_ptr< Sample > sample
Definition Patman.h:90
Sample::PlaybackState * state
Definition Patman.h:88
bool tuned
Definition Patman.h:89