1// Copyright 2017 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#pragma once 6 7#include <audio-utils/audio-stream.h> 8#include <zircon/types.h> 9 10#include "wav-common.h" 11 12class WAVSource : public WAVCommon, 13 public audio::utils::AudioSource { 14public: 15 WAVSource() { } 16 zx_status_t Initialize(const char* filename); 17 18 // AudioSource interface 19 zx_status_t GetFormat(AudioStream::Format* out_format) final; 20 zx_status_t GetFrames(void* buffer, uint32_t buf_space, uint32_t* out_packed) final; 21 bool finished() const final { return payload_played_ >= payload_len_; } 22 23private: 24 uint32_t payload_len_ = 0; 25 uint32_t payload_played_ = 0; 26 AudioStream::Format audio_format_; 27}; 28 29