Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2s_stream.h in custom cpp component esp-idf 5.0.0 or higher (AUD-5743) #1286

Closed
coencuppen opened this issue Oct 1, 2024 · 2 comments
Closed

Comments

@coencuppen
Copy link

Using i2s_stream.h in a custom cpp file leads to errors:

i2s_stream.h:233:1: error: designator order for field 'i2s_stream_cfg_t::expand_src_bits' does not match declaration order in 'i2s_stream_cfg_t'

which can be fixed by replacing the i2s_stream_cfg_t struct in
\esp-adf\components\audio_stream\include\i2s_stream.h
under // ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0):

typedef struct {
    audio_stream_type_t  type;                  /*!< Type of stream */
    i2s_comm_mode_t      transmit_mode;         /*!< I2S transmit mode */
    i2s_chan_config_t    chan_cfg;              /*!< I2S controller channel configuration */
    i2s_std_config_t     std_cfg;               /*!< I2S standard mode major configuration that including clock/slot/gpio configuration  */
#if SOC_I2S_SUPPORTS_PDM_RX
    i2s_pdm_rx_config_t  pdm_rx_cfg;            /*!< I2S PDM RX mode major configuration that including clock/slot/gpio configuration  */
#endif // SOC_I2S_SUPPORTS_PDM_RX
#if SOC_I2S_SUPPORTS_PDM_TX
    i2s_pdm_tx_config_t  pdm_tx_cfg;            /*!< I2S PDM TX mode major configuration that including clock/slot/gpio configuration  */
#endif // SOC_I2S_SUPPORTS_PDM_TX
#if SOC_I2S_SUPPORTS_TDM
    i2s_tdm_config_t     tdm_cfg;               /*!< I2S TDM mode major configuration that including clock/slot/gpio configuration  */
#endif // SOC_I2S_SUPPORTS_TDM
    i2s_data_bit_width_t expand_src_bits;       /*!< The source bits per sample when data expand */
    bool                 use_alc;               /*!< It is a flag for ALC. If use ALC, the value is true. Or the value is false */
    int                  volume;                /*!< The volume of audio input data will be set. */
    int                  out_rb_size;           /*!< Size of output ringbuffer */
    int                  task_stack;            /*!< Task stack size */
    int                  task_core;             /*!< Task running in core (0 or 1) */
    int                  task_prio;             /*!< Task priority (based on freeRTOS priority) */
    bool                 stack_in_ext;          /*!< Try to allocate stack in external memory */
    int                  multi_out_num;         /*!< The number of multiple output */
    bool                 uninstall_drv;         /*!< whether uninstall the i2s driver when stream destroyed*/
    bool                 need_expand;           /*!< whether to expand i2s data */
    int                  buffer_len;            /*!< Buffer length use for an Element. Note: when 'bits_per_sample' is 24 bit, the buffer length must be a multiple of 3. The recommended value is 3600 */
} i2s_stream_cfg_t;

by:

typedef struct {
    audio_stream_type_t  type;                  /*!< Type of stream */
    i2s_comm_mode_t      transmit_mode;         /*!< I2S transmit mode */
    i2s_std_config_t     std_cfg;               /*!< I2S standard mode major configuration that including clock/slot/gpio configuration  */
    i2s_chan_config_t    chan_cfg;              /*!< I2S controller channel configuration */
#if SOC_I2S_SUPPORTS_PDM_RX
    i2s_pdm_rx_config_t  pdm_rx_cfg;            /*!< I2S PDM RX mode major configuration that including clock/slot/gpio configuration  */
#endif // SOC_I2S_SUPPORTS_PDM_RX
#if SOC_I2S_SUPPORTS_PDM_TX
    i2s_pdm_tx_config_t  pdm_tx_cfg;            /*!< I2S PDM TX mode major configuration that including clock/slot/gpio configuration  */
#endif // SOC_I2S_SUPPORTS_PDM_TX
#if SOC_I2S_SUPPORTS_TDM
    i2s_tdm_config_t     tdm_cfg;               /*!< I2S TDM mode major configuration that including clock/slot/gpio configuration  */
#endif // SOC_I2S_SUPPORTS_TDM
    bool                 use_alc;               /*!< It is a flag for ALC. If use ALC, the value is true. Or the value is false */
    int                  volume;                /*!< The volume of audio input data will be set. */
    int                  out_rb_size;           /*!< Size of output ringbuffer */
    int                  task_stack;            /*!< Task stack size */
    int                  task_core;             /*!< Task running in core (0 or 1) */
    int                  task_prio;             /*!< Task priority (based on freeRTOS priority) */
    bool                 stack_in_ext;          /*!< Try to allocate stack in external memory */
    int                  multi_out_num;         /*!< The number of multiple output */
    bool                 uninstall_drv;         /*!< whether uninstall the i2s driver when stream destroyed*/
    bool                 need_expand;           /*!< whether to expand i2s data */
    i2s_data_bit_width_t expand_src_bits;       /*!< The source bits per sample when data expand */
    int                  buffer_len;            /*!< Buffer length use for an Element. Note: when 'bits_per_sample' is 24 bit, the buffer length must be a multiple of 3. The recommended value is 3600 */
} i2s_stream_cfg_t;

reproducing this behaviour can be done by these steps under the fix of the same issue for idf 4.2:
https://github.com/espressif/esp-adf/issues/409

@github-actions github-actions bot changed the title i2s_stream.h in custom cpp component esp-idf 5.0.0 or higher i2s_stream.h in custom cpp component esp-idf 5.0.0 or higher (AUD-5743) Oct 1, 2024
@hbler99
Copy link

hbler99 commented Oct 14, 2024

Thanks for your report, it will be solved as soon.

@jason-mao
Copy link
Collaborator

@coencuppen I think this issue was fixed on d1f7d4a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants