1 #ifndef ADM_qtScript_AudioOutput
2 #define ADM_qtScript_AudioOutput
3 
4 #include "QtScriptObject.h"
5 #include "AudioEncoder.h"
6 
7 namespace ADM_qtScript
8 {
9     class AdmScriptMapper;
10 
11 	/** \brief The AudioOutput %class provides an interface for configuring the output of an audio track.
12 	 */
13 	class AudioOutput : public QtScriptObject
14 	{
15 		Q_OBJECT
16 		Q_ENUMS(AudioInputType GainMode MixerMode StretchAudioMode)
17 
18 	public:
19 		/** \brief Specifies the type of audio track that will be encoded
20 		 */
21 		enum AudioInputType
22 		{
23 			SourceVideo = 1, /**< An audio track from the currently open video will be encoded */
24 			ExternalFile = 2, /**< An external audio file will be encoded */
25 		};
26 
27 		/** \brief Gain mode
28 		 */
29 		enum GainMode
30 		{
31 			NoGain = 0, /**< No gain */
32 			AutomaticGain = 1, /**< Automatic gain (maximum -3dB) */
33 			ManualGain = 2 /**< Manual gain */
34 		};
35 
36 		/** \brief Specifies the audio mixing mode
37 		 */
38 		enum MixerMode
39 		{
40 			OriginalMix = 0, /**< No remixing of audio */
41 			MonoMix = 1, /**< Mono mix */
42 			StereoMix = 2, /**< Stereo mix */
43 			TwoFrontOneRearMix = 3, /**< Stereo front and rear-centre mix */
44 			TwoFrontTwoRearMix = 4, /**< Stereo front and stereo rear mix */
45 			ThreeFrontMix = 5, /**< Stereo front and centre mix */
46 			ThreeFrontOneRearMix = 6, /**< Stereo front, centre and rear-centre mix */
47 			ThreeFrontTwoRearMix = 7, /**< 5.0 channel mix */
48 			ThreeFrontTwoRearLfeMix = 8, /**< 5.1 channel mix */
49 			DolbyProLogicMix = 9, /**< Dolby Pro Logic mix */
50 			DolbyProLogicIIMix = 10 /**< Doly Pro Logic II mix */
51 		};
52 
53 		/** \brief Specifies the mode for stretching audio
54 		 */
55 		enum StretchAudioMode
56 		{
57 			NoStretch = 0, /**< No audio stretching */
58 			FilmToPal = 1, /**< Shrinks audio from a 25fps video to 23.976fps */
59 			PalToFilm = 2 /**< Stretches audio from a 23.976fps video to 25fps */
60 		};
61 
62 	private:
63 		EditableAudioTrack *_track;
64 		int _trackObjectId;
65 		AdmScriptMapper *_mapper;
66 
67 		bool verifyTrack();
68 
69 		QScriptValue getAudioInputFile();
70 		QScriptValue getAudioInputIndex();
71 		QScriptValue getAudioInputType();
72 		QScriptValue getEncoder();
73 		QScriptValue getGainMode();
74 		QScriptValue getGainValue();
75         QScriptValue getDrcMode();
76 		QScriptValue getMixer();
77 		QScriptValue getResample();
78 		QScriptValue getStretchAudioMode();
79 		QScriptValue getTimeShift();
80 		void setAudioInputFile(QScriptValue inputFile);
81 		void setAudioInputIndex(QScriptValue inputIndex);
82 		void setEncoder(QScriptValue encoder);
83 		void setGainMode(QScriptValue gainMode);
84         void setDrcMode(QScriptValue drcMode);
85 		void setGainValue(QScriptValue gainValue);
86 		void setMixer(QScriptValue mixer);
87 		void setResample(QScriptValue resample);
88 		void setStretchAudioMode(QScriptValue stretchAudioMode);
89 		void setTimeShift(QScriptValue timeShift);
90 
91 	public:
92 		/** \cond */
93 		AudioOutput(IEditor *editor, EditableAudioTrack *track);
94 		~AudioOutput();
95 		/** \endcond */
96 
97 		/** \brief Gets or sets the path of the external audio file if an external file is to be encoded.
98 		 * \sa audioInputType
99 		 */
100 		Q_PROPERTY(QScriptValue /*% Number %*/ audioInputFile READ getAudioInputFile WRITE setAudioInputFile);
101 
102 		/** \brief Gets or sets the zero-based index of an audio track in the currently opened video
103 		 * if an internal track is to be encoded.
104 		 * \sa audioInputType
105 		 */
106 		Q_PROPERTY(QScriptValue /*% Number %*/ audioInputIndex READ getAudioInputIndex WRITE setAudioInputIndex);
107 
108 		/** \brief Returns the type of audio track that will be encoded.
109 		 * \sa audioInputFile and audioInputIndex
110 		 */
111 		Q_PROPERTY(QScriptValue /*% AudioInputType %*/ audioInputType READ getAudioInputType);
112 
113 		/** \brief Gets or sets the encoder that will be used on the input audio.
114 		 */
115 		Q_PROPERTY(QScriptValue /*% AudioEncoder %*/ encoder READ getEncoder WRITE setEncoder);
116 
117 		/** \brief Gets or sets the gain mode of the Gain audio filter.
118 		 * \sa gainValue
119 		 */
120 		Q_PROPERTY(QScriptValue /*% GainMode %*/ gainMode READ getGainMode WRITE setGainMode);
121 
122 		/** \brief Gets or sets whether Dynamic Range Compression will be applied to the input audio during encoding.
123 		 */
124 		Q_PROPERTY(QScriptValue /*% Boolean %*/ drcEnabled READ getDrcMode WRITE setDrcMode);
125 
126 		/** \brief Gets or sets the level of gain adjustment (in decibels) that will be applied to the input
127 		 * audio during encoding.
128 		 *
129 		 * The Gain audio filter amplifies (or attenuates) the sound level of the input audio. Setting this property
130 		 * will automatically set AudioOutput.gainMode to AudioOutput::ManualGain.
131 		 *
132 		 * \sa gainMode
133 		 */
134 		Q_PROPERTY(QScriptValue /*% Number %*/ gainValue READ getGainValue WRITE setGainValue);
135 
136 		/** \brief Gets or sets the mixer that will be applied to the input audio during encoding.
137 		 */
138 		Q_PROPERTY(QScriptValue /*% MixerMode %*/ mixer READ getMixer WRITE setMixer);
139 
140 		/** \brief Gets or sets the sampling rate (in hertz) for resampling the input audio.
141 		 *
142 		 * A value of zero indicates that resampling is disabled.
143 		 */
144 		Q_PROPERTY(QScriptValue /*% Number %*/ samplingRate READ getResample WRITE setResample);
145 
146 		/** \brief Shortens or extends the encoded audio relative to the source audio.
147 		 */
148 		Q_PROPERTY(QScriptValue /*% StretchAudioMode %*/ stretchAudioMode READ getStretchAudioMode WRITE setStretchAudioMode);
149 
150 		/** \brief Shifts (in milliseconds) the input audio forward (positive number) or backward
151 		 * (negative number).
152 		 */
153 		Q_PROPERTY(QScriptValue /*% Number %*/ timeShift READ getTimeShift WRITE setTimeShift);
154 	};
155 }
156 
157 #endif
158