APIs for playing audio (e.g.
More...
#include <stdbool.h>
#include <core/pubsub.h>
Go to the source code of this file.
|
|
#define | RECORD_AUDIO "audio" |
| | Record key to access the Audio instance.
|
| |
|
|
typedef struct Audio | Audio |
| | Audio opaque type declaration.
|
| |
APIs for playing audio (e.g.
files from MMC storage).
◆ AudioEventType
The types of events that can occur.
| Enumerator |
|---|
| AudioEventVolumeUpdate | Volume has been changed.
|
| AudioEventPlayEnd | File ended playing.
|
◆ audio_get_pubsub()
| FuriPubSub * audio_get_pubsub |
( |
Audio * | instance | ) |
|
Get the PubSub instance for events subscription.
The received events will be of AudioEvent underlying type.
- Parameters
-
| [in] | instance | pointer to the Audio instance |
- Returns
- pointer to the PubSub instance
◆ audio_get_volume()
| float audio_get_volume |
( |
Audio * | instance | ) |
|
Get the playback volume.
The volume is in range 0.0 (mute) to 1.0 (full volume).
- Parameters
-
| [in] | instance | pointer to the Audio instance |
- Returns
- volume value (see above range)
◆ audio_play_file()
| bool audio_play_file |
( |
Audio * | instance, |
|
|
const char * | file_name ) |
Play an audio file from storage.
The file MUST be in the following format:
- Header: none
- Channels: 1
- Rate: 44100 Hz
- Bits: 16bit LE
If this function is called when a file is already playing, the new file will start playing immediately without waiting for the playback to end.
- Parameters
-
| [in,out] | instance | pointer to the Audio instance |
| [in] | file_name | full path to the file location on the storage |
- Returns
- true if the file could be played, false otherwise
◆ audio_set_volume()
| void audio_set_volume |
( |
Audio * | instance, |
|
|
float | volume ) |
Set the playback volume.
The volume MUST be in range 0.0 (mute) to 1.0 (full volume).
- Parameters
-
| [in,out] | instance | pointer to the Audio instance |
| [in] | volume | new volume value (see above range) |
◆ audio_stop()
| bool audio_stop |
( |
Audio * | instance | ) |
|
Stop playing current audio from file.
- Parameters
-
| [in,out] | instance | pointer to the Audio instance |
- Returns
- true if the audio is stopping, false if not playing