[AUDIO_PROVIDER_SOUND_SERVER] = {
.bus_name = "org.tizen.SoundServer",
.object = "/org/tizen/SoundServer1",
- .interface ="org.tizen.SoundServer1"
+ .interface = "org.tizen.SoundServer1"
},
[AUDIO_PROVIDER_FOCUS_SERVER] = {
.bus_name = "org.tizen.FocusServer",
};
/* Only For error types which is currently being used in server-side */
-static const GDBusErrorEntry mm_sound_error_entries[] =
-{
+static const GDBusErrorEntry mm_sound_error_entries[] = {
{MM_ERROR_OUT_OF_MEMORY, "org.tizen.multimedia.OutOfMemory"},
{MM_ERROR_OUT_OF_STORAGE, "org.tizen.multimedia.OutOfStorage"},
{MM_ERROR_INVALID_ARGUMENT, "org.tizen.multimedia.InvalidArgument"},
debug_error("error name is [%s]", err_name);
for (i = 0; i < G_N_ELEMENTS(mm_sound_error_entries); i++) {
- if (!strcmp(mm_sound_error_entries[i].dbus_error_name, err_name)) {
+ if (!strcmp(mm_sound_error_entries[i].dbus_error_name, err_name))
return mm_sound_error_entries[i].error_code;
- }
}
return MM_ERROR_COMMON_UNKNOWN;
debug_log("Get new connection on system bus");
conn_system = g_bus_get_sync(bustype, NULL, &err);
if (!conn_system || err) {
- debug_error ("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
+ debug_error("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
g_error_free(err);
return NULL;
}
debug_log("Get new connection on session bus");
conn_session = g_bus_get_sync(bustype, NULL, &err);
if (!conn_session || err) {
- debug_error ("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
+ debug_error("g_dbus_get_sync() error (%s)", err ? err->message : NULL);
g_error_free(err);
return NULL;
}
debug_log("Signal(%s.%s) Received, Let's call Wrapper-Callback", interface_name, signal_name);
- if (!strcmp(signal_name, g_events[AUDIO_EVENT_VOLUME_CHANGED].name)) {
+ if (!strcmp(signal_name, g_events[AUDIO_EVENT_VOLUME_CHANGED].name))
(cb_data->user_cb)(AUDIO_EVENT_VOLUME_CHANGED, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_CONNECTED].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_CONNECTED].name))
(cb_data->user_cb)(AUDIO_EVENT_DEVICE_CONNECTED, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_INFO_CHANGED].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_INFO_CHANGED].name))
(cb_data->user_cb)(AUDIO_EVENT_DEVICE_INFO_CHANGED, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_STATE_CHANGED].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_STATE_CHANGED].name))
(cb_data->user_cb)(AUDIO_EVENT_DEVICE_STATE_CHANGED, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_CHANGED].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_CHANGED].name))
(cb_data->user_cb)(AUDIO_EVENT_FOCUS_CHANGED, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_WATCH].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_WATCH].name))
(cb_data->user_cb)(AUDIO_EVENT_FOCUS_WATCH, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_PLAY_FILE_END].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_PLAY_FILE_END].name))
(cb_data->user_cb)(AUDIO_EVENT_PLAY_FILE_END, params, cb_data->user_data);
- } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_EMERGENT_EXIT].name)) {
+ else if (!strcmp(signal_name, g_events[AUDIO_EVENT_EMERGENT_EXIT].name))
(cb_data->user_cb)(AUDIO_EVENT_EMERGENT_EXIT, params, cb_data->user_data);
- }
}
static void callback_data_free_func(gpointer data)
return MM_ERROR_SOUND_INTERNAL;
}
- dbus_ret = g_dbus_connection_emit_signal (conn,
+ dbus_ret = g_dbus_connection_emit_signal(conn,
NULL, g_paths[provider].object,
g_paths[provider].interface, g_events[event].name,
param, &err);
if (!dbus_ret || err) {
- debug_error ("g_dbus_connection_emit_signal() error (%s)", err ? err->message : NULL);
+ debug_error("g_dbus_connection_emit_signal() error (%s)", err ? err->message : NULL);
g_error_free(err);
return MM_ERROR_SOUND_INTERNAL;
}
/* Get volume value from VCONF */
if (vconf_get_int(g_volume_vconf[type], &vconf_value)) {
- debug_error ("vconf_get_int(%s) failed..\n", g_volume_vconf[type]);
+ debug_error("vconf_get_int(%s) failed..\n", g_volume_vconf[type]);
return MM_ERROR_SOUND_INTERNAL;
}
if (ret == -1) {
if (errno == ENOENT) {
- debug_warning ("/proc/%d not exist", pid);
+ debug_warning("/proc/%d not exist", pid);
return false;
} else {
- debug_error ("/proc/%d access errno[%d]", pid, errno);
+ debug_error("/proc/%d access errno[%d]", pid, errno);
/* FIXME: error occured but file exists */
return true;
#include "../include/mm_sound_stream.h"
#include "mm_sound_mgr_focus_ipc.h"
-typedef enum
-{
+typedef enum {
FOCUS_COMMAND_RELEASE,
FOCUS_COMMAND_ACQUIRE,
} focus_command_e;
-typedef enum
-{
+typedef enum {
FOCUS_TYPE_PLAYBACK = 1,
FOCUS_TYPE_CAPTURE,
FOCUS_TYPE_BOTH,
} focus_type_e;
-typedef enum
-{
+typedef enum {
FOCUS_STATUS_DEACTIVATED,
FOCUS_STATUS_ACTIVATED_PLAYBACK,
FOCUS_STATUS_ACTIVATED_CAPTURE,
bool is_for_monitor;
} _mm_sound_mgr_focus_param_t;
-typedef struct _taken_by_id
-{
+typedef struct _taken_by_id {
int pid;
int handle_id;
bool by_session;
#define USE_SYSTEM_SERVER_PROCESS_MONITORING
typedef struct {
- int startserver;
- int printlist;
- int testmode;
+ int startserver;
+ int printlist;
+ int testmode;
} server_arg;
static int _get_option(int argc, char **argv, server_arg *arg);
static void _mainloop_run()
{
g_mainloop = g_main_loop_new(NULL, TRUE);
- if (g_mainloop == NULL) {
+ if (g_mainloop == NULL)
debug_error("g_main_loop_new() failed");
- }
g_main_loop_run(g_mainloop);
}
c = getopt_long (argc, argv, "SFLHRUP:Tiurd", long_options, &opt_idx);
if (c == -1)
break;
- switch (c)
- {
+ switch (c) {
case 'S': /* Start daemon */
arg->startserver = 1;
break;
_signal_initialize();
- if (serveropt.startserver) {
+ if (serveropt.startserver)
sem = _sem_create_n_wait();
- }
+
/* Daemon process create */
if (!serveropt.testmode && serveropt.startserver) {
#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
- daemon(0,0); //chdir to ("/"), and close stdio
+ daemon(0, 0); //chdir to ("/"), and close stdio
#endif
}
unlink(PA_READY); // remove pa_ready file after focus-server init.
if (sem) {
- if (sem_post(sem) == -1) {
+ if (sem_post(sem) == -1)
debug_error("error sem post : %d", errno);
- } else {
+ else
debug_msg("Ready to play booting sound!!!!");
- }
}
/* FIXME : This code is moved from sound_server temporally for TV migration
this code will be removed */
/* broadcast if we're ready */
#ifdef USE_LWIPC
- if (LwipcEventDone(SOUND_SERVER_READY) < 0) {
+ if (LwipcEventDone(SOUND_SERVER_READY) < 0)
debug_error("cannot create SOUND_SERVER_READY(sound_server_ready)");
- } else {
+ else
debug_warning("SOUND_SERVER_READY(%s) event was created", SOUND_SERVER_READY);
- }
#else
_generate_ready_file(SOUND_SERVER_READY);
#endif
((x_node)->is_for_session != (x_param)->is_for_session)) \
continue; \
-static char* __get_focus_pipe_path(int instance_id, int handle, const char* postfix, bool is_watch)
+static char* __get_focus_pipe_path(int instance_id, int handle, const char *postfix, bool is_watch)
{
gchar* path = NULL;
gchar* path2 = NULL;
- if (is_watch) {
+ if (is_watch)
path = g_strdup_printf("/tmp/FOCUS.%d.%d.wch", instance_id, handle);
- } else {
+ else
path = g_strdup_printf("/tmp/FOCUS.%d.%d", instance_id, handle);
- }
if (postfix) {
path2 = g_strconcat(path, postfix, NULL);
debug_error("[RETCB] failed to get watch return pipe");
goto RELEASE;
}
- if ((fd_FOCUS_R = open(filename2, O_RDONLY|O_NONBLOCK)) == -1) {
+ if ((fd_FOCUS_R = open(filename2, O_RDONLY | O_NONBLOCK)) == -1) {
char str_error[256];
strerror_r(errno, str_error, sizeof(str_error));
debug_error("[RETCB] failed to open watch return pipe (%s, err:%s)", filename2, str_error);
} else {
/* client will gain the lost focus */
for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
- if ((victim_node->taken_by_id[i].pid == assaulter_param->pid) && ((victim_node->taken_by_id[i].handle_id == assaulter_param->handle_id) || victim_node->taken_by_id[i].by_session)) {
- flag_for_focus_type |= i+1; /* playback:1, capture:2 */
+ if ((victim_node->taken_by_id[i].pid == assaulter_param->pid) &&
+ ((victim_node->taken_by_id[i].handle_id == assaulter_param->handle_id) || victim_node->taken_by_id[i].by_session)) {
+ flag_for_focus_type |= i + 1; /* playback:1, capture:2 */
}
}
cb_data.type = flag_for_focus_type & assaulter_param->request_type;
res = -1;
goto RELEASE;
}
- if ((fd_FOCUS_R = open(filename2, O_RDONLY|O_NONBLOCK)) == -1) {
+ if ((fd_FOCUS_R = open(filename2, O_RDONLY | O_NONBLOCK)) == -1) {
char str_error[256];
strerror_r(errno, str_error, sizeof(str_error));
debug_error("[RETCB] failed to open return pipe (%s, err:%s)", filename2, str_error);
pfd.fd = fd_FOCUS_R;
pfd.events = POLLIN;
pfd.revents = 0;
- debug_msg("[RETCB] wait CALLBACK (client pid=%d, handle=%d, cmd=%d, timeout=%d(ms))", cb_data.pid, cb_data.handle, command, CALLBACK_TIMEOUT);
+ debug_msg("[RETCB] wait CALLBACK (client pid=%d, handle=%d, cmd=%d, timeout=%d(ms))",
+ cb_data.pid, cb_data.handle, command, CALLBACK_TIMEOUT);
pret = poll(&pfd, 1, CALLBACK_TIMEOUT);
if (pret < 0) {
debug_error("[RETCB] poll failed (%d)", pret);
for (list = g_focus_node_list; list != NULL; list = list->next) {
if ((node = (focus_node_t *)list->data) && !node->is_for_watch) {
debug_msg("*** pid[%5d]/handle_id[%2d]/[%14s]:priority[%2d],status[%s],taken_by[P(%5d/%2d/%2d)C(%5d/%2d/%2d)],session[%d],option[0x%x/0x%x],ext_info[%s/%s]",
- node->pid, node->handle_id, node->stream_type, node->priority, focus_status_str[node->status],
- node->taken_by_id[0].pid, node->taken_by_id[0].handle_id, node->taken_by_id[0].by_session, node->taken_by_id[1].pid,
- node->taken_by_id[1].handle_id, node->taken_by_id[1].by_session, node->is_for_session, node->option[0], node->option[1], node->ext_info[0], node->ext_info[1]);
+ node->pid, node->handle_id, node->stream_type, node->priority, focus_status_str[node->status],
+ node->taken_by_id[0].pid, node->taken_by_id[0].handle_id, node->taken_by_id[0].by_session,
+ node->taken_by_id[1].pid, node->taken_by_id[1].handle_id, node->taken_by_id[1].by_session,
+ node->is_for_session,
+ node->option[0], node->option[1],
+ node->ext_info[0], node->ext_info[1]);
}
}
debug_msg("================================================ focus node list : end =====================================================");
for (list = g_focus_node_list; list != NULL; list = list->next) {
if ((node = (focus_node_t *)list->data) && node->is_for_watch)
debug_msg("*** pid[%5d]/handle_id[%d]/watch on focus status[%s]/for_session[%d]/for_monitor[%d]",
- node->pid, node->handle_id, focus_status_str[node->status], node->is_for_session, node->is_for_monitor);
+ node->pid, node->handle_id, focus_status_str[node->status], node->is_for_session, node->is_for_monitor);
}
debug_msg("============================================= focus watch node list : end ===================================================");
/* get priority from stream type */
ret = _mm_sound_mgr_focus_get_priority_from_stream_type(&priority, param->stream_type);
- if (ret) {
+ if (ret)
goto FINISH;
- }
+
node = g_malloc0(sizeof(focus_node_t));
/* fill up information to the node */
if (my_node->taken_by_id[i].pid) {
/* If exists update the taken focus info to my victim node */
- if (node->taken_by_id[i].by_session && !node->status) {
+ if (node->taken_by_id[i].by_session && !node->status)
UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, my_node->taken_by_id[i].by_session);
- } else if (node->taken_by_id[i].handle_id == param->handle_id) {
+ else if (node->taken_by_id[i].handle_id == param->handle_id)
UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, false);
- }
} else if (my_node->status & (i+1)) {
if (node->is_for_session)
continue;
int index = (focus_type == FOCUS_TYPE_BOTH) ? FOCUS_TYPE_PLAYBACK - 1 : focus_type - 1;
debug_msg("found a node : request_focus_type(%d), stream_type(%s)/ext info(%s) of acquired focus",
- focus_type, node->stream_type, node->ext_info[index]);
+ focus_type, node->stream_type, node->ext_info[index]);
*stream_type = node->stream_type;
*option = node->option[index];
/* do callback for resumption */
if ((ret = _mm_sound_mgr_focus_do_callback(FOCUS_COMMAND_ACQUIRE, node, param_s)))
debug_error("Fail to _focus_do_callback for COMMAND ACQUIRE to node[%x], ret[0x%x]", node, ret);
- if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN)) {
+ if (!strncmp(my_node->stream_type, node->stream_type, MAX_STREAM_TYPE_LEN))
need_to_trigger_watch_cb = false;
- }
+
need_to_trigger_monitor_cb = false;
}
}
CONTINUE_IF_LIST_DATA_IS_NULL(src_node, list);
if ((src_node->pid == param->pid) && (src_node->handle_id == param->handle_id)) {
debug_log("SRC: found the node of pid[%d]/handle_id[%d] for watch focus",
- param->pid, param->handle_id);
+ param->pid, param->handle_id);
break;
}
}
if (src_node == NULL) {
debug_error("could not find the source node of param, pid[%d]/handle_id[%d]",
- param->pid, param->handle_id);
+ param->pid, param->handle_id);
ret = MM_ERROR_INVALID_ARGUMENT;
goto FINISH;
}
if (!(src_node->status & param->request_type)) {
debug_error("invalid request type(0x%x), src_node->status(0x%x)",
- param->request_type, src_node->status);
+ param->request_type, src_node->status);
ret = MM_ERROR_SOUND_INVALID_STATE;
goto FINISH;
}
CONTINUE_IF_LIST_DATA_IS_NULL(dst_node, list);
if ((dst_node->pid == param->pid) && (dst_node->handle_id == param->handle_id_dst)) {
debug_log("DST: found the destination node of param, pid[%d]/handle_id[%d]",
- param->pid, param->handle_id_dst);
+ param->pid, param->handle_id_dst);
break;
}
}
if (dst_node == NULL) {
debug_error("could not find the destination node of param, pid[%d]/handle_id[%d]",
- param->pid, param->handle_id_dst);
+ param->pid, param->handle_id_dst);
ret = MM_ERROR_INVALID_ARGUMENT;
goto FINISH;
}
if ((node->taken_by_id[i].pid == src_node->pid) &&
(node->taken_by_id[i].handle_id == src_node->handle_id) &&
(node->taken_by_id[i].by_session == false)) {
- debug_log("found the node that focus was taken by this src node, update it",
- node->pid, node->handle_id);
+ debug_log("found the node pid[%d]/handle_id[%d] that focus was taken by this src node, update it",
+ node->pid, node->handle_id);
UPDATE_FOCUS_TAKEN_INFO(by_id, node, dst_node->pid, dst_node->handle_id, false);
}
if ((node->taken_backup[i].pid == src_node->pid) &&
(node->taken_backup[i].handle_id == src_node->handle_id) &&
(node->taken_backup[i].by_session == false)) {
- debug_log("found the node that focus was taken by this src node and set reacquisition to false, update it",
- node->pid, node->handle_id);
+ debug_log("found the node pid[%d]/handle_id[%d] that focus was taken by this src node and set reacquisition to false, update it",
+ node->pid, node->handle_id);
UPDATE_FOCUS_TAKEN_INFO(backup, node, dst_node->pid, dst_node->handle_id, false);
}
}
CONTINUE_IF_LIST_DATA_IS_NULL(node, list_s);
for (i = 0; i < NUM_OF_STREAM_IO_TYPE; i++) {
if (node->taken_by_id[i].pid == param->pid) {
- if (my_node->taken_by_id[i].pid) {
+ if (my_node->taken_by_id[i].pid)
UPDATE_FOCUS_TAKEN_INFO(by_id, node, my_node->taken_by_id[i].pid, my_node->taken_by_id[i].handle_id, my_node->taken_by_id[i].by_session);
- } else {
+ else
UPDATE_FOCUS_TAKEN_INFO(by_id, node, 0, 0, false);
- }
}
}
}
debug_fenter();
for (i = 0; i < AVAIL_STREAMS_MAX; i++) {
- if (g_stream_list.stream_types[i]) {
+ if (g_stream_list.stream_types[i])
free(g_stream_list.stream_types[i]);
- }
}
debug_fleave();
/* Introspection data for the service we are exporting */
static const gchar introspection_xml[] =
- "<node>"
- " <interface name='org.tizen.FocusServer1'>"
- " <method name='GetUniqueId'>"
- " <arg name='id' type='i' direction='out'/>"
- " </method>"
- " <method name='RegisterFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='stream_type' type='s' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " </method>"
- " <method name='UnregisterFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " </method>"
- " <method name='SetFocusReacquisition'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='reacquisition' type='b' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " </method>"
- " <method name='GetAcquiredFocusStreamType'>"
- " <arg name='focus_type' type='i' direction='in'/>"
- " <arg name='stream_type' type='s' direction='out'/>"
- " <arg name='option' type='i' direction='out'/>"
- " <arg name='ext_info' type='s' direction='out'/>"
- " </method>"
- " <method name='AcquireFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='focus_type' type='i' direction='in'/>"
- " <arg name='option' type='i' direction='in'/>"
- " <arg name='ext_info' type='s' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " </method>"
- " <method name='ReleaseFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='focus_type' type='i' direction='in'/>"
- " <arg name='option' type='i' direction='in'/>"
- " <arg name='ext_info' type='s' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " </method>"
- " <method name='WatchFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='focus_type' type='i' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " <arg name='is_for_monitor' type='b' direction='in'/>"
- " </method>"
- " <method name='UnwatchFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='handle_id' type='i' direction='in'/>"
- " <arg name='is_for_session' type='b' direction='in'/>"
- " </method>"
- " <method name='DeliverFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " <arg name='src_handle_id' type='i' direction='in'/>"
- " <arg name='dst_handle_id' type='i' direction='in'/>"
- " <arg name='focus_type' type='i' direction='in'/>"
- " </method>"
- " <method name='EmergentExitFocus'>"
- " <arg name='pid' type='i' direction='in'/>"
- " </method>"
- " </interface>"
- "</node>";
+ "<node>"
+ " <interface name='org.tizen.FocusServer1'>"
+ " <method name='GetUniqueId'>"
+ " <arg name='id' type='i' direction='out'/>"
+ " </method>"
+ " <method name='RegisterFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='stream_type' type='s' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " </method>"
+ " <method name='UnregisterFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " </method>"
+ " <method name='SetFocusReacquisition'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='reacquisition' type='b' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " </method>"
+ " <method name='GetAcquiredFocusStreamType'>"
+ " <arg name='focus_type' type='i' direction='in'/>"
+ " <arg name='stream_type' type='s' direction='out'/>"
+ " <arg name='option' type='i' direction='out'/>"
+ " <arg name='ext_info' type='s' direction='out'/>"
+ " </method>"
+ " <method name='AcquireFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='focus_type' type='i' direction='in'/>"
+ " <arg name='option' type='i' direction='in'/>"
+ " <arg name='ext_info' type='s' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " </method>"
+ " <method name='ReleaseFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='focus_type' type='i' direction='in'/>"
+ " <arg name='option' type='i' direction='in'/>"
+ " <arg name='ext_info' type='s' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " </method>"
+ " <method name='WatchFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='focus_type' type='i' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " <arg name='is_for_monitor' type='b' direction='in'/>"
+ " </method>"
+ " <method name='UnwatchFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='handle_id' type='i' direction='in'/>"
+ " <arg name='is_for_session' type='b' direction='in'/>"
+ " </method>"
+ " <method name='DeliverFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " <arg name='src_handle_id' type='i' direction='in'/>"
+ " <arg name='dst_handle_id' type='i' direction='in'/>"
+ " <arg name='focus_type' type='i' direction='in'/>"
+ " </method>"
+ " <method name='EmergentExitFocus'>"
+ " <arg name='pid' type='i' direction='in'/>"
+ " </method>"
+ " </interface>"
+ "</node>";
static GDBusConnection* conn_g;
typedef void (*dbus_method_handler)(GDBusMethodInvocation *invocation);
typedef int (*dbus_signal_sender)(GDBusConnection *conn, GVariant *parameter);
-struct mm_sound_mgr_focus_dbus_method{
+struct mm_sound_mgr_focus_dbus_method {
struct mm_sound_dbus_method_info info;
- dbus_method_handler handler;
+ dbus_method_handler handler;
};
-struct mm_sound_mgr_focus_dbus_signal{
+struct mm_sound_mgr_focus_dbus_signal {
struct mm_sound_dbus_signal_info info;
dbus_signal_sender sender;
};
unsigned emergent_exit_subs_id;
/*
- For pass error code with 'g_dbus_method_invocation_return_error'
- We have to use some glib features like GError, GQuark
+ For pass error code with 'g_dbus_method_invocation_return_error'
+ We have to use some glib features like GError, GQuark
*/
/* Only For error types which is currently being used in server-side */
-static const GDBusErrorEntry mm_sound_error_entries[] =
-{
+static const GDBusErrorEntry mm_sound_error_entries[] = {
{MM_ERROR_OUT_OF_MEMORY, "org.tizen.multimedia.OutOfMemory"},
{MM_ERROR_OUT_OF_STORAGE, "org.tizen.multimedia.OutOfStorage"},
{MM_ERROR_INVALID_ARGUMENT, "org.tizen.multimedia.InvalidArgument"},
int i = 0;
for (i = 0; i < G_N_ELEMENTS(mm_sound_error_entries); i++) {
- if (err_code == mm_sound_error_entries[i].error_code) {
+ if (err_code == mm_sound_error_entries[i].error_code)
return mm_sound_error_entries[i].dbus_error_name;
- }
}
return "org.tizen.multimedia.common.Unknown";
ret = __mm_sound_mgr_focus_ipc_register_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id, stream_type, is_for_session);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = __mm_sound_mgr_focus_ipc_unregister_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id, is_for_session);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = __mm_sound_mgr_focus_ipc_set_focus_reacquisition(_get_sender_pid(invocation), handle_id, reacquisition, is_for_session);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
g_variant_get(params, "(iiiisb)", &pid, &handle_id, &focus_type, &option, &ext_info, &is_for_session);
ret = __mm_sound_mgr_focus_ipc_acquire_focus((is_for_session) ? pid : _get_sender_pid(invocation),
- handle_id, focus_type, option, ext_info, false, is_for_session);
+ handle_id, focus_type, option, ext_info, false, is_for_session);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
g_variant_get(params, "(iiiisb)", &pid, &handle_id, &focus_type, &option, &ext_info, &is_for_session);
ret = __mm_sound_mgr_focus_ipc_release_focus((is_for_session) ? pid : _get_sender_pid(invocation),
- handle_id, focus_type, option, ext_info, false, is_for_session);
+ handle_id, focus_type, option, ext_info, false, is_for_session);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = __mm_sound_mgr_focus_ipc_watch_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id, focus_type, is_for_session, is_for_monitor);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = __mm_sound_mgr_focus_ipc_unwatch_focus((is_for_session) ? pid : _get_sender_pid(invocation), handle_id);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = __mm_sound_mgr_focus_ipc_deliver_focus(pid, src_handle_id, dst_handle_id, focus_type);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
debug_msg("Method Call, obj : %s, intf : %s, method : %s", object_path, interface_name, method_name);
for (method_idx = AUDIO_METHOD_GET_UNIQUE_ID; method_idx < AUDIO_METHOD_MAX; method_idx++) {
- if (!g_strcmp0(method_name, methods[method_idx].info.name)) {
+ if (!g_strcmp0(method_name, methods[method_idx].info.name))
methods[method_idx].handler(invocation);
- }
}
}
debug_fleave();
}
-static const GDBusInterfaceVTable interface_vtable =
-{
+static const GDBusInterfaceVTable interface_vtable = {
handle_method_call,
handle_get_property,
handle_set_property
static void _mm_sound_mgr_focus_dbus_unown_name(guint oid)
{
debug_msg("Unown name for focus-server [%d]", oid);
- if (oid > 0) {
+ if (oid > 0)
g_bus_unown_name(oid);
- }
}
#define PA_BUS_NAME "org.pulseaudio.Server"
debug_fenter();
ret = __mm_sound_mgr_focus_ipc_acquire_focus(param->pid, param->handle_id, param->focus_type,
- param->option, param->ext_info, true, param->is_for_session);
+ param->option, param->ext_info, true, param->is_for_session);
debug_fleave();
debug_fenter();
ret = __mm_sound_mgr_focus_ipc_release_focus(param->pid, param->handle_id, param->focus_type,
- param->option, param->ext_info, true, param->is_for_session);
+ param->option, param->ext_info, true, param->is_for_session);
debug_fleave();
debug_error("failed to write(), err: %s", str_error);
}
} else {
- debug_error("failed to read(), read size mismatched, rval(%d), expect size(%d)", rval,sizeof(_mm_sound_mgr_focus_socket_param_t));
+ debug_error("failed to read(), read size mismatched, rval(%d), expect size(%d)",
+ rval, sizeof(_mm_sound_mgr_focus_socket_param_t));
}
close(accepted_fd);
if (g_focus_work_thread_id) {
unlink(FOCUS_SERVER_SOCK);
- shutdown(fd,SHUT_RDWR);
+ shutdown(fd, SHUT_RDWR);
close(fd);
pthread_join(g_focus_work_thread_id, NULL);
debug_msg("pthread join well");
* @brief Enumerations of supporting source_type
*/
typedef enum {
- SUPPORT_SOURCE_TYPE_DEFAULT,
- SUPPORT_SOURCE_TYPE_MIRRORING,
- SUPPORT_SOURCE_TYPE_VOICECONTROL,
- SUPPORT_SOURCE_TYPE_SVR,
- SUPPORT_SOURCE_TYPE_VIDEOCALL,
- SUPPORT_SOURCE_TYPE_VOICERECORDING,
- SUPPORT_SOURCE_TYPE_VOIP, /* Supporting VoIP source*/
- SUPPORT_SOURCE_TYPE_CALL_FORWARDING,
- SUPPORT_SOURCE_TYPE_FMRADIO,
- SUPPORT_SOURCE_TYPE_LOOPBACK,
+ SUPPORT_SOURCE_TYPE_DEFAULT,
+ SUPPORT_SOURCE_TYPE_MIRRORING,
+ SUPPORT_SOURCE_TYPE_VOICECONTROL,
+ SUPPORT_SOURCE_TYPE_SVR,
+ SUPPORT_SOURCE_TYPE_VIDEOCALL,
+ SUPPORT_SOURCE_TYPE_VOICERECORDING,
+ SUPPORT_SOURCE_TYPE_VOIP, /* Supporting VoIP source*/
+ SUPPORT_SOURCE_TYPE_CALL_FORWARDING,
+ SUPPORT_SOURCE_TYPE_FMRADIO,
+ SUPPORT_SOURCE_TYPE_LOOPBACK,
} mm_sound_source_type_e;
/**
*
* @param type [in] volume type to set change callback function
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark None.
* @pre Callback function should be registered previously for given volume type.
/**
* This function is to remove volume change callback.
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
- * with error code.
+ * @return This function returns MM_ERROR_NONE on success, or negative value
+ * with error code.
**/
int mm_sound_remove_volume_changed_callback(unsigned int id);
* @param type [in] volume type to set value.
* @param value [in] volume value.
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark value should be 0 ~ MAX
* @see mm_sound_volume_get_value volume_type_t
* @param type [in] volume type to get value.
* @param value [out] volume value.
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark None.
* @pre None.
*
* @param type [in] volume type to set as primary volume type.
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark Application should use this function during foreground.
* @pre None.
* @param filter_parameters [in] extra filter parameters(optional)
* @param filter_group [in] extra filter group(optional)
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark None
* @pre None
*
* @param stream_type [in] stream type to remove
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark None
* @pre None
* @param filter_name [in] specify filter module to apply
* @param filter_controls [in] filter control parameters(e.g, "0.0, 0.1, 3.0")
*
- * @return This function returns MM_ERROR_NONE on success, or negative value
+ * @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark None
* @pre None
* Terminate callback function type.
*
* @param data [in] Argument passed when callback was set
- * @param id [in] handle which has completed playing
+ * @param id [in] handle which has completed playing
*
* @return No return value
* @remark It is not allowed to call MMSound API recursively or do time-consuming
* @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
* @remark This function is almost same with mm_sound_play_sound,
- * but this make other audio playback stream to mute during playing time.
+ * but this make other audio playback stream to mute during playing time.
* @see mm_sound_stop_sound mm_sound_stop_callback_func volume_type_t volume_gain_t
* @pre None.
* @post Sound will be generated with given filename.
typedef enum {
MM_SOUND_TONE_DTMF_0 = 0, /**< Predefined DTMF 0 */
- MM_SOUND_TONE_DTMF_1, /**< Predefined DTMF 1 */
+ MM_SOUND_TONE_DTMF_1, /**< Predefined DTMF 1 */
MM_SOUND_TONE_DTMF_2, /**< Predefined DTMF 2 */
MM_SOUND_TONE_DTMF_3, /**< Predefined DTMF 3 */
MM_SOUND_TONE_DTMF_4, /**< Predefined DTMF 4 */
MM_SOUND_TONE_DTMF_7, /**< Predefined DTMF 7 */
MM_SOUND_TONE_DTMF_8, /**< Predefined DTMF 8 */
MM_SOUND_TONE_DTMF_9, /**< Predefined DTMF 9 */
- MM_SOUND_TONE_DTMF_S, /**< Predefined DTMF Star - Asterisk (*) */
+ MM_SOUND_TONE_DTMF_S, /**< Predefined DTMF Star - Asterisk (*) */
MM_SOUND_TONE_DTMF_P, /**< Predefined DTMF sharP (#) */
MM_SOUND_TONE_DTMF_A, /**< Predefined DTMF A (A) */
MM_SOUND_TONE_DTMF_B, /**< Predefined DTMF B (B) */
MM_SOUND_TONE_DTMF_D, /**< Predefined DTMF D (D) */
/**< Pre-defined TONE */
- MM_SOUND_TONE_SUP_DIAL, /**Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */
+ MM_SOUND_TONE_SUP_DIAL, /**Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */
MM_SOUND_TONE_ANSI_DIAL, /**Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous */
MM_SOUND_TONE_JAPAN_DIAL, /**Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous*/
MM_SOUND_TONE_SUP_BUSY, /**Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF... */
- MM_SOUND_TONE_ANSI_BUSY, /**Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */
- MM_SOUND_TONE_JAPAN_BUSY, /**Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/
- MM_SOUND_TONE_SUP_CONGESTION, /**Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */
+ MM_SOUND_TONE_ANSI_BUSY, /**Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */
+ MM_SOUND_TONE_JAPAN_BUSY, /**Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/
+ MM_SOUND_TONE_SUP_CONGESTION, /**Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */
MM_SOUND_TONE_ANSI_CONGESTION, /**Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... */
MM_SOUND_TONE_SUP_RADIO_ACK, /**Call supervisory tone, Radio path acknowlegment : CEPT, ANSI: 425Hz, 200ms ON */
MM_SOUND_TONE_JAPAN_RADIO_ACK, /**Call supervisory tone, Radio path acknowlegment : JAPAN: 400Hz, 1s ON, 2s OFF...*/
MM_SOUND_TONE_SUP_RINGTONE, /**Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... */
MM_SOUND_TONE_ANSI_RINGTONE, /**Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... */
MM_SOUND_TONE_PROP_BEEP, /**General beep: 400Hz+1200Hz, 35ms ON */
- MM_SOUND_TONE_PROP_ACK, /**Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts */
- MM_SOUND_TONE_PROP_NACK, /**Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON */
- MM_SOUND_TONE_PROP_PROMPT, /**Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON */
- MM_SOUND_TONE_PROP_BEEP2, /**Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */
- MM_SOUND_TONE_SUP_INTERCEPT, /**Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */
+ MM_SOUND_TONE_PROP_ACK, /**Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts */
+ MM_SOUND_TONE_PROP_NACK, /**Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON */
+ MM_SOUND_TONE_PROP_PROMPT, /**Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON */
+ MM_SOUND_TONE_PROP_BEEP2, /**Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */
+ MM_SOUND_TONE_SUP_INTERCEPT, /**Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */
MM_SOUND_TONE_SUP_INTERCEPT_ABBREV, /**Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds */
- MM_SOUND_TONE_SUP_CONGESTION_ABBREV, /**Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */
- MM_SOUND_TONE_SUP_CONFIRM, /**Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle */
- MM_SOUND_TONE_SUP_PIP, /**Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */
- MM_SOUND_TONE_CDMA_DIAL_TONE_LITE, /**425Hz continuous */
- MM_SOUND_TONE_CDMA_NETWORK_USA_RINGBACK, /**CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/
- MM_SOUND_TONE_CDMA_INTERCEPT, /**CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/
- MM_SOUND_TONE_CDMA_ABBR_INTERCEPT, /**CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */
- MM_SOUND_TONE_CDMA_REORDER, /**CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */
- MM_SOUND_TONE_CDMA_ABBR_REORDER, /**CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */
- MM_SOUND_TONE_CDMA_NETWORK_BUSY, /**CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */
- MM_SOUND_TONE_CDMA_CONFIRM, /**CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */
- MM_SOUND_TONE_CDMA_ANSWER, /**CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF */
- MM_SOUND_TONE_CDMA_NETWORK_CALLWAITING, /**CDMA Network Callwaiting tone: 440Hz 300ms ON */
- MM_SOUND_TONE_CDMA_PIP, /**CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL, /**ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP, /**ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.*/
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI, /**ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT3, /**SDN Call sign PAT3 tone: silent tone */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING, /**ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT5, /**ISDN Pat5 tone: silent tone */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT6, /**ISDN Pat6 tone: silent tone */
- MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT7, /**ISDN Pat7 tone: silent tone */
- MM_SOUND_TONE_CDMA_HIGH_L, /**TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */
- MM_SOUND_TONE_CDMA_MED_L, /**TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */
- MM_SOUND_TONE_CDMA_LOW_L, /**TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */
- MM_SOUND_TONE_CDMA_HIGH_SS, /**CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
- MM_SOUND_TONE_CDMA_MED_SS, /**CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
- MM_SOUND_TONE_CDMA_LOW_SS, /**CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
- MM_SOUND_TONE_CDMA_HIGH_SSL, /**CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
- MM_SOUND_TONE_CDMA_MED_SSL, /**CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
- MM_SOUND_TONE_CDMA_LOW_SSL, /**CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
- MM_SOUND_TONE_CDMA_HIGH_SS_2, /**CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat .... */
- MM_SOUND_TONE_CDMA_MED_SS_2, /**CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat .... */
- MM_SOUND_TONE_CDMA_LOW_SS_2, /**CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat .... */
- MM_SOUND_TONE_CDMA_HIGH_SLS, /**CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT */
- MM_SOUND_TONE_CDMA_MED_SLS, /**CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT */
- MM_SOUND_TONE_CDMA_LOW_SLS, /**CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT */
- MM_SOUND_TONE_CDMA_HIGH_S_X4, /**CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_MED_S_X4, /**CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_LOW_S_X4, /**CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....*/
- MM_SOUND_TONE_CDMA_HIGH_PBX_L, /**CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_MED_PBX_L, /**CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_LOW_PBX_L, /**CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_HIGH_PBX_SS, /**CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_MED_PBX_SS, /**CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_LOW_PBX_SS, /**CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_HIGH_PBX_SSL, /**CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_MED_PBX_SSL, /**CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_LOW_PBX_SSL, /**CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_HIGH_PBX_SLS, /**CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_MED_PBX_SLS, /**CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_LOW_PBX_SLS, /**CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
- MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4, /**CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... */
- MM_SOUND_TONE_CDMA_MED_PBX_S_X4, /**CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... */
- MM_SOUND_TONE_CDMA_LOW_PBX_S_X4, /**CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... */
- MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE, /**CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */
- MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE, /**CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */
- MM_SOUND_TONE_CDMA_ONE_MIN_BEEP, /**CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */
- MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE, /**CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */
- MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE, /**CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */
- MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE, /**CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms*/
- MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK, /**CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */
- MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD, /**CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */
- MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE, /**CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */
- MM_SOUND_TONE_CDMA_CALLDROP_LITE, /**CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */
- MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT, /**CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */
- MM_SOUND_TONE_CDMA_ABBR_ALERT, /**CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */
+ MM_SOUND_TONE_SUP_CONGESTION_ABBREV, /**Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */
+ MM_SOUND_TONE_SUP_CONFIRM, /**Call supervisory tone (IS-95), confirm tone: a 350 Hz tone added to a 440 Hz tone repeated 3 times in a 100 ms on, 100 ms off cycle */
+ MM_SOUND_TONE_SUP_PIP, /**Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */
+ MM_SOUND_TONE_CDMA_DIAL_TONE_LITE, /**425Hz continuous */
+ MM_SOUND_TONE_CDMA_NETWORK_USA_RINGBACK, /**CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/
+ MM_SOUND_TONE_CDMA_INTERCEPT, /**CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/
+ MM_SOUND_TONE_CDMA_ABBR_INTERCEPT, /**CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */
+ MM_SOUND_TONE_CDMA_REORDER, /**CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */
+ MM_SOUND_TONE_CDMA_ABBR_REORDER, /**CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */
+ MM_SOUND_TONE_CDMA_NETWORK_BUSY, /**CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */
+ MM_SOUND_TONE_CDMA_CONFIRM, /**CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */
+ MM_SOUND_TONE_CDMA_ANSWER, /**CDMA answer tone: silent tone - defintion Frequency 0, 0ms ON, 0ms OFF */
+ MM_SOUND_TONE_CDMA_NETWORK_CALLWAITING, /**CDMA Network Callwaiting tone: 440Hz 300ms ON */
+ MM_SOUND_TONE_CDMA_PIP, /**CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL, /**ISDN Call Signal Normal tone: {2091Hz 32ms ON, 2556 64ms ON} 20 times, 2091 32ms ON, 2556 48ms ON, 4s OFF */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP, /**ISDN Call Signal Intergroup tone: {2091Hz 32ms ON, 2556 64ms ON} 8 times, 2091Hz 32ms ON, 400ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 8times, 2091Hz 32ms ON, 4s OFF.*/
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI, /**ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT3, /**SDN Call sign PAT3 tone: silent tone */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING, /**ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT5, /**ISDN Pat5 tone: silent tone */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT6, /**ISDN Pat6 tone: silent tone */
+ MM_SOUND_TONE_CDMA_CALL_SIGNAL_ISDN_PAT7, /**ISDN Pat7 tone: silent tone */
+ MM_SOUND_TONE_CDMA_HIGH_L, /**TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */
+ MM_SOUND_TONE_CDMA_MED_L, /**TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */
+ MM_SOUND_TONE_CDMA_LOW_L, /**TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */
+ MM_SOUND_TONE_CDMA_HIGH_SS, /**CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_MED_SS, /**CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_LOW_SS, /**CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_HIGH_SSL, /**CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+ MM_SOUND_TONE_CDMA_MED_SSL, /**CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+ MM_SOUND_TONE_CDMA_LOW_SSL, /**CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ... */
+ MM_SOUND_TONE_CDMA_HIGH_SS_2, /**CDMA HIGH SS2 tone: {3700Hz 25ms, 4000Hz 25ms} 20 times, 1000ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_MED_SS_2, /**CDMA MED SS2 tone: {2600Hz 25ms, 2900Hz 25ms} 20 times, 1000ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_LOW_SS_2, /**CDMA LOW SS2 tone: {1300Hz 25ms, 1450Hz 25ms} 20 times, 1000ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 3000ms OFF, repeat .... */
+ MM_SOUND_TONE_CDMA_HIGH_SLS, /**CDMA HIGH SLS tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 20 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+ MM_SOUND_TONE_CDMA_MED_SLS, /**CDMA MED SLS tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 20 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+ MM_SOUND_TONE_CDMA_LOW_SLS, /**CDMA LOW SLS tone: {1300Hz 25ms, 1450Hz 25ms} 10 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 20 times, 500ms OFF, {1300Hz 25ms, 1450Hz 25ms} 10 times, 3000ms OFF, REPEAT */
+ MM_SOUND_TONE_CDMA_HIGH_S_X4, /**CDMA HIGH S X4 tone: {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 500ms OFF, {3700Hz 25ms, 4000Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_S_X4, /**CDMA MED S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_S_X4, /**CDMA LOW S X4 tone: {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 500ms OFF, {2600Hz 25ms, 2900Hz 25ms} 10 times, 2500ms OFF, REPEAT....*/
+ MM_SOUND_TONE_CDMA_HIGH_PBX_L, /**CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_L, /**CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_L, /**CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_SS, /**CDMA HIGH PBX SS tone: {3700Hz 25ms, 4000Hz 25ms} 8 times 200 ms OFF, {3700Hz 25ms 4000Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_SS, /**CDMA MED PBX SS tone: {2600Hz 25ms, 2900Hz 25ms} 8 times 200 ms OFF, {2600Hz 25ms 2900Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_SS, /**CDMA LOW PBX SS tone: {1300Hz 25ms, 1450Hz 25ms} 8 times 200 ms OFF, {1300Hz 25ms 1450Hz 25ms}8 times, 2000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_SSL, /**CDMA HIGH PBX SSL tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_SSL, /**CDMA MED PBX SSL tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_SSL, /**CDMA LOW PBX SSL tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_SLS, /**CDMA HIGH PBX SLS tone:{3700Hz 25ms, 4000Hz 25ms} 8 times 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 16 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_MED_PBX_SLS, /**CDMA MED PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_SLS, /**CDMA LOW PBX SLS tone:{1300Hz 25ms, 1450Hz 25ms} 8 times 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 16 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} 8 times, 1000ms OFF, REPEAT.... */
+ MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4, /**CDMA HIGH PBX X S4 tone: {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms 4000Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_MED_PBX_S_X4, /**CDMA MED PBX X S4 tone: {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms 2900Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_LOW_PBX_S_X4, /**CDMA LOW PBX X S4 tone: {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms 1450Hz 25ms} 8 times, 800ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE, /**CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */
+ MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE, /**CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */
+ MM_SOUND_TONE_CDMA_ONE_MIN_BEEP, /**CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */
+ MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE, /**CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */
+ MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE, /**CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */
+ MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE, /**CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms*/
+ MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK, /**CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */
+ MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD, /**CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */
+ MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE, /**CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */
+ MM_SOUND_TONE_CDMA_CALLDROP_LITE, /**CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */
+ MM_SOUND_TONE_CDMA_NETWORK_BUSY_ONE_SHOT, /**CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */
+ MM_SOUND_TONE_CDMA_ABBR_ALERT, /**CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */
MM_SOUND_TONE_CDMA_SIGNAL_OFF, /**CDMA_SIGNAL_OFF - silent tone */
MM_SOUND_TONE_LOW_FRE, /**100Hz continuous */
MM_SOUND_TONE_MED_FRE, /**200Hz continuous */
MM_SOUND_TONE_HIGH_FRE, /**300Hz continuous */
MM_SOUND_TONE_NUM,
-}MMSoundTone_t;
+} MMSoundTone_t;
typedef unsigned long sound_time_msec_t; /**< millisecond unit */
* This function is to play tone sound.
*
* @param num [in] predefined tone type (MMSoundTone_t)
- * volume config [in] volume type & volume gain
+ * volume config [in] volume type & volume gain
* volume [in] volume ratio (0.0 ~1.0)
- * duration [in] millisecond (-1 for infinite)
+ * duration [in] millisecond (-1 for infinite)
* handle [in] Handle of mm_sound_play_tone
* enable_session [in] set enable/unable session
*
}
* @endcode
*/
-int mm_sound_play_tone_ex (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session);
+int mm_sound_play_tone_ex(MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle, bool enable_session);
/**
* This function is to play tone sound.
*
* @param num [in] predefined tone type (MMSoundTone_t)
- * volume config [in] volume type & volume gain
+ * volume config [in] volume type & volume gain
* volume [in] volume ratio (0.0 ~1.0)
- * duration [in] millisecond (-1 for infinite)
+ * duration [in] millisecond (-1 for infinite)
* handle [in] Handle of mm_sound_play_tone
*
* @return This function returns MM_ERROR_NONE on success, or negative value
}
* @endcode
*/
-int mm_sound_play_tone (MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle);
+int mm_sound_play_tone(MMSoundTone_t num, int volume_config, const double volume, const int duration, int *handle);
int mm_sound_play_tone_with_stream_info(MMSoundTone_t tone, char *stream_type, int stream_id, const double volume, const int duration, int *handle);
* Enumerations of device & route
*/
-typedef enum{
+typedef enum {
MM_SOUND_DIRECTION_NONE,
MM_SOUND_DIRECTION_IN, /**< Capture */
MM_SOUND_DIRECTION_OUT, /**< Playback */
} mm_sound_direction;
-typedef enum{
+typedef enum {
MM_SOUND_DEVICE_IN_NONE = 0x00,
MM_SOUND_DEVICE_IN_MIC = 0x01, /**< Device builtin mic. */
MM_SOUND_DEVICE_IN_WIRED_ACCESSORY = 0x02, /**< Wired input devices */
MM_SOUND_DEVICE_IN_BT_SCO = 0x08, /**< Bluetooth SCO device */
} mm_sound_device_in;
-typedef enum{
+typedef enum {
MM_SOUND_DEVICE_OUT_NONE = 0x000,
MM_SOUND_DEVICE_OUT_SPEAKER = 0x001<<8, /**< Device builtin speaker */
MM_SOUND_DEVICE_OUT_RECEIVER = 0x002<<8, /**< Device builtin receiver */
MM_SOUND_DEVICE_OUT_BT_A2DP = 0x010<<8, /**< Bluetooth A2DP device */
MM_SOUND_DEVICE_OUT_DOCK = 0x020<<8, /**< DOCK device */
MM_SOUND_DEVICE_OUT_HDMI = 0x040<<8, /**< HDMI device */
- MM_SOUND_DEVICE_OUT_MIRRORING = 0x080<<8, /**< MIRRORING device */
+ MM_SOUND_DEVICE_OUT_MIRRORING = 0x080<<8, /**< MIRRORING device */
MM_SOUND_DEVICE_OUT_USB_AUDIO = 0x100<<8, /**< USB Audio device */
MM_SOUND_DEVICE_OUT_MULTIMEDIA_DOCK = 0x200<<8, /**< Multimedia DOCK device */
} mm_sound_device_out;
MM_SOUND_DEVICE_STATE_ACTIVATED,
} mm_sound_device_state_e;
-typedef enum
-{
+typedef enum {
MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER, /**< Built-in speaker. */
MM_SOUND_DEVICE_TYPE_BUILTIN_RECEIVER, /**< Built-in receiver. */
MM_SOUND_DEVICE_TYPE_BUILTIN_MIC, /**< Built-in mic. */
int mm_sound_free_device_list(MMSoundDeviceList_t device_list);
/* Use this only for the device handle which got from mm_sound_get_device_by_id */
int mm_sound_free_device(MMSoundDevice_t device_h);
-int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
-int mm_sound_get_prev_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
+int mm_sound_get_next_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
+int mm_sound_get_prev_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
int mm_sound_get_device_type(MMSoundDevice_t device_h, mm_sound_device_type_e *type);
int mm_sound_get_device_io_direction(MMSoundDevice_t device_h, mm_sound_device_io_direction_e *io_direction);
int mm_sound_get_device_id(MMSoundDevice_t device_h, int *id);
#define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
#define MMSOUND_ENTER_CRITICAL_SECTION(x_mutex) \
-switch ( pthread_mutex_lock( x_mutex ) ) \
-{ \
+switch (pthread_mutex_lock(x_mutex)) { \
case EINVAL: \
debug_warning("try mutex init.."); \
- if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
+ if (0 > pthread_mutex_init(x_mutex, NULL)) { \
return; \
} else { \
break; \
return; \
}
-#define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex,x_return) \
-switch ( pthread_mutex_lock( x_mutex ) ) \
-{ \
+#define MMSOUND_ENTER_CRITICAL_SECTION_WITH_RETURN(x_mutex, x_return) \
+switch (pthread_mutex_lock(x_mutex)) { \
case EINVAL: \
debug_warning("try mutex init.."); \
- if( 0 > pthread_mutex_init( x_mutex, NULL) ) { \
+ if (0 > pthread_mutex_init(x_mutex, NULL)) { \
return x_return; \
} else { \
break; \
}
#define MMSOUND_LEAVE_CRITICAL_SECTION(x_mutex) \
-if( pthread_mutex_unlock( x_mutex ) ) { \
+if (pthread_mutex_unlock(x_mutex)) { \
debug_error("mutex unlock failed"); \
}
strncpy(dst, src, size - 1); \
dst[size - 1] = '\0';\
} \
-} while(0)
+} while (0)
#endif /* __MM_SOUND_COMMON_H__ */
typedef void (*dbus_method_handler)(GDBusMethodInvocation *invocation);
typedef int (*dbus_signal_sender)(GDBusConnection *conn, GVariant *parameter);
-typedef struct mm_sound_dbus_method_info{
+typedef struct mm_sound_dbus_method_info {
const char* name;
/*
const char* argument;
*/
} mm_sound_dbus_method_info_t;
-typedef struct mm_sound_dbus_signal_info{
+typedef struct mm_sound_dbus_signal_info {
const char* name;
const char* argument;
} mm_sound_dbus_signal_info_t;
DEVICE_CHANGED_INFO_IO_DIRECTION,
} device_changed_info_e;
-typedef enum
-{
+typedef enum {
DEVICE_UPDATE_STATUS_DISCONNECTED = 0,
DEVICE_UPDATE_STATUS_CONNECTED,
DEVICE_UPDATE_STATUS_CHANGED_INFO_STATE,
DEVICE_UPDATE_STATUS_CHANGED_INFO_IO_DIRECTION,
} device_update_status_e;
-typedef enum
-{
+typedef enum {
DEVICE_TYPE_BUILTIN_SPEAKER, /**< Built-in speaker. */
DEVICE_TYPE_BUILTIN_RECEIVER, /**< Built-in receiver. */
DEVICE_TYPE_BUILTIN_MIC, /**< Built-in mic. */
HANDLE_MODE_OUTPUT_AP_CALL, /**< for VT call on thin modem */
HANDLE_MODE_INPUT_AP_CALL, /**< for VT call on thin modem */
HANDLE_MODE_NUM, /**< Number of mode */
-}MMSoundHandleMode;
+} MMSoundHandleMode;
int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec* ss, pa_channel_map* channel_map, int* size, char *stream_type, int stream_index);
int mm_sound_pa_write(const int handle, void* buf, const int size);
#endif
/**
- @internal
+ @internal
@addtogroup SOUND_PRIVATE
@{
- */
+*/
#define MM_SOUND_VOLUME_CONFIG_TYPE(vol) (vol & 0x00FF)
* with error code.
*
* @remark This function provide low latency sound play (such as dialer keytone)
- * using fixed spec of wave file (44100Hz, mono channel)
+ * using fixed spec of wave file (44100Hz, mono channel)
* @see volume_type_t volume_gain_t mm_sound_volume_set_value
*/
int mm_sound_play_keysound(const char *filename, int volume_config);
char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
} ipc_t;
-#define MMSOUND_STRNCPY(dst,src,size)\
+#define MMSOUND_STRNCPY(dst, src, size) \
do { \
- if(src != NULL && dst != NULL && size > 0) {\
- strncpy(dst,src,size-1); \
- dst[size-1] = '\0';\
- } else if(dst == NULL) { \
+ if (src != NULL && dst != NULL && size > 0) { \
+ strncpy(dst, src, size - 1); \
+ dst[size - 1] = '\0'; \
+ } else if (dst == NULL) { \
debug_error("STRNCPY ERROR: Destination String is NULL"); \
- } \
- else if(size <= 0) { \
+ } \
+ else if (size <= 0) { \
debug_error("STRNCPY ERROR: Destination String is NULL"); \
- } \
- else { \
+ } \
+ else { \
debug_error("STRNCPY ERROR: Destination String is NULL"); \
- } \
-} while(0)
+ } \
+} while (0)
EXPORT_API
int mm_sound_boot_ready(int timeout_sec)
sem_t* sem = NULL;
debug_msg("[BOOT] check for sync....");
- if ((sem = sem_open ("booting-sound", O_CREAT, 0660, 0))== SEM_FAILED) {
- debug_error ("error creating sem : %d", errno);
+ if ((sem = sem_open("booting-sound", O_CREAT, 0660, 0)) == SEM_FAILED) {
+ debug_error("error creating sem : %d", errno);
return -1;
}
int err = 0;
int fd = -1;
int size = 0;
- ipc_t data = {{0,},{0,},{0,}};
+ ipc_t data = { { 0, }, { 0, }, { 0, } };
debug_msg("[BOOT] play boot sound [%s]!!!!", path);
if (path == NULL)
void* user_data;
} focus_session_interrupt_info_t;
-typedef gboolean (*focus_callback_handler_t)(gpointer user_data);
+typedef gboolean(*focus_callback_handler_t)(gpointer user_data);
focus_sound_info_t g_focus_sound_handle[FOCUS_HANDLE_MAX];
focus_session_interrupt_info_t g_focus_session_interrupt_info = {-1, NULL, NULL};
ret = mm_sound_proxy_add_play_sound_end_callback(_mm_sound_stop_callback_wrapper_func, cb_data,
play_end_callback_data_free_func, &end_cb_data->subs_id);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
debug_error("Add callback for play sound(%d) Failed", *handle);
- }
}
#ifdef USE_FOCUS
if (!param->skip_session && !g_focus_signal_handle) {
ret = mm_sound_proxy_add_play_sound_end_callback(_mm_sound_stop_callback_wrapper_func, cb_data,
play_end_callback_data_free_func, &end_cb_data->subs_id);
- if (ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE)
debug_error("Add callback for play sound(%d) Failed", *handle);
- }
}
failed:
{
int ret = MM_ERROR_NONE;
- if (!volume_type_str) {
+ if (!volume_type_str)
return MM_ERROR_COMMON_INVALID_ARGUMENT;
- }
switch (volume_type) {
case VOLUME_TYPE_SYSTEM:
{
int ret = MM_ERROR_NONE;
- if (!volume_type || !volume_type_str) {
+ if (!volume_type || !volume_type_str)
return MM_ERROR_COMMON_INVALID_ARGUMENT;
- }
if (!strncmp(volume_type_str, "system", VOLUME_TYPE_LEN)) {
*volume_type = VOLUME_TYPE_SYSTEM;
g_focus_sound_handle[index].handle);
}
pre_mask = umask(0);
- if (mknod(filename, S_IFIFO|0666, 0)) {
+ if (mknod(filename, S_IFIFO|0666, 0))
debug_error("mknod() failure, errno(%d)", errno);
- }
umask(pre_mask);
g_focus_sound_handle[index].focus_fd = open(filename, O_RDWR|O_NONBLOCK);
if (g_focus_sound_handle[index].focus_fd == -1) {
g_focus_sound_handle[index].handle);
}
pre_mask = umask(0);
- if (mknod(filename2, S_IFIFO | 0666, 0)) {
+ if (mknod(filename2, S_IFIFO | 0666, 0))
debug_error("mknod() failure, errno(%d)", errno);
- }
umask(pre_mask);
g_free(filename2);
filename2 = NULL;
_focus_init_callback(index, false);
cleanup:
- if (ret) {
+ if (ret)
g_focus_sound_handle[index].is_used = false;
- }
MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
debug_fleave();
if (!g_mutex_trylock(&g_focus_sound_handle[index].focus_lock)) {
debug_warning("maybe focus_callback is being called, try one more time..");
usleep(2500000); // 2.5 sec
- if (g_mutex_trylock(&g_focus_sound_handle[index].focus_lock)) {
+ if (g_mutex_trylock(&g_focus_sound_handle[index].focus_lock))
debug_msg("finally got focus_lock");
- }
}
ret = mm_sound_proxy_unregister_focus(instance, id, g_focus_sound_handle[index].is_for_session);
_focus_init_callback(index, true);
cleanup:
- if (ret) {
+ if (ret)
g_focus_sound_handle[index].is_used = false;
- }
MMSOUND_LEAVE_CRITICAL_SECTION(&g_index_mutex);
debug_fleave();
mm_sound_device_list_t g_device_list;
pthread_mutex_t g_thread_mutex = PTHREAD_MUTEX_INITIALIZER;
-static int _check_for_valid_mask (int flags)
+static int _check_for_valid_mask(int flags)
{
int ret = MM_ERROR_NONE;
bool at_least_cond = false;
} else {
ret = MM_ERROR_INVALID_ARGUMENT;
}
- if (!at_least_cond) {
+
+ if (!at_least_cond)
ret = MM_ERROR_INVALID_ARGUMENT;
- }
- if (ret) {
+
+ if (ret)
debug_error("flags[0x%x] is not valid", flags);
- }
+
return ret;
}
-static int __convert_device_type_to_enum (char *device_type, mm_sound_device_type_e *device_type_enum)
+static int __convert_device_type_to_enum(char *device_type, mm_sound_device_type_e *device_type_enum)
{
int ret = MM_ERROR_NONE;
- if (!device_type || !device_type_enum) {
+ if (!device_type || !device_type_enum)
return MM_ERROR_INVALID_ARGUMENT;
- }
if (!strncmp(device_type, "builtin-speaker", VOLUME_TYPE_LEN)) {
*device_type_enum = MM_SOUND_DEVICE_TYPE_BUILTIN_SPEAKER;
ret = _check_for_valid_mask(flags);
if (ret == MM_ERROR_NONE) {
ret = mm_sound_client_add_device_connected_callback(flags, func, user_data, id);
- if (ret < 0) {
+ if (ret < 0)
debug_error("Could not add device connected callback, ret = %x", ret);
- }
}
return ret;
int ret = MM_ERROR_NONE;
ret = mm_sound_client_remove_device_connected_callback(id);
- if (ret < 0) {
+ if (ret < 0)
debug_error("Could not remove device connected callback, ret = %x", ret);
- }
return ret;
}
ret = _check_for_valid_mask(flags);
if (ret == MM_ERROR_NONE) {
ret = mm_sound_client_add_device_info_changed_callback(flags, func, user_data, id);
- if (ret < 0) {
+ if (ret < 0)
debug_error("Could not add device information changed callback, ret = %x", ret);
- }
}
return ret;
int ret = MM_ERROR_NONE;
ret = mm_sound_client_remove_device_info_changed_callback(id);
- if (ret < 0) {
+ if (ret < 0)
debug_error("Could not remove device information changed callback, ret = %x", ret);
- }
return ret;
}
ret = _check_for_valid_mask(flags);
if (ret == MM_ERROR_NONE) {
ret = mm_sound_client_add_device_state_changed_callback(flags, func, user_data, id);
- if (ret < 0) {
+ if (ret < 0)
debug_error("Could not add device state changed callback, ret = %x", ret);
- }
}
return ret;
int ret = MM_ERROR_NONE;
ret = mm_sound_client_remove_device_state_changed_callback(id);
- if (ret < 0) {
+ if (ret < 0)
debug_error("Could not remove device state changed callback, ret = %x", ret);
- }
return ret;
}
{
int ret = MM_ERROR_NONE;
- if (!device_list) {
+ if (!device_list)
return MM_ERROR_INVALID_ARGUMENT;
- }
+
ret = _check_for_valid_mask(flags);
if (ret != MM_ERROR_NONE) {
debug_error("mask[0x%x] is invalid, ret=0x%x", flags, ret);
int ret = MM_ERROR_NONE;
mm_sound_device_list_t *_device_list;
- if (!device_list) {
+ if (!device_list)
return MM_ERROR_INVALID_ARGUMENT;
- }
+
ret = _check_for_valid_mask(flags);
if (ret != MM_ERROR_NONE) {
debug_error("mask[0x%x] is invalid, ret=0x%x", flags, ret);
}
EXPORT_API
-int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
+int mm_sound_get_next_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
{
int ret = MM_ERROR_NONE;
mm_sound_device_list_t *device_list_t = NULL;
GList *node = NULL;
- if (!device_list || !device) {
+
+ if (!device_list || !device)
return MM_ERROR_INVALID_ARGUMENT;
- }
+
device_list_t = (mm_sound_device_list_t*) device_list;
- if (device_list_t->is_new_device_list) {
+ if (device_list_t->is_new_device_list)
node = g_list_first(device_list_t->list);
- } else {
+ else
node = g_list_next(device_list_t->list);
- }
+
if (!node) {
ret = MM_ERROR_SOUND_NO_DATA;
} else {
- if (device_list_t->is_new_device_list) {
+ if (device_list_t->is_new_device_list)
device_list_t->is_new_device_list = false;
- } else {
+ else
device_list_t->list = node;
- }
+
*device = (mm_sound_device_t*)node->data;
debug_log("next device[0x%x]", *device);
}
}
EXPORT_API
-int mm_sound_get_prev_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
+int mm_sound_get_prev_device(MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
{
int ret = MM_ERROR_NONE;
mm_sound_device_list_t *device_list_t = NULL;
GList *node = NULL;
- if (!device_list || !device) {
+
+ if (!device_list || !device)
return MM_ERROR_INVALID_ARGUMENT;
- }
+
device_list_t = (mm_sound_device_list_t*) device_list;
node = g_list_previous(device_list_t->list);
if (!node) {
int mm_sound_get_device_type(MMSoundDevice_t device_h, mm_sound_device_type_e *type)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device || !type) {
+ if (!device || !type) {
debug_error("invalid argument");
return MM_ERROR_INVALID_ARGUMENT;
}
int mm_sound_get_device_io_direction(MMSoundDevice_t device_h, mm_sound_device_io_direction_e *io_direction)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device) {
+ if (!device) {
debug_error("invalid handle");
return MM_ERROR_INVALID_ARGUMENT;
}
int mm_sound_get_device_id(MMSoundDevice_t device_h, int *id)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device) {
+ if (!device) {
debug_error("invalid handle");
return MM_ERROR_INVALID_ARGUMENT;
}
int mm_sound_get_device_state(MMSoundDevice_t device_h, mm_sound_device_state_e *state)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device) {
+ if (!device) {
debug_error("invalid handle");
return MM_ERROR_INVALID_ARGUMENT;
}
int mm_sound_get_device_name(MMSoundDevice_t device_h, char **name)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device) {
+ if (!device) {
debug_error("invalid handle");
return MM_ERROR_INVALID_ARGUMENT;
}
int mm_sound_get_device_vendor_id(MMSoundDevice_t device_h, int *vendor_id)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device) {
+ if (!device) {
debug_error("invalid handle");
return MM_ERROR_INVALID_ARGUMENT;
}
int mm_sound_get_device_product_id(MMSoundDevice_t device_h, int *product_id)
{
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
- if(!device) {
+ if (!device) {
debug_error("invalid handle");
return MM_ERROR_INVALID_ARGUMENT;
}
mm_sound_device_t *device = (mm_sound_device_t*)device_h;
bool _is_on = false;
- if(!device || !is_on) {
+ if (!device || !is_on) {
debug_error("invalid argument");
return MM_ERROR_INVALID_ARGUMENT;
}
RETURN_ERROR_IF_FOCUS_CB_THREAD(g_thread_self());
ret = mm_sound_client_unset_session_interrupt_callback();
- if (ret) {
+ if (ret)
debug_error("Failed to mm_sound_client_unset_session_interrupt_callback(), ret[0x%x]", ret);
- }
debug_fleave();
RETURN_ERROR_IF_FOCUS_CB_THREAD(g_thread_self());
ret = mm_sound_client_get_unique_id(id);
- if (ret) {
+ if (ret)
debug_error("Failed to mm_sound_client_get_unique_id(), ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_register_focus(id, getpid(), stream_type, false, callback, user_data);
- if (ret) {
+ if (ret)
debug_error("Could not register focus, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_register_focus(id, pid, stream_type, true, callback, user_data);
- if (ret) {
+ if (ret)
debug_error("Could not register focus for session, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_get_focus_reacquisition(id, reacquisition);
- if (ret) {
+ if (ret)
debug_error("Could not get focus reacquisition, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_get_acquired_focus_stream_type(focus_type, stream_type, option, ext_info);
- if (ret) {
+ if (ret)
debug_error("Could not get acquired focus stream type, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_acquire_focus(id, focus_type, 0, ext_info);
- if (ret) {
+ if (ret)
debug_error("Could not acquire focus, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_release_focus(id, focus_type, 0, ext_info);
- if (ret) {
+ if (ret)
debug_error("Could not release focus, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_acquire_focus(id, focus_type, option, ext_info);
- if (ret) {
+ if (ret)
debug_error("Could not acquire focus, ret[0x%x]", ret);
- }
debug_fleave();
}
ret = mm_sound_client_release_focus(id, focus_type, option, ext_info);
- if (ret) {
+ if (ret)
debug_error("Could not release focus, ret[0x%x]", ret);
- }
debug_fleave();
return MM_ERROR_INVALID_ARGUMENT;
}
ret = mm_sound_client_set_focus_watch_callback(getpid(), focus_type, false, false, callback, user_data, id);
- if (ret) {
+ if (ret)
debug_error("Could not set focus watch callback, ret[0x%x]", ret);
- }
debug_fleave();
return MM_ERROR_INVALID_ARGUMENT;
}
ret = mm_sound_client_set_focus_watch_callback(pid, focus_type, true, false, callback, user_data, id);
- if (ret) {
+ if (ret)
debug_error("Could not set focus watch callback, ret[0x%x]", ret);
- }
debug_fleave();
return MM_ERROR_INVALID_ARGUMENT;
}
ret = mm_sound_client_set_focus_watch_callback(pid, focus_type, true, true, callback, user_data, id);
- if (ret) {
+ if (ret)
debug_error("Could not set focus watch callback, ret[0x%x]", ret);
- }
debug_fleave();
MMSOUND_STRNCPY(x_param.ext_info, x_ext_info, MM_SOUND_NAME_NUM); \
x_param.is_in_thread = x_is_in_thread; \
x_param.is_for_session = x_is_for_session; \
-} while(0) \
+} while (0) \
static int _convert_error_from_string(const char *error_string)
{
memset(&data, 0x00, sizeof(_mm_sound_mgr_focus_socket_param_t));
FILL_SOCKET_PARAM(data, FOCUS_FUNC_NAME_ACQUIRE, instance, id, focus_type,
- option, ext_info, is_in_thread, is_for_session);
+ option, ext_info, is_in_thread, is_for_session);
if ((ret = _send_data_to_server(fd, &data))) {
debug_error("failed to _send_data_to_server(), ret[0x%x]", ret);
memset(&data, 0x00, sizeof(_mm_sound_mgr_focus_socket_param_t));
FILL_SOCKET_PARAM(data, FOCUS_FUNC_NAME_RELEASE, instance, id, focus_type,
- option, ext_info, is_in_thread, is_for_session);
+ option, ext_info, is_in_thread, is_for_session);
if ((ret = _send_data_to_server(fd, &data))) {
debug_error("failed to _send_data_to_server()");
#define AUDIO_VOLUME_CONFIG_GAIN(vol) (vol & 0xFF00)
typedef struct ipc_data {
- char filename[FILE_FULL_PATH];
- char role[ROLE_NAME_LEN];
- char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
-}ipc_t;
+ char filename[FILE_FULL_PATH];
+ char role[ROLE_NAME_LEN];
+ char volume_gain_type[VOLUME_GAIN_TYPE_LEN];
+} ipc_t;
typedef enum {
IPC_TYPE_PIPE,
IPC_TYPE_DBUS,
-}ipc_type_t;
+} ipc_type_t;
static int _mm_sound_play_keysound(const char *filename, int volume_config, ipc_type_t ipc_type);
static const char* convert_volume_type_to_role(int volume_type)
{
debug_log("volume_type(%d)", volume_type);
- switch(volume_type) {
+ switch (volume_type) {
case VOLUME_TYPE_MEDIA:
return "media";
case VOLUME_TYPE_SYSTEM:
case VOLUME_TYPE_RINGTONE:
return "ringtone-call";
default:
- debug_warning ("not supported type(%d), we change it SYSTEM type forcibly" );
+ debug_warning("not supported type(%d), we change it SYSTEM type forcibly", volume_type);
return "system";
}
}
static const char* convert_volume_gain_type_to_string(int volume_gain_type)
{
debug_log("volume_gain_type(0x%x)", volume_gain_type);
- switch(volume_gain_type) {
+ switch (volume_gain_type) {
case VOLUME_GAIN_DEFAULT:
return "";
case VOLUME_GAIN_DIALER:
/* convert volume type to role/volume gain */
role = convert_volume_type_to_role(AUDIO_VOLUME_CONFIG_TYPE(volume_config));
- if (role) {
+ if (role)
vol_gain_type = convert_volume_gain_type_to_string(AUDIO_VOLUME_CONFIG_GAIN(volume_config));
- }
if (ipc_type == IPC_TYPE_PIPE) {
int res = 0;
int fd = -1;
int size = 0;
- ipc_t data = {{0,},{0,},{0,}};
+ ipc_t data = { { 0, }, { 0, }, { 0, } };
/* Check whether file exists */
fd = open(filename, O_RDONLY);
}
/* convert volume type to role/volume gain */
- if (role) {
+ if (role)
MMSOUND_STRNCPY(data.role, role, ROLE_NAME_LEN);
- }
- if (vol_gain_type) {
+
+ if (vol_gain_type)
MMSOUND_STRNCPY(data.volume_gain_type, vol_gain_type, VOLUME_GAIN_TYPE_LEN);
- }
MMSOUND_STRNCPY(data.filename, filename, FILE_FULL_PATH);
debug_error("g_bus_get_sync() error (%s)", err ? err->message : NULL);
ret = MM_ERROR_SOUND_INTERNAL;
} else {
- result = g_dbus_connection_call_sync (conn,
+ result = g_dbus_connection_call_sync(conn,
PA_BUS_NAME,
PA_SOUND_PLAYER_OBJECT_PATH,
PA_SOUND_PLAYER_INTERFACE,
PA_SOUND_PLAYER_METHOD_NAME_SIMPLE_PLAY,
- g_variant_new ("(sss)", filename, role, vol_gain_type),
+ g_variant_new("(sss)", filename, role, vol_gain_type),
NULL,
G_DBUS_CALL_FLAGS_NONE,
2000,
#define MM_SOUND_CHANNEL_MAX 6
typedef struct _mm_sound_handle_t {
- uint32_t handle;
+ uint32_t handle;
- int mode;
- int volume_type;
- int gain_type;
- int rate;
- int channels;
- pa_simple* s;
+ int mode;
+ int volume_type;
+ int gain_type;
+ int rate;
+ int channels;
+ pa_simple *s;
- int period; /* open api retrun value.*/
+ int period; /* open api retrun value. */
- unsigned int stream_idx;
- int source_type;
+ unsigned int stream_idx;
+ int source_type;
} mm_sound_handle_t;
static struct {
- uint32_t handle_count; /* use amotic operations */
- GList* handles;
- pthread_mutex_t lock;
+ uint32_t handle_count; /* use amotic operations */
+ GList *handles;
+ pthread_mutex_t lock;
- int state;
- pa_threaded_mainloop *mainloop;
- pa_context *context;
+ int state;
+ pa_threaded_mainloop *mainloop;
+ pa_context *context;
} mm_sound_handle_mgr;
#define CHECK_HANDLE_RANGE(x) \
- do { \
- if(x == 0) { \
- debug_msg("invalid handle(%d)", x); \
- return MM_ERROR_INVALID_ARGUMENT; \
- } \
- } while(0);
+ do { \
+ if (x == 0) { \
+ debug_msg("invalid handle(%d)", x); \
+ return MM_ERROR_INVALID_ARGUMENT; \
+ } \
+ } while (0);
#define ATOMIC_INC(l, x) \
- do { \
- pthread_mutex_lock(l); \
- x = x + 1; \
- if(x == 0) \
- x = x + 1; \
- pthread_mutex_unlock(l); \
- } while(0);
+ do { \
+ pthread_mutex_lock(l); \
+ x = x + 1; \
+ if (x == 0) \
+ x = x + 1; \
+ pthread_mutex_unlock(l); \
+ } while (0);
// phandle(ret), GList, userdata, coimpare func
#define GET_HANDLE_DATA(p, l, u, func) \
- do { \
- GList* list = 0; \
- list = g_list_find_custom(l, u, func); \
- if(list != 0) \
- p = (mm_sound_handle_t*)list->data; \
- else \
- p = NULL; \
- } while(0);
-
+ do { \
+ GList* list = 0; \
+ list = g_list_find_custom(l, u, func); \
+ if (list != 0) \
+ p = (mm_sound_handle_t*)list->data; \
+ else \
+ p = NULL; \
+ } while (0);
#define PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT 1536 /* frames */
#define PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE 4
#define PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC 75
#define PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC 20
-__attribute__ ((constructor)) void __mm_sound_pa_init(void)
+__attribute__ ((constructor))
+void __mm_sound_pa_init(void)
{
- memset(&mm_sound_handle_mgr, 0, sizeof(mm_sound_handle_mgr));
- mm_sound_handle_mgr.state = FALSE;
+ memset(&mm_sound_handle_mgr, 0, sizeof(mm_sound_handle_mgr));
+ mm_sound_handle_mgr.state = FALSE;
- mm_sound_handle_mgr.handles = g_list_alloc();
- mm_sound_handle_mgr.handle_count = 1;
- pthread_mutex_init(&mm_sound_handle_mgr.lock, NULL);
+ mm_sound_handle_mgr.handles = g_list_alloc();
+ mm_sound_handle_mgr.handle_count = 1;
+ pthread_mutex_init(&mm_sound_handle_mgr.lock, NULL);
}
-__attribute__ ((destructor)) void __mm_sound_pa_deinit(void)
+__attribute__ ((destructor))
+void __mm_sound_pa_deinit(void)
{
- g_list_free(mm_sound_handle_mgr.handles);
- pthread_mutex_destroy(&mm_sound_handle_mgr.lock);
- mm_sound_handle_mgr.handle_count = 0;
-
- if(mm_sound_handle_mgr.state) {
- debug_msg("mainloop(%x), context(%x)", mm_sound_handle_mgr.mainloop, mm_sound_handle_mgr.context);
- pa_threaded_mainloop_stop(mm_sound_handle_mgr.mainloop);
- pa_context_disconnect(mm_sound_handle_mgr.context);
- pa_context_unref(mm_sound_handle_mgr.context);
- pa_threaded_mainloop_free(mm_sound_handle_mgr.mainloop);
- }
+ g_list_free(mm_sound_handle_mgr.handles);
+ pthread_mutex_destroy(&mm_sound_handle_mgr.lock);
+ mm_sound_handle_mgr.handle_count = 0;
+
+ if (mm_sound_handle_mgr.state) {
+ debug_msg("mainloop(%x), context(%x)", mm_sound_handle_mgr.mainloop, mm_sound_handle_mgr.context);
+ pa_threaded_mainloop_stop(mm_sound_handle_mgr.mainloop);
+ pa_context_disconnect(mm_sound_handle_mgr.context);
+ pa_context_unref(mm_sound_handle_mgr.context);
+ pa_threaded_mainloop_free(mm_sound_handle_mgr.mainloop);
+ }
}
gint __mm_sound_handle_comparefunc(gconstpointer a, gconstpointer b)
{
- mm_sound_handle_t* phandle = (mm_sound_handle_t*)a;
- int* handle = (int*)b;
+ mm_sound_handle_t *phandle = (mm_sound_handle_t *) a;
+ int *handle = (int *)b;
- if(phandle == NULL)
- return -1;
+ if (phandle == NULL)
+ return -1;
- if(phandle->handle == *handle)
- return 0;
- else
- return -1;
+ if (phandle->handle == *handle)
+ return 0;
+ else
+ return -1;
}
EXPORT_API
-int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec* ss, pa_channel_map* channel_map, int* size, char *stream_type, int stream_index)
+int mm_sound_pa_open(MMSoundHandleMode mode, int volume_config, pa_sample_spec * ss, pa_channel_map * channel_map,
+ int *size, char *stream_type, int stream_index)
{
- pa_simple *s = NULL;
- pa_channel_map maps;
- pa_buffer_attr attr;
-
- int prop_vol_type = 0;
- int prop_gain_type = VOLUME_GAIN_DEFAULT;
-
- int err = MM_ERROR_SOUND_INTERNAL;
- int period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
- int samples_per_period = PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT;
- int periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
-
- int handle_mode = mode;
- int sample_size = 0;
- pa_proplist *proplist = NULL;
-
- mm_sound_handle_t* handle = NULL;
-
- if (ss->channels < MM_SOUND_CHANNEL_MIN || ss->channels > MM_SOUND_CHANNEL_MAX)
- return MM_ERROR_INVALID_ARGUMENT;
-
- proplist = pa_proplist_new();
-
- if(channel_map == NULL) {
- pa_channel_map_init_auto(&maps, ss->channels, PA_CHANNEL_MAP_ALSA);
- channel_map = &maps;
- }
-
- switch(ss->format) {
- case PA_SAMPLE_U8:
- sample_size = 1 * ss->channels;
- break;
- case PA_SAMPLE_S16LE:
- sample_size = 2 * ss->channels;
- break;
- default :
- sample_size = 0;
- debug_error("Invalid sample size (%d)", sample_size);
- break;
- }
-
- /* Set volume type of stream */
- if(volume_config > 0) {
- debug_log("setting gain type");
- prop_vol_type = 0; /* not used, set it system(0) temporarily */
-
- /* Set gain type of stream */
- prop_gain_type = (volume_config >> 8) & 0x000000FF;
-
- pa_proplist_setf(proplist, PA_PROP_MEDIA_TIZEN_GAIN_TYPE, "%d", prop_gain_type);
- }
-
- if (stream_index != -1) {
- char stream_index_s[11];
- debug_msg("Set stream index [%d]", stream_index);
-
- snprintf(stream_index_s, sizeof(stream_index_s)-1, "%d", stream_index);
- debug_msg("stream_index[%d] converted to string[%s]", stream_index, stream_index_s);
- pa_proplist_sets(proplist, PA_PROP_MEDIA_PARENT_ID, stream_index_s);
- }
- /* Set stream type */
- pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, stream_type);
-
- memset(&attr, '\0', sizeof(attr));
-
- switch (handle_mode) {
- case HANDLE_MODE_INPUT:
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
- attr.prebuf = 0;
- attr.minreq = -1;
- attr.tlength = -1;
- attr.maxlength = -1;
- attr.fragsize = samples_per_period * pa_sample_size(ss);
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "CAPTURE", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_INPUT_LOW_LATENCY:
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_ULOW_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
- attr.prebuf = 0;
- attr.minreq = -1;
- attr.tlength = -1;
- attr.maxlength = -1;
- attr.fragsize = samples_per_period * pa_sample_size(ss);
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "LOW LATENCY CAPTURE", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_INPUT_HIGH_LATENCY:
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_CAPTURE;
- attr.prebuf = 0;
- attr.minreq = -1;
- attr.tlength = -1;
- attr.maxlength = -1;
- attr.fragsize = samples_per_period * pa_sample_size(ss);
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "HIGH LATENCY CAPTURE", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_OUTPUT:
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
- attr.prebuf = -1;
- attr.minreq = -1;
- attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
- attr.maxlength = -1;
- attr.fragsize = 0;
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "PLAYBACK", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_OUTPUT_LOW_LATENCY:
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
- attr.prebuf = (ss->rate / 100) * pa_sample_size(ss) * ss->channels;
- attr.minreq = -1;
- attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
- attr.maxlength = -1;
- attr.fragsize = 0;
- debug_msg("rate(%d), samplesize(%d), ch(%d) format(%d)", ss->rate, pa_sample_size(ss), ss->channels, ss->format);
-
- debug_msg("prebuf(%d), minreq(%d), tlength(%d), maxlength(%d), fragsize(%d)", attr.prebuf, attr.minreq, attr.tlength, attr.maxlength, attr.fragsize);
-
- s = pa_simple_new_proplist(NULL,"MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_OUTPUT_CLOCK:
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_PLAYBACK;
- attr.prebuf = -1;
- attr.minreq = -1;
- attr.tlength = (uint32_t)-1;
- attr.maxlength = -1;
- attr.fragsize = 0;
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "HIGH LATENCY PLAYBACK", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_OUTPUT_VIDEO: /* low latency playback */
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VIDEO;
- attr.prebuf = 4*(samples_per_period * pa_sample_size(ss));
- attr.minreq = samples_per_period * pa_sample_size(ss);
- attr.tlength = periods_per_buffer * samples_per_period * pa_sample_size(ss);
- attr.maxlength = -1;
- attr.fragsize = 0;
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss, channel_map, &attr, proplist, &err);
- break;
-
- case HANDLE_MODE_OUTPUT_AP_CALL:
+ pa_simple *s = NULL;
+ pa_channel_map maps;
+ pa_buffer_attr attr;
+
+ int prop_vol_type = 0;
+ int prop_gain_type = VOLUME_GAIN_DEFAULT;
+
+ int err = MM_ERROR_SOUND_INTERNAL;
+ int period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
+ int samples_per_period = PA_SIMPLE_SAMPLES_PER_PERIOD_DEFAULT;
+ int periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
+
+ int handle_mode = mode;
+ int sample_size = 0;
+ pa_proplist *proplist = NULL;
+
+ mm_sound_handle_t *handle = NULL;
+
+ if (ss->channels < MM_SOUND_CHANNEL_MIN || ss->channels > MM_SOUND_CHANNEL_MAX)
+ return MM_ERROR_INVALID_ARGUMENT;
+
+ proplist = pa_proplist_new();
+
+ if (channel_map == NULL) {
+ pa_channel_map_init_auto(&maps, ss->channels, PA_CHANNEL_MAP_ALSA);
+ channel_map = &maps;
+ }
+
+ switch (ss->format) {
+ case PA_SAMPLE_U8:
+ sample_size = 1 * ss->channels;
+ break;
+ case PA_SAMPLE_S16LE:
+ sample_size = 2 * ss->channels;
+ break;
+ default:
+ sample_size = 0;
+ debug_error("Invalid sample size (%d)", sample_size);
+ break;
+ }
+
+ /* Set volume type of stream */
+ if (volume_config > 0) {
+ debug_log("setting gain type");
+ prop_vol_type = 0; /* not used, set it system(0) temporarily */
+
+ /* Set gain type of stream */
+ prop_gain_type = (volume_config >> 8) & 0x000000FF;
+
+ pa_proplist_setf(proplist, PA_PROP_MEDIA_TIZEN_GAIN_TYPE, "%d", prop_gain_type);
+ }
+
+ if (stream_index != -1) {
+ char stream_index_s[11];
+ debug_msg("Set stream index [%d]", stream_index);
+
+ snprintf(stream_index_s, sizeof(stream_index_s) - 1, "%d", stream_index);
+ debug_msg("stream_index[%d] converted to string[%s]", stream_index, stream_index_s);
+ pa_proplist_sets(proplist, PA_PROP_MEDIA_PARENT_ID, stream_index_s);
+ }
+ /* Set stream type */
+ pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, stream_type);
+
+ memset(&attr, '\0', sizeof(attr));
+
+ switch (handle_mode) {
+ case HANDLE_MODE_INPUT:
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
+ attr.prebuf = 0;
+ attr.minreq = -1;
+ attr.tlength = -1;
+ attr.maxlength = -1;
+ attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "CAPTURE", ss, channel_map, &attr,
+ proplist, &err);
+ break;
+
+ case HANDLE_MODE_INPUT_LOW_LATENCY:
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_ULOW_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
+ attr.prebuf = 0;
+ attr.minreq = -1;
+ attr.tlength = -1;
+ attr.maxlength = -1;
+ attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "LOW LATENCY CAPTURE", ss, channel_map,
+ &attr, proplist, &err);
+ break;
+
+ case HANDLE_MODE_INPUT_HIGH_LATENCY:
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_CAPTURE;
+ attr.prebuf = 0;
+ attr.minreq = -1;
+ attr.tlength = -1;
+ attr.maxlength = -1;
+ attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "HIGH LATENCY CAPTURE", ss, channel_map,
+ &attr, proplist, &err);
+ break;
+
+ case HANDLE_MODE_OUTPUT:
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_MID_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_DEFAULT;
+ attr.prebuf = -1;
+ attr.minreq = -1;
+ attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
+ attr.maxlength = -1;
+ attr.fragsize = 0;
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "PLAYBACK", ss, channel_map, &attr,
+ proplist, &err);
+ break;
+
+ case HANDLE_MODE_OUTPUT_LOW_LATENCY:
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_FASTMODE;
+ attr.prebuf = (ss->rate / 100) * pa_sample_size(ss) * ss->channels;
+ attr.minreq = -1;
+ attr.tlength = (ss->rate / 10) * pa_sample_size(ss) * ss->channels;
+ attr.maxlength = -1;
+ attr.fragsize = 0;
+ debug_msg("rate(%d), samplesize(%d), ch(%d) format(%d)", ss->rate, pa_sample_size(ss), ss->channels, ss->format);
+
+ debug_msg("prebuf(%d), minreq(%d), tlength(%d), maxlength(%d), fragsize(%d)", attr.prebuf, attr.minreq, attr.tlength,
+ attr.maxlength, attr.fragsize);
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss,
+ channel_map, &attr, proplist, &err);
+ break;
+
+ case HANDLE_MODE_OUTPUT_CLOCK:
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_HIGH_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_PLAYBACK;
+ attr.prebuf = -1;
+ attr.minreq = -1;
+ attr.tlength = (uint32_t) - 1;
+ attr.maxlength = -1;
+ attr.fragsize = 0;
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "HIGH LATENCY PLAYBACK", ss,
+ channel_map, &attr, proplist, &err);
+ break;
+
+ case HANDLE_MODE_OUTPUT_VIDEO: /* low latency playback */
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_LOW_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VIDEO;
+ attr.prebuf = 4 * (samples_per_period * pa_sample_size(ss));
+ attr.minreq = samples_per_period * pa_sample_size(ss);
+ attr.tlength = periods_per_buffer * samples_per_period * pa_sample_size(ss);
+ attr.maxlength = -1;
+ attr.fragsize = 0;
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "LOW LATENCY PLAYBACK", ss,
+ channel_map, &attr, proplist, &err);
+ break;
+
+ case HANDLE_MODE_OUTPUT_AP_CALL:
#if defined(_MMFW_I386_ALL_SIMULATOR)
- debug_msg("Does not support AP call mode at i386 simulator");
- s = NULL;
+ debug_msg("Does not support AP call mode at i386 simulator");
+ s = NULL;
#else
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
- attr.prebuf = -1;
- attr.minreq = pa_usec_to_bytes(20*PA_USEC_PER_MSEC, ss);
- attr.tlength = pa_usec_to_bytes(100*PA_USEC_PER_MSEC, ss);
- attr.maxlength = -1;
- attr.fragsize = 0;
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "VoIP PLAYBACK", ss, channel_map, &attr, proplist, &err);
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
+ attr.prebuf = -1;
+ attr.minreq = pa_usec_to_bytes(20 * PA_USEC_PER_MSEC, ss);
+ attr.tlength = pa_usec_to_bytes(100 * PA_USEC_PER_MSEC, ss);
+ attr.maxlength = -1;
+ attr.fragsize = 0;
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_PLAYBACK, NULL, "VoIP PLAYBACK", ss, channel_map,
+ &attr, proplist, &err);
#endif
- break;
- case HANDLE_MODE_INPUT_AP_CALL:
+ break;
+ case HANDLE_MODE_INPUT_AP_CALL:
#if defined(_MMFW_I386_ALL_SIMULATOR)
- debug_msg("Does not support AP call mode at i386 simulator");
- s = NULL;
+ debug_msg("Does not support AP call mode at i386 simulator");
+ s = NULL;
#else
- period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
- samples_per_period = (ss->rate * period_time) / 1000;
- periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
- attr.prebuf = 0;
- attr.minreq = -1;
- attr.tlength = -1;
- attr.maxlength = -1;
- attr.fragsize = samples_per_period * pa_sample_size(ss);
-
- s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "VoIP CAPTURE", ss, channel_map, &attr, proplist, &err);
+ period_time = PA_SIMPLE_PERIOD_TIME_FOR_VOIP_LATENCY_MSEC;
+ samples_per_period = (ss->rate * period_time) / 1000;
+ periods_per_buffer = PA_SIMPLE_PERIODS_PER_BUFFER_VOIP;
+ attr.prebuf = 0;
+ attr.minreq = -1;
+ attr.tlength = -1;
+ attr.maxlength = -1;
+ attr.fragsize = samples_per_period * pa_sample_size(ss);
+
+ s = pa_simple_new_proplist(NULL, "MM_SOUND_PA_CLIENT", PA_STREAM_RECORD, NULL, "VoIP CAPTURE", ss, channel_map, &attr,
+ proplist, &err);
#endif
- break;
- default:
- err = MM_ERROR_SOUND_INTERNAL;
- goto fail;
- break;
- }
-
- if (!s) {
- debug_error("Open pulseaudio handle has failed - %s", pa_strerror(err));
- if (!strncmp(pa_strerror(err), "Access denied by security check",strlen(pa_strerror(err)))) {
- err = MM_ERROR_SOUND_PERMISSION_DENIED;
- } else {
- err = MM_ERROR_SOUND_INTERNAL;
- }
- goto fail;
- }
-
- handle = (mm_sound_handle_t*)malloc(sizeof(mm_sound_handle_t));
- memset(handle, 0, sizeof(mm_sound_handle_t));
- handle->mode = mode;
- handle->volume_type = prop_vol_type;
- handle->gain_type = prop_gain_type;
- handle->rate = ss->rate;
- handle->channels = ss->channels;
- handle->s = s;
- handle->period = samples_per_period * sample_size;
- *size = handle->period;
- handle->handle = mm_sound_handle_mgr.handle_count;
- ATOMIC_INC(&mm_sound_handle_mgr.lock, mm_sound_handle_mgr.handle_count); // 0 is not used
-
- if (0 > pa_simple_get_stream_index(s, &handle->stream_idx, &err)) {
- debug_msg("Can not get stream index %s", pa_strerror(err));
- err = MM_ERROR_SOUND_INTERNAL;
- goto fail;
- }
- mm_sound_handle_mgr.handles = g_list_append(mm_sound_handle_mgr.handles, handle);
-
- if(handle->handle == 0) {
- debug_msg("out of range. handle(%d)", handle->handle);
- goto fail;
- }
-
- debug_msg("created handle[%d]. mode(%d), volumetype(%d), gain(%d), rate(%d), channels(%d), format(%d), stream_idx(%d), s(%x), source_type(%d)",
- handle->handle, handle->mode, handle->volume_type, handle->gain_type,
- handle->rate, handle->channels, ss->format, handle->stream_idx, handle->s, handle->source_type);
-
- if (proplist)
- pa_proplist_free(proplist);
-
- return handle->handle;
-
-fail:
- if (proplist)
- pa_proplist_free(proplist);
-
- if(handle)
- free(handle);
-
- return err;
+ break;
+ default:
+ err = MM_ERROR_SOUND_INTERNAL;
+ goto fail;
+ break;
+ }
+
+ if (!s) {
+ debug_error("Open pulseaudio handle has failed - %s", pa_strerror(err));
+ if (!strncmp(pa_strerror(err), "Access denied by security check", strlen(pa_strerror(err))))
+ err = MM_ERROR_SOUND_PERMISSION_DENIED;
+ else
+ err = MM_ERROR_SOUND_INTERNAL;
+ goto fail;
+ }
+
+ handle = (mm_sound_handle_t *) malloc(sizeof(mm_sound_handle_t));
+ memset(handle, 0, sizeof(mm_sound_handle_t));
+ handle->mode = mode;
+ handle->volume_type = prop_vol_type;
+ handle->gain_type = prop_gain_type;
+ handle->rate = ss->rate;
+ handle->channels = ss->channels;
+ handle->s = s;
+ handle->period = samples_per_period * sample_size;
+ *size = handle->period;
+ handle->handle = mm_sound_handle_mgr.handle_count;
+ ATOMIC_INC(&mm_sound_handle_mgr.lock, mm_sound_handle_mgr.handle_count); // 0 is not used
+
+ if (0 > pa_simple_get_stream_index(s, &handle->stream_idx, &err)) {
+ debug_msg("Can not get stream index %s", pa_strerror(err));
+ err = MM_ERROR_SOUND_INTERNAL;
+ goto fail;
+ }
+ mm_sound_handle_mgr.handles = g_list_append(mm_sound_handle_mgr.handles, handle);
+
+ if (handle->handle == 0) {
+ debug_msg("out of range. handle(%d)", handle->handle);
+ goto fail;
+ }
+
+ debug_msg
+ ("created handle[%d]. mode(%d), volumetype(%d), gain(%d), rate(%d), channels(%d), format(%d), stream_idx(%d), s(%x), source_type(%d)",
+ handle->handle, handle->mode, handle->volume_type, handle->gain_type, handle->rate, handle->channels, ss->format,
+ handle->stream_idx, handle->s, handle->source_type);
+
+ if (proplist)
+ pa_proplist_free(proplist);
+
+ return handle->handle;
+
+ fail:
+ if (proplist)
+ pa_proplist_free(proplist);
+
+ if (handle)
+ free(handle);
+
+ return err;
}
EXPORT_API
-int mm_sound_pa_write(const int handle, void* buf, const int size)
+int mm_sound_pa_write(const int handle, void *buf, const int size)
{
- mm_sound_handle_t* phandle = NULL;
- int err = MM_ERROR_NONE;
+ mm_sound_handle_t *phandle = NULL;
+ int err = MM_ERROR_NONE;
- if (buf == NULL)
- return MM_ERROR_INVALID_ARGUMENT;
+ if (buf == NULL)
+ return MM_ERROR_INVALID_ARGUMENT;
- if (size < 0)
- return MM_ERROR_INVALID_ARGUMENT;
- else if (size == 0)
- return MM_ERROR_NONE;
+ if (size < 0)
+ return MM_ERROR_INVALID_ARGUMENT;
+ else if (size == 0)
+ return MM_ERROR_NONE;
- CHECK_HANDLE_RANGE(handle);
- GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
+ CHECK_HANDLE_RANGE(handle);
+ GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
#ifdef __STREAM_DEBUG__
- debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d), buf(%p), size(%d)",
- phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx. buf, size);
+ debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d), buf(%p), size(%d)",
+ phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx.buf, size);
#endif
- if(phandle == NULL) {
- debug_msg("phandle is null");
- return MM_ERROR_SOUND_INTERNAL;
- }
+ if (phandle == NULL) {
+ debug_msg("phandle is null");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
- if (0 > pa_simple_write(phandle->s, buf, size, &err)) {
- debug_error("pa_simple_write() failed with %s", pa_strerror(err));
- return MM_ERROR_SOUND_INTERNAL;
- }
+ if (0 > pa_simple_write(phandle->s, buf, size, &err)) {
+ debug_error("pa_simple_write() failed with %s", pa_strerror(err));
+ return MM_ERROR_SOUND_INTERNAL;
+ }
- return size;
+ return size;
}
EXPORT_API
int mm_sound_pa_close(const int handle)
{
- mm_sound_handle_t* phandle = NULL;
- int err = MM_ERROR_NONE;
+ mm_sound_handle_t *phandle = NULL;
+ int err = MM_ERROR_NONE;
- CHECK_HANDLE_RANGE(handle);
- GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
- if(phandle == NULL) {
- debug_msg("phandle is null");
- return MM_ERROR_SOUND_INTERNAL;
- }
+ CHECK_HANDLE_RANGE(handle);
+ GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
+ if (phandle == NULL) {
+ debug_msg("phandle is null");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
- debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d)",
- phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx);
+ debug_msg("phandle(%x) s(%x), handle(%d), rate(%d), ch(%d) stream_idx(%d)",
+ phandle, phandle->s, phandle->handle, phandle->rate, phandle->channels, phandle->stream_idx);
switch (phandle->mode) {
case HANDLE_MODE_OUTPUT:
case HANDLE_MODE_OUTPUT_AP_CALL:
case HANDLE_MODE_OUTPUT_VIDEO:
if (0 > pa_simple_flush(phandle->s, &err)) {
- err = MM_ERROR_SOUND_INTERNAL;
+ err = MM_ERROR_SOUND_INTERNAL;
debug_msg("pa_simple_flush() failed with %s", pa_strerror(err));
}
break;
}
pa_simple_free(phandle->s);
- phandle->s = NULL;
+ phandle->s = NULL;
- debug_msg("leave: handle[%d] stream_index[%d]", handle, phandle->stream_idx);
+ debug_msg("leave: handle[%d] stream_index[%d]", handle, phandle->stream_idx);
- mm_sound_handle_mgr.handles = g_list_remove(mm_sound_handle_mgr.handles, phandle);
- if(phandle != NULL) {
- free(phandle);
- phandle = NULL;
- }
+ mm_sound_handle_mgr.handles = g_list_remove(mm_sound_handle_mgr.handles, phandle);
+ if (phandle != NULL) {
+ free(phandle);
+ phandle = NULL;
+ }
- return err;
+ return err;
}
EXPORT_API
int mm_sound_pa_drain(const int handle)
{
- mm_sound_handle_t* phandle = NULL;
- int err = MM_ERROR_NONE;
+ mm_sound_handle_t *phandle = NULL;
+ int err = MM_ERROR_NONE;
CHECK_HANDLE_RANGE(handle);
- GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
- if(phandle == NULL)
- return MM_ERROR_SOUND_INTERNAL;
+ GET_HANDLE_DATA(phandle, mm_sound_handle_mgr.handles, &handle, __mm_sound_handle_comparefunc);
+ if (phandle == NULL)
+ return MM_ERROR_SOUND_INTERNAL;
- if (0 > pa_simple_drain(phandle->s, &err)) {
+ if (0 > pa_simple_drain(phandle->s, &err)) {
debug_error("pa_simple_drain() failed with %s", pa_strerror(err));
err = MM_ERROR_SOUND_INTERNAL;
}
return err;
}
-
return MM_ERROR_SOUND_INTERNAL;
}
- if ((ret = mm_sound_dbus_emit_signal(AUDIO_PROVIDER_AUDIO_CLIENT, AUDIO_EVENT_CLIENT_HANDLED, params))) {
+ if ((ret = mm_sound_dbus_emit_signal(AUDIO_PROVIDER_AUDIO_CLIENT, AUDIO_EVENT_CLIENT_HANDLED, params)))
debug_error("dbus send signal for client handled failed");
- }
debug_fleave();
return ret;
debug_fenter();
params = g_variant_new("(iiiiiiibsi)", tone, repeat, volume, volume_config, session_type,
- session_options, client_pid , _enable_session, stream_type, stream_index);
+ session_options, client_pid, _enable_session, stream_type, stream_index);
if (params) {
if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_DTMF, params, &result)) != MM_ERROR_NONE) {
debug_error("dbus play tone failed");
gboolean enable_session, int *codechandle, char *stream_type, int stream_index);
int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle, char *stream_type, int stream_index);
-int __mm_sound_mgr_ipc_notify_play_file_end (int handle);
+int __mm_sound_mgr_ipc_notify_play_file_end(int handle);
#endif /* __MM_SOUND_MGR_H__ */
#define __MM_SOUND_PLUGIN_H__
enum {
- MM_SOUND_PLUGIN_TYPE_NONE = 0,
- MM_SOUND_PLUGIN_TYPE_CODEC,
- MM_SOUND_PLUGIN_TYPE_RUN,
- MM_SOUND_PLUGIN_TYPE_LAST,
+ MM_SOUND_PLUGIN_TYPE_NONE = 0,
+ MM_SOUND_PLUGIN_TYPE_CODEC,
+ MM_SOUND_PLUGIN_TYPE_RUN,
+ MM_SOUND_PLUGIN_TYPE_LAST,
};
typedef struct {
- int type;
- void *module;
+ int type;
+ void *module;
} MMSoundPluginType;
/* Plugin Interface */
} mmsound_codec_param_t;
typedef struct {
- int* (*GetSupportTypes)(void);
- int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
- int (*Parse)(const char*, mmsound_codec_info_t*);
- int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
- int (*Play)(MMHandleType);
- int (*Stop)(MMHandleType);
- int (*Destroy)(MMHandleType);
+ int* (*GetSupportTypes)(void);
+ int (*SetThreadPool) (int (*)(void*, void (*)(void*)));
+ int (*Parse)(const char*, mmsound_codec_info_t*);
+ int (*Create)(mmsound_codec_param_t*, mmsound_codec_info_t*, MMHandleType*);
+ int (*Play)(MMHandleType);
+ int (*Stop)(MMHandleType);
+ int (*Destroy)(MMHandleType);
} mmsound_codec_interface_t;
/* Utility Functions */
bool stop_by_user;
bool enable_session;
- } __mmsound_mgr_codec_handle_t;
+} __mmsound_mgr_codec_handle_t;
static MMSoundPluginType *g_codec_plugins = NULL;
static __mmsound_mgr_codec_handle_t g_slots[MANAGER_HANDLE_MAX];
int result = MM_ERROR_NONE;
mm_sound_device_type_e type;
- debug_warning ("device_connected_callback called : handle[%p], connected[%d], slotid[%d]", device, is_connected, slotid);
+ debug_warning("device_connected_callback called : handle[%p], connected[%d], slotid[%d]", device, is_connected, slotid);
- if (mm_sound_get_device_type (device, &type) != MM_ERROR_NONE) {
+ if (mm_sound_get_device_type(device, &type) != MM_ERROR_NONE) {
debug_error("getting device type failed");
return;
}
switch (type) {
- case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
- case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
- case MM_SOUND_DEVICE_TYPE_HDMI:
- case MM_SOUND_DEVICE_TYPE_MIRRORING:
- case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
- if (!is_connected) {
- debug_warning("sound device unplugged");
- result = MMSoundMgrCodecStop(slotid);
- if (result != MM_ERROR_NONE)
- debug_error("MMSoundMgrCodecStop error %d", result);
-
- result = mm_sound_remove_device_connected_callback(g_slots[slotid].subs_id);
- if (result != MM_ERROR_NONE)
- debug_error("mm_sound_remove_device_connected_callback error %d", result);
- }
- break;
+ case MM_SOUND_DEVICE_TYPE_AUDIOJACK:
+ case MM_SOUND_DEVICE_TYPE_BLUETOOTH:
+ case MM_SOUND_DEVICE_TYPE_HDMI:
+ case MM_SOUND_DEVICE_TYPE_MIRRORING:
+ case MM_SOUND_DEVICE_TYPE_USB_AUDIO:
+ if (!is_connected) {
+ debug_warning("sound device unplugged");
+ result = MMSoundMgrCodecStop(slotid);
+ if (result != MM_ERROR_NONE)
+ debug_error("MMSoundMgrCodecStop error %d", result);
+
+ result = mm_sound_remove_device_connected_callback(g_slots[slotid].subs_id);
+ if (result != MM_ERROR_NONE)
+ debug_error("mm_sound_remove_device_connected_callback error %d", result);
+ }
+ break;
- default:
- break;
+ default:
+ break;
}
}
#endif
MMSoundPluginScan(targetdir, MM_SOUND_PLUGIN_TYPE_CODEC, &g_codec_plugins);
if (g_codec_plugins) {
- while (g_codec_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
+ while (g_codec_plugins[loop].type != MM_SOUND_PLUGIN_TYPE_NONE)
_MMSoundMgrCodecRegisterInterface(&g_codec_plugins[loop++]);
- }
}
if (_shutdown_cb)
g_slots[*slotid].status = STATUS_IDLE;
SLOT_UNLOCK();
#ifdef FOCUS_INTEGRATION
- if (param->focus_handle) {
+ if (param->focus_handle)
need_focus_unregister = 1;
- }
#endif
goto cleanup;
}
debug_error("Fail to play : 0x%08X", err);
g_plugins[g_slots[*slotid].pluginid].Destroy(g_slots[*slotid].plughandle);
#ifdef FOCUS_INTEGRATION
- if (param->focus_handle) {
+ if (param->focus_handle)
need_focus_unregister = 1;
- }
#endif
}
#endif
g_slots[*slotid].pluginid = plugin_id;
- g_slots[*slotid].param = param->param; /* This arg is used callback data */
+ g_slots[*slotid].param = param->param; /* This arg is used callback data */
g_slots[*slotid].session_type = param->session_type;
g_slots[*slotid].session_options = param->session_options;
#ifdef FOCUS_INTEGRATION
- g_slots[*slotid].focus_handle= param->focus_handle;
- g_slots[*slotid].focus_wcb_id= param->focus_wcb_id;
+ g_slots[*slotid].focus_handle = param->focus_handle;
+ g_slots[*slotid].focus_wcb_id = param->focus_wcb_id;
#endif
g_slots[*slotid].enable_session = param->enable_session;
g_slots[*slotid].pid = (int)param->param;
#endif
err = _mm_sound_mgr_codec_slot_get_empty(slotid);
- if (err != MM_ERROR_NONE || *slotid < 0)
- {
+ if (err != MM_ERROR_NONE || *slotid < 0) {
debug_error("Empty g_slot is not found");
goto cleanup;
}
debug_enter("(Slotid : [%d])", slotid);
- if (slotid < 0 || MANAGER_HANDLE_MAX <= slotid) {
+ if (slotid < 0 || MANAGER_HANDLE_MAX <= slotid)
return MM_ERROR_INVALID_ARGUMENT;
- }
SLOT_LOCK();
if (g_slots[slotid].status == STATUS_IDLE) {
g_slots[slotid].stop_by_user = true;
err = g_plugins[g_slots[slotid].pluginid].Stop(g_slots[slotid].plughandle);
- if (err != MM_ERROR_NONE) {
+ if (err != MM_ERROR_NONE)
debug_error("Fail to STOP Code : 0x%08X", err);
- }
cleanup:
SLOT_UNLOCK();
g_slots[slotid].session_type != MM_SESSION_TYPE_VIDEOCALL &&
g_slots[slotid].session_type != MM_SESSION_TYPE_VOIP &&
g_slots[slotid].session_type != MM_SESSION_TYPE_VOICE_RECOGNITION &&
- g_slots[slotid].enable_session ) {
+ g_slots[slotid].enable_session) {
if ((g_slots[slotid].session_options & MM_SESSION_OPTION_PAUSE_OTHERS) ||
g_slots[slotid].session_type == MM_SESSION_TYPE_ALARM ||
g_slots[slotid].session_type == MM_SESSION_TYPE_NOTIFY ||
g_slots[slotid].session_type == MM_SESSION_TYPE_EMERGENCY) {
err = mm_sound_release_focus(g_slots[slotid].focus_handle, FOCUS_FOR_BOTH, NULL);
- if (err) {
+ if (err)
debug_error("mm_sound_release_focus failed [0x%x]", err);
- }
+
if (mm_sound_unregister_focus(g_slots[slotid].focus_handle) || err) {
debug_error("Focus clean up failed [0x%x]", err);
err = MM_ERROR_POLICY_INTERNAL;
int err = MM_ERROR_NONE;
if (param < 0 || param >= MANAGER_HANDLE_MAX) {
- debug_error ("Slot index param [%d] is invalid", param);
+ debug_error("Slot index param [%d] is invalid", param);
return MM_ERROR_INVALID_ARGUMENT;
}
debug_enter("(Slot : %d) stop-by-user : %d", param, g_slots[param].stop_by_user);
- if (g_slots[param].stop_by_user == false) {
+ if (g_slots[param].stop_by_user == false)
SLOT_LOCK();
- }
#ifdef FOCUS_INTEGRATION
/*
* Unregister FOCUS here
*/
- debug_msg("[CODEC MGR] enable_session %d ",g_slots[param].enable_session);
+ debug_msg("[CODEC MGR] enable_session %d ", g_slots[param].enable_session);
if (g_slots[param].focus_handle || g_slots[param].focus_wcb_id) {
if (g_slots[param].session_type != MM_SESSION_TYPE_CALL &&
g_slots[param].session_type != MM_SESSION_TYPE_VIDEOCALL &&
g_slots[param].session_type != MM_SESSION_TYPE_VOIP &&
g_slots[param].session_type != MM_SESSION_TYPE_VOICE_RECOGNITION &&
- g_slots[param].enable_session ) {
+ g_slots[param].enable_session) {
if ((g_slots[param].session_options & MM_SESSION_OPTION_PAUSE_OTHERS) ||
g_slots[param].session_type == MM_SESSION_TYPE_ALARM ||
g_slots[param].session_type == MM_SESSION_TYPE_NOTIFY ||
g_slots[param].session_type == MM_SESSION_TYPE_EMERGENCY) {
if (g_slots[param].current_focus_type != FOCUS_NONE) {
err = mm_sound_release_focus(g_slots[param].focus_handle, g_slots[param].current_focus_type, NULL);
- if (err) {
+ if (err)
debug_error("mm_sound_release_focus failed [0x%x]", err);
- }
}
if (mm_sound_unregister_focus(g_slots[param].focus_handle) || err) {
debug_error("Focus clean up failed [0x%x]", err);
_mm_sound_mgr_codec_shutdown_timer_start();
finish:
- if (g_slots[param].stop_by_user == false) {
+ if (g_slots[param].stop_by_user == false)
SLOT_UNLOCK();
- }
debug_fleave();
Functions For handling request from client
******************************************************************************************/
// except msgid
-int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int volume_config,
- int session_type, int session_options, int client_pid, gboolean enable_session,
- int *codechandle, char *stream_type, int stream_index)
+int _MMSoundMgrIpcPlayFile(char* filename, int tone, int repeat, int volume, int volume_config,
+ int session_type, int session_options, int client_pid, gboolean enable_session,
+ int *codechandle, char *stream_type, int stream_index)
{
- mmsound_mgr_codec_param_t param = {0,};
+ mmsound_mgr_codec_param_t param = { 0, };
int ret = MM_ERROR_NONE;
/* Set sound player parameter */
int _MMSoundMgrIpcPlayFileWithStreamInfo(char *filename, int repeat, int volume,
int client_pid, int *codechandle, char *stream_type, int stream_index)
{
- mmsound_mgr_codec_param_t param = {0,};
+ mmsound_mgr_codec_param_t param = { 0, };
int ret = MM_ERROR_NONE;
/* Set sound player parameter */
}
int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
- int session_type, int session_options, int client_pid,
- gboolean enable_session, int *codechandle, char *stream_type, int stream_index)
+ int session_type, int session_options, int client_pid,
+ gboolean enable_session, int *codechandle,
+ char *stream_type, int stream_index)
{
- mmsound_mgr_codec_param_t param = {0,};
+ mmsound_mgr_codec_param_t param = { 0, };
int ret = MM_ERROR_NONE;
/* Set sound player parameter */
debug_msg("DTMF %d", param.tone);
debug_msg("Loop %d", param.repeat_count);
- debug_msg("Volume %d",param.volume);
- debug_msg("VolumeConfig %x",param.volume_config);
+ debug_msg("Volume %d", param.volume);
+ debug_msg("VolumeConfig %x", param.volume_config);
debug_msg("session %d", param.session_type);
debug_msg("session options %x", param.session_options);
debug_msg("enable_session %d", param.enable_session);
ret = MMSoundMgrCodecPlayDtmf(codechandle, ¶m);
- if ( ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("Will be closed a sources, codec handle : [0x%d]", *codechandle);
return ret;
}
return ret;
}
-int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle, char *stream_type, int stream_index)
+int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle,
+ char *stream_type, int stream_index)
{
- mmsound_mgr_codec_param_t param = {0,};
+ mmsound_mgr_codec_param_t param = { 0, };
int ret = MM_ERROR_NONE;
/* Set sound player parameter */
debug_msg("DTMF %d", param.tone);
debug_msg("Loop %d", param.repeat_count);
- debug_msg("Volume %d",param.volume);
+ debug_msg("Volume %d", param.volume);
debug_msg("stream type %s", param.stream_type);
debug_msg("stream index %d", param.stream_index);
ret = MMSoundMgrCodecPlayDtmfWithStreamInfo(codechandle, ¶m);
- if ( ret != MM_ERROR_NONE) {
+ if (ret != MM_ERROR_NONE) {
debug_error("Will be closed a sources, codec handle : [0x%d]", *codechandle);
return ret;
}
Functions For Server-Side to notify Clients
******************************************************************************************/
-int __mm_sound_mgr_ipc_notify_play_file_end (int handle) {
- return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);
+int __mm_sound_mgr_ipc_notify_play_file_end(int handle)
+{
+ return __mm_sound_mgr_ipc_dbus_notify_play_file_end(handle);
}
#define INTERFACE_SOUND_SERVER "org.tizen.SoundServer1"
/* workaround for AF volume gain tuning */
-#define PROC_DBUS_OBJECT "/Org/Tizen/ResourceD/Process"
-#define PROC_DBUS_INTERFACE "org.tizen.resourced.process"
-#define PROC_DBUS_METHOD "ProcExclude"
+#define PROC_DBUS_OBJECT "/Org/Tizen/ResourceD/Process"
+#define PROC_DBUS_INTERFACE "org.tizen.resourced.process"
+#define PROC_DBUS_METHOD "ProcExclude"
/* Introspection data for the service we are exporting */
static const gchar introspection_xml[] =
- "<node>"
- " <interface name='org.tizen.SoundServer1'>"
- " <method name='MethodTest1'>"
- " <arg type='i' name='num1' direction='in'/>"
- " <arg type='i' name='num2' direction='in'/>"
- " <arg type='i' name='multiple' direction='out'/>"
- " </method>"
- " <method name='GetBTA2DPStatus'>"
- " <arg type='b' name='is_bt_on' direction='out'/>"
- " <arg type='s' name='bt_name' direction='out'/>"
- " </method>"
- " <method name='PlayFileStart'>"
- " <arg type='s' name='filename' direction='in'/>"
- " <arg type='i' name='tone' direction='in'/>"
- " <arg type='i' name='repeat' direction='in'/>"
- " <arg type='i' name='volume' direction='in'/>"
- " <arg type='i' name='vol_config' direction='in'/>"
- " <arg type='i' name='session_type' direction='in'/>"
- " <arg type='i' name='session_option' direction='in'/>"
- " <arg type='i' name='client_pid' direction='in'/>"
- " <arg type='b' name='enable_session' direction='in'/>"
- " <arg type='s' name='stream_type' direction='in'/>"
- " <arg type='i' name='stream_index' direction='in'/>"
- " <arg type='i' name='handle' direction='out'/>"
- " </method>"
- " <method name='PlayFileStartWithStreamInfo'>"
- " <arg type='s' name='filename' direction='in'/>"
- " <arg type='i' name='repeat' direction='in'/>"
- " <arg type='i' name='volume' direction='in'/>"
- " <arg type='i' name='client_pid' direction='in'/>"
- " <arg type='s' name='stream_type' direction='in'/>"
- " <arg type='i' name='stream_index' direction='in'/>"
- " <arg type='i' name='handle' direction='out'/>"
- " </method>"
- " <method name='PlayFileStop'>"
- " <arg type='i' name='handle' direction='in'/>"
- " </method>"
+ "<node>"
+ " <interface name='org.tizen.SoundServer1'>"
+ " <method name='MethodTest1'>"
+ " <arg type='i' name='num1' direction='in'/>"
+ " <arg type='i' name='num2' direction='in'/>"
+ " <arg type='i' name='multiple' direction='out'/>"
+ " </method>"
+ " <method name='GetBTA2DPStatus'>"
+ " <arg type='b' name='is_bt_on' direction='out'/>"
+ " <arg type='s' name='bt_name' direction='out'/>"
+ " </method>"
+ " <method name='PlayFileStart'>"
+ " <arg type='s' name='filename' direction='in'/>"
+ " <arg type='i' name='tone' direction='in'/>"
+ " <arg type='i' name='repeat' direction='in'/>"
+ " <arg type='i' name='volume' direction='in'/>"
+ " <arg type='i' name='vol_config' direction='in'/>"
+ " <arg type='i' name='session_type' direction='in'/>"
+ " <arg type='i' name='session_option' direction='in'/>"
+ " <arg type='i' name='client_pid' direction='in'/>"
+ " <arg type='b' name='enable_session' direction='in'/>"
+ " <arg type='s' name='stream_type' direction='in'/>"
+ " <arg type='i' name='stream_index' direction='in'/>"
+ " <arg type='i' name='handle' direction='out'/>"
+ " </method>"
+ " <method name='PlayFileStartWithStreamInfo'>"
+ " <arg type='s' name='filename' direction='in'/>"
+ " <arg type='i' name='repeat' direction='in'/>"
+ " <arg type='i' name='volume' direction='in'/>"
+ " <arg type='i' name='client_pid' direction='in'/>"
+ " <arg type='s' name='stream_type' direction='in'/>"
+ " <arg type='i' name='stream_index' direction='in'/>"
+ " <arg type='i' name='handle' direction='out'/>"
+ " </method>"
+ " <method name='PlayFileStop'>"
+ " <arg type='i' name='handle' direction='in'/>"
+ " </method>"
#ifdef FOCUS_INTEGRATION
- " <method name='ClearFocus'>"
- " <arg type='i' name='pid' direction='in'/>"
- " </method>"
+ " <method name='ClearFocus'>"
+ " <arg type='i' name='pid' direction='in'/>"
+ " </method>"
#endif
- " <method name='PlayDTMF'>"
- " <arg type='i' name='tone' direction='in'/>"
- " <arg type='i' name='repeat' direction='in'/>"
- " <arg type='i' name='volume' direction='in'/>"
- " <arg type='i' name='vol_config' direction='in'/>"
- " <arg type='i' name='session_type' direction='in'/>"
- " <arg type='i' name='session_option' direction='in'/>"
- " <arg type='i' name='client_pid' direction='in'/>"
- " <arg type='b' name='enable_session' direction='in'/>"
- " <arg type='s' name='stream_type' direction='in'/>"
- " <arg type='i' name='stream_index' direction='in'/>"
- " <arg type='i' name='handle' direction='out'/>"
- " </method>"
- " <method name='PlayDTMFWithStreamInfo'>"
- " <arg type='i' name='tone' direction='in'/>"
- " <arg type='i' name='repeat' direction='in'/>"
- " <arg type='i' name='volume' direction='in'/>"
- " <arg type='i' name='client_pid' direction='in'/>"
- " <arg type='s' name='stream_type' direction='in'/>"
- " <arg type='i' name='stream_index' direction='in'/>"
- " <arg type='i' name='handle' direction='out'/>"
- " </method>"
- " <method name='GetConnectedDeviceList'>"
- " <arg type='i' name='device_mask' direction='in'/>"
- " <arg type='a(iiiis)' name='device_list' direction='out'/>"
- " </method>"
- " </interface>"
- "</node>";
+ " <method name='PlayDTMF'>"
+ " <arg type='i' name='tone' direction='in'/>"
+ " <arg type='i' name='repeat' direction='in'/>"
+ " <arg type='i' name='volume' direction='in'/>"
+ " <arg type='i' name='vol_config' direction='in'/>"
+ " <arg type='i' name='session_type' direction='in'/>"
+ " <arg type='i' name='session_option' direction='in'/>"
+ " <arg type='i' name='client_pid' direction='in'/>"
+ " <arg type='b' name='enable_session' direction='in'/>"
+ " <arg type='s' name='stream_type' direction='in'/>"
+ " <arg type='i' name='stream_index' direction='in'/>"
+ " <arg type='i' name='handle' direction='out'/>"
+ " </method>"
+ " <method name='PlayDTMFWithStreamInfo'>"
+ " <arg type='i' name='tone' direction='in'/>"
+ " <arg type='i' name='repeat' direction='in'/>"
+ " <arg type='i' name='volume' direction='in'/>"
+ " <arg type='i' name='client_pid' direction='in'/>"
+ " <arg type='s' name='stream_type' direction='in'/>"
+ " <arg type='i' name='stream_index' direction='in'/>"
+ " <arg type='i' name='handle' direction='out'/>"
+ " </method>"
+ " <method name='GetConnectedDeviceList'>"
+ " <arg type='i' name='device_mask' direction='in'/>"
+ " <arg type='a(iiiis)' name='device_list' direction='out'/>"
+ " </method>"
+ " </interface>"
+ "</node>";
static GDBusConnection* conn_g;
static void handle_method_play_file_start(GDBusMethodInvocation* invocation);
guint sound_server_owner_id ;
/*
- For pass error code with 'g_dbus_method_invocation_return_error'
- We have to use some glib features like GError, GQuark
+ For pass error code with 'g_dbus_method_invocation_return_error'
+ We have to use some glib features like GError, GQuark
*/
/* Only For error types which is currently being used in server-side */
-static const GDBusErrorEntry mm_sound_error_entries[] =
-{
+static const GDBusErrorEntry mm_sound_error_entries[] = {
{MM_ERROR_OUT_OF_MEMORY, "org.tizen.multimedia.OutOfMemory"},
{MM_ERROR_OUT_OF_STORAGE, "org.tizen.multimedia.OutOfStorage"},
{MM_ERROR_INVALID_ARGUMENT, "org.tizen.multimedia.InvalidArgument"},
int i = 0;
for (i = 0; i < G_N_ELEMENTS(mm_sound_error_entries); i++) {
- if (err_code == mm_sound_error_entries[i].error_code) {
+ if (err_code == mm_sound_error_entries[i].error_code)
return mm_sound_error_entries[i].dbus_error_name;
- }
}
return "org.tizen.multimedia.common.Unknown";
static int mm_sound_mgr_ipc_dbus_send_signal(audio_event_t event, GVariant *parameter)
{
- if(mm_sound_dbus_emit_signal(AUDIO_PROVIDER_SOUND_SERVER, event, parameter) != MM_ERROR_NONE) {
+ if (mm_sound_dbus_emit_signal(AUDIO_PROVIDER_SOUND_SERVER, event, parameter) != MM_ERROR_NONE) {
debug_error("Sound Server Emit signal failed");
return MM_ERROR_SOUND_INTERNAL;
}
g_variant_get(params, "(ii)", &val, &val2);
debug_log("Got value : %d , %d", val, val2);
- if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_TEST, g_variant_new("(i)", val+val2))) != MM_ERROR_NONE) {
+ if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_TEST, g_variant_new("(i)", val+val2))) != MM_ERROR_NONE)
debug_error("signal send error : %X", ret);
- } else {
+ else
debug_error("signal send success");
- }
send_reply:
if (ret == MM_ERROR_NONE) {
}
g_variant_get(params, "(siiiiiiibsi)", &filename, &tone, &repeat, &volume,
- &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
+ &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
if (!filename) {
- debug_error("filename null");
- ret = MM_ERROR_SOUND_INTERNAL;
- goto send_reply;
+ debug_error("filename null");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto send_reply;
}
ret = _MMSoundMgrIpcPlayFile(filename, tone, repeat, volume, vol_config,
session_type, session_option, _get_sender_pid(invocation), enable_session, &slotid, stream_type, stream_index);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("(i)", slotid));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
g_free(filename);
g_free(stream_type);
g_variant_get(params, "(siiisi)", &filename, &repeat, &volume, &pid, &stream_type, &stream_index);
if (!filename) {
- debug_error("filename null");
- ret = MM_ERROR_SOUND_INTERNAL;
- goto send_reply;
+ debug_error("filename null");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto send_reply;
}
ret = _MMSoundMgrIpcPlayFileWithStreamInfo(filename, repeat, volume, _get_sender_pid(invocation),
- &slotid, stream_type, stream_index);
+ &slotid, stream_type, stream_index);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("(i)", slotid));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
g_free(filename);
g_free(stream_type);
}
g_variant_get(params, "(iiiiiiibsi)", &tone, &repeat, &volume,
- &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
+ &vol_config, &session_type, &session_option, &pid, &enable_session, &stream_type, &stream_index);
debug_error("volume - %d", volume);
ret = _MMSoundMgrIpcPlayDTMF(tone, repeat, volume, vol_config,
- session_type, session_option, _get_sender_pid(invocation), enable_session, &slotid, stream_type, stream_index);
+ session_type, session_option, _get_sender_pid(invocation),
+ enable_session, &slotid, stream_type, stream_index);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("(i)", slotid));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
g_free(stream_type);
ret = _MMSoundMgrIpcPlayDTMFWithStreamInfo(tone, repeat, volume, _get_sender_pid(invocation), &slotid, stream_type, stream_index);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("(i)", slotid));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = _MMSoundMgrIpcStop(handle);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
ret = _MMSoundMgrIpcClearFocus(pid);
send_reply:
- if (ret == MM_ERROR_NONE) {
+ if (ret == MM_ERROR_NONE)
_method_call_return_value(invocation, g_variant_new("()"));
- } else {
+ else
_method_call_return_error(invocation, ret);
- }
debug_fleave();
}
debug_log("Method Call, obj : %s, intf : %s, method : %s", object_path, interface_name, method_name);
for (method_idx = 0; method_idx < AUDIO_METHOD_MAX; method_idx++) {
- if (!g_strcmp0(method_name, methods[method_idx].info.name)) {
+ if (!g_strcmp0(method_name, methods[method_idx].info.name))
methods[method_idx].handler(invocation);
- }
}
}
return TRUE;
}
-static const GDBusInterfaceVTable interface_vtable =
-{
+static const GDBusInterfaceVTable interface_vtable = {
handle_method_call,
handle_get_property,
handle_set_property
static void _mm_sound_mgr_dbus_unown_name(guint oid)
{
debug_log("Unown name for Sound-Server [%d]", oid);
- if (oid > 0) {
+ if (oid > 0)
g_bus_unown_name(oid);
- }
}
int __mm_sound_mgr_ipc_dbus_notify_play_file_end(int handle)
param = g_variant_new("(i)", handle);
if (param) {
- if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_PLAY_FILE_END, param)) != MM_ERROR_NONE) {
+ if ((ret = mm_sound_mgr_ipc_dbus_send_signal(AUDIO_EVENT_PLAY_FILE_END, param)) != MM_ERROR_NONE)
debug_error("Send play file end for '%d' failed", handle);
- }
} else {
debug_error("Build variant for dbus param failed");
}
#include <mm_debug.h>
static char* __strcatdup(const char *str1, const char *str2, const char *str3);
-static int _MMSoundPluginGetList(const char *plugdir ,char ***list);
+static int _MMSoundPluginGetList(const char *plugdir, char ***list);
static int _MMSoundPluginDestroyList(char **list);
int MMSoundPluginScan(const char *plugindir, const int type, MMSoundPluginType **pluginlist)
{
- char **list = NULL;
- int err = MM_ERROR_NONE;
- char *item = NULL;
- int index = 0;
- MMSoundPluginType plugin[100];
- int plugin_index = 0;
-
- debug_fenter ();
-
- debug_msg(" Plugin dir :: %s ", plugindir);
- err = _MMSoundPluginGetList(plugindir, &list);
- if (err != MM_ERROR_NONE)
- return err;
-
- while((item = list[index++]) != NULL) {
- if(MMSoundPluginOpen(item, &plugin[plugin_index]) != MM_ERROR_NONE) {
- debug_warning("%s is not sound plugin", item);
- continue;
- }
- if (plugin[plugin_index].type != type)
- MMSoundPluginClose(&plugin[plugin_index]);
- else
- plugin_index++;
- }
-
- _MMSoundPluginDestroyList(list);
-
- *pluginlist = (MMSoundPluginType*) malloc(sizeof(MMSoundPluginType) * (plugin_index+1));
- if ((*pluginlist) == NULL) {
- debug_critical("Memory allocation fail");
- /* Occur segmentation fault */
- *pluginlist = (void*)1;
- }
-
- memcpy(*pluginlist, plugin, sizeof(MMSoundPluginType) * (plugin_index+1));
- /* Marking end of array */
- (*pluginlist)[plugin_index].type = MM_SOUND_PLUGIN_TYPE_NONE;
- (*pluginlist)[plugin_index].module = NULL;
-
- debug_fleave ();
-
- return MM_ERROR_NONE;
+ char **list = NULL;
+ int err = MM_ERROR_NONE;
+ char *item = NULL;
+ int index = 0;
+ MMSoundPluginType plugin[100];
+ int plugin_index = 0;
+
+ debug_fenter();
+
+ debug_msg(" Plugin dir :: %s ", plugindir);
+ err = _MMSoundPluginGetList(plugindir, &list);
+ if (err != MM_ERROR_NONE)
+ return err;
+
+ while ((item = list[index++]) != NULL) {
+ if (MMSoundPluginOpen(item, &plugin[plugin_index]) != MM_ERROR_NONE) {
+ debug_warning("%s is not sound plugin", item);
+ continue;
+ }
+ if (plugin[plugin_index].type != type)
+ MMSoundPluginClose(&plugin[plugin_index]);
+ else
+ plugin_index++;
+ }
+
+ _MMSoundPluginDestroyList(list);
+
+ *pluginlist = (MMSoundPluginType*) malloc(sizeof(MMSoundPluginType) * (plugin_index+1));
+ if ((*pluginlist) == NULL) {
+ debug_critical("Memory allocation fail");
+ /* Occur segmentation fault */
+ *pluginlist = (void*)1;
+ }
+
+ memcpy(*pluginlist, plugin, sizeof(MMSoundPluginType) * (plugin_index+1));
+ /* Marking end of array */
+ (*pluginlist)[plugin_index].type = MM_SOUND_PLUGIN_TYPE_NONE;
+ (*pluginlist)[plugin_index].module = NULL;
+
+ debug_fleave();
+
+ return MM_ERROR_NONE;
}
int MMSoundPluginRelease(MMSoundPluginType *pluginlist)
{
- int loop = 0;
+ int loop = 0;
- debug_fenter ();
+ debug_fenter();
- while (pluginlist[loop].type != MM_SOUND_PLUGIN_TYPE_NONE) {
- MMSoundPluginClose(&pluginlist[loop++]);
- }
+ while (pluginlist[loop].type != MM_SOUND_PLUGIN_TYPE_NONE)
+ MMSoundPluginClose(&pluginlist[loop++]);
- free (pluginlist);
+ free(pluginlist);
- debug_fleave ();
+ debug_fleave();
- return MM_ERROR_NONE;
+ return MM_ERROR_NONE;
}
int MMSoundPluginOpen(char *file, MMSoundPluginType *plugin)
{
- void *pdll = NULL;
- int (*func)(void) = NULL;
- int t = -1;
-
- debug_fenter ();
-
- pdll = dlopen(file, RTLD_NOW|RTLD_GLOBAL);
-
- if (pdll == NULL) {
- debug_error("%s", dlerror());
- return MM_ERROR_SOUND_INVALID_FILE;
- }
-
- func = (int (*)(void))dlsym(pdll, "MMSoundGetPluginType");
- if (func == NULL) {
- dlclose(pdll);
- debug_error("Cannot find symbol : MMSoundGetPluginType");
- return MM_ERROR_SOUND_INVALID_FILE;
- }
- t = func();
-
- debug_msg("%s is %s", file,
- t == MM_SOUND_PLUGIN_TYPE_CODEC ? "CODEC":
- t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : "Unknown");
- switch(t)
- {
- case MM_SOUND_PLUGIN_TYPE_CODEC:
- case MM_SOUND_PLUGIN_TYPE_RUN:
- plugin->type = t;
- plugin->module = pdll;
- break;
- default:
- debug_error("Type is %d",t);
- dlclose(pdll);
- return MM_ERROR_SOUND_INVALID_FILE;
- }
-
- debug_fleave ();
-
- return MM_ERROR_NONE;
+ void *pdll = NULL;
+ int (*func)(void) = NULL;
+ int t = -1;
+
+ debug_fenter();
+
+ pdll = dlopen(file, RTLD_NOW | RTLD_GLOBAL);
+
+ if (pdll == NULL) {
+ debug_error("%s", dlerror());
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+
+ func = (int (*)(void))dlsym(pdll, "MMSoundGetPluginType");
+ if (func == NULL) {
+ dlclose(pdll);
+ debug_error("Cannot find symbol : MMSoundGetPluginType");
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+ t = func();
+
+ debug_msg("%s is %s", file,
+ t == MM_SOUND_PLUGIN_TYPE_CODEC ? "CODEC" :
+ t == MM_SOUND_PLUGIN_TYPE_RUN ? "RUN" : "Unknown");
+ switch (t) {
+ case MM_SOUND_PLUGIN_TYPE_CODEC:
+ case MM_SOUND_PLUGIN_TYPE_RUN:
+ plugin->type = t;
+ plugin->module = pdll;
+ break;
+ default:
+ debug_error("Type is %d", t);
+ dlclose(pdll);
+ return MM_ERROR_SOUND_INVALID_FILE;
+ }
+
+ debug_fleave();
+
+ return MM_ERROR_NONE;
}
int MMSoundPluginClose(MMSoundPluginType *plugin)
{
- debug_fenter ();
+ debug_fenter();
- if(plugin->module)
- dlclose(plugin->module);
- plugin->type = MM_SOUND_PLUGIN_TYPE_NONE;
- plugin->module = NULL;
+ if (plugin->module)
+ dlclose(plugin->module);
+ plugin->type = MM_SOUND_PLUGIN_TYPE_NONE;
+ plugin->module = NULL;
- debug_fleave ();
- return MM_ERROR_NONE;
+ debug_fleave();
+ return MM_ERROR_NONE;
}
int MMSoundPluginGetSymbol(MMSoundPluginType *plugin, const char *symbol, void **func)
{
- void *fn = NULL;
+ void *fn = NULL;
- debug_fenter ();
+ debug_fenter();
- if (plugin->module == NULL)
- return MM_ERROR_SOUND_INVALID_FILE;
- fn = dlsym(plugin->module, symbol);
- if (fn == NULL)
- return MM_ERROR_SOUND_INVALID_FILE;
- *func = fn;
+ if (plugin->module == NULL)
+ return MM_ERROR_SOUND_INVALID_FILE;
+ fn = dlsym(plugin->module, symbol);
+ if (fn == NULL)
+ return MM_ERROR_SOUND_INVALID_FILE;
+ *func = fn;
- debug_fleave ();
- return MM_ERROR_NONE;
+ debug_fleave();
+ return MM_ERROR_NONE;
}
#define MAX_PATH_SIZE 256
-static int _MMSoundPluginGetList(const char *plugdir ,char ***list)
+static int _MMSoundPluginGetList(const char *plugdir, char ***list)
{
struct dirent **entry = NULL;
int items;
return MM_ERROR_INVALID_ARGUMENT;
temp = (char **)malloc(sizeof(char *) * (items + 1));
- if(!temp) {
+ if (!temp) {
ret = MM_ERROR_OUT_OF_MEMORY;
goto free_entry;
}
memset(temp, 0, sizeof(char*) * (items + 1));
memset(curdir, '\0', sizeof(curdir));
- if(NULL == getcwd(curdir, sizeof(curdir)-1)) {
+ if (NULL == getcwd(curdir, sizeof(curdir)-1)) {
if (temp) {
- free (temp);
+ free(temp);
temp = NULL;
}
ret = MM_ERROR_OUT_OF_STORAGE;
if (chdir(plugdir) != 0) {
debug_error("chdir error");
if (temp) {
- free (temp);
+ free(temp);
temp = NULL;
}
ret = MM_ERROR_INVALID_ARGUMENT;
goto free_entry;
}
- for(item_idx = items; item_idx--; ) {
- if(stat(entry[item_idx]->d_name, &finfo) < 0) {
+ for (item_idx = items; item_idx--; ) {
+ if (stat(entry[item_idx]->d_name, &finfo) < 0) {
debug_error("Stat error");
if (temp) {
free(temp);
debug_log("item %d is %s", item_idx, entry[item_idx]->d_name);
- if (S_ISREG(finfo.st_mode)) {
+ if (S_ISREG(finfo.st_mode))
temp[tn++] = __strcatdup(plugdir, "/", entry[item_idx]->d_name);
- }
}
*list = temp;
free_entry:
- for(item_idx = 0; item_idx < items; item_idx++) {
+ for (item_idx = 0; item_idx < items; item_idx++)
free(entry[item_idx]);
- }
free(entry);
return ret;
}
static int _MMSoundPluginDestroyList(char **list)
{
int tn = 0;
- while(list[tn]) {
+ while (list[tn])
free(list[tn++]);
- }
- free (list);
+ free(list);
return MM_ERROR_NONE;
}
static char* __strcatdup(const char *str1, const char *str2, const char *str3)
{
- char *dest = NULL;
- int len = 0;
- len = strlen(str1) + strlen(str2) + strlen(str3) + 1;
- dest = (char*) malloc(len*sizeof(char));
- if (!dest)
- return NULL;
- strncpy(dest, str1, len-1);
- strncat(dest, str2, len-strlen(dest)-1);
- strncat(dest, str3, len-strlen(dest)-1);
- return dest;
+ char *dest = NULL;
+ int len = 0;
+ len = strlen(str1) + strlen(str2) + strlen(str3) + 1;
+ dest = (char*) malloc(len*sizeof(char));
+ if (!dest)
+ return NULL;
+ strncpy(dest, str1, len-1);
+ strncat(dest, str2, len-strlen(dest)-1);
+ strncat(dest, str3, len-strlen(dest)-1);
+ return dest;
}
#define USE_SYSTEM_SERVER_PROCESS_MONITORING
typedef struct {
- char plugdir[MAX_PLUGIN_DIR_PATH_LEN];
- int startserver;
- int printlist;
- int testmode;
+ char plugdir[MAX_PLUGIN_DIR_PATH_LEN];
+ int startserver;
+ int printlist;
+ int testmode;
} server_arg;
static int _get_option(int argc, char **argv, server_arg *arg);
//__attribute__ ((destructor))
static void _exit_handler(int sig)
{
- switch(sig) {
+ switch (sig) {
case SIGINT:
sigaction(SIGINT, &sigint_action, NULL);
debug_error("signal(SIGINT) error");
/* Daemon process create */
if (!serveropt.testmode && serveropt.startserver) {
#if !defined(USE_SYSTEM_SERVER_PROCESS_MONITORING)
- daemon(0,0); //chdir to ("/"), and close stdio
+ daemon(0, 0); //chdir to ("/"), and close stdio
#endif
}
#define MAX_UNUSED_THREADS_IN_THREADPOOL 10
-typedef struct __THREAD_INFO
-{
+typedef struct __THREAD_INFO {
void (*func)(gpointer data);
void *param;
} THREAD_INFO;
/* Info was allocated by MMSoundThreadPoolRun().
The actual content of info should be freed whether inside func or outside (if handle) */
- debug_log ("free [%p]", info);
+ debug_log("free [%p]", info);
free(info);
info = NULL;
} else {
if (fulldump) {
debug_log("##### [ThreadPool] max threads=[%d], max unused=[%d], max idle time=[%d]",
- g_thread_pool_get_max_threads (g_pool),
+ g_thread_pool_get_max_threads(g_pool),
g_thread_pool_get_max_unused_threads(),
g_thread_pool_get_max_idle_time());
}
debug_log("***** [ThreadPool] running=[%d], unused=[%d]",
- g_thread_pool_get_num_threads (g_pool),
+ g_thread_pool_get_num_threads(g_pool),
g_thread_pool_get_num_unused_threads());
return MM_ERROR_NONE;
int MMSoundThreadPoolInit()
{
- int i=0;
+ int i = 0;
GError *error = NULL;
debug_enter();
g_pool = g_thread_pool_new(__ThreadWork, NULL, -1, FALSE, &error);
if (g_pool == NULL && error != NULL) {
debug_error("thread pool created failed : %s", error->message);
- g_error_free (error);
+ g_error_free(error);
return MM_ERROR_SOUND_INTERNAL;
}
- debug_msg ("thread pool created successfully");
+ debug_msg("thread pool created successfully");
MMSoundThreadPoolDump(TRUE);
/* Thread pool setting : this will maintain at least 10 unused threads and this will be reused. */
/* If no unused thread left, new thread will be created, but always maintain 10 unused thread */
- debug_msg ("thread pool set max unused threads to %d", MAX_UNUSED_THREADS_IN_THREADPOOL);
+ debug_msg("thread pool set max unused threads to %d", MAX_UNUSED_THREADS_IN_THREADPOOL);
g_thread_pool_set_max_unused_threads(MAX_UNUSED_THREADS_IN_THREADPOOL);
/* To reserve unused threads, let's start some threads for beginning
his dummy thread will be remained unused as soon as it started */
debug_msg("run threads to reserve minimum thread");
- for (i = 0; i < MAX_UNUSED_THREADS_IN_THREADPOOL; i++) {
+ for (i = 0; i < MAX_UNUSED_THREADS_IN_THREADPOOL; i++)
MMSoundThreadPoolRun((void *)i, __DummyWork);
- }
MMSoundThreadPoolDump(TRUE);
#endif
typedef struct {
- /* AMR Buffer */
- int size; /* sizeof hole amr data */
- pthread_mutex_t mutex;
-
- /* Audio Infomations */
- int handle;
-
- /* control Informations */
- int repeat_count;
- int (*stop_cb)(int);
- int cb_param;
- int state;
- int number;
- double volume;
- int time;
- int pid;
-
- int thread_state;
+ /* AMR Buffer */
+ int size; /* sizeof hole amr data */
+ pthread_mutex_t mutex;
+
+ /* Audio Infomations */
+ int handle;
+
+ /* control Informations */
+ int repeat_count;
+ int (*stop_cb)(int);
+ int cb_param;
+ int state;
+ int number;
+ double volume;
+ int time;
+ int pid;
+
+ int thread_state;
} tone_info_t;
-typedef enum
-{
+typedef enum {
LOW_FREQUENCY = 0,
MIDDLE_FREQUENCY,
HIGH_FREQUENCY,
LOOP_INDEX,
} volume_type_e;
-typedef struct st_tone
-{
+typedef struct st_tone {
float low_frequency;
float middle_frequency;
float high_frequency;
int loopIndx;
} TONE;
-static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] =
-{
+static const int TONE_SEGMENT[][MM_SOUND_TONE_NUM] = {
{941, 1336, 0, -1, 0, 0,
-1, -1, -1, -1, 0, 0},// 0 key: 1336Hz, 941Hz
{425, 0, 0, 200, 0, 0,
0, 0, 0, 600, 0, 0,
425, 0, 0, 200, 0, 0,
- 0, 0, 0, 3000,0, 0,
+ 0, 0, 0, 3000, 0, 0,
-1, -1, -1, -1, 0, 0}, //Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF...
{440, 0, 0, 300, 0, 0,
0, 0, 0, 4000, 0, 0,
-1, -1, -1, -1, 0, 0}, //Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF...
- {440, 480, 0, 2000, 0, 0,
+ {440, 480, 0, 2000, 0, 0,
0, 0, 0, 4000, 0, 0,
-1, -1, -1, -1, 0, 0}, //Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF...
- {400, 1200, 0, 35, 0, 0,
+ {400, 1200, 0, 35, 0, 0,
-1, -1, -1, -1, 1, 0}, // General beep: 400Hz+1200Hz, 35ms ON
{1200, 0, 0, 100, 0, 0,
0, 0, 0, 100, 0, 0,
-1, -1, -1, -1, 2, 0}, //Proprietary tone, positive acknowlegement: 1200Hz, 100ms ON, 100ms OFF 2 bursts
- {300, 400, 500, 400, 0, 0,
+ {300, 400, 500, 400, 0, 0,
-1, -1, -1, -1, 1, 0}, //Proprietary tone, negative acknowlegement: 300Hz+400Hz+500Hz, 400ms ON
- {400, 1200, 0, 200, 0, 0,
+ {400, 1200, 0, 200, 0, 0,
-1, -1, -1, -1, 1, 0}, //Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON
{400, 1200, 0, 35, 0, 0,
-1, -1, -1, -1, 8, 0}, //Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds
{480, 620, 0, 250, 0, 0,
- 0, 0, 0, 250, 0, 0,
- -1, -1, -1, -1, 8, 0 }, //Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds
+ 0, 0, 0, 250, 0, 0,
+ -1, -1, -1, -1, 8, 0}, //Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds
{350, 440, 0, 100, 0, 0,
0, 0, 0, 100, 0, 0,
{2091, 0, 0, 32, 0, 0,
2556, 0, 0, 64, 3, 0,
2091, 0, 0, 32, 0, 0,
- 0, 0, 0, 200, 0, 0,
+ 0, 0, 0, 200, 0, 0,
2091, 0, 0, 32, 0, 0,
2556, 0, 0, 64, 3, 4,
2091, 0, 0, 32, 0, 0,
- 0, 0, 0, 200, 0, 0,
- -1, -1, -1, -1, 1, 0},//ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF
+ 0, 0, 0, 200, 0, 0,
+ -1, -1, -1, -1, 1, 0},//ISDN Call Signal SP PRI tone:{2091Hz 32ms ON, 2556 64ms ON} 4 times 2091Hz 16ms ON, 200ms OFF, {2091Hz 32ms ON, 2556Hz 64ms ON} 4 times, 2091Hz 16ms ON, 200ms OFF
{0, 0, 0, -1, 0, 0,
-1, -1, -1, -1, 1, 0}, //ISDN Call sign PAT3 tone: silent tone
{2091, 0, 0, 32, 0, 0,
2556, 0, 0, 64, 4, 0,
2091, 0, 0, 20, 0, 0,
- -1, -1, -1, -1, 1, 0}, //ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON
+ -1, -1, -1, -1, 1, 0}, //ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON
{0, 0, 0, -1, 0, 0,
-1, -1, -1, -1, 1, 0}, //ISDN Pat5 tone: silent tone
{1300, 0, 0, 25, 0, 0,
1450, 0, 0, 25, 39, 0,
- 0, 0, 0,4000, 0, 0,
+ 0, 0, 0, 4000, 0, 0,
-1, -1, -1, -1, 0, 0}, //TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat ....
{3700, 0, 0, 25, 0, 0,
{2600, 0, 0, 25, 0, 0,
2900, 0, 0, 25, 15, 0,
- 0, 0, 0,400, 0, 0,
+ 0, 0, 0, 400, 0, 0,
-1, -1, -1, -1, 0, 0}, //CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat ....
{1300, 0, 0, 25, 0, 0,
{3700, 0, 0, 25, 0, 0,
4000, 0, 0, 25, 7, 0,
- 0, 0, 0, 200, 0, 0,
+ 0, 0, 0, 200, 0, 0,
3700, 0, 0, 25, 0, 0,
4000, 0, 0, 25, 7, 3,
- 0, 0, 0, 200, 0, 0,
+ 0, 0, 0, 200, 0, 0,
3700, 0, 0, 25, 0, 0,
4000, 0, 0, 25, 15, 6,
- 0, 0, 0, 4000,0, 0,
- -1, -1, -1, -1, 0, 0}, //CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
+ 0, 0, 0, 4000, 0, 0,
+ -1, -1, -1, -1, 0, 0}, //CDMA HIGH SSL tone: {3700Hz 25ms, 4000Hz 25ms} 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 8 times, 200ms OFF, {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
{2600, 0, 0, 25, 0, 0,
2900, 0, 0, 25, 7, 0,
0, 0, 0, 200, 0, 0,
2600, 0, 0, 25, 0, 0,
2900, 0, 0, 25, 15, 6,
- 0, 0, 0, 4000,0, 0,
+ 0, 0, 0, 4000, 0, 0,
-1, -1, -1, -1, 0, 0}, //CDMA MED SSL tone: {2600Hz 25ms, 2900Hz 25ms} 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 8 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
{1300, 0, 0, 25, 0, 0,
0, 0, 0, 200, 0, 0,
1300, 0, 0, 25, 0, 0,
1450, 0, 0, 25, 15, 6,
- 0, 0, 0, 4000,0, 0,
+ 0, 0, 0, 4000, 0, 0,
-1, -1, -1, -1, 0, 0}, //CDMA LOW SSL tone: {1300Hz 25ms, 1450Hz 25ms} 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 8 times, 200ms OFF, {1300Hz 25ms, 1450Hz 25ms} repeat 16 times, 4000ms OFF, repeat ...
{3700, 0, 0, 25, 0, 0,
0, 0, 0, 200, 0, 0,
2600, 0, 0, 25, 0, 0,
2900, 0, 0, 25, 7, 3,
- 0, 0, 0, 1000,0, 0,
- -1, -1, -1, -1, 0, 0 }, //CDMA HIGH PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT....//
+ 0, 0, 0, 1000, 0, 0,
+ -1, -1, -1, -1, 0, 0 }, //CDMA HIGH PBX SLS tone:{2600Hz 25ms, 2900Hz 25ms} 8 times 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 16 times, 200ms OFF, {2600Hz 25ms, 2900Hz 25ms} 8 times, 1000ms OFF, REPEAT....//
{1300, 0, 0, 25, 0, 0,
1450, 0, 0, 25, 15, 0,
831, 0, 0, 62, 0, 0,
784, 0, 0, 62, 0, 0,
1109, 0, 0, 62, 0, 0,
- 784, 0, 0, 62, 0, 0,
+ 784, 0, 0, 62, 0, 0,
831, 0, 0, 62, 0, 0,
- 784, 0, 0, 62, 0, 0,
- -1, -1, -1, -1, 1, 0}, //CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms
+ 784, 0, 0, 62, 0, 0,
+ -1, -1, -1, -1, 1, 0}, //CDMA ALERT INCALL LITE tone: 587Hz 62ms, 784 62ms, 831Hz 62ms, 784Hz 62ms, 1109 62ms, 784Hz 62ms, 831Hz 62ms, 784Hz 62ms
{941, 0, 0, 125, 0, 0,
0, 0, 0, 10, 0, 0,
int* MMSoundPlugCodecToneGetSupportTypes(void)
{
- debug_enter();
- static int suported[2] = {MM_SOUND_SUPPORTED_CODEC_DTMF, 0};
- debug_leave();
- return suported;
+ debug_enter();
+ static int suported[2] = {MM_SOUND_SUPPORTED_CODEC_DTMF, 0};
+ debug_leave();
+ return suported;
}
int MMSoundPlugCodecToneCreate(mmsound_codec_param_t *param, mmsound_codec_info_t *info, MMHandleType *handle)
*handle = (MMHandleType)toneInfo;
debug_msg("wait until thread_stare THREAD_STATE_START");
- while((toneInfo->thread_state == THREAD_STATE_NONE) && (wait_count < WAIT_THREAD_WAIT_CNT)) {
+ while ((toneInfo->thread_state == THREAD_STATE_NONE) && (wait_count < WAIT_THREAD_WAIT_CNT)) {
usleep(WAIT_THREAD_WAIT_TIME * 1000);
wait_count++;
}
- if (wait_count >= WAIT_THREAD_WAIT_CNT) {
+ if (wait_count >= WAIT_THREAD_WAIT_CNT)
debug_error("timeout for thread pool. wait_count: %d ms ", WAIT_THREAD_WAIT_CNT * WAIT_THREAD_WAIT_TIME);
- } else {
+ else
debug_msg("_running_tone thread is started");
- }
debug_leave();
return MM_ERROR_NONE;
Error:
- if(toneInfo) {
- if(toneInfo->handle) {
- if(MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
+ if (toneInfo) {
+ if (toneInfo->handle) {
+ if (MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
debug_error("mm_sound_pa_close() fail. handle(%lu)", toneInfo->handle);
}
free(toneInfo);
pthread_mutex_destroy(&toneInfo->mutex);
if (toneInfo)
- free (toneInfo);
+ free(toneInfo);
debug_leave();
return err;
short *pbuf;
double i = 0;
double amplitude, f1, f2, f3;
- int quota= 0;
+ int quota = 0;
float low_frequency;
float middle_frequency;
float high_frequency;
int sample_size = 0;
char* buffer;
- if(is_cycle_ended) {
- low_frequency = 0;
- middle_frequency = 0;
- high_frequency = 0;
+ if (is_cycle_ended) {
+ low_frequency = 0;
+ middle_frequency = 0;
+ high_frequency = 0;
} else {
- low_frequency = _TONE.low_frequency;
- middle_frequency = _TONE.middle_frequency;
- high_frequency = _TONE.high_frequency;
+ low_frequency = _TONE.low_frequency;
+ middle_frequency = _TONE.middle_frequency;
+ high_frequency = _TONE.high_frequency;
}
- if(sample == NULL) {
+ if (sample == NULL) {
debug_error("Sample buffer is not allocated");
return NULL;
}
/* Create a buffer for the tone */
- if((_TONE.playingTime > MAX_DURATION) || (_TONE.playingTime == -1) ) {
+ if ((_TONE.playingTime > MAX_DURATION) || (_TONE.playingTime == -1))
*toneSize = ((MAX_DURATION / 1000.) * SAMPLERATE * SAMPLE_SIZE * CHANNELS) / 8;
- } else {
+ else
*toneSize = ((_TONE.playingTime / 1000.) * SAMPLERATE * SAMPLE_SIZE * CHANNELS) / 8;
- }
- *toneSize = ((*toneSize+1)>>1)<<1;
+
+ *toneSize = ((*toneSize + 1) >> 1) << 1;
sample_size = (*toneSize) / (SAMPLE_SIZE / 8);
debug_log("%0.f, %0.f, %0.f _TONE.playing_time: %d toneSize: %d",
low_frequency, middle_frequency, high_frequency, _TONE.playingTime, *toneSize);
- buffer = g_malloc (*toneSize);
- if(buffer == NULL) {
+ buffer = g_malloc(*toneSize);
+ if (buffer == NULL) {
debug_error("Buffer is not allocated");
return NULL;
} else {
pbuf = (short*)buffer;
- if(_TONE.low_frequency > 0) {
+ if (_TONE.low_frequency > 0)
quota++;
- }
- if(_TONE.middle_frequency > 0) {
+
+ if (_TONE.middle_frequency > 0)
quota++;
- }
- if(_TONE.high_frequency > 0) {
+
+ if (_TONE.high_frequency > 0)
quota++;
- }
if (quota == 0) {
debug_error("quota is zero!!!");
* We add the fundamental frequencies together.
*/
- f1 = sin (2 * M_PI * low_frequency * ((*sample) / SAMPLERATE));
- f2 = sin (2 * M_PI * middle_frequency * ((*sample) / SAMPLERATE));
- f3 = sin (2 * M_PI * high_frequency * ((*sample) / SAMPLERATE));
+ f1 = sin(2 * M_PI * low_frequency * ((*sample) / SAMPLERATE));
+ f2 = sin(2 * M_PI * middle_frequency * ((*sample) / SAMPLERATE));
+ f3 = sin(2 * M_PI * high_frequency * ((*sample) / SAMPLERATE));
- if(f1 + f2 + f3 != 0) {
+ if (f1 + f2 + f3 != 0) {
amplitude = (f1 + f2 + f3) / quota;
/* Adjust the volume */
amplitude *= volume;
_mm_get_waveCnt_PlayingTime(int toneTime, TONE _TONE, int *waveCnt, int *waveRestPlayTime)
{
int ret = MM_ERROR_NONE;
- if(waveCnt == NULL || waveRestPlayTime == NULL) {
+ if (waveCnt == NULL || waveRestPlayTime == NULL) {
debug_error("waveCnt || waveRestPlayTime buffer is NULL");
return MM_ERROR_SOUND_INTERNAL;
}
/*Set wave count and wave playing time*/
- if( _TONE.playingTime == -1) {
+ if (_TONE.playingTime == -1) {
*waveCnt = abs(toneTime) /MAX_DURATION;
- *waveRestPlayTime = abs(toneTime) % MAX_DURATION;
+ *waveRestPlayTime = abs(toneTime) % MAX_DURATION;
} else {
*waveCnt = _TONE.playingTime /MAX_DURATION;
*waveRestPlayTime = _TONE.playingTime % MAX_DURATION;
_mm_get_CurIndex(TONE _TONE, int *CurArrayPlayCnt, int *CurIndex)
{
int ret = MM_ERROR_NONE;
- if(CurArrayPlayCnt == NULL || CurIndex == NULL) {
+ if (CurArrayPlayCnt == NULL || CurIndex == NULL) {
debug_error("CurArrayPlayCnt || CurIndex buffer is NULL");
return MM_ERROR_SOUND_INTERNAL;
}
- if(_TONE.loopCnt != 0 && *CurArrayPlayCnt <= _TONE.loopCnt) {
+ if (_TONE.loopCnt != 0 && *CurArrayPlayCnt <= _TONE.loopCnt) {
(*CurArrayPlayCnt)++;
- if(*CurArrayPlayCnt >_TONE.loopCnt) {
+ if (*CurArrayPlayCnt > _TONE.loopCnt) {
(*CurIndex)++;
*CurArrayPlayCnt = 0;
} else {
char *ptoneBuf = NULL;
char filename[100];
- if(param == NULL) {
+ if (param == NULL) {
debug_error("param Buffer is not allocated");
return;
}
tone_info_t *toneInfo = (tone_info_t*) param;
int toneKey = 0;
- int toneTime =0;
+ int toneTime = 0;
int prePlayingTime = 0;
int duration = 0;
int playingTime = 0;
pthread_mutex_unlock(&toneInfo->mutex);
double sample = 0;
toneTime = toneInfo->time;
- if(toneTime != 0) {
+ if (toneTime != 0) {
toneKey = toneInfo->number;
- debug_msg ("toneKey number = %d", toneKey);
+ debug_msg("toneKey number = %d", toneKey);
/* Set pid check file */
snprintf(filename, sizeof(filename), "/proc/%d/cmdline", toneInfo->pid);
debug_msg("Wait start signal");
- while(toneInfo->state == STATE_READY)
+ while (toneInfo->state == STATE_READY)
usleep(10);
debug_msg("Recv start signal");
pthread_mutex_lock(&toneInfo->mutex);
- if ((toneInfo->state == STATE_STOP)||(toneInfo->thread_state == THREAD_STATE_STOP)) {
- debug_msg("state is stop. state(%d) thread_state(%d) goto exit.", toneInfo->state, toneInfo->thread_state );
+ if ((toneInfo->state == STATE_STOP) || (toneInfo->thread_state == THREAD_STATE_STOP)) {
+ debug_msg("state is stop. state(%d) thread_state(%d) goto exit.", toneInfo->state, toneInfo->thread_state);
pthread_mutex_unlock(&toneInfo->mutex);
goto exit;
} else {
while (toneInfo->thread_state == THREAD_STATE_START) {
TONE _TONE = _mm_get_tone(toneKey, CurIndex); /*Pop one of Tone Set */
- if(_mm_get_waveCnt_PlayingTime(toneTime, _TONE, &numWave, &waveRestPlayTime) != MM_ERROR_NONE) {
+ if (_mm_get_waveCnt_PlayingTime(toneTime, _TONE, &numWave, &waveRestPlayTime) != MM_ERROR_NONE) {
debug_error("_mm_get_waveCnt_PlayingTime return value error");
goto exit;
}
- if(_mm_get_CurIndex(_TONE, &CurArrayPlayCnt, &CurIndex) != MM_ERROR_NONE) {
+ if (_mm_get_CurIndex(_TONE, &CurArrayPlayCnt, &CurIndex) != MM_ERROR_NONE) {
debug_error("_mm_get_CurIndex return value error");
goto exit;
}
- debug_log ("Predefined Tone[%d] Total Play time (ms) : %d, _TONE.playing_time: %d _numWave = %d low_frequency: %0.f, middle_frequency: %0.f, high_frequency: %0.f",
+ debug_log("Predefined Tone[%d] Total Play time (ms) : %d, _TONE.playing_time: %d _numWave = %d low_frequency: %0.f, middle_frequency: %0.f, high_frequency: %0.f",
CurIndex, toneTime, _TONE.playingTime, numWave, _TONE.low_frequency, _TONE.middle_frequency, _TONE.high_frequency);
if (_TONE.low_frequency == -1) { /* skip frequency which's value is -1*/
- if((_TONE.loopCnt > 0) && (CurArrayPlayCnt == _TONE.loopCnt)) {
+ if ((_TONE.loopCnt > 0) && (CurArrayPlayCnt == _TONE.loopCnt)) {
is_cycle_ended = TRUE;
debug_log("[is_cycle_ended]");
}
}
/* Write pcm data */
- for(CurWaveIndex = 0; CurWaveIndex < numWave+1; CurWaveIndex++) {
- if(CurWaveIndex == numWave ) { /* play the last tone set*/
+ for (CurWaveIndex = 0; CurWaveIndex < numWave+1; CurWaveIndex++) {
+ if (CurWaveIndex == numWave) /* play the last tone set*/
playingTime = waveRestPlayTime;
- } else {
+ else
playingTime = MAX_DURATION;
- }
+
duration = playingTime;
- if(playingTime == 0) {
+ if (playingTime == 0)
break;
- }
- if(prePlayingTime + playingTime > toneTime && toneTime != -1) {
+ if (prePlayingTime + playingTime > toneTime && toneTime != -1)
playingTime = toneTime - prePlayingTime;
- }
ptoneBuf = _create_tone(&sample, _TONE, toneInfo->volume, &toneSize, is_cycle_ended);
- if(ptoneBuf == NULL) {
+ if (ptoneBuf == NULL) {
debug_error("Tone Buffer is not allocated");
goto exit;
}
- debug_log ("[TONE] Play.....%dth %dms", CurWaveIndex, playingTime);
+ debug_log("[TONE] Play.....%dth %dms", CurWaveIndex, playingTime);
mm_sound_pa_write(toneInfo->handle, ptoneBuf, ((toneSize * playingTime /duration + 1)>>1)<<1);
prePlayingTime += playingTime;
- debug_log ("previous_sum: %d", prePlayingTime);
- g_free (ptoneBuf);
+ debug_log("previous_sum: %d", prePlayingTime);
+ g_free(ptoneBuf);
ptoneBuf = NULL;
- if(prePlayingTime == toneTime || toneInfo->state != STATE_PLAY) {
- debug_log ("Finished.....on Total Playing Time : %d _TONE.playing_time: %d", prePlayingTime, _TONE.playingTime);
+ if (prePlayingTime == toneTime || toneInfo->state != STATE_PLAY) {
+ debug_log("Finished.....on Total Playing Time : %d _TONE.playing_time: %d", prePlayingTime, _TONE.playingTime);
mm_sound_pa_drain(toneInfo->handle);
- debug_log ("Finished.....quit loop");
+ debug_log("Finished.....quit loop");
goto exit;
}
- debug_log ("[%d] CurIndex: %d previous_sum: %d", CurArrayPlayCnt, CurIndex, prePlayingTime);
+ debug_log("[%d] CurIndex: %d previous_sum: %d", CurArrayPlayCnt, CurIndex, prePlayingTime);
}
}
-exit :
- if(MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
+exit:
+ if (MM_ERROR_NONE != mm_sound_pa_close(toneInfo->handle))
debug_error("mm_sound_pa_close() fail. handle(%lu)", toneInfo->handle);
#if 0
pthread_mutex_unlock(&toneInfo->mutex);
debug_msg("sent stop signal");
- while(toneInfo->state != STATE_NONE) {
+ while (toneInfo->state != STATE_NONE)
usleep(30000);
- }
debug_leave();
static
int MMSoundPlugCodecToneSetThreadPool(int (*func)(void*, void (*)(void*)))
{
- debug_enter("(func : 0x%x)", func);
- g_thread_pool_func = func;
- debug_leave();
- return MM_ERROR_NONE;
+ debug_enter("(func : 0x%x)", func);
+ g_thread_pool_func = func;
+ debug_leave();
+ return MM_ERROR_NONE;
}
#if 0
EXPORT_API
int MMSoundGetPluginType(void)
{
- debug_enter();
- debug_leave();
- return MM_SOUND_PLUGIN_TYPE_CODEC;
+ debug_enter();
+ debug_leave();
+ return MM_SOUND_PLUGIN_TYPE_CODEC;
}
EXPORT_API
int MMSoundPlugCodecGetInterface(mmsound_codec_interface_t *intf)
{
- debug_enter();
+ debug_enter();
- intf->GetSupportTypes = MMSoundPlugCodecToneGetSupportTypes;
- intf->Create = MMSoundPlugCodecToneCreate;
- intf->Destroy = MMSoundPlugCodecToneDestroy;
- intf->Play = MMSoundPlugCodecTonePlay;
- intf->Stop = MMSoundPlugCodecToneStop;
- intf->SetThreadPool = MMSoundPlugCodecToneSetThreadPool;
+ intf->GetSupportTypes = MMSoundPlugCodecToneGetSupportTypes;
+ intf->Create = MMSoundPlugCodecToneCreate;
+ intf->Destroy = MMSoundPlugCodecToneDestroy;
+ intf->Play = MMSoundPlugCodecTonePlay;
+ intf->Stop = MMSoundPlugCodecToneStop;
+ intf->SetThreadPool = MMSoundPlugCodecToneSetThreadPool;
- debug_leave();
+ debug_leave();
- return MM_ERROR_NONE;
+ return MM_ERROR_NONE;
}
#include <sndfile.h>
#include <pulse/pulseaudio.h>
-typedef struct
-{
+typedef struct {
int handle;
int repeat_count;
int (*stop_cb)(int);
}
/* Context Callbacks */
-static void _pa_context_state_callback(pa_context *c, void *userdata) {
+static void _pa_context_state_callback(pa_context *c, void *userdata)
+{
pa_threaded_mainloop *m = (pa_threaded_mainloop *)userdata;
assert(c);
switch (pa_context_get_state(c)) {
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
- debug_log("context(%p), state(%d)", c, pa_context_get_state(c));
- break;
-
- case PA_CONTEXT_READY:
- case PA_CONTEXT_TERMINATED:
- case PA_CONTEXT_FAILED:
- debug_warning("context(%p), state(%d)", c, pa_context_get_state(c));
- pa_threaded_mainloop_signal(m, 0);
- break;
-
- default:
- break;
+ case PA_CONTEXT_CONNECTING:
+ case PA_CONTEXT_AUTHORIZING:
+ case PA_CONTEXT_SETTING_NAME:
+ debug_log("context(%p), state(%d)", c, pa_context_get_state(c));
+ break;
+
+ case PA_CONTEXT_READY:
+ case PA_CONTEXT_TERMINATED:
+ case PA_CONTEXT_FAILED:
+ debug_warning("context(%p), state(%d)", c, pa_context_get_state(c));
+ pa_threaded_mainloop_signal(m, 0);
+ break;
+
+ default:
+ break;
}
}
assert(s);
switch (pa_stream_get_state(s)) {
- case PA_STREAM_CREATING:
- debug_log("stream(%p), state(%d)", s, pa_stream_get_state(s));
- break;
- case PA_STREAM_READY:
- case PA_STREAM_FAILED:
- case PA_STREAM_TERMINATED:
- debug_warning("stream(%p), state(%d)", s, pa_stream_get_state(s));
- pa_threaded_mainloop_signal(m, 0);
- break;
- default:
- break;
+ case PA_STREAM_CREATING:
+ debug_log("stream(%p), state(%d)", s, pa_stream_get_state(s));
+ break;
+ case PA_STREAM_READY:
+ case PA_STREAM_FAILED:
+ case PA_STREAM_TERMINATED:
+ debug_warning("stream(%p), state(%d)", s, pa_stream_get_state(s));
+ pa_threaded_mainloop_signal(m, 0);
+ break;
+ default:
+ break;
}
}
if ((bytes = sf_readf_short(h->sf, data, (sf_count_t)(data_length / frame_size))) > 0)
bytes *= (sf_count_t)frame_size;
- debug_log("=== %lld / %d ===",bytes, data_length);
+ debug_log("=== %lld / %d ===", bytes, data_length);
if (bytes > 0)
pa_stream_write(s, data, (size_t)bytes, NULL, 0, PA_SEEK_RELATIVE);
memset(p, 0, sizeof(wave_info_t));
p->handle = 0;
- p->repeat_count = param ->repeat_count;
+ p->repeat_count = param->repeat_count;
p->stop_cb = param->stop_cb;
p->cb_param = param->param;
MMSOUND_STRNCPY(p->filename, param->pfilename, MM_SOUND_MAX_FILENAME);