6c8c1ccabf2659ae5c9c5a7aee4411e3b9d559a3
[platform/core/api/audio-io.git] / src / audio_io_deprecated.c
1 /*
2 * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18 #include <cpp_audio_io.h>
19 #include <dlog.h>
20
21 #ifdef LOG_TAG
22 #undef LOG_TAG
23 #endif
24 #define LOG_TAG "TIZEN_N_AUDIO_IO"
25
26 typedef enum {
27         AUDIO_IO_INTERRUPTED_COMPLETED = 0,         /**< Interrupt completed */
28         AUDIO_IO_INTERRUPTED_BY_MEDIA,              /**< Interrupted by a media application */
29         AUDIO_IO_INTERRUPTED_BY_CALL,               /**< Interrupted by an incoming call */
30         AUDIO_IO_INTERRUPTED_BY_EARJACK_UNPLUG,     /**< Interrupted by unplugging headphones */
31         AUDIO_IO_INTERRUPTED_BY_RESOURCE_CONFLICT,  /**< Interrupted by a resource conflict */
32         AUDIO_IO_INTERRUPTED_BY_ALARM,              /**< Interrupted by an alarm */
33         AUDIO_IO_INTERRUPTED_BY_EMERGENCY,          /**< Interrupted by an emergency */
34         AUDIO_IO_INTERRUPTED_BY_NOTIFICATION,       /**< Interrupted by a notification */
35 } audio_io_interrupted_code_e;
36
37 typedef void (*audio_io_interrupted_cb)(audio_io_interrupted_code_e code, void *user_data);
38
39 #define DEPRECATED_WARN() do { \
40    LOGW("DEPRECATION WARNING: %s() is deprecated", __func__); \
41 } while (0)
42
43 #define DEPRECATED_WARN_INSTEAD(msg) do { \
44    LOGW("DEPRECATION WARNING: %s() is deprecated. Use %s() instead.", __func__, msg); \
45 } while (0)
46
47 int audio_out_create(int sample_rate, audio_channel_e channel, audio_sample_type_e type, sound_type_e sound_type, audio_out_h* output)
48 {
49         DEPRECATED_WARN_INSTEAD("audio_out_create_new");
50
51         /* ignore sound_type, treat this stream as media type */
52         return cpp_audio_out_create_new(sample_rate, channel, type, output);
53 }
54
55 int audio_out_set_interrupted_cb(audio_out_h output, audio_io_interrupted_cb callback, void *user_data)
56 {
57         DEPRECATED_WARN_INSTEAD("sound_manager_create_stream_information");
58
59         /* dummy, do nothing */
60         return AUDIO_IO_ERROR_NONE;
61 }
62
63