01a171036cb238a3aba709d252bb58c936589b48
[platform/core/api/tone-player.git] / test / multimedia_tone_player_test.c
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. 
15 */
16
17
18
19 #include <stdio.h>
20 #include <tone_player.h>
21 #include <glib.h>
22 #include <unistd.h>
23 #include <string.h>
24 #include <stdlib.h>
25
26 static GMainLoop *g_mainloop = NULL;
27 static GThread *event_thread;
28
29 gpointer GmainThread(gpointer data){
30         g_mainloop = g_main_loop_new (NULL, 0);
31         g_main_loop_run (g_mainloop);
32
33         return NULL;
34 }
35
36 void tone_play_test(){
37         int i ;
38         
39         for( i =0 ; i <= 106 ; i++){
40                 printf("play %d sound\n", i);
41                 tone_player_start(i, SOUND_TYPE_MEDIA ,500,NULL);
42                 usleep(1000);
43
44         }
45
46 //      tone_player_start(SOUND_TONE_DTMF_C, SOUND_TYPE_MEDIA ,100000,NULL);    
47         sleep(1000);
48 }
49
50 int main(int argc, char**argv)
51 {
52         if( !g_thread_supported() )
53         {
54                 g_thread_init(NULL);
55         }
56
57         GError *gerr = NULL;
58         event_thread = g_thread_create(GmainThread, NULL, 1, &gerr);
59
60         tone_play_test();
61         return 0;
62 }