1 /* 2 * Hydrogen 3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net] 4 * 5 * http://www.hydrogen-music.org 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 2 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY, without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * 21 */ 22 23 #ifndef SAMPLEEDITOR_H 24 #define SAMPLEEDITOR_H 25 26 #include "ui_SampleEditor_UI.h" 27 #include "../InstrumentEditor/InstrumentEditor.h" 28 29 #include <QDialog> 30 #include <hydrogen/object.h> 31 #include <hydrogen/Preferences.h> 32 #include <hydrogen/basics/song.h> 33 #include <hydrogen/basics/sample.h> 34 #include <hydrogen/basics/instrument.h> 35 36 37 class Button; 38 class MainSampleWaveDisplay; 39 class TargetWaveDisplay; 40 class DetailWaveDisplay; 41 42 /// 43 /// This dialog is used to preview audiofiles 44 /// 45 class SampleEditor : public QDialog, public Ui_SampleEditor_UI, public H2Core::Object 46 { 47 H2_OBJECT 48 Q_OBJECT 49 public: 50 51 SampleEditor( QWidget* pParent, int nSelectedComponent, int nSelectedLayer, QString nSampleFilename ); 52 ~SampleEditor(); 53 54 void setSampleName( QString name); 55 bool getCloseQuestion(); 56 bool m_pSampleEditorStatus; 57 bool returnAllMainWaveDisplayValues(); 58 void returnAllTargetDisplayValues(); 59 void setTrue(); 60 61 //this values come from the real sample to restore a frm song loaded sample 62 bool m_sample_is_modified; ///< true if sample is modified 63 64 private slots: 65 void valueChangedLoopCountSpinBox( int ); 66 void valueChangedProcessingTypeComboBox( const QString ); 67 void valueChangedrubberComboBox( const QString ); 68 void valueChangedrubberbandCsettingscomboBox( const QString ); 69 void valueChangedpitchdoubleSpinBox( double ); 70 void on_ClosePushButton_clicked(); 71 void on_PrevChangesPushButton_clicked(); 72 void valueChangedStartFrameSpinBox( int ); 73 void valueChangedLoopFrameSpinBox( int ); 74 void valueChangedEndFrameSpinBox( int ); 75 void on_PlayPushButton_clicked(); 76 void on_PlayOrigPushButton_clicked(); 77 void on_verticalzoomSlider_valueChanged ( int value ); 78 void updateMainsamplePositionRuler(); 79 void updateTargetsamplePositionRuler(); 80 81 82 83 private: 84 85 H2Core::Sample *m_pSampleFromFile; 86 int m_pSelectedLayer; 87 int m_pSelectedComponent; 88 QString m_samplename; 89 90 double m_divider; 91 92 void openDisplays(); 93 void getAllFrameInfos(); 94 void getAllLocalFrameInfos(); 95 void setAllSampleProps(); 96 void testPositionsSpinBoxes(); 97 void createNewLayer(); 98 void setSamplelengthFrames(); 99 void createPositionsRulerPath(); 100 void testpTimer(); 101 void closeEvent(QCloseEvent *event); 102 void checkRatioSettings(); 103 104 virtual void mouseReleaseEvent(QMouseEvent *ev); 105 106 MainSampleWaveDisplay *m_pMainSampleWaveDisplay; 107 TargetWaveDisplay *m_pTargetSampleView; 108 DetailWaveDisplay *m_pSampleAdjustView; 109 110 float m_pZoomfactor; 111 unsigned m_pDetailFrame; 112 QString m_pLineColor; 113 bool m_pOnewayStart; 114 bool m_pOnewayLoop; 115 bool m_pOnewayEnd; 116 unsigned long m_pRealtimeFrameEnd; 117 unsigned long m_prealtimeframeendfortarget; 118 unsigned m_pslframes; 119 unsigned m_pSamplerate; 120 QTimer *m_pTimer; 121 QTimer *m_pTargetDisplayTimer; 122 unsigned *m_pPositionsRulerPath; 123 bool m_pPlayButton; 124 float m_pRatio; 125 H2Core::Sample::Loops __loops; 126 H2Core::Sample::Rubberband __rubberband; 127 128 }; 129 130 131 #endif 132