1 /*
2  *  tracker/SectionHDRecorder.h
3  *
4  *  Copyright 2009 Peter Barth
5  *
6  *  This file is part of Milkytracker.
7  *
8  *  Milkytracker is free software: you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation, either version 3 of the License, or
11  *  (at your option) any later version.
12  *
13  *  Milkytracker 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
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with Milkytracker.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 /*
24  *  SectionHDRecorder.h
25  *  MilkyTracker
26  *
27  *  Created by Peter Barth on 26.10.05.
28  *
29  */
30 
31 #ifndef SECTIONHDRECORDER__H
32 #define SECTIONHDRECORDER__H
33 
34 #include "BasicTypes.h"
35 #include "Event.h"
36 #include "SectionUpperLeft.h"
37 
38 class PPControl;
39 class Tracker;
40 class PPCheckBox;
41 
42 class SectionHDRecorder : public SectionUpperLeft
43 {
44 private:
45 	enum RecorderModes
46 	{
47 		RecorderModeToFile,
48 		RecorderModeToSample
49 	};
50 
51 	RecorderModes recorderMode;
52 	pp_int32 fromOrder;
53 	pp_int32 toOrder;
54 	pp_int32 mixerVolume;
55 	pp_uint32 resampler;
56 
57 	pp_int32 insIndex;
58 	pp_int32 smpIndex;
59 
60 	PPSystemString currentFileName;
61 
62 	bool getSettingsRamping();
63 	void setSettingsRamping(bool b);
64 
65 	pp_uint32 getSettingsResampler();
66 	void setSettingsResampler(pp_uint32 resampler);
67 
68 	bool getSettingsAllowMuting();
69 	void setSettingsAllowMuting(bool b);
70 
71 	pp_int32 getSettingsFrequency();
72 	void setSettingsFrequency(pp_int32 freq);
73 
getSettingsMixerVolume()74 	pp_int32 getSettingsMixerVolume() { return mixerVolume; }
setSettingsMixerVolume(pp_int32 vol)75 	void setSettingsMixerVolume(pp_int32 vol) { mixerVolume = vol; }
76 
77 	pp_int32 getSettingsMixerShift();
78 	void setSettingsMixerShift(pp_int32 shift);
79 
80 	void validate();
81 
82 public:
83 	SectionHDRecorder(Tracker& tracker);
84 	virtual ~SectionHDRecorder();
85 
86 	// Derived from SectionAbstract
87 	virtual pp_int32 handleEvent(PPObject* sender, PPEvent* event);
88 
init()89 	virtual void init() { SectionUpperLeft::init(); }
90 	virtual void init(pp_int32 x, pp_int32 y);
91 	virtual void show(bool bShow);
92 	virtual void update(bool repaint = true);
93 
94 	virtual void notifyInstrumentSelect(pp_int32 index);
95 	virtual void notifySampleSelect(pp_int32 index);
96 
97 	void exportWAVAs(const PPSystemString& fileName);
98 	void exportWAVWithPanel(const PPSystemString& defaultFileName);
99 	void exportWAVAsFileName(const PPSystemString& fileName);
100 
101 	void exportWAVAsSample();
102 
103 	void getPeakLevel();
104 
105 	void resetCurrentFileName();
106 	void setCurrentFileName(const PPSystemString& fileName);
107 
108 	void adjustOrders();
109 
selectFileOutput()110 	void selectFileOutput() { recorderMode = RecorderModeToFile; }
selectSampleOutput()111 	void selectSampleOutput() { recorderMode = RecorderModeToSample; }
112 
113 private:
114 	// Message box with list of resampler
115 	void showResamplerMessageBox();
116 
117 	void storeResampler(pp_uint32 resampler);
118 
119 	// Responder should be friend
120 	friend class DialogResponderHDRec;
121 
122 	friend class Tracker;
123 };
124 
125 #endif
126