summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJaechul Lee <jcsing.lee@samsung.com>2020-05-22 15:08:04 +0900
committerJaechul Lee <jcsing.lee@samsung.com>2020-06-17 13:35:45 +0900
commit81dc81ea6f73d7605507f4db434c04d4853f7a75 (patch)
tree2746446db3b3d704af314da2c8c0fbfa6bc42f72 /testsuite
parent5e8a21d755d0d5c0fc43bf7a238212c8735e9832 (diff)
downloadlibmm-sound-81dc81ea6f73d7605507f4db434c04d4853f7a75.tar.gz
libmm-sound-81dc81ea6f73d7605507f4db434c04d4853f7a75.tar.bz2
libmm-sound-81dc81ea6f73d7605507f4db434c04d4853f7a75.zip
tone-player and wav-player in sound-server were moved to pulseaudio. sound_server is not necessary to play sound/tone. Tizen_HW_Touch.ogg is moved to pulseaudio-modules-tizen package. [Version] 0.13.0 [Issue Type] Improvement Change-Id: I06f5088db6381d5ca79d73d45bcfa143bc4a3923 Signed-off-by: Jaechul Lee <jcsing.lee@samsung.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/mm_sound_testsuite_simple.c265
1 files changed, 1 insertions, 264 deletions
diff --git a/testsuite/mm_sound_testsuite_simple.c b/testsuite/mm_sound_testsuite_simple.c
index c335808..2094be1 100755
--- a/testsuite/mm_sound_testsuite_simple.c
+++ b/testsuite/mm_sound_testsuite_simple.c
@@ -46,7 +46,7 @@
#include <vconf.h>
#define POWERON_FILE "/usr/share/keysound/poweron.ogg"
-#define KEYTONE_FILE "/usr/share/sounds/sound-server/Tizen_HW_Touch.ogg"
+#define KEYTONE_FILE "/usr/share/sounds/mm-sound/Tizen_HW_Touch.ogg"
#define KEYTONE_NOTI_FILE "/usr/share/sounds/alsa/Front_Center.wav"
enum {
@@ -202,10 +202,6 @@ static void displaymenu()
g_print("kn : Play Keysound (Notification) \t");
g_print("ksn : Stop Keysound (Notification) \t");
g_print("ksa : Stop Keysound (All) \n");
- g_print("as : play sound with stream type\n");
- g_print("FS : Play DTMF with stream type\t");
- g_print("b : Play directory\n");
- g_print("s : Stop play \n");
g_print("==================================================================\n");
g_print(" Volume APIs\n");
g_print("==================================================================\n");
@@ -631,271 +627,12 @@ static void interpret(char *cmd)
g_print("Current Voice volume is %d\n", value);
}
- } else if (strncmp(cmd, "as", 2) == 0) {
- debug_log("stream %s type, %d", "media", g_volume_value);
- ret = mm_sound_play_sound_with_stream_info(g_file_name, "media", -1, 1, mycallback, "USERDATA", &handle);
- if (ret < 0)
- debug_log("mm_sound_play_sound() failed with 0x%x", ret);
-
- } else if (strncmp(cmd, "FS", 2) == 0) {
- char num = 0;
- char input_string[128] = "";
- char *tok = NULL;
- char *ptr = NULL;
- char *stream_type = NULL;
- int tonetime = 0;
- double volume = 1.0;
- MMSoundTone_t tone = MM_SOUND_TONE_DTMF_0;
-
- while (num != 'q') {
- fflush(stdin);
- g_print("enter number(0~H exit:q), stream type(media, system, ...), volume(0.0~1.0), time(ms):\t ");
- if (fgets(input_string, sizeof(input_string)-1, stdin)) {
- tok = strtok_r(input_string, " ", &ptr);
- if (!tok)
- continue;
- if (tok[0] == 'q') {
- break;
- } else if (tok[0] < '0' || tok[0] > '~') {
- if (tok[0] != '*' && tok[0] != '#')
- continue;
- }
- num = tok[0];
- if (num >= '0' && num <= '9')
- tone = (MMSoundTone_t)(num - '0');
- else if (num == '*')
- tone = MM_SOUND_TONE_DTMF_S;
- else if (num == '#')
- tone = MM_SOUND_TONE_DTMF_P;
- else if (num == 'A')
- tone = MM_SOUND_TONE_DTMF_A;
- else if (num == 'B')
- tone = MM_SOUND_TONE_DTMF_B;
- else if (num == 'C')
- tone = MM_SOUND_TONE_DTMF_C;
- else if (num == 'D')
- tone = MM_SOUND_TONE_DTMF_D;
- else if (num == 'E')
- tone = MM_SOUND_TONE_SUP_DIAL;
- else if (num == 'F')
- tone = MM_SOUND_TONE_ANSI_DIAL;
- else if (num == 'G')
- tone = MM_SOUND_TONE_JAPAN_DIAL;
- else if (num == 'H')
- tone = MM_SOUND_TONE_SUP_BUSY;
- else if (num == 'I')
- tone = MM_SOUND_TONE_ANSI_BUSY;
- else if (num == 'J')
- tone = MM_SOUND_TONE_JAPAN_BUSY;
- else if (num == 'K')
- tone = MM_SOUND_TONE_SUP_CONGESTION;
- else if (num == 'L')
- tone = MM_SOUND_TONE_ANSI_CONGESTION;
- else if (num == 'M')
- tone = MM_SOUND_TONE_SUP_RADIO_ACK;
- else if (num == 'N')
- tone = MM_SOUND_TONE_JAPAN_RADIO_ACK;
- else if (num == 'O')
- tone = MM_SOUND_TONE_SUP_RADIO_NOTAVAIL;
- else if (num == 'P')
- tone = MM_SOUND_TONE_SUP_ERROR;
- else if (num == 'Q')
- tone = MM_SOUND_TONE_SUP_CALL_WAITING;
- else if (num == 'R')
- tone = MM_SOUND_TONE_ANSI_CALL_WAITING;
- else if (num == 'S')
- tone = MM_SOUND_TONE_SUP_RINGTONE;
- else if (num == 'T')
- tone = MM_SOUND_TONE_ANSI_RINGTONE;
- else if (num == 'U')
- tone = MM_SOUND_TONE_PROP_BEEP;
- else if (num == 'V')
- tone = MM_SOUND_TONE_PROP_ACK;
- else if (num == 'W')
- tone = MM_SOUND_TONE_PROP_NACK;
- else if (num == 'X')
- tone = MM_SOUND_TONE_PROP_PROMPT;
- else if (num == 'Y')
- tone = MM_SOUND_TONE_PROP_BEEP2;
- else if (num == 'Z')
- tone = MM_SOUND_TONE_CDMA_HIGH_SLS;
- else if (num == '[')
- tone = MM_SOUND_TONE_CDMA_MED_SLS;
- else if (num == ']')
- tone = MM_SOUND_TONE_CDMA_LOW_SLS;
- else if (num == '^')
- tone = MM_SOUND_TONE_CDMA_HIGH_S_X4;
- else if (num == '_')
- tone = MM_SOUND_TONE_CDMA_MED_S_X4;
- else if (num == 'a')
- tone = MM_SOUND_TONE_CDMA_LOW_S_X4;
- else if (num == 'b')
- tone = MM_SOUND_TONE_CDMA_HIGH_PBX_L;
- else if (num == 'c')
- tone = MM_SOUND_TONE_CDMA_MED_PBX_L;
- else if (num == 'd')
- tone = MM_SOUND_TONE_CDMA_LOW_PBX_L;
- else if (num == 'e')
- tone = MM_SOUND_TONE_CDMA_HIGH_PBX_SS;
- else if (num == 'f')
- tone = MM_SOUND_TONE_CDMA_MED_PBX_SS;
- else if (num == 'g')
- tone = MM_SOUND_TONE_CDMA_LOW_PBX_SS;
- else if (num == 'h')
- tone = MM_SOUND_TONE_CDMA_HIGH_PBX_SSL;
- else if (num == 'i')
- tone = MM_SOUND_TONE_CDMA_MED_PBX_SSL;
- else if (num == 'j')
- tone = MM_SOUND_TONE_CDMA_LOW_PBX_SSL;
- else if (num == 'k')
- tone = MM_SOUND_TONE_CDMA_HIGH_PBX_SLS;
- else if (num == 'l')
- tone = MM_SOUND_TONE_CDMA_MED_PBX_SLS;
- else if (num == 'm')
- tone = MM_SOUND_TONE_CDMA_LOW_PBX_SLS;
- else if (num == 'n')
- tone = MM_SOUND_TONE_CDMA_HIGH_PBX_S_X4;
- else if (num == 'o')
- tone = MM_SOUND_TONE_CDMA_MED_PBX_S_X4;
- else if (num == 'p')
- tone = MM_SOUND_TONE_CDMA_LOW_PBX_S_X4;
- else if (num == 'q')
- tone = MM_SOUND_TONE_CDMA_ALERT_NETWORK_LITE;
- else if (num == 'r')
- tone = MM_SOUND_TONE_CDMA_ALERT_AUTOREDIAL_LITE;
- else if (num == 's')
- tone = MM_SOUND_TONE_CDMA_ONE_MIN_BEEP;
- else if (num == 't')
- tone = MM_SOUND_TONE_CDMA_KEYPAD_VOLUME_KEY_LITE;
- else if (num == 'u')
- tone = MM_SOUND_TONE_CDMA_PRESSHOLDKEY_LITE;
- else if (num == 'v')
- tone = MM_SOUND_TONE_CDMA_ALERT_INCALL_LITE;
- else if (num == 'w')
- tone = MM_SOUND_TONE_CDMA_EMERGENCY_RINGBACK;
- else if (num == 'x')
- tone = MM_SOUND_TONE_CDMA_ALERT_CALL_GUARD;
- else if (num == 'y')
- tone = MM_SOUND_TONE_CDMA_SOFT_ERROR_LITE;
- else if (num == 'z')
- tone = MM_SOUND_TONE_CDMA_CALLDROP_LITE;
- else if (num == '{')
- tone = MM_SOUND_TONE_LOW_FRE;
- else if (num == '}')
- tone = MM_SOUND_TONE_MED_FRE;
- else if (num == '~')
- tone = MM_SOUND_TONE_HIGH_FRE;
-
- stream_type = strtok_r(NULL, " ", &ptr);
-
- tok = strtok_r(NULL, " ", &ptr);
- if (tok)
- volume = (double)atof(tok);
-
- tok = strtok_r(NULL, " ", &ptr);
- if (tok)
- tonetime = atoi(tok);
- else
- tonetime = MIN_TONE_PLAY_TIME;
-
- debug_log("stream type: %s\t volume is %f\t tonetime: %d", stream_type, volume, tonetime);
- ret = mm_sound_play_tone_with_stream_info(tone, stream_type, -1, volume, tonetime, &handle);
- if (ret < 0)
- debug_log("failed to mm_sound_play_tone_with_stream_info(), ret[0x%x]", ret);
- } else {
- g_print("### fgets return NULL\n");
- }
- }
-
- } else if (strncmp(cmd, "b", 1) == 0) {
- DIR *basedir;
- struct dirent *entry = NULL;
- struct dirent *prev_entry = NULL;
- int entry_len;
- int ret;
- struct stat file_stat;
- char fullpath[MAX_PATH_LEN] = "";
- struct timespec start_time = {0,};
- struct timespec current_time = {0,};
-
- if (g_dir_name[strlen(g_dir_name)-1] == '/')
- g_dir_name[strlen(g_dir_name)-1] = '\0';
-
- basedir = opendir(g_dir_name);
- if (basedir != NULL) {
- entry_len = offsetof(struct dirent, d_name) + fpathconf(dirfd(basedir), MAX_STRING_LEN) + 1;
- prev_entry = malloc(entry_len);
- if (prev_entry == NULL) {
- debug_error("malloc error");
- closedir(basedir);
- break;
- }
-
- while (1) {
- int playfail = 0;
- int mywait = 0;
-
- ret = readdir_r(basedir, prev_entry, &entry);
- if (ret == 0) {
- debug_error("error on readdir_r(%p)", basedir);
- break;
- }
- if (entry == NULL)
- break;
-
- if (entry->d_name[0] == '.')
- continue;
- memset(fullpath, '\0', sizeof(fullpath));
- snprintf(fullpath, sizeof(fullpath) - 1, "%s/%s", g_dir_name, entry->d_name);
- debug_log("Try %s", fullpath);
-
- if (lstat(fullpath, &file_stat) == -1)
- continue;
-
- if (S_ISREG(file_stat.st_mode)) {
- test_callback_done = 0 ;
- start_time.tv_sec = (long int)(time(NULL));
- start_time.tv_nsec = 0;
-
- ret = mm_sound_play_sound_with_stream_info(fullpath, "media", -1, 1, test_callback, "USERDATA", &handle);
- if (ret != MM_ERROR_NONE) {
- debug_log("Play file error : %s", fullpath);
- sleep(4);
- playfail = 1;
- }
- } else {
- debug_log("this is not regular file : %s", fullpath);
- playfail = 1;
- }
- while ((test_callback_done == 0) && (playfail == 0)) {
- current_time.tv_sec = (long int)(time(NULL));
- current_time.tv_nsec = 0;
- if (current_time.tv_sec - start_time.tv_sec > 200) {
- if ((++mywait)%5 == 0) {
- debug_log("I'm waiting callback for %d seconds after play %s",
- (int)(current_time.tv_sec - start_time.tv_sec), fullpath);
- }
- }
- sleep(2);
- }
- debug_log("goto next file");
- }
- free(prev_entry);
- closedir(basedir);
- } else {
- debug_log("Cannot Open such a directory %s", g_dir_name);
- }
-
} else if (strncmp(cmd, "f", 1) == 0) {
g_menu_state = CURRENT_STATUS_FILENAME;
} else if (strncmp(cmd, "d", 1) == 0) {
g_menu_state = CURRENT_STATUS_DIRNAME;
- } else if (strncmp(cmd, "s", 1) == 0) {
- if (mm_sound_stop_sound(handle))
- debug_log(" Cannot stop sound !!! %d ", handle);
-
} else if (strncmp(cmd, "L", 1) == 0) {
int ret = 0;
mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;