loopback.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /**
  2. * OpenAL cross platform audio library
  3. * Copyright (C) 2011 by Chris Robinson
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Library General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Library General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Library General Public
  15. * License along with this library; if not, write to the
  16. * Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. * Or go to http://www.gnu.org/copyleft/lgpl.html
  19. */
  20. #include "config.h"
  21. #include "loopback.h"
  22. #include "core/device.h"
  23. namespace {
  24. struct LoopbackBackend final : public BackendBase {
  25. LoopbackBackend(DeviceBase *device) noexcept : BackendBase{device} { }
  26. void open(std::string_view name) override;
  27. bool reset() override;
  28. void start() override;
  29. void stop() override;
  30. };
  31. void LoopbackBackend::open(std::string_view name)
  32. {
  33. mDevice->DeviceName = name;
  34. }
  35. bool LoopbackBackend::reset()
  36. {
  37. setDefaultWFXChannelOrder();
  38. return true;
  39. }
  40. void LoopbackBackend::start()
  41. { }
  42. void LoopbackBackend::stop()
  43. { }
  44. } // namespace
  45. bool LoopbackBackendFactory::init()
  46. { return true; }
  47. bool LoopbackBackendFactory::querySupport(BackendType)
  48. { return true; }
  49. auto LoopbackBackendFactory::enumerate(BackendType) -> std::vector<std::string>
  50. { return {}; }
  51. BackendPtr LoopbackBackendFactory::createBackend(DeviceBase *device, BackendType)
  52. { return BackendPtr{new LoopbackBackend{device}}; }
  53. BackendFactory &LoopbackBackendFactory::getFactory()
  54. {
  55. static LoopbackBackendFactory factory{};
  56. return factory;
  57. }