summaryrefslogtreecommitdiff
path: root/chromium/components/audio_modem/audio_player.h
blob: 53f838d77174a4d80a30fb39cebbb92c47375f0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_H_
#define COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_H_

#include <vector>

#include "base/macros.h"
#include "base/memory/ref_counted.h"

namespace media {
class AudioBusRefCounted;
}

namespace audio_modem {

// The AudioPlayerImpl class will play a set of samples till it is told to stop.
class AudioPlayer {
 public:
  // Initializes the object. Do not use this object before calling this method.
  virtual void Initialize() = 0;

  // Play the given samples. These samples will keep on being played in a loop
  // till we explicitly tell the player to stop playing. If we are already
  // playing, this call will be ignored.
  virtual void Play(
      const scoped_refptr<media::AudioBusRefCounted>& samples) = 0;

  // Stop playing. If we're already stopped, this call will be ignored.
  virtual void Stop() = 0;

  // Cleans up and deletes this object. Do not use object after this call.
  virtual void Finalize() = 0;

 protected:
  virtual ~AudioPlayer() {}
};

}  // namespace audio_modem

#endif  // COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_H_