CubebUtils.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* vim:set ts=2 sw=2 sts=2 et cindent: */
  3. /* This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. #if !defined(CubebUtils_h_)
  7. #define CubebUtils_h_
  8. #include "cubeb/cubeb.h"
  9. #include "mozilla/dom/AudioChannelBinding.h"
  10. #include "mozilla/Maybe.h"
  11. namespace mozilla {
  12. namespace CubebUtils {
  13. typedef cubeb_devid AudioDeviceID;
  14. // Initialize Audio Library. Some Audio backends require initializing the
  15. // library before using it.
  16. void InitLibrary();
  17. // Shutdown Audio Library. Some Audio backends require shutting down the
  18. // library after using it.
  19. void ShutdownLibrary();
  20. // Returns the maximum number of channels supported by the audio hardware.
  21. uint32_t MaxNumberOfChannels();
  22. // Get the sample rate the hardware/mixer runs at. Thread safe.
  23. uint32_t PreferredSampleRate();
  24. void PrefChanged(const char* aPref, void* aClosure);
  25. double GetVolumeScale();
  26. bool GetFirstStream();
  27. cubeb* GetCubebContext();
  28. cubeb* GetCubebContextUnlocked();
  29. uint32_t GetCubebPlaybackLatencyInMilliseconds();
  30. Maybe<uint32_t> GetCubebMSGLatencyInFrames();
  31. bool CubebLatencyPrefSet();
  32. void GetCurrentBackend(nsAString& aBackend);
  33. } // namespace CubebUtils
  34. } // namespace mozilla
  35. #endif // CubebUtils_h_