🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.0 KiB

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