Advertisement
Songs0fFailure

rockbox, Swap Channels

Mar 16th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.77 KB | None | 0 0
  1. diff --git a/apps/lang/english.lang b/apps/lang/english.lang
  2. index 627fda8..ef715c7 100644
  3. --- apps/lang/english.lang
  4. +++ apps/lang/english.lang
  5. @@ -12993,3 +12993,20 @@
  6.      *: "Restart Sleep Timer On Keypress"
  7.    </voice>
  8.  </phrase>
  9. +<phrase>
  10. +  id: LANG_CHANNEL_SWAP
  11. +  desc: in sound_settings
  12. +  user: core
  13. +  <source>
  14. +    *: none
  15. +    swcodec: "Swap channels"
  16. +  </source>
  17. +  <dest>
  18. +    *: none
  19. +    swcodec: "Swap channels"
  20. +  </dest>
  21. +  <voice>
  22. +    *: none
  23. +    swcodec: "Swap channels"
  24. +  </voice>
  25. +</phrase>
  26. diff --git a/apps/dsp.c b/apps/dsp.c
  27. index 00de511..40cb1b6 100644
  28. --- apps/dsp.c
  29. +++ apps/dsp.c
  30. @@ -1119,6 +1119,18 @@
  31.  }
  32.  #endif /* DSP_HAVE_ASM_SOUND_CHAN_KARAOKE */
  33.  
  34. +static void channels_process_sound_chan_swap(int count, int32_t *buf[])
  35. +{
  36. +    int32_t *sl = buf[0], *sr = buf[1];
  37. +
  38. +    while (count-- > 0)
  39. +    {
  40. +        int32_t ch = *sl;
  41. +        *sl++ = *sr;
  42. +        *sr++ = ch;
  43. +    }
  44. +}
  45. +
  46.  static void dsp_set_channel_config(int value)
  47.  {
  48.      static const channels_process_fn_type channels_process_functions[] =
  49. @@ -1130,6 +1142,7 @@
  50.          [SOUND_CHAN_MONO_LEFT]  = channels_process_sound_chan_mono_left,
  51.          [SOUND_CHAN_MONO_RIGHT] = channels_process_sound_chan_mono_right,
  52.          [SOUND_CHAN_KARAOKE]    = channels_process_sound_chan_karaoke,
  53. +        [SOUND_CHAN_SWAP]       = channels_process_sound_chan_swap,
  54.      };
  55.  
  56.      if ((unsigned)value >= ARRAYLEN(channels_process_functions) ||
  57. diff --git a/apps/settings_list.c b/apps/settings_list.c
  58. index 44295ac..03d49e4 100644
  59. --- apps/settings_list.c
  60. +++ apps/settings_list.c
  61. @@ -696,11 +696,12 @@
  62.  
  63.      CHOICE_SETTING(F_SOUNDSETTING, channel_config, LANG_CHANNEL_CONFIGURATION,
  64.                     0,"channels",
  65. -                   "stereo,mono,custom,mono left,mono right,karaoke",
  66. -                   sound_set_channels, 6,
  67. +                   "stereo,mono,custom,mono left,mono right,karaoke,swap",
  68. +                   sound_set_channels, 7,
  69.                     ID2P(LANG_CHANNEL_STEREO), ID2P(LANG_CHANNEL_MONO),
  70.                     ID2P(LANG_CHANNEL_CUSTOM), ID2P(LANG_CHANNEL_LEFT),
  71. -                   ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE)),
  72. +                   ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE),
  73. +                   ID2P(LANG_CHANNEL_SWAP)),
  74.      SOUND_SETTING(F_SOUNDSETTING, stereo_width, LANG_STEREO_WIDTH,
  75.                    "stereo_width", SOUND_STEREO_WIDTH),
  76.  #ifdef AUDIOHW_HAVE_DEPTH_3D
  77. diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
  78. index 304c5aa..c8c87dd 100644
  79. --- firmware/export/audiohw.h
  80. +++ firmware/export/audiohw.h
  81. @@ -346,6 +346,7 @@
  82.      SOUND_CHAN_MONO_LEFT,
  83.      SOUND_CHAN_MONO_RIGHT,
  84.      SOUND_CHAN_KARAOKE,
  85. +    SOUND_CHAN_SWAP,
  86.      SOUND_CHAN_NUM_MODES,
  87.  };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement