Author: Ding Dong,Huaqing vision embedded CollegeLecturer.
Including the Symbian platform and meego platform, which have started to support QT software development. If you develop an audioProgramFirst, we need to introduce several classes.
Qmediarecorder:
This class is mainly used to access the content of audio devices. Although this class does not have the ability to access audio, it can be used in combination with other classes, such as qaudiocapturesource and qradiotuner, to access audio, the following is how to load an audio file on a mobile phone device.
Audiosource-New qaudiocapturesource;
Recorder = new qmediarecorder (audiosource );
// Manages audio sources
Qaudiencodersettings audiosettings;
Audiosettings. setcodec ("adio/Vorbis ");
Audiosettings. setquality (qtmedia: highquality );
Recorder-> setencodingsettings (audiosettings );
Recorder-> setoutputlocation (qurl: fromlocalfile (filename ));
// Use macro-defined methods on different platforms to select the compatibility of Software Migration
// # Ifndef q_symbian_ OS
// # Else
Recorder-> record ();
Next, record the sound
Qaudiocapturesource:
This class provides an access point for audio, which is used to access the current audio input. This class is platform-based.CodeIs used to access an input content:
Qaudiocapturesource * audiocapturesource = new qaudiocapturesource;
Qmediarecorder * capture = new qmediarecorder (audiocapturesource );
The audiocapturesource interface is used to obtain and set the current audio input.
The capture interface is used to set the current audio input location and audio format parameters, such as encoding. Use record () for audio recording and stop () for audio recording.
In the second article, we will introduce the development of a recorder applet on a mobile phone.