Still no good new for the i2s driver in 32 bit mode
Code: Select all
int ret; ret = 0;
int i;
for (i=0; i < no_samples; i++) {
#if defined(USE_DAC)
short samp = mono_to_8bit_stereo(short_sample_buff[i]);
#else
int samp = mono_to_16bit_stereo(short_sample_buff[i]);
char samp2x32[8];
samp2x32[0] = 0;
samp2x32[1] = 0;
samp2x32[2] = 0;
samp2x32[3] = 0;
samp2x32[4] = 0xff;
samp2x32[5] = 0;
samp2x32[6] = 0;
samp2x32[7] = 0;
#endif
//Dependent on the amount of buffer we have too much or too little, we're going to add or remove
//samples. This basically does error diffusion on the sample added or removed.
if (sampErr>(1<<24)) {
sampErr-=(1<<24);
//...and don't output an i2s sample
} else if (sampErr<-(1<<24)) {
sampErr+=(1<<24);
//..and output 2 samples instead of one.
i2s_push_sample(I2S_NUM_0, (char *)&samp2x32, portMAX_DELAY);
i2s_push_sample(I2S_NUM_0, (char *)&samp2x32, portMAX_DELAY);
} else {
//Just output the sample.
ret = i2s_push_sample(I2S_NUM_0, (char *)&samp2x32, portMAX_DELAY);
}
}
printf("Number of char pushed:%d #samples:%d\n",ret,no_samples);
}
I set the bit pr sample to 32 in the driver construct increased the buffer length by a factor 2.
The result is what I saw when playing with example 22_i2s
Every second left/right sample set is missing,
I tried to hard code the sample code that get pushed to
Code: Select all
char samp2x32[8];
samp2x32[0] = 1;
samp2x32[1] = 3;
samp2x32[2] = 7;
samp2x32[3] = 0x0f;
samp2x32[4] = 0x1f;
samp2x32[5] = 0x3f;
samp2x32[6] = 0x7f;
samp2x32[7] = 0xff;
and this is what I get
some thing is miss aligned in the driver and after 30 sec I get a
Code: Select all
I (38679) http_client: ... done reading from socket. Last read return=0 errno=128
/Jorgen