Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

59 lines
1.5KB

  1. #ifndef USBaudio_h_
  2. #define USBaudio_h_
  3. #include "usb_desc.h"
  4. #ifdef AUDIO_INTERFACE
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. extern uint16_t usb_audio_receive_buffer[];
  9. extern uint16_t usb_audio_transmit_buffer[];
  10. extern void usb_audio_receive_callback(unsigned int len);
  11. extern unsigned int usb_audio_transmit_callback(void);
  12. extern uint32_t usb_audio_sync_feedback;
  13. extern uint8_t usb_audio_receive_setting;
  14. extern uint8_t usb_audio_transmit_setting;
  15. #ifdef __cplusplus
  16. }
  17. #include "AudioStream.h"
  18. class AudioInputUSB : public AudioStream
  19. {
  20. public:
  21. AudioInputUSB(void) : AudioStream(0, NULL) { begin(); }
  22. virtual void update(void);
  23. void begin(void);
  24. friend void usb_audio_receive_callback(unsigned int len);
  25. private:
  26. static bool update_responsibility;
  27. static audio_block_t *incoming_left;
  28. static audio_block_t *incoming_right;
  29. static audio_block_t *ready_left;
  30. static audio_block_t *ready_right;
  31. static uint16_t incoming_count;
  32. static uint8_t receive_flag;
  33. };
  34. class AudioOutputUSB : public AudioStream
  35. {
  36. public:
  37. AudioOutputUSB(void) : AudioStream(2, inputQueueArray) { begin(); }
  38. virtual void update(void);
  39. void begin(void);
  40. friend unsigned int usb_audio_transmit_callback(void);
  41. private:
  42. static bool update_responsibility;
  43. static audio_block_t *left_1st;
  44. static audio_block_t *left_2nd;
  45. static audio_block_t *right_1st;
  46. static audio_block_t *right_2nd;
  47. static uint16_t offset_1st;
  48. audio_block_t *inputQueueArray[2];
  49. };
  50. #endif // __cplusplus
  51. #endif // AUDIO_INTERFACE
  52. #endif // USBaudio_h_