Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: runtime/embedders/openglui/common/sound_handler.cc

Issue 11883013: Refactored OpenGL embedder that works on Android, Mac or Linux. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "embedders/openglui/common/sound_handler.h"
6
7 #include <string.h>
8
9 #include "embedders/openglui/common/log.h"
10
11 SoundHandler* SoundHandler::instance_ = NULL;
12
13 SoundHandler::SoundHandler()
14 : samples_() {
15 }
16
17 Sample* SoundHandler::GetSample(const char* path) {
18 for (samples_t::iterator sp = samples_.begin();
19 sp != samples_.end();
20 ++sp) {
21 Sample* sample = (*sp);
22 if (strcmp(sample->path(), path) == 0) {
23 return sample;
24 }
25 }
26 Sample* sample = new Sample(path);
27 if (sample->Load() != 0) {
28 LOGI("Failed to load sample %s", path);
29 delete sample;
30 return NULL;
31 }
32 samples_.push_back(sample);
33 return sample;
34 }
35
36
37 int32_t PlayBackgroundSound(const char* path) {
38 return SoundHandler::instance()->PlayBackground(path);
39 }
40
41 void StopBackgroundSound() {
42 SoundHandler::instance()->StopBackground();
43 }
44
45 int32_t LoadSoundSample(const char* path) {
46 return SoundHandler::instance()->LoadSample(path);
47 }
48
49 int32_t PlaySoundSample(const char* path) {
50 return SoundHandler::instance()->PlaySample(path);
51 }
52
OLDNEW
« no previous file with comments | « runtime/embedders/openglui/common/sound_handler.h ('k') | runtime/embedders/openglui/common/timer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698