PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

72 lines
2.5KB

  1. /* Audio Library for Teensy 3.X
  2. * Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com
  3. *
  4. * https://hackaday.io/project/5912-teensy-super-audio-board
  5. * https://github.com/whollender/Audio/tree/SuperAudioBoard
  6. *
  7. * Development of this audio library was funded by PJRC.COM, LLC by sales of
  8. * Teensy and Audio Adaptor boards. Please support PJRC's efforts to develop
  9. * open source software by purchasing Teensy or other PJRC products.
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a copy
  12. * of this software and associated documentation files (the "Software"), to deal
  13. * in the Software without restriction, including without limitation the rights
  14. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15. * copies of the Software, and to permit persons to whom the Software is
  16. * furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice, development funding notice, and this permission
  19. * notice shall be included in all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27. * THE SOFTWARE.
  28. */
  29. #ifndef control_cs4272_h_
  30. #define control_cs4272_h_
  31. #include "AudioControl.h"
  32. class AudioControlCS4272 : public AudioControl
  33. {
  34. public:
  35. bool enable(void);
  36. bool disable(void) { return false; }
  37. bool volume(float n) { return volumeInteger(n * 127 + 0.499); }
  38. bool inputLevel(float n) { return false; }
  39. bool inputSelect(int n) { return false; }
  40. bool volume(float left, float right);
  41. bool dacVolume(float n) { return volumeInteger(n * 127 + 0.499); }
  42. bool dacVolume(float left, float right);
  43. bool muteOutput(void);
  44. bool unmuteOutput(void);
  45. bool muteInput(void);
  46. bool unmuteInput(void);
  47. bool enableDither(void);
  48. bool disableDither(void);
  49. protected:
  50. bool write(unsigned int reg, unsigned int val);
  51. bool volumeInteger(unsigned int n); // range: 0x0 to 0x7F
  52. uint8_t regLocal[8];
  53. void initLocalRegs(void);
  54. };
  55. // For sample rate ratio select (only single speed tested)
  56. #define CS4272_RATIO_SINGLE 0
  57. #define CS4272_RATIO_DOUBLE 2
  58. #define CS4272_RATIO_QUAD 3
  59. #endif