ladybird/Libraries/LibAudio/AWavFile.h
Robin Burchell ffa8cb668f AudioServer: Assorted infrastructure work
* Add a LibAudio, and move WAV file parsing there (via AWavFile and AWavLoader)
* Add CLocalSocket, and CSocket::connect() variant for local address types.
  We make some small use of this in WindowServer (as that's where we
  modelled it from), but don't get too invasive as this PR is already
  quite large, and the WS I/O is a bit carefully done
* Add an AClientConnection which will eventually be used to talk to
  AudioServer (and make use of it in Piano, though right now it really
  doesn't do anything except connect, using our new CLocalSocket...)
2019-07-13 22:57:24 +02:00

32 lines
882 B
C++

#pragma once
#include <AK/RefCounted.h>
#include <AK/ByteBuffer.h>
#include <AK/Types.h>
class AWavFile : public RefCounted<AWavFile> {
public:
enum class Format {
Invalid,
PCM,
};
Format format() const { return m_format; }
u16 channel_count() const { return m_channel_count; }
u32 sample_rate_per_second() const { return m_sample_rate; }
u32 average_byte_rate_per_second() const { return m_byte_rate; }
u16 block_align() const { return m_block_align; }
u16 bits_per_sample() const { return m_bits_per_sample; }
const ByteBuffer& sample_data() const { return m_sample_data; }
private:
Format m_format = Format::Invalid;
u16 m_channel_count = 0;
u32 m_sample_rate = 0;
u32 m_byte_rate = 0;
u16 m_block_align = 0;
u16 m_bits_per_sample = 0;
ByteBuffer m_sample_data;
friend class AWavLoader;
};