SampleFormats.h 654 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org>.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteString.h>
  8. #include <AK/Types.h>
  9. namespace Audio {
  10. // Supported PCM sample formats.
  11. enum class PcmSampleFormat : u8 {
  12. Uint8,
  13. Int16,
  14. Int24,
  15. Int32,
  16. Float32,
  17. Float64,
  18. };
  19. // Most of the read code only cares about how many bits to read or write
  20. u16 pcm_bits_per_sample(PcmSampleFormat format);
  21. bool is_integer_format(PcmSampleFormat format);
  22. Optional<PcmSampleFormat> integer_sample_format_for(u16 bits_per_sample);
  23. ByteString sample_format_name(PcmSampleFormat format);
  24. }