ESPオーディオ¶
ESP Audio
このコンポーネントは、いくつかの単純な高レベルAPIを提供します。 これは、標準化されたオーディオ要素の一般的な相互接続に基づくオーディオアプリケーションの迅速な実装を目的としています。
This component provides several simple high level APIs. It is intended for quick implementation of audio applications based on typical interconnections of standardized audio elements.
APIリファレンス¶
API Reference
構造体¶
Structures
-
struct
esp_audio_state_t¶ esp_audioステータス情報パラメータ
esp_audio status information parameters
Public Members
-
esp_audio_status_t
status¶ esp_audioのステータス
Status of esp_audio
-
audio_err_t
err_msg¶ ステータスは
AUDIO_STATUS_ERRORで、err_msgが設定されますStatus is
AUDIO_STATUS_ERROR, err_msg will be setup
-
media_source_type_t
media_src¶ メディアソースタイプ
Media source type
-
esp_audio_status_t
タイプ定義¶
Type Definitions
-
typedef void (*
esp_audio_event_callback)(esp_audio_state_t *audio, void *ctx)¶
-
typedef esp_err_t (*
audio_volume_set)(void *hd, int vol)¶
-
typedef esp_err_t (*
audio_volume_get)(void *hd, int *vol)¶
列挙¶
Enumerations
-
enum
audio_err_t¶ Values:
-
ESP_ERR_AUDIO_NO_ERROR= ESP_OK¶
-
ESP_ERR_AUDIO_FAIL= ESP_FAIL¶
-
ESP_ERR_AUDIO_NO_INPUT_STREAM= ESP_ERR_AUDIO_BASE + 1¶
-
ESP_ERR_AUDIO_NO_OUTPUT_STREAM= ESP_ERR_AUDIO_BASE + 2¶
-
ESP_ERR_AUDIO_NO_CODEC= ESP_ERR_AUDIO_BASE + 3¶
-
ESP_ERR_AUDIO_HAL_FAIL= ESP_ERR_AUDIO_BASE + 4¶
-
ESP_ERR_AUDIO_MEMORY_LACK= ESP_ERR_AUDIO_BASE + 5¶
-
ESP_ERR_AUDIO_INVALID_URI= ESP_ERR_AUDIO_BASE + 6¶
-
ESP_ERR_AUDIO_INVALID_PATH= ESP_ERR_AUDIO_BASE + 7¶
-
ESP_ERR_AUDIO_INVALID_PARAMETER= ESP_ERR_AUDIO_BASE + 8¶
-
ESP_ERR_AUDIO_NOT_READY= ESP_ERR_AUDIO_BASE + 9¶
-
ESP_ERR_AUDIO_NOT_SUPPORT= ESP_ERR_AUDIO_BASE + 10¶
-
ESP_ERR_AUDIO_TIMEOUT= ESP_ERR_AUDIO_BASE + 11¶
-
ESP_ERR_AUDIO_ALREADY_EXISTS= ESP_ERR_AUDIO_BASE + 12¶
-
ESP_ERR_AUDIO_LINK_FAIL= ESP_ERR_AUDIO_BASE + 13¶
-
ESP_ERR_AUDIO_UNKNOWN= ESP_ERR_AUDIO_BASE + 14¶
-
ESP_ERR_AUDIO_OUT_OF_RANGE= ESP_ERR_AUDIO_BASE + 15¶
-
ESP_ERR_AUDIO_OPEN= ESP_ERR_AUDIO_BASE + 0x100¶
-
ESP_ERR_AUDIO_INPUT= ESP_ERR_AUDIO_BASE + 0x101¶
-
ESP_ERR_AUDIO_PROCESS= ESP_ERR_AUDIO_BASE + 0x102¶
-
ESP_ERR_AUDIO_OUTPUT= ESP_ERR_AUDIO_BASE + 0x103¶
-
ESP_ERR_AUDIO_CLOSE= ESP_ERR_AUDIO_BASE + 0x104¶
-
-
enum
esp_audio_status_t¶ Values:
-
AUDIO_STATUS_UNKNOWN= 0¶
-
AUDIO_STATUS_RUNNING= 1¶
-
AUDIO_STATUS_PAUSED= 2¶
-
AUDIO_STATUS_STOPPED= 3¶
-
AUDIO_STATUS_FINISHED= 4¶
-
AUDIO_STATUS_ERROR= 5¶
-
-
enum
audio_termination_type_t¶ Values:
-
TERMINATION_TYPE_NOW= 0¶ 音声操作はすぐに終了します
Audio operation will be terminated immediately
-
TERMINATION_TYPE_DONE= 1¶ 終了すると音声操作が停止します
Audio operation will be stopped when finished
-
TERMINATION_TYPE_MAX¶
-
-
enum
media_source_type_t¶ Values:
-
MEDIA_SRC_TYPE_NULL= 0¶
-
MEDIA_SRC_TYPE_MUSIC_BASE= 0x100¶
-
MEDIA_SRC_TYPE_MUSIC_SD= MEDIA_SRC_TYPE_MUSIC_BASE + 1¶
-
MEDIA_SRC_TYPE_MUSIC_HTTP= MEDIA_SRC_TYPE_MUSIC_BASE + 2¶
-
MEDIA_SRC_TYPE_MUSIC_FLASH= MEDIA_SRC_TYPE_MUSIC_BASE + 3¶
-
MEDIA_SRC_TYPE_MUSIC_A2DP= MEDIA_SRC_TYPE_MUSIC_BASE + 4¶
-
MEDIA_SRC_TYPE_MUSIC_DLNA= MEDIA_SRC_TYPE_MUSIC_BASE + 5¶
-
MEDIA_SRC_TYPE_MUSIC_RAW= MEDIA_SRC_TYPE_MUSIC_BASE + 6¶
-
MEDIA_SRC_TYPE_MUSIC_MAX= 0x1FF¶
-
MEDIA_SRC_TYPE_TONE_BASE= 0x200¶
-
MEDIA_SRC_TYPE_TONE_SD= MEDIA_SRC_TYPE_TONE_BASE + 1¶
-
MEDIA_SRC_TYPE_TONE_HTTP= MEDIA_SRC_TYPE_TONE_BASE + 2¶
-
MEDIA_SRC_TYPE_TONE_FLASH= MEDIA_SRC_TYPE_TONE_BASE + 3¶
-
MEDIA_SRC_TYPE_TONE_MAX= 0x2FF¶
-
MEDIA_SRC_TYPE_RESERVE_BASE= 0x800¶
-
MEDIA_SRC_TYPE_RESERVE_MAX= 0xFFF¶
-
関数¶
Functions
-
esp_audio_handle_t
esp_audio_create(const esp_audio_cfg_t *cfg)¶ 「cfg」パラメータに従ってesp_audioインスタンスを作成します。
Create esp_audio instance according to ‘cfg’ parameter.
この関数は、指定された構成でesp_audioインスタンスを作成します。
This function create an esp_audio instance, at the specified configuration.
- Return
- NULL:エラー
NULL: Error
- その他:完全に認証するesp_audioインスタンス
Others: esp_audio instance fully certifying
- NULL:エラー
- Parameters
cfg: esp_audio初期化構成を提供しますcfg: Provide esp_audio initialization configuration
-
audio_err_t
esp_audio_destroy(esp_audio_handle_t handle)¶ 特定のesp_audioインスタンスが破棄されます。
Specific esp_audio instance will be destroyed.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
ESP_ERR_AUDIO_NO_ERROR: on success
- ESP_ERR_AUDIO_INVALID_PARAMETER: 解放するインスタンスがない場合は、最初にesp_audio_initを呼び出します
ESP_ERR_AUDIO_INVALID_PARAMETER: no instance to free, call esp_audio_init first
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instance
-
audio_err_t
esp_audio_input_stream_add(esp_audio_handle_t handle, audio_element_handle_t in_stream)¶ 特定のesp_audioインスタンスにオーディオ入力ストリームを追加します。
Add audio input stream to specific esp_audio instance.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
ESP_ERR_AUDIO_NO_ERROR: on success
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_MEMORY_LACK: メモリの割り当てに失敗する
ESP_ERR_AUDIO_MEMORY_LACK: allocate memory fail
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancein_stream: オーディオストリームインスタンスin_stream: Audio stream instance
-
audio_err_t
esp_audio_output_stream_add(esp_audio_handle_t handle, audio_element_handle_t out_stream)¶ 特定のesp_audioインスタンスにオーディオ出力ストリームを追加します。
Add audio output stream to specific esp_audio instance.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
ESP_ERR_AUDIO_NO_ERROR: on success
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_MEMORY_LACK: メモリの割り当てに失敗する
ESP_ERR_AUDIO_MEMORY_LACK: allocate memory fail
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instanceout_stream: オーディオストリーム要素インスタンスout_stream: The audio stream element instance
-
audio_err_t
esp_audio_codec_lib_add(esp_audio_handle_t handle, audio_codec_type_t type, audio_element_handle_t lib)¶ 音楽ファイルをデコードまたはエンコードできる新しいコーデックライブラリを追加します。
Add a new codec lib that can decode or encode a music file.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
ESP_ERR_AUDIO_NO_ERROR: on success
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_MEMORY_LACK: メモリの割り当てに失敗する
ESP_ERR_AUDIO_MEMORY_LACK: allocate memory fail
- ESP_ERR_AUDIO_NO_ERROR: 成功した場合
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancetype: オーディオコーデックタイプ(エンコーダーまたはデコーダー)type: The audio codec type(encoder or decoder)lib: オーディオストリーム要素を提供するにはlib: To provide audio stream element
-
audio_err_t
esp_audio_codec_lib_query(esp_audio_handle_t handle, audio_codec_type_t type, const char *extension)¶ この種の音楽拡張機能がサポートされているかどうかを確認してください。
Check if this kind of music extension is supported or not.
- Note
- この関数は、esp_audio_codec_lib_addによってすでに追加されているコーデックを照会するだけです。 延長の最大長は6です。
This function just query the codec which has already add by esp_audio_codec_lib_add. The max length of extension is 6.
- Return
- ESP_ERR_AUDIO_NO_ERROR: サポートされています
ESP_ERR_AUDIO_NO_ERROR: supported
- ESP_ERR_AUDIO_NOT_SUPPORT: サポートしません
ESP_ERR_AUDIO_NOT_SUPPORT: not support
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NO_ERROR: サポートされています
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancetype: CODEC_ENCODERまたはCODEC_DECODERtype: The CODEC_ENCODER or CODEC_DECODERextension: 「mp3」、「wav」、「aac」などextension: Such as “mp3”, “wav”, “aac”
-
audio_err_t
esp_audio_play(esp_audio_handle_t handle, audio_codec_type_t type, const char *uri, int pos)¶ 指定されたURIを再生します。
Play the given uri.
esp_audio_playには、フォローアクティビティがあり、URIによってinputstream、outputstream、およびcodecをセットアップし、それらすべてを開始します。 esp_audioは、URIフィールドによって入力ストリーム、コーデック、および出力ストリームを選択するという規則があります。
The esp_audio_play have follow activity, setup inputstream, outputstream and codec by uri, start all of them. There is a rule that esp_audio will select input stream, codec and output stream by URI field.
URIフィールドのルールは次のとおりです。
Rule of URI field are as follow.
- 既存のストリームから入力ストリームを選択するためのURIの
UF_SCHEMAフィールド。 例:「http」、「file」UF_SCHEMAfield of URI for choose input stream from existing streams. e.g:”http”,”file” - 既存のコーデックからコーデックを選択するためのURIの
UF_PATHフィールド。 例:「/audio/mp3_music.mp3」UF_PATHfield of URI for choose codec from existing codecs. e.g:”/audio/mp3_music.mp3” - 既存のストリームから出力ストリームを選択するためのURIの
UF_FRAGMENTフィールド。出力ストリームはデフォルトでI2Sです。UF_FRAGMENTfield of URI for choose output stream from existing streams, output stream is I2S by default. - エンコードモードでの特定のサンプルレートとチャネルのURIの
UF_USERINFOフィールド。UF_USERINFOfield of URI for specific sample rate and channels at encode mode.
userinfoフィールドの「user:password」の形式、「user」はサンプルレート、「password」はチャネルです。
The format “user:password” in the userinfo field, “user” is sample rate, “password” is channels.
現在、esp_audio_playはURIに従うことをサポートしています。
Now esp_audio_play support follow URIs.
- ”https://dl.espressif.com/dl/audio/mp3_music.mp3”
- ”http://media-ice.musicradio.com/ClassicFMMP3”
- ”file://sdcard/test.mp3”
- ”iis://16000:2@from.pcm/rec.wav#file”
- ”iis://16000:1@record.pcm/record.wav#raw”
- ”aadp://44100:2@bt/sink/stream.pcm”
- Note
http_parser_parse_urlによって解析されたURI、不正な文字列はESP_ERR_AUDIO_INVALID_URIを返します。The URI parse by
http_parser_parse_url,any illegal string will be returnESP_ERR_AUDIO_INVALID_URI.- esp_decoderコーデックが
handleに追加されると、他のデコーダーが追加された場合でも、esp_decoderのハンドルがデフォルトのデコーダーとして設定されます。If the esp_decoder codec is added to
handle, then thehandleof esp_decoder will be set as the default decoder, even if other decoders are added. CONFIG_FATFS_API_ENCODING_UTF_8を有効にすると、URIは漢字をサポートできます。Enabled
CONFIG_FATFS_API_ENCODING_UTF_8, the URI can be support Chinese characters.- 非同期インターフェース
Asynchronous interface
- ブロック時間の最大値は
esp_audio_play_timeout_setで変更できます。デフォルト値は25秒です。The maximum of block time can be modify by
esp_audio_play_timeout_set, default value is 25 seconds.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_TIMEOUT: 再生アクティビティをタイムアウトします
ESP_ERR_AUDIO_TIMEOUT: timeout the play activity
- ESP_ERR_AUDIO_NOT_SUPPORT: 現在のステータスはAUDIO_STATUS_RUNNINGです
ESP_ERR_AUDIO_NOT_SUPPORT: Currently status is AUDIO_STATUS_RUNNING
- ESP_ERR_AUDIO_INVALID_URI: URIは違法です
ESP_ERR_AUDIO_INVALID_URI: URI is illegal
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audio_handle_tインスタンスhandle: The esp_audio_handle_t instanceuri: 「file://sdcard/test.wav」や「http://iot.espressif.com/file/example.mp3」など。 NULLを設定する場合は、esp_audio_setupによるURI設定が使用されます。uri: Such as “file://sdcard/test.wav” or “http://iot.espressif.com/file/example.mp3”. If NULL to be set, the uri setup byesp_audio_setupwill used.type: 特定のハンドルタイプのデコーダーまたはエンコーダーtype: Specific handle type decoder or encoderpos: バイト単位の特定の開始位置pos: Specific starting position by bytes
- 既存のストリームから入力ストリームを選択するためのURIの
-
audio_err_t
esp_audio_sync_play(esp_audio_handle_t handle, const char *uri, int pos)¶ 音楽が終了するかエラーが発生するまで、指定されたURIを再生します。
Play the given uri until music finished or error occured.
- Note
- すべての機能は
esp_audio_playと同じですAll features are same with
esp_audio_play - 同期インターフェース
Synchronous interface
- デコーダーモードのみをサポート
Support decoder mode only
- 再生中にイベントが投稿されることはありません
No any events post during playing
- すべての機能は
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_TIMEOUT: タイムアウト(8000ms)プレイアクティビティ
ESP_ERR_AUDIO_TIMEOUT: timeout(8000ms) the play activity
- ESP_ERR_AUDIO_NOT_SUPPORT: 現在のステータスはAUDIO_STATUS_RUNNINGです
ESP_ERR_AUDIO_NOT_SUPPORT: Currently status is AUDIO_STATUS_RUNNING
- ESP_ERR_AUDIO_INVALID_URI: URIは違法です
ESP_ERR_AUDIO_INVALID_URI: URI is illegal
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audio_handle_tインスタンスhandle: The esp_audio_handle_t instance- uri:「file://sdcard/test.wav」や「http://iot.espressif.com/file/example.mp3」など、
uri: Such as “file://sdcard/test.wav” or “http://iot.espressif.com/file/example.mp3”, pos: バイト単位の特定の開始位置pos: Specific starting position by bytes
-
audio_err_t
esp_audio_stop(esp_audio_handle_t handle, audio_termination_type_t type)¶ esp_audioを停止するための同期インターフェース。 最大ブロック時間は8000msです。
A synchronous interface for stop the esp_audio. The maximum of block time is 8000ms.
- Note
- 1. ユーザーキューがevt_queによって登録されている場合、成功の場合はAUDIO_STATUS_STOPPEDイベント、エラーの場合はAUDIO_STATUS_ERRORイベントが受信されます。
1. If user queue has been registered by evt_que, AUDIO_STATUS_STOPPED event for success or AUDIO_STATUS_ERROR event for error will be received.
TERMINATION_TYPE_DONEは、それ自体では停止できない入力ストリームでのみ機能します。生の読み取り/書き込みストリーム、その他のストリームは効果がありません。TERMINATION_TYPE_DONEonly works with input stream which can’t stopped by itself, e.g.raw read/write stream, others streams are no effect.- 同期インターフェースは、作業中のパイプラインが確実に停止するようにするために使用されます。
The synchronous interface is used to ensure that working pipeline is stopped.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NOT_READY: ステータスがAUDIO_STATUS_RUNNINGまたはAUDIO_STATUS_PAUSEDではありません
ESP_ERR_AUDIO_NOT_READY: The status is not AUDIO_STATUS_RUNNING or AUDIO_STATUS_PAUSED
- ESP_ERR_AUDIO_TIMEOUT: タイムアウト(8000ms)停止アクティビティ。
ESP_ERR_AUDIO_TIMEOUT: timeout(8000ms) the stop activity.
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancetype: すぐに停止するか、完了type: Stop immediately or done
-
audio_err_t
esp_audio_pause(esp_audio_handle_t handle)¶ esp_audioを一時停止します。
Pause the esp_audio.
- Note
- 1. 音楽のみをサポートし、ライブストリームはサポートしません。 ユーザーキューがevt_queによって登録されている場合、成功の場合はAUDIO_STATUS_PAUSEDイベント、エラーの場合はAUDIO_STATUS_ERRORイベントが受信されます。
1. Only support music and without live stream. If user queue has been registered by evt_que, AUDIO_STATUS_PAUSED event for success or AUDIO_STATUS_ERROR event for error will be received.
- 一時停止した音楽は、新しい再生の前に
esp_audio_stopで停止する必要があります。そうしないと、新しい再生でブロックされます。The Paused music must be stoped by
esp_audio_stopbefore new playing, otherwise got block on new play.
- 一時停止した音楽は、新しい再生の前に
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NOT_READY: ステータスは実行されていません
ESP_ERR_AUDIO_NOT_READY: the status is not running
- ESP_ERR_AUDIO_TIMEOUT: タイムアウト(8000ms)一時停止アクティビティ。
ESP_ERR_AUDIO_TIMEOUT: timeout(8000ms) the pause activity.
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instance
-
audio_err_t
esp_audio_resume(esp_audio_handle_t handle)¶ 一時停止した音楽を再開します。
Resume the music paused.
- Note
- 音楽のみをサポートし、ライブストリームはサポートしません。 ユーザーキューがevt_queによって登録されている場合、成功の場合はAUDIO_STATUS_RUNNINGイベント、エラーの場合はAUDIO_STATUS_ERRORイベントが受信されます。
Only support music and without live stream. If user queue has been registered by evt_que, AUDIO_STATUS_RUNNING event for success or AUDIO_STATUS_ERROR event for error will be received.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_TIMEOUT: タイムアウト(8000ms)再開アクティビティ。
ESP_ERR_AUDIO_TIMEOUT: timeout(8000ms) the resume activity.
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instance
-
audio_err_t
esp_audio_vol_set(esp_audio_handle_t handle, int vol)¶ esp_audioの音量を設定します。
Setting esp_audio volume.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_CTRL_HAL_FAIL: ハードウェアのエラー。
ESP_ERR_AUDIO_CTRL_HAL_FAIL: error with hardware.
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancevol: 比容積が設定されます。 0〜100は合法です。 0はミュートになります。vol: Specific volume will be set. 0-100 is legal. 0 will be mute.
-
audio_err_t
esp_audio_vol_get(esp_audio_handle_t handle, int *vol)¶ esp_audioボリュームを取得します。
Get esp_audio volume.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_CTRL_HAL_FAIL: ハードウェアのエラー。
ESP_ERR_AUDIO_CTRL_HAL_FAIL: error with hardware.
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancevol: esp_audioボリュームを示すintへのポインタ。vol: A pointer to int that indicates esp_audio volume.
-
audio_err_t
esp_audio_state_get(esp_audio_handle_t handle, esp_audio_state_t *state)¶ esp_audioステータスを取得します。
Get esp_audio status.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスがないかesp_audioが再生されない
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance or esp_audio does not playing
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancestate: esp_audioステータスを示すesp_audio_state_tへのポインタ。state: A pointer to esp_audio_state_t that indicates esp_audio status.
-
audio_err_t
esp_audio_pos_get(esp_audio_handle_t handle, int *pos)¶ 現在再生されている音楽のバイト単位の位置を取得します。
Get the position in bytes of currently played music.
- Note
- この機能は、音楽のデコードでのみ機能します。
This function works only with decoding music.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスはありません
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance
- ESP_ERR_AUDIO_NOT_READY: コーデック要素なし
ESP_ERR_AUDIO_NOT_READY: no codec element
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancepos: esp_audioのデコード位置を示すintへのポインタ。pos: A pointer to int that indicates esp_audio decoding position.
-
audio_err_t
esp_audio_time_get(esp_audio_handle_t handle, int *time)¶ 現在再生されている音楽のマイクロ秒単位で位置を取得します。
Get the position in microseconds of currently played music.
- Note
- この機能は、音楽のデコードでのみ機能します。
This function works only with decoding music.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスはありません
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance
- ESP_ERR_AUDIO_NOT_READY: アウトストリームなし
ESP_ERR_AUDIO_NOT_READY: no out stream
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancetime: esp_audioのデコード位置を示すintへのポインタ。time: A pointer to int that indicates esp_audio decoding position.
-
audio_err_t
esp_audio_setup(esp_audio_handle_t handle, esp_audio_setup_t *sets)¶ in_stream、codec、out_streamを確実に選択し、URIを設定します。Choose the
in_stream,codecandout_streamdefinitely, and seturi.- Note
- この関数は、イン/アウトストリームとコーデックを手動で選択する方法を提供します。
esp_audio_playの前に呼び出してから、esp_audio_playURIパラメーターを1回だけ無視する必要があります。This function provide a manual way to select in/out stream and codec, should be called before the
esp_audio_play, then ignore theesp_audio_playURI parameter only one time. - Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスはありません
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance
- ESP_ERR_AUDIO_MEMORY_LACK: メモリの割り当てに失敗する
ESP_ERR_AUDIO_MEMORY_LACK: allocate memory fail
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancesets: esp_audio_setup_tへのポインタ。sets: A pointer to esp_audio_setup_t.
-
audio_err_t
esp_audio_media_type_set(esp_audio_handle_t handle, media_source_type_t type)¶
-
audio_err_t
esp_audio_info_get(esp_audio_handle_t handle, esp_audio_info_t *info)¶
-
audio_err_t
esp_audio_info_set(esp_audio_handle_t handle, esp_audio_info_t *info)¶
-
audio_err_t
esp_audio_callback_set(esp_audio_handle_t handle, esp_audio_event_callback cb, void *cb_ctx)¶
-
audio_err_t
esp_audio_seek(esp_audio_handle_t handle, int seek_time_sec)¶ 現在再生されている音楽の2番目の位置を探します。
Seek the position in second of currently played music.
- Note
- この機能は、音楽のデコードでのみ機能します。
This function works only with decoding music.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_FAIL: コーデックまたは割り当てが失敗する
ESP_ERR_AUDIO_FAIL: codec or allocation fail
- ESP_ERR_AUDIO_TIMEOUT: 要素ステータスを同期するためのタイムアウト
ESP_ERR_AUDIO_TIMEOUT: timeout for sync the element status
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスはありません
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance
- ESP_ERR_AUDIO_NOT_SUPPORT: コーデックが終了しました
ESP_ERR_AUDIO_NOT_SUPPORT: codec has finished
- ESP_ERR_AUDIO_OUT_OF_RANGE: seek_time_msが範囲外です
ESP_ERR_AUDIO_OUT_OF_RANGE: the seek_time_ms is out of the range
- ESP_ERR_AUDIO_NOT_READY: ステータスは実行中でも一時停止でもありません
ESP_ERR_AUDIO_NOT_READY: the status is neither running nor paused
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instanceseek_time_sec: esp_audioのデコード位置を示すintへのポインタ。seek_time_sec: A pointer to int that indicates esp_audio decoding position.
-
audio_err_t
esp_audio_duration_get(esp_audio_handle_t handle, int *duration)¶ 音楽を再生する時間をマイクロ秒単位で取得します。
Get the duration in microseconds of playing music.
- Note
- この機能は、音楽のデコードでのみ機能します。
This function works only with decoding music.
- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスはありません
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance
- ESP_ERR_AUDIO_NOT_READY: コーデック要素なしまたは要素内なし
ESP_ERR_AUDIO_NOT_READY: no codec element or no in element
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instanceduration: デコードの合計時間を示すintへのポインタ。duration: A pointer to int that indicates decoding total time.
-
audio_err_t
esp_audio_play_timeout_set(esp_audio_handle_t handle, int time_ms)¶ esp_audio_playのみを待機する最大時間を設定します。Setting the maximum amount of time to waiting for
esp_audio_playonly.- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: 無効な引数
ESP_ERR_AUDIO_INVALID_PARAMETER: invalid arguments
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancetime_ms: 最大時間time_ms: The maximum amount of time
-
audio_err_t
esp_audio_prefer_type_get(esp_audio_handle_t handle, esp_audio_prefer_t *type)¶ esp_audio_prefer_tのタイプを取得しますGet the type of
esp_audio_prefer_t- Return
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
ESP_ERR_AUDIO_NO_ERROR: on succss
- ESP_ERR_AUDIO_INVALID_PARAMETER: esp_audioインスタンスはありません
ESP_ERR_AUDIO_INVALID_PARAMETER: no esp_audio instance
- ESP_ERR_AUDIO_NO_ERROR: 成功したとき
- Parameters
handle: esp_audioインスタンスhandle: The esp_audio instancetype: esp_audio_prefer_tへのポインタtype: A pointer to esp_audio_prefer_t
構造体¶
Structures
-
struct
esp_audio_cfg_t¶ esp_audio構成パラメーター
esp_audio configuration parameters
Public Members
-
int
in_stream_buf_size¶ 入力バッファサイズ
Input buffer size
-
int
out_stream_buf_size¶ 出力バッファサイズ
Output buffer size
-
int
resample_rate¶ 宛先サンプルレート、0:rsampleを無効にします。 その他:44.1K、48K、32K、16K、8KがサポートされていますI2Sストリーム
sample_rateと同じであることを確認する必要がありますDestination sample rate, 0: disable rsample; others: 44.1K, 48K, 32K, 16K, 8K has supported It should be make sure same with I2S stream
sample_rate
-
QueueHandle_t
evt_que¶ 受信したesp_audioイベントの場合(オプション)
For received esp_audio events (optional)
-
esp_audio_event_callback
cb_func¶ esp_audioイベントコールバック(オプション)
esp_audio events callback (optional)
-
void *
cb_ctx¶ esp_audioコールバックコンテキスト(オプション)
esp_audio callback context (optional)
-
esp_audio_prefer_t
prefer_type¶ espオーディオは特定のタイプで動作します。デフォルトのメモリが推奨されます。
esp_audio works on sepcific type, default memory is preferred.
ESP_AUDIO_PREFER_MEMモードは、アウトストリーム要素を除いて、新しいピピリンが開始する前に以前のリンクされた要素を停止しました。ESP_AUDIO_PREFER_MEMmode stopped the previous linked elements before the new pipiline starting, except out stream element.ESP_AUDIO_PREFER_SPEEDモードは、アウトストリーム要素を除いて、新しいピピリンが開始する前に以前のリンクされた要素を保持しました。ESP_AUDIO_PREFER_SPEEDmode kept the previous linked elements before the new pipiline starting, except out stream element.
-
void *
vol_handle¶ ボリューム変更インスタンス
Volume change instance
-
audio_volume_set
vol_set¶ ボリュームコールバックを設定する
Set volume callback
-
audio_volume_get
vol_get¶ ボリュームコールバックを取得する
Get volume callback
-
int
task_prio¶ esp_audioタスクの優先度
esp_audio task priority
-
int
task_stack¶ esp_audioタスクスタックのサイズ
Size of esp_audio task stack
-
int
-
struct
esp_audio_setup_t¶ 手動によるesp_audioセットアップパラメータ
esp_audio setup parameters by manual
Public Members
-
audio_codec_type_t
set_type¶ コーデックタイプを設定する
Set codec type
-
int
set_sample_rate¶ 音楽のサンプルレートを設定する
Set music sample rate
-
int
set_channel¶ 音楽チャンネルを設定する
Set music channels
-
int
set_pos¶ 開始位置を設定する
Set starting position
-
int
set_time¶ マイクロ秒時間の開始位置を設定します(オプション)
Set starting position of the microseconds time (optional)
-
char *
set_uri¶ URIを設定する
Set URI
-
char *
set_in_stream¶ in_streamのタグ
Tag of in_stream
-
char *
set_codec¶ コーデックのタグ
Tag of the codec
-
char *
set_out_stream¶ out_streamのタグ
Tag of out_stream
-
audio_codec_type_t
-
struct
esp_audio_info_t¶ esp_audio情報
esp_audio information
Public Members
-
audio_element_info_t
codec_info¶ コーデック情報
Codec information
-
audio_element_handle_t
in_el¶ Handle of the in stream
Handle of the in stream
-
audio_element_handle_t
out_el¶ アウトストリームのハンドル
Handle of the out stream
-
audio_element_handle_t
codec_el¶ コーデックのハンドル
Handle of the codec
-
audio_element_handle_t
filter_el¶ フィルターのハンドル
Handle of the filter
-
esp_audio_state_t
st¶ esp_audioの状態
The state of esp_audio
-
int
time_pos¶ マイクロ秒時間の位置
Position of the microseconds time
-
audio_element_info_t