@@ -527,6 +527,18 @@ bool init_i2s(/*renderer_config_t *config*/)
527527{
528528 renderer_config_t * config ;
529529 config = renderer_get ();
530+
531+ config -> bit_depth = I2S_BITS_PER_SAMPLE_16BIT ;
532+ config -> i2s_num = I2S_NUM_0 ;
533+ config -> sample_rate = 44100 ;
534+ config -> sample_rate_modifier = 1.0 ;
535+ config -> output_mode = get_audio_output_mode ();
536+
537+ if (config -> output_mode == I2S_MERUS ) {
538+ config -> bit_depth = I2S_BITS_PER_SAMPLE_32BIT ;
539+ }
540+
541+
530542 i2s_mode_t mode = I2S_MODE_MASTER | I2S_MODE_TX ;
531543 i2s_comm_format_t comm_fmt = I2S_COMM_FORMAT_I2S | I2S_COMM_FORMAT_I2S_MSB ;
532544 i2s_bits_per_sample_t bit_depth = config -> bit_depth ;
@@ -537,6 +549,7 @@ bool init_i2s(/*renderer_config_t *config*/)
537549
538550 if (config -> output_mode == DAC_BUILT_IN )
539551 {
552+ config -> bit_depth = I2S_BITS_PER_SAMPLE_16BIT ;
540553 mode = mode | I2S_MODE_DAC_BUILT_IN ;
541554 comm_fmt = I2S_COMM_FORMAT_I2S_MSB ;
542555 }
@@ -552,7 +565,7 @@ bool init_i2s(/*renderer_config_t *config*/)
552565 }
553566
554567 if ((config -> output_mode == I2S )|| (config -> output_mode == I2S_MERUS )
555- || (config -> output_mode == SPDIF ) || (config -> output_mode == DAC_BUILT_IN ))
568+ || (config -> output_mode == SPDIF ) ) // || (config->output_mode == DAC_BUILT_IN))
556569 {
557570 /* don't use audio pll on buggy rev0 chips */
558571 // don't do it for PDM
@@ -581,8 +594,8 @@ bool init_i2s(/*renderer_config_t *config*/)
581594 .dma_buf_count = bc , // number of buffers, 128 max. 16
582595// .dma_buf_len = bigSram()?256:128, // size of each buffer 128
583596 .dma_buf_len = 512 , // size of each buffer 128
584- .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1 , // lowest level 1
585- // .intr_alloc_flags = 0 , // default
597+ // .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, // lowest level 1
598+ .intr_alloc_flags = 0 , // default
586599 .tx_desc_auto_clear = true,
587600 .use_apll = use_apll
588601 };
@@ -598,7 +611,7 @@ bool init_i2s(/*renderer_config_t *config*/)
598611 .data_out_num = i2sdata ,
599612 .data_in_num = I2S_PIN_NO_CHANGE
600613 };
601-
614+ ESP_LOGD ( TAG , "mode:%d, sample_rate:%d, bit_depth:%d, comm:%d, data:%d" , mode , sample_rate , bit_depth , comm_fmt , i2sdata );
602615
603616 if (i2s_driver_install (config -> i2s_num , & i2s_config , 0 , NULL ) != ESP_OK )
604617 {
@@ -617,7 +630,7 @@ bool init_i2s(/*renderer_config_t *config*/)
617630 if (config -> output_mode == DAC_BUILT_IN )// || (mode & I2S_MODE_PDM))
618631 {
619632 i2s_set_pin (config -> i2s_num , NULL );
620- i2s_set_dac_mode (I2S_DAC_CHANNEL_BOTH_EN );
633+ // i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
621634 }
622635 else {
623636 if ((lrck != 255 ) && (bclk != 255 ) && (i2sdata != 255 ))
0 commit comments