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

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

Issue 13042015: Various OpenGLUI changes: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_ 5 #ifndef EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_
6 #define EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_ 6 #define EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
11 #include "embedders/openglui/common/sample.h" 11 #include "embedders/openglui/common/sample.h"
12 12
13 class SoundHandler { 13 class SoundHandler {
14 public: 14 public:
15 SoundHandler(); 15 SoundHandler();
vsm 2013/03/27 22:27:06 Do you want to make this constructor private? Is
16 16
17 virtual ~SoundHandler() { 17 virtual ~SoundHandler() {
18 } 18 }
19 19
20 virtual int32_t Start() { 20 virtual int32_t Start() {
21 return 0; 21 return 0;
22 } 22 }
23 23
24 virtual void Stop() { 24 virtual void Stop() {
25 } 25 }
(...skipping 12 matching lines...) Expand all
38 38
39 virtual void StopBackground() { 39 virtual void StopBackground() {
40 } 40 }
41 41
42 // Optional, for preloading. 42 // Optional, for preloading.
43 int32_t LoadSample(const char* path) { 43 int32_t LoadSample(const char* path) {
44 return (GetSample(path) == NULL) ? -1 : 0; 44 return (GetSample(path) == NULL) ? -1 : 0;
45 } 45 }
46 46
47 virtual int32_t PlaySample(const char* path) { 47 virtual int32_t PlaySample(const char* path) {
48 return 0; 48 // Just do a load so we can get logging.
49 return (GetSample(path) == NULL) ? -1 : 0;
49 } 50 }
50 51
51 static SoundHandler* instance() { 52 static SoundHandler* instance() {
53 if (instance_ == NULL) {
54 return new SoundHandler();
55 }
52 return instance_; 56 return instance_;
53 } 57 }
54 58
55 protected: 59 protected:
56 typedef std::vector<Sample*> samples_t; 60 typedef std::vector<Sample*> samples_t;
57 61
58 Sample* GetSample(const char* path); 62 Sample* GetSample(const char* path);
59 63
60 samples_t samples_; 64 samples_t samples_;
61 65
62 static SoundHandler* instance_; 66 static SoundHandler* instance_;
63 }; 67 };
64 68
65 int32_t PlayBackgroundSound(const char* path); 69 int32_t PlayBackgroundSound(const char* path);
66 void StopBackgroundSound(); 70 void StopBackgroundSound();
67 int32_t LoadSoundSample(const char* path); 71 int32_t LoadSoundSample(const char* path);
68 int32_t PlaySoundSample(const char* path); 72 int32_t PlaySoundSample(const char* path);
69 73
70 #endif // EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_ 74 #endif // EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_
71 75
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698