浏览代码

change sample rate between tracks + tweak EMBEDDED option

philippe44 5 年之前
父节点
当前提交
4b8790cf88
共有 3 个文件被更改,包括 14 次插入11 次删除
  1. 5 0
      components/squeezelite/embedded.h
  2. 5 5
      components/squeezelite/output_i2s.c
  3. 4 6
      components/squeezelite/squeezelite.h

+ 5 - 0
components/squeezelite/embedded.h

@@ -10,6 +10,11 @@
 #define PTHREAD_STACK_MIN	256
 #endif
 
+#define STREAM_THREAD_STACK_SIZE  8 * 1024
+#define DECODE_THREAD_STACK_SIZE 20 * 1024
+#define OUTPUT_THREAD_STACK_SIZE  8 * 1024
+#define IR_THREAD_STACK_SIZE      8 * 1024
+
 typedef int16_t   s16_t;
 typedef int32_t   s32_t;
 typedef int64_t   s64_t;

+ 5 - 5
components/squeezelite/output_i2s.c

@@ -305,11 +305,11 @@ static void *output_thread_i2s() {
 				isI2SStarted=true;
 				LOG_INFO("Restarting I2S.");
 				i2s_start(CONFIG_I2S_NUM);
-				if( i2s_config.sample_rate != output.current_sample_rate)
-				{
-					i2s_config.sample_rate = output.current_sample_rate;
-					i2s_set_sample_rates(CONFIG_I2S_NUM, i2s_config.sample_rate);
-				}
+			} 
+			if (i2s_config.sample_rate != output.current_sample_rate) {
+				LOG_INFO("changing sampling rate %u to %u", i2s_config.sample_rate, output.current_sample_rate);
+				i2s_config.sample_rate = output.current_sample_rate;
+				i2s_set_sample_rates(CONFIG_I2S_NUM, i2s_config.sample_rate);
 			}
 			count++;
 			LOG_SDEBUG("Outputting to I2S");

+ 4 - 6
components/squeezelite/squeezelite.h

@@ -286,19 +286,17 @@
 #if SUN
 #include <sys/types.h>
 #endif /* SUN */
-
-#define STREAM_THREAD_STACK_SIZE  8 * 1024
-#define DECODE_THREAD_STACK_SIZE 20 * 1024
-#define OUTPUT_THREAD_STACK_SIZE  8 * 1024
-#define IR_THREAD_STACK_SIZE      8 * 1024
 #if !OSX
 #define thread_t pthread_t;
 #endif
 #define closesocket(s) close(s)
 #define last_error() errno
 #define ERROR_WOULDBLOCK EWOULDBLOCK
-
 #if !EMBEDDED
+#define STREAM_THREAD_STACK_SIZE  64 * 1024
+#define DECODE_THREAD_STACK_SIZE 128 * 1024
+#define OUTPUT_THREAD_STACK_SIZE  64 * 1024
+#define IR_THREAD_STACK_SIZE      64 * 1024
 #ifdef SUN
 typedef uint8_t  u8_t;
 typedef uint16_t u16_t;