audio_opensles_device_impl.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 2012 Doubango Telecom <http://www.doubango.org>
  2. *
  3. * This file is part of Open Source Doubango Framework.
  4. *
  5. * DOUBANGO is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * DOUBANGO is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with DOUBANGO.
  17. */
  18. #ifndef _DOUBANGO_AUDIO_OPENSLES_SLDEVICE_IMPL_H
  19. #define _DOUBANGO_AUDIO_OPENSLES_SLDEVICE_IMPL_H
  20. #include "audio_opensles_config.h"
  21. #include "audio_opensles_device.h"
  22. class SLAudioDeviceCallbackImpl : public SLAudioDeviceCallback
  23. {
  24. public:
  25. SLAudioDeviceCallbackImpl();
  26. virtual ~SLAudioDeviceCallbackImpl();
  27. virtual int32_t RecordedDataIsAvailable(const void* audioSamples,
  28. const uint32_t nSamples,
  29. const uint8_t nBytesPerSample,
  30. const uint8_t nChannels,
  31. const uint32_t samplesPerSec);
  32. virtual int32_t NeedMorePlayData(const uint32_t nSamples,
  33. const uint8_t nBytesPerSample,
  34. const uint8_t nChannels,
  35. const uint32_t samplesPerSec,
  36. void* audioSamples,
  37. uint32_t& nSamplesOut);
  38. inline void SetConsumer(const struct audio_consumer_opensles_s* pConsumer) {
  39. m_pConsumer = pConsumer;
  40. }
  41. inline void SetProducer(const struct audio_producer_opensles_s* pProducer) {
  42. m_pProducer = pProducer;
  43. }
  44. private:
  45. const struct audio_consumer_opensles_s* m_pConsumer; // mut be const and must not take reference
  46. const struct audio_producer_opensles_s* m_pProducer; // mut be const and must not take reference
  47. };
  48. #endif /* _DOUBANGO_AUDIO_OPENSLES_SLDEVICE_IMPL_H */