OLD | NEW |
(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 #ifndef EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_ |
| 6 #define EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "embedders/openglui/common/sample.h" |
| 12 |
| 13 class SoundHandler { |
| 14 public: |
| 15 SoundHandler(); |
| 16 |
| 17 virtual ~SoundHandler() { |
| 18 } |
| 19 |
| 20 virtual int32_t Start() { |
| 21 return 0; |
| 22 } |
| 23 |
| 24 virtual void Stop() { |
| 25 } |
| 26 |
| 27 virtual int32_t PlayBackground(const char* path) { |
| 28 return 0; |
| 29 } |
| 30 |
| 31 virtual void StopBackground() { |
| 32 } |
| 33 |
| 34 // Optional, for preloading. |
| 35 int32_t LoadSample(const char* path) { |
| 36 return (GetSample(path) == NULL) ? -1 : 0; |
| 37 } |
| 38 |
| 39 virtual int32_t PlaySample(const char* path) { |
| 40 return 0; |
| 41 } |
| 42 |
| 43 static SoundHandler* instance() { |
| 44 return instance_; |
| 45 } |
| 46 |
| 47 protected: |
| 48 typedef std::vector<Sample*> samples_t; |
| 49 |
| 50 Sample* GetSample(const char* path); |
| 51 |
| 52 samples_t samples_; |
| 53 |
| 54 static SoundHandler* instance_; |
| 55 }; |
| 56 |
| 57 int32_t PlayBackgroundSound(const char* path); |
| 58 void StopBackgroundSound(); |
| 59 int32_t LoadSoundSample(const char* path); |
| 60 int32_t PlaySoundSample(const char* path); |
| 61 |
| 62 #endif // EMBEDDERS_OPENGLUI_COMMON_SOUND_HANDLER_H_ |
| 63 |
OLD | NEW |