2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
7 * Unless required by applicable law or agreed to in writing, software
8 * distributed under the License is distributed on an "AS IS" BASIS,
9 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 * See the License for the specific language governing permissions and
11 * limitations under the License.
15 #ifndef __TTSD_AUDIO_OUT_H_
16 #define __TTSD_AUDIO_OUT_H_
21 #include <sound_manager.h>
30 AUDIO_STATE_WAIT_FOR_PLAYING,
34 typedef void (*focusReleaseCallback)();
36 AudioStream(focusReleaseCallback focusReleaseCb);
39 int setAudioFormat(ttse_audio_type_e type, int rate);
40 int acquireSoundFocus(const char* extra_info);
41 int releaseSoundFocus();
42 int prepareAudioOut();
43 int unprepareAudioOut();
45 AudioState getState();
46 int playAudioData(char* buffer, unsigned int length);
49 static void __focusStateChangedCallback(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask,
50 sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason_for_change, int sound_behavior, const char *extra_info,
53 int createAudioHandle(ttse_audio_type_e type, int rate);
54 void destroyAudioHandle();
56 void createSoundStreamInfo();
57 void destroySoundStreamInfo();
60 audio_out_h __audioHandle;
61 ttse_audio_type_e __audioType;
65 sound_stream_info_h __streamInfo;
66 focusReleaseCallback __focusReleaseCallback;
67 std::string __currentExtraInfo;
74 #endif /* __TTSD_AUDIO_OUT_H_ */