QAudioRecorder露
- PyQt5.QtMultimedia.QAudioRecorder
Inherits from QMediaRecorder.
Description露
The QAudioRecorder class is used for the recording of audio.
The QAudioRecorder class is a high level media recording class and contains the same functionality as QMediaRecorder.
# audioRecorder = new QAudioRecorder;
# QAudioEncoderSettings audioSettings;
# audioSettings.setCodec("audio/amr");
# audioSettings.setQuality(QMultimedia::HighQuality);
# audioRecorder->setEncodingSettings(audioSettings);
# audioRecorder->setOutputLocation(QUrl::fromLocalFile("test.amr"));
# audioRecorder->record();
In addition QAudioRecorder provides functionality for selecting the audio input.
# QStringList inputs = audioRecorder->audioInputs();
# QString selectedInput = audioRecorder->defaultAudioInput();
# foreach (QString input, inputs) {
# QString description = audioRecorder->audioInputDescription(input);
# // show descriptions to user and allow selection
# selectedInput = input;
# }
# audioRecorder->setAudioInput(selectedInput);
The Audio Recorder Example shows how to use this class in more detail.
See also
QMediaRecorder, QAudioInputSelectorControl.
Methods露
- __init__(parent: QObject = None)
Constructs an audio recorder. The parent is passed to QMediaObject.
- audioInput() → str
Returns the active audio input name.
See also
- audioInputDescription(str) → str
Returns the readable translated description of the audio input device with name.
- audioInputs() → List[str]
Returns a list of available audio inputs
- defaultAudioInput() → str
Returns the default audio input name.
- setAudioInput(str)
Set the active audio input to name.
See also