1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Index: firmware/export/audiohw.h
===================================================================
--- firmware/export/audiohw.h	(revision 29594)
+++ firmware/export/audiohw.h	(working copy)
@@ -338,6 +338,7 @@
     SOUND_CHAN_MONO_LEFT,
     SOUND_CHAN_MONO_RIGHT,
     SOUND_CHAN_KARAOKE,
+    SOUND_CHAN_SWAP,
     SOUND_CHAN_NUM_MODES,
 };
 
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang	(revision 29594)
+++ apps/lang/english.lang	(working copy)
@@ -12744,3 +12744,20 @@
     *: "In custom directories only"
   </voice>
 </phrase>
+<phrase>
+  id: LANG_CHANNEL_SWAP
+  desc: in sound_settings
+  user: core
+  <source>
+    *: none
+    swcodec: "Swap channels"
+  </source>
+  <dest>
+    *: none
+    swcodec: "Swap channels"
+  </dest>
+  <voice>
+    *: none
+    swcodec: "Swap channels"
+  </voice>
+</phrase>
Index: apps/dsp.c
===================================================================
--- apps/dsp.c	(revision 29594)
+++ apps/dsp.c	(working copy)
@@ -1116,6 +1116,18 @@
 }
 #endif /* DSP_HAVE_ASM_SOUND_CHAN_KARAOKE */
 
+static void channels_process_sound_chan_swap(int count, int32_t *buf[])
+{
+    int32_t *sl = buf[0], *sr = buf[1];
+
+    while (count-- > 0)
+    {
+        int32_t ch = *sl;
+        *sl++ = *sr;
+        *sr++ = ch;
+    }
+}
+
 static void dsp_set_channel_config(int value)
 {
     static const channels_process_fn_type channels_process_functions[] =
@@ -1127,6 +1139,7 @@
         [SOUND_CHAN_MONO_LEFT]  = channels_process_sound_chan_mono_left,
         [SOUND_CHAN_MONO_RIGHT] = channels_process_sound_chan_mono_right,
         [SOUND_CHAN_KARAOKE]    = channels_process_sound_chan_karaoke,
+        [SOUND_CHAN_SWAP]       = channels_process_sound_chan_swap,
     };
 
     if ((unsigned)value >= ARRAYLEN(channels_process_functions) ||
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c	(revision 29594)
+++ apps/settings_list.c	(working copy)
@@ -639,11 +639,12 @@
 
     CHOICE_SETTING(F_SOUNDSETTING, channel_config, LANG_CHANNEL_CONFIGURATION,
                    0,"channels",
-                   "stereo,mono,custom,mono left,mono right,karaoke",
-                   sound_set_channels, 6,
+                   "stereo,mono,custom,mono left,mono right,karaoke,swap",
+                   sound_set_channels, 7,
                    ID2P(LANG_CHANNEL_STEREO), ID2P(LANG_CHANNEL_MONO),
                    ID2P(LANG_CHANNEL_CUSTOM), ID2P(LANG_CHANNEL_LEFT),
-                   ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE)),
+                   ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE),
+                   ID2P(LANG_CHANNEL_SWAP)),
     SOUND_SETTING(F_SOUNDSETTING, stereo_width, LANG_STEREO_WIDTH,
                   "stereo_width", SOUND_STEREO_WIDTH),
 #ifdef AUDIOHW_HAVE_DEPTH_3D