/* Switch dynamically (while audio file is played) the output target (speaker or headphone).  */
uint32_t Codec_SwitchOutput(uint8_t Output)
/* Switch dynamically (while audio file is played) the output target (speaker or headphone).  */
uint32_t Codec_SwitchOutput(uint8_t Output)
{
  uint8_t counter = 0;
  switch (Output)
  {
  case OUTPUT_DEVICE_SPEAKER:
    counter += Codec_WriteRegister(0x04, 0xFA);
    OutputDev = 0xFA;
    break;
  case OUTPUT_DEVICE_HEADPHONE:
    counter += Codec_WriteRegister(0x04, 0xAF);
    OutputDev = 0xAF;
    break;
  case OUTPUT_DEVICE_BOTH:
    counter += Codec_WriteRegister(0x04, 0xAA);
    OutputDev = 0xAA;
    break;
  case OUTPUT_DEVICE_AUTO:
    counter += Codec_WriteRegister(0x04, 0x05);
    OutputDev = 0x05;
    break;
  default:
    counter += Codec_WriteRegister(0x04, 0x05);
    OutputDev = 0x05;
    break;
  }
  return counter;
}