| OLD | NEW |
| 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_ANDROID_ANDROID_SOUND_HANDLER_H_ | 5 #ifndef EMBEDDERS_OPENGLUI_ANDROID_ANDROID_SOUND_HANDLER_H_ |
| 6 #define EMBEDDERS_OPENGLUI_ANDROID_ANDROID_SOUND_HANDLER_H_ | 6 #define EMBEDDERS_OPENGLUI_ANDROID_ANDROID_SOUND_HANDLER_H_ |
| 7 | 7 |
| 8 #include <android_native_app_glue.h> | 8 #include <android_native_app_glue.h> |
| 9 #include <SLES/OpenSLES.h> | 9 #include <SLES/OpenSLES.h> |
| 10 #include <SLES/OpenSLES_Android.h> | 10 #include <SLES/OpenSLES_Android.h> |
| 11 #include <SLES/OpenSLES_AndroidConfiguration.h> | 11 #include <SLES/OpenSLES_AndroidConfiguration.h> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "embedders/openglui/common/sample.h" | 14 #include "embedders/openglui/common/sample.h" |
| 15 #include "embedders/openglui/common/sound_handler.h" | 15 #include "embedders/openglui/common/sound_handler.h" |
| 16 #include "embedders/openglui/common/types.h" | 16 #include "embedders/openglui/common/types.h" |
| 17 | 17 |
| 18 class AndroidSoundHandler : public SoundHandler { | 18 class AndroidSoundHandler : public SoundHandler { |
| 19 public: | 19 public: |
| 20 explicit AndroidSoundHandler(android_app* application); | 20 explicit AndroidSoundHandler(android_app* application); |
| 21 int32_t Start(); | 21 int32_t Start(); |
| 22 void Stop(); | 22 void Stop(); |
| 23 int32_t Pause(); |
| 24 int32_t Resume(); |
| 23 | 25 |
| 24 int32_t PlayBackground(const char* path); | 26 int32_t PlayBackground(const char* path); |
| 25 void StopBackground(); | 27 void StopBackground(); |
| 26 | 28 |
| 27 int32_t PlaySample(const char* path); | 29 int32_t PlaySample(const char* path); |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 int32_t CreateAudioPlayer(SLEngineItf engine_if, | 32 int32_t CreateAudioPlayer(SLEngineItf engine_if, |
| 31 const SLInterfaceID extra_if, | 33 const SLInterfaceID extra_if, |
| 32 SLDataSource data_source, | 34 SLDataSource data_source, |
| 33 SLDataSink data_sink, | 35 SLDataSink data_sink, |
| 34 SLObjectItf& player_out, | 36 SLObjectItf& player_out, |
| 35 SLPlayItf& player_if_out); | 37 SLPlayItf& player_if_out); |
| 36 | 38 |
| 39 int32_t SetBackgroundPlayerState(int state); |
| 37 int32_t StartSamplePlayer(); | 40 int32_t StartSamplePlayer(); |
| 38 | 41 |
| 39 android_app* application_; | 42 android_app* application_; |
| 40 SLObjectItf engine_; | 43 SLObjectItf engine_; |
| 41 SLEngineItf engine_if_; | 44 SLEngineItf engine_if_; |
| 42 SLObjectItf output_mix_; | 45 SLObjectItf output_mix_; |
| 43 SLObjectItf background_player_; | 46 SLObjectItf background_player_; |
| 44 SLPlayItf background_player_if_; | 47 SLPlayItf background_player_if_; |
| 45 SLSeekItf background_player_seek_if_; | 48 SLSeekItf background_player_seek_if_; |
| 46 SLObjectItf sample_player_; | 49 SLObjectItf sample_player_; |
| 47 SLPlayItf sample_player_if_; | 50 SLPlayItf sample_player_if_; |
| 48 SLBufferQueueItf sample_player_queue_; | 51 SLBufferQueueItf sample_player_queue_; |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 #endif // EMBEDDERS_OPENGLUI_ANDROID_ANDROID_SOUND_HANDLER_H_ | 54 #endif // EMBEDDERS_OPENGLUI_ANDROID_ANDROID_SOUND_HANDLER_H_ |
| 52 | 55 |
| OLD | NEW |