summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp/dev/audio_dev.cc
blob: c747c78b6947be225c3ba866cce0cee3ae264627 (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
// Copyright (c) 2010 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.

#include "ppapi/cpp/dev/audio_dev.h"

#include "ppapi/cpp/module_impl.h"

namespace {

DeviceFuncs<PPB_Audio_Dev> audio_f(PPB_AUDIO_DEV_INTERFACE);

}  // namespace

namespace pp {

Audio_Dev::Audio_Dev(const Instance& instance,
                     const AudioConfig_Dev& config,
                     PPB_Audio_Callback callback,
                     void* user_data)
    : config_(config) {
  if (audio_f) {
    PassRefFromConstructor(audio_f->Create(instance.pp_instance(),
                                           config.pp_resource(),
                                           callback, user_data));
  }
}

bool Audio_Dev::StartPlayback() {
  return audio_f && audio_f->StartPlayback(pp_resource());
}

bool Audio_Dev::StopPlayback() {
  return audio_f && audio_f->StopPlayback(pp_resource());
}

}  // namespace pp