loopback.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 "backends/loopback.h"
  22. #include "alcmain.h"
  23. #include "alu.h"
  24. namespace {
  25. struct LoopbackBackend final : public BackendBase {
  26. LoopbackBackend(ALCdevice *device) noexcept : BackendBase{device} { }
  27. void open(const ALCchar *name) override;
  28. bool reset() override;
  29. void start() override;
  30. void stop() override;
  31. DEF_NEWDEL(LoopbackBackend)
  32. };
  33. void LoopbackBackend::open(const ALCchar *name)
  34. {
  35. mDevice->DeviceName = name;
  36. }
  37. bool LoopbackBackend::reset()
  38. {
  39. setDefaultWFXChannelOrder();
  40. return true;
  41. }
  42. void LoopbackBackend::start()
  43. { }
  44. void LoopbackBackend::stop()
  45. { }
  46. } // namespace
  47. bool LoopbackBackendFactory::init()
  48. { return true; }
  49. bool LoopbackBackendFactory::querySupport(BackendType)
  50. { return true; }
  51. std::string LoopbackBackendFactory::probe(BackendType)
  52. { return std::string{}; }
  53. BackendPtr LoopbackBackendFactory::createBackend(ALCdevice *device, BackendType)
  54. { return BackendPtr{new LoopbackBackend{device}}; }
  55. BackendFactory &LoopbackBackendFactory::getFactory()
  56. {
  57. static LoopbackBackendFactory factory{};
  58. return factory;
  59. }