1 /*************************************************************************** 2 ** ** 3 ** Polyphone, a soundfont editor ** 4 ** Copyright (C) 2013-2020 Davy Triponney ** 5 ** ** 6 ** This program is free software: you can redistribute it and/or modify ** 7 ** it under the terms of the GNU General Public License as published by ** 8 ** the Free Software Foundation, either version 3 of the License, or ** 9 ** (at your option) any later version. ** 10 ** ** 11 ** This program is distributed in the hope that it will be useful, ** 12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** 13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** 14 ** GNU General Public License for more details. ** 15 ** ** 16 ** You should have received a copy of the GNU General Public License ** 17 ** along with this program. If not, see http://www.gnu.org/licenses/. ** 18 ** ** 19 **************************************************************************** 20 ** Author: Davy Triponney ** 21 ** Website/Contact: https://www.polyphone-soundfonts.com ** 22 ** Date: 01.01.2013 ** 23 ***************************************************************************/ 24 25 #ifndef PAGE_SMPL_H 26 #define PAGE_SMPL_H 27 28 #include <QWidget> 29 #include "page.h" 30 31 namespace Ui 32 { 33 class PageSmpl; 34 } 35 36 class PageSmpl : public Page 37 { 38 Q_OBJECT 39 40 public: 41 explicit PageSmpl(QWidget * parent = nullptr); 42 ~PageSmpl() override; 43 44 void getPeakFrequencies(EltID id, QList<double> &frequencies, QList<double> &factors, QList<int> &keys, QList<int> &corrections); 45 static EltID getRepercussionID(EltID id); 46 47 public slots: 48 // When the key "space" is pressed in the tree 49 void onSampleOnOff(); 50 51 protected: 52 // Update the interface 53 bool updateInterface(QString editingSource, IdList selectedIds, int displayOption) override; 54 55 // Refresh things after a page is shown 56 void onShow() override; 57 58 // Reaction when a key is played 59 void keyPlayedInternal(int key, int velocity) override; 60 61 private slots: 62 void lecture(); 63 void lecteurFinished(int token); 64 void setStartLoop(); 65 void setStartLoop(int val); 66 void setEndLoop(); 67 void setEndLoop(int val); 68 void on_pushFullLength_clicked(); 69 void setRootKey(); 70 void setRootKey(int val); 71 void setTune(); 72 void setTune(int val); 73 void setType(int index); 74 void setLinkedSmpl(int index); 75 void setRate(int index); 76 void setSinusEnabled(bool val); 77 void setGainSample(int val); 78 void setStereo(bool val); 79 void on_pushAutoTune_clicked(); 80 void onLinkClicked(EltID id); 81 void onCutOrdered(int start, int end); 82 bool cutSample(EltID id, quint32 start, quint32 end); 83 void on_checkLectureBoucle_clicked(bool checked); 84 85 private: 86 Ui::PageSmpl *ui; 87 int _currentPlayingToken; 88 89 void updatePlayButton(); 90 void setRateElt(EltID id, quint32 echFinal); 91 void autoTune(EltID id, int &pitch, int &correction); 92 void updateSinus(); 93 }; 94 95 #endif // PAGE_SMPL_H 96