IDeviceFactory.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*******************************************************************************
  2. * Copyright 2009-2016 Jörg Müller
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. ******************************************************************************/
  16. #pragma once
  17. /**
  18. * @file IDeviceFactory.h
  19. * @ingroup devices
  20. * The IDeviceFactory interface.
  21. */
  22. #include "respec/Specification.h"
  23. #include <memory>
  24. AUD_NAMESPACE_BEGIN
  25. /**
  26. * @interface IDeviceFactory
  27. * The IDeviceFactory interface opens an output device.
  28. */
  29. class AUD_API IDeviceFactory
  30. {
  31. public:
  32. /**
  33. * Opens an audio device for playback.
  34. * \exception Exception Thrown if the audio device cannot be opened.
  35. */
  36. virtual std::shared_ptr<IDevice> openDevice()=0;
  37. /**
  38. * Returns the priority of the device to be the default device for a system.
  39. * The higher the priority the more likely it is for this device to be used as the default device.
  40. * \return Priority to be the default device.
  41. */
  42. virtual int getPriority()=0;
  43. /**
  44. * Sets the wanted device specifications for opening the device.
  45. * \param specs The wanted audio specification.
  46. */
  47. virtual void setSpecs(DeviceSpecs specs)=0;
  48. /**
  49. * Sets the size for the internal playback buffers.
  50. * The bigger the buffersize, the less likely clicks happen,
  51. * but the latency increases too.
  52. * \param buffersize The size of the internal buffer.
  53. */
  54. virtual void setBufferSize(int buffersize)=0;
  55. /**
  56. * Sets a name for the device.
  57. * \param name The internal name for the device.
  58. */
  59. virtual void setName(std::string name)=0;
  60. };
  61. AUD_NAMESPACE_END