BeatLib


MP3Decoder QML Type

Decodes, analyzes, modifies and plays MP3 files. More...

Import Statement: import

Properties

Methods

Detailed Description

This QML type decodes and plays MP3 files. It can also apply signal-processing effects to the decoded data before playing. Set the effect to any instance of AudioEffect for this. To use more than one effect, use MultiEffect.

You can play a file directly by calling play() with a file name parameter. Alternatively you can use an AudioStream instance as parameter to play(). Such streams can be obtained from one of the AudioFileSelector methods. This allows using platform-native file paths, like content:// on Android.

Property Documentation

[read-only] busyRate : real

Contains a value indicating the time the MP3Decoder spends being busy decoding audio. This is a value between 0 (never busy) and 1 (always busy).

See also busyRateAverage.


[read-only] busyRateAverage : real

Contains an average of busyRate over the current decoding process, since calling play().

See also busyRate.


effect : AudioEffect

An AudioEffect instance that is applied to the MP3Decoder's audio signal. The effect may alter the signal or just analyze it, based on AudioEffect::processSample()'s return value.

You can use more than 1 effect by setting this property to a MultiEffect instance.


[read-only] idle : bool

Contains true if the MP3Decoder is currently ready to start decoding and playing audio.

This is true before calling play() and true initially or after calling stop().

See also state, running, stopping, play(), and stop().


[read-only] metaData : MP3MetaData

Contains meta information about the currently decoding MP3 signal. This is only set if the signal contains meta data.


[read-only] running : bool

Contains true if the MP3Decoder is currently decoding and playing audio.

This is true after calling play() and false initially or after calling stop() and the current buffer has been emptied.

See also state, idle, stopping, play(), and stop().


[read-only] sampleRate : int

Contains the current audio signal's sample rate, in Hertz.


[read-only] startTime : int

Contains a time interval in milliseconds since 1970/01/01 when the audio signal started playing.


[read-only] state : bool

Contains the current internal state of the MP3Decoder.

This property can have one of the following values:

See also idle, running, stopping, play(), and stop().


[read-only] stopping : bool

Contains true if the MP3Decoder is currently stopping the decoding process.

This is true after calling stop() until the current audio buffer is empty.

See also state, idle, running, play(), and stop().


Method Documentation

play(var stream)

Decode and play back an MP3 stream in the MP3Decoder.

The parameter stream can either be an MP3 file's path or an AudioStream instance.

See also stop() and state.


stop()

Stop current audio decoding and playback.

See also play() and state.