From 8eba331611306bde04758979668423ace4e9722a Mon Sep 17 00:00:00 2001 From: Kibum Kim Date: Sat, 7 Jan 2012 00:43:05 +0900 Subject: [PATCH] Git init --- .gitignore | 26 ++++ AUTHORS | 2 + CMakeLists.txt | 114 +++++++++++++++ LICENSE | 206 ++++++++++++++++++++++++++ capi-media-tone-player.pc.in | 15 ++ debian/README | 0 debian/capi-media-tone-player-dev.install | 4 + debian/capi-media-tone-player-dev.postinst | 1 + debian/capi-media-tone-player.install | 1 + debian/capi-media-tone-player.postinst | 1 + debian/changelog | 5 + debian/compat | 1 + debian/control | 22 +++ debian/rules | 65 +++++++++ include/tone_player.h | 224 +++++++++++++++++++++++++++++ packaging/capi-media-tone-player.spec | 52 +++++++ src/tone_player.c | 74 ++++++++++ test/CMakeLists.txt | 21 +++ test/multimedia_tone_player_test.c | 62 ++++++++ 19 files changed, 896 insertions(+) create mode 100755 .gitignore create mode 100755 AUTHORS create mode 100755 CMakeLists.txt create mode 100755 LICENSE create mode 100755 capi-media-tone-player.pc.in create mode 100755 debian/README create mode 100755 debian/capi-media-tone-player-dev.install create mode 100755 debian/capi-media-tone-player-dev.postinst create mode 100755 debian/capi-media-tone-player.install create mode 100755 debian/capi-media-tone-player.postinst create mode 100644 debian/changelog create mode 100755 debian/compat create mode 100755 debian/control create mode 100755 debian/rules create mode 100755 include/tone_player.h create mode 100755 packaging/capi-media-tone-player.spec create mode 100755 src/tone_player.c create mode 100755 test/CMakeLists.txt create mode 100755 test/multimedia_tone_player_test.c diff --git a/.gitignore b/.gitignore new file mode 100755 index 0000000..f884ceb --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +CMakeCache.txt +*/CMakeFiles/* +*.cmake +CMakeFiles* +*.a +*.so +Testing +cmake.depends +cmake.check_depends +cmake.check_cache +core +core.* +gmon.out +install_manifest.txt +*~ +.kdev_include_paths +src.kdev4 +.cproject +.project +tet_captured +tet_lock +*.pc +*-test +*-test_* +*tester.c +TC/config diff --git a/AUTHORS b/AUTHORS new file mode 100755 index 0000000..a724834 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,2 @@ +Seungkeun Lee +Kangho Hur diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100755 index 0000000..2ab940e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,114 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) + +SET(Services + "application" + "base" + "content" + "location" + "media" + "messaging" + "network" + "social" + "telephony" + "system" + ) + + +# project +SET(project_prefix "capi") +SET(prefix "/usr") +SET(version "0.0.1") +SET(maintainer "Seungkeun Lee , Kangho Hur") +SET(description "A tone player library in Tizen Native API") +SET(service "media") +SET(submodule "tone-player") + +# for package file +SET(dependents "mm-sound dlog capi-base-common capi-media-sound-manager") + +SET(fw_name "${project_prefix}-${service}-${submodule}") + +PROJECT(${fw_name}) + +SET(CMAKE_INSTALL_PREFIX ${prefix}) +SET(PREFIX ${CMAKE_INSTALL_PREFIX}) +SET(VERSION ${version}) + +SET(INC_DIR include) +INCLUDE_DIRECTORIES(${INC_DIR}) + +INCLUDE(FindPkgConfig) +pkg_check_modules(${fw_name} REQUIRED ${dependents}) +FOREACH(flag ${${fw_name}_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") +ENDFOREACH(flag) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror") +SET(CMAKE_C_FLAGS_DEBUG "-O0 -g") + +IF("${ARCH}" MATCHES "^arm.*") + ADD_DEFINITIONS("-DTARGET") +ENDIF("${ARCH}" MATCHES "^arm.*") + +ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"") +ADD_DEFINITIONS("-DTIZEN_DEBUG") + +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib") + +aux_source_directory(src SOURCES) +ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) + +TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS}) + +INSTALL(TARGETS ${fw_name} DESTINATION lib) +INSTALL( + DIRECTORY ${INC_DIR}/ DESTINATION include/${service} + FILES_MATCHING + PATTERN "*_private.h" EXCLUDE + PATTERN "${INC_DIR}/*.h" + ) + +SET(PC_NAME ${fw_name}) +SET(PC_REQUIRED ${dependents}) +SET(PC_LDFLAGS -l${fw_name}) +SET(PC_CFLAGS -I\${includedir}/${service}) + +CONFIGURE_FILE( + ${fw_name}.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc + @ONLY +) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig) + +#ADD_SUBDIRECTORY(test) + +IF(UNIX) + +ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution) +ADD_CUSTOM_COMMAND( + DEPENDS clean + COMMENT "distribution clean" + COMMAND find + ARGS . + -not -name config.cmake -and \( + -name tester.c -or + -name Testing -or + -name CMakeFiles -or + -name cmake.depends -or + -name cmake.check_depends -or + -name CMakeCache.txt -or + -name cmake.check_cache -or + -name *.cmake -or + -name Makefile -or + -name core -or + -name core.* -or + -name gmon.out -or + -name install_manifest.txt -or + -name *.pc -or + -name *~ \) + | grep -v TC | xargs rm -rf + TARGET distclean + VERBATIM +) + +ENDIF(UNIX) diff --git a/LICENSE b/LICENSE new file mode 100755 index 0000000..bbe9d02 --- /dev/null +++ b/LICENSE @@ -0,0 +1,206 @@ +Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + + diff --git a/capi-media-tone-player.pc.in b/capi-media-tone-player.pc.in new file mode 100755 index 0000000..773d667 --- /dev/null +++ b/capi-media-tone-player.pc.in @@ -0,0 +1,15 @@ + +# Package Information for pkg-config + +prefix=@PREFIX@ +exec_prefix=/usr +libdir=/usr/lib +includedir=/usr/include/media + +Name: @PC_NAME@ +Description: @PACKAGE_DESCRIPTION@ +Version: @VERSION@ +Requires: @PC_REQUIRED@ +Libs: -L${libdir} @PC_LDFLAGS@ +Cflags: -I${includedir} @PC_CFLAGS@ + diff --git a/debian/README b/debian/README new file mode 100755 index 0000000..e69de29 diff --git a/debian/capi-media-tone-player-dev.install b/debian/capi-media-tone-player-dev.install new file mode 100755 index 0000000..761a28b --- /dev/null +++ b/debian/capi-media-tone-player-dev.install @@ -0,0 +1,4 @@ +/usr/include/* +/usr/include/*/* +/usr/lib/pkgconfig/*.pc + diff --git a/debian/capi-media-tone-player-dev.postinst b/debian/capi-media-tone-player-dev.postinst new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/debian/capi-media-tone-player-dev.postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/debian/capi-media-tone-player.install b/debian/capi-media-tone-player.install new file mode 100755 index 0000000..4a755a4 --- /dev/null +++ b/debian/capi-media-tone-player.install @@ -0,0 +1 @@ +/usr/lib/lib*.so* diff --git a/debian/capi-media-tone-player.postinst b/debian/capi-media-tone-player.postinst new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/debian/capi-media-tone-player.postinst @@ -0,0 +1 @@ +#!/bin/sh diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b8a15ba --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +capi-media-tone-player (0.1.0-5) unstable; urgency=low + + * Initial release. + + -- Seungkeun Lee Wed, 07 Dec 2011 12:53:09 +0900 diff --git a/debian/compat b/debian/compat new file mode 100755 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100755 index 0000000..57bde41 --- /dev/null +++ b/debian/control @@ -0,0 +1,22 @@ + +Source: capi-media-tone-player +Section: libs +Priority: extra +Maintainer: Seungkeun Lee , Kangho Hur +Build-Depends: debhelper (>= 5), libmm-sound-dev , capi-base-common-dev , dlog-dev, capi-media-sound-manager-dev + +Package: capi-media-tone-player +Architecture: any +Depends: ${shilbs:Depends}, ${misc:Depends} , libmm-sound-0 +Description: A tone player library in Tizen Native API + +Package: capi-media-tone-player-dev +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-tone-player (= ${Source-Version}), dlog-dev, capi-base-common-dev, libmm-sound-dev +Description: A tone player library in Tizen Native API (DEV) + +Package: capi-media-tone-player-dbg +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-media-tone-player (= ${Source-Version}) +Description: A tone player library in Tizen Native API (DBG) + diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..e82563d --- /dev/null +++ b/debian/rules @@ -0,0 +1,65 @@ +#!/usr/bin/make -f + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +CMAKE_ROOT_DIR ?= $(CURDIR) +CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp + +configure: configure-stamp +configure-stamp: + dh_testdir + mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. + touch configure-stamp + + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + cd $(CMAKE_BUILD_DIR) && $(MAKE) + touch $@ + +clean: + cd $(CMAKE_ROOT_DIR) + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + rm -f + rm -rf $(CMAKE_BUILD_DIR) + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_installexamples + dh_install --sourcedir=debian/tmp + dh_installman + dh_link + dh_strip --dbg-package=capi-media-tone-player-dbg + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure + diff --git a/include/tone_player.h b/include/tone_player.h new file mode 100755 index 0000000..21031b6 --- /dev/null +++ b/include/tone_player.h @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + + +#ifndef __TIZEN_MEDIA_TONE_PLAYER_H__ +#define __TIZEN_MEDIA_TONE_PLAYER_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +#define TONE_PLAYER_ERROR_CLASS TIZEN_ERROR_MULTIMEDIA_CLASS | 0x60 + +/** + * @file tone_player.h + * @brief This file contains the tone player API + */ + +/** + * @addtogroup CAPI_MEDIA_TONE_PLAYER_MODULE + * @{ + */ + +/** + * @brief Enumerations of error codes for wav player + */ +typedef enum +{ + TONE_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + TONE_PLAYER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + TONE_PLAYER_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */ +} tone_player_error_e; + +/** + * @brief Enumerations of tone + */ +typedef enum +{ + TONE_TYPE_DEFAULT = 0, /**< The default tone */ + TONE_TYPE_DTMF_0 = 0, /**< Predefined DTMF 0 */ + TONE_TYPE_DTMF_1, /**< Predefined DTMF 1 */ + TONE_TYPE_DTMF_2, /**< Predefined DTMF 2 */ + TONE_TYPE_DTMF_3, /**< Predefined DTMF 3 */ + TONE_TYPE_DTMF_4, /**< Predefined DTMF 4 */ + TONE_TYPE_DTMF_5, /**< Predefined DTMF 5 */ + TONE_TYPE_DTMF_6, /**< Predefined DTMF 6 */ + TONE_TYPE_DTMF_7, /**< Predefined DTMF 7 */ + TONE_TYPE_DTMF_8, /**< Predefined DTMF 8 */ + TONE_TYPE_DTMF_9, /**< Predefined DTMF 9 */ + TONE_TYPE_DTMF_S, /**< Predefined DTMF Star - Asterisk (*) */ + TONE_TYPE_DTMF_P, /**< Predefined DTMF sharP (#) */ + TONE_TYPE_DTMF_A, /**< Predefined DTMF A (A) */ + TONE_TYPE_DTMF_B, /**< Predefined DTMF B (B) */ + TONE_TYPE_DTMF_C, /**< Predefined DTMF C (C) */ + TONE_TYPE_DTMF_D, /**< Predefined DTMF D (D) */ + TONE_TYPE_SUP_DIAL, /**< Call supervisory tone, Dial tone: CEPT: 425Hz, continuous */ + TONE_TYPE_ANSI_DIAL, /**< Call supervisory tone, Dial tone: ANSI (IS-95): 350Hz+440Hz, continuous */ + TONE_TYPE_JAPAN_DIAL, /**< Call supervisory tone, Dial tone: JAPAN: 400Hz, continuous*/ + TONE_TYPE_SUP_BUSY, /**< Call supervisory tone, Busy: CEPT: 425Hz, 500ms ON, 500ms OFF... */ + TONE_TYPE_ANSI_BUSY, /**< Call supervisory tone, Busy: ANSI (IS-95): 480Hz+620Hz, 500ms ON, 500ms OFF... */ + TONE_TYPE_JAPAN_BUSY, /**< Call supervisory tone, Busy: JAPAN: 400Hz, 500ms ON, 500ms OFF...*/ + TONE_TYPE_SUP_CONGESTION, /**< Call supervisory tone, Congestion: CEPT, JAPAN: 425Hz, 200ms ON, 200ms OFF */ + TONE_TYPE_ANSI_CONGESTION, /**< Call supervisory tone, Congestion: ANSI (IS-95): 480Hz+620Hz, 250ms ON, 250ms OFF... */ + TONE_TYPE_SUP_RADIO_ACK, /**< Call supervisory tone, Radio path acknowledgment : CEPT, ANSI: 425Hz, 200ms ON */ + TONE_TYPE_JAPAN_RADIO_ACK, /**< Call supervisory tone, Radio path acknowledgment : JAPAN: 400Hz, 1s ON, 2s OFF...*/ + TONE_TYPE_SUP_RADIO_NOTAVAIL, /**< Call supervisory tone, Radio path not available: 425Hz, 200ms ON, 200 OFF 3 bursts */ + TONE_TYPE_SUP_ERROR, /**< Call supervisory tone, Error/Special info: 950Hz+1400Hz+1800Hz, 330ms ON, 1s OFF... */ + TONE_TYPE_SUP_CALL_WAITING, /**< Call supervisory tone, Call Waiting: CEPT, JAPAN: 425Hz, 200ms ON, 600ms OFF, 200ms ON, 3s OFF... */ + TONE_TYPE_ANSI_CALL_WAITING, /**< Call supervisory tone, Call Waiting: ANSI (IS-95): 440 Hz, 300 ms ON, 9.7 s OFF, (100 ms ON, 100 ms OFF, 100 ms ON, 9.7s OFF ...) */ + TONE_TYPE_SUP_RINGTONE, /**< Call supervisory tone, Ring Tone: CEPT, JAPAN: 425Hz, 1s ON, 4s OFF... */ + TONE_TYPE_ANSI_RINGTONE, /**< Call supervisory tone, Ring Tone: ANSI (IS-95): 440Hz + 480Hz, 2s ON, 4s OFF... */ + TONE_TYPE_PROP_BEEP, /**< General beep: 400Hz+1200Hz, 35ms ON */ + TONE_TYPE_PROP_ACK, /**< Proprietary tone, positive acknowledgment: 1200Hz, 100ms ON, 100ms OFF 2 bursts */ + TONE_TYPE_PROP_NACK, /**< Proprietary tone, negative acknowledgment: 300Hz+400Hz+500Hz, 400ms ON */ + TONE_TYPE_PROP_PROMPT, /**< Proprietary tone, prompt tone: 400Hz+1200Hz, 200ms ON */ + TONE_TYPE_PROP_BEEP2, /**< Proprietary tone, general double beep: twice 400Hz+1200Hz, 35ms ON, 200ms OFF, 35ms ON */ + TONE_TYPE_SUP_INTERCEPT, /**< Call supervisory tone (IS-95), intercept tone: alternating 440 Hz and 620 Hz tones, each on for 250 ms */ + TONE_TYPE_SUP_INTERCEPT_ABBREV, /**< Call supervisory tone (IS-95), abbreviated intercept: intercept tone limited to 4 seconds */ + TONE_TYPE_SUP_CONGESTION_ABBREV, /**< Call supervisory tone (IS-95), abbreviated congestion: congestion tone limited to 4 seconds */ + TONE_TYPE_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 */ + TONE_TYPE_SUP_PIP, /**< Call supervisory tone (IS-95), pip tone: four bursts of 480 Hz tone (0.1 s on, 0.1 s off). */ + TONE_TYPE_CDMA_DIAL_TONE_LITE, /**< 425Hz continuous */ + TONE_TYPE_CDMA_NETWORK_USA_RINGBACK, /**< CDMA USA Ringback: 440Hz+480Hz 2s ON, 4000 OFF ...*/ + TONE_TYPE_CDMA_INTERCEPT, /**< CDMA Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON ...*/ + TONE_TYPE_CDMA_ABBR_INTERCEPT, /**< CDMA Abbr Intercept tone: 440Hz 250ms ON, 620Hz 250ms ON */ + TONE_TYPE_CDMA_REORDER, /**< CDMA Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF... */ + TONE_TYPE_CDMA_ABBR_REORDER, /**< CDMA Abbr Reorder tone: 480Hz+620Hz 250ms ON, 250ms OFF repeated for 8 times */ + TONE_TYPE_CDMA_NETWORK_BUSY, /**< CDMA Network Busy tone: 480Hz+620Hz 500ms ON, 500ms OFF continuous */ + TONE_TYPE_CDMA_CONFIRM, /**< CDMA Confirm tone: 350Hz+440Hz 100ms ON, 100ms OFF repeated for 3 times */ + TONE_TYPE_CDMA_ANSWER, /**< CDMA answer tone: silent tone - definition Frequency 0, 0ms ON, 0ms OFF */ + TONE_TYPE_CDMA_NETWORK_CALLWAITING, /**< CDMA Network Callwaiting tone: 440Hz 300ms ON */ + TONE_TYPE_CDMA_PIP, /**< CDMA PIP tone: 480Hz 100ms ON, 100ms OFF repeated for 4 times */ + TONE_TYPE_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 */ + TONE_TYPE_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.*/ + TONE_TYPE_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 */ + TONE_TYPE_CDMA_CALL_SIGNAL_ISDN_PAT3, /**< SDN Call sign PAT3 tone: silent tone */ + TONE_TYPE_CDMA_CALL_SIGNAL_ISDN_PING_RING, /**< ISDN Ping Ring tone: {2091Hz 32ms ON, 2556Hz 64ms ON} 5 times 2091Hz 20ms ON */ + TONE_TYPE_CDMA_CALL_SIGNAL_ISDN_PAT5, /**< ISDN Pat5 tone: silent tone */ + TONE_TYPE_CDMA_CALL_SIGNAL_ISDN_PAT6, /**< ISDN Pat6 tone: silent tone */ + TONE_TYPE_CDMA_CALL_SIGNAL_ISDN_PAT7, /**< ISDN Pat7 tone: silent tone */ + TONE_TYPE_CDMA_HIGH_L, /**< TONE_CDMA_HIGH_L tone: {3700Hz 25ms, 4000Hz 25ms} 40 times 4000ms OFF, Repeat .... */ + TONE_TYPE_CDMA_MED_L, /**< TONE_CDMA_MED_L tone: {2600Hz 25ms, 2900Hz 25ms} 40 times 4000ms OFF, Repeat .... */ + TONE_TYPE_CDMA_LOW_L, /**< TONE_CDMA_LOW_L tone: {1300Hz 25ms, 1450Hz 25ms} 40 times, 4000ms OFF, Repeat .... */ + TONE_TYPE_CDMA_HIGH_SS, /**< CDMA HIGH SS tone: {3700Hz 25ms, 4000Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */ + TONE_TYPE_CDMA_MED_SS, /**< CDMA MED SS tone: {2600Hz 25ms, 2900Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */ + TONE_TYPE_CDMA_LOW_SS, /**< CDMA LOW SS tone: {1300z 25ms, 1450Hz 25ms} repeat 16 times, 400ms OFF, repeat .... */ + TONE_TYPE_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 ... */ + TONE_TYPE_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 ... */ + TONE_TYPE_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 ... */ + TONE_TYPE_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 .... */ + TONE_TYPE_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 .... */ + TONE_TYPE_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 .... */ + TONE_TYPE_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 */ + TONE_TYPE_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 */ + TONE_TYPE_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 */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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....*/ + TONE_TYPE_CDMA_HIGH_PBX_L, /**< CDMA HIGH PBX L: {3700Hz 25ms, 4000Hz 25ms}20 times, 2000ms OFF, REPEAT.... */ + TONE_TYPE_CDMA_MED_PBX_L, /**< CDMA MED PBX L: {2600Hz 25ms, 2900Hz 25ms}20 times, 2000ms OFF, REPEAT.... */ + TONE_TYPE_CDMA_LOW_PBX_L, /**< CDMA LOW PBX L: {1300Hz 25ms,1450Hz 25ms}20 times, 2000ms OFF, REPEAT.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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.... */ + TONE_TYPE_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... */ + TONE_TYPE_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... */ + TONE_TYPE_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... */ + TONE_TYPE_CDMA_ALERT_NETWORK_LITE, /**< CDMA Alert Network Lite tone: 1109Hz 62ms ON, 784Hz 62ms ON, 740Hz 62ms ON 622Hz 62ms ON, 1109Hz 62ms ON */ + TONE_TYPE_CDMA_ALERT_AUTOREDIAL_LITE, /**< CDMA Alert Auto Redial tone: {1245Hz 62ms ON, 659Hz 62ms ON} 3 times, 1245 62ms ON */ + TONE_TYPE_CDMA_ONE_MIN_BEEP, /**< CDMA One Min Beep tone: 1150Hz+770Hz 400ms ON */ + TONE_TYPE_CDMA_KEYPAD_VOLUME_KEY_LITE, /**< CDMA KEYPAD Volume key lite tone: 941Hz+1477Hz 120ms ON */ + TONE_TYPE_CDMA_PRESSHOLDKEY_LITE, /**< CDMA PRESSHOLDKEY LITE tone: 587Hz 375ms ON, 1175Hz 125ms ON */ + TONE_TYPE_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*/ + TONE_TYPE_CDMA_EMERGENCY_RINGBACK, /**< CDMA EMERGENCY RINGBACK tone: {941Hz 125ms ON, 10ms OFF} 3times 4990ms OFF, REPEAT... */ + TONE_TYPE_CDMA_ALERT_CALL_GUARD, /**< CDMA ALERT CALL GUARD tone: {1319Hz 125ms ON, 125ms OFF} 3 times */ + TONE_TYPE_CDMA_SOFT_ERROR_LITE, /**< CDMA SOFT ERROR LITE tone: 1047Hz 125ms ON, 370Hz 125ms */ + TONE_TYPE_CDMA_CALLDROP_LITE, /**< CDMA CALLDROP LITE tone: 1480Hz 125ms, 1397Hz 125ms, 784Hz 125ms */ + TONE_TYPE_CDMA_NETWORK_BUSY_ONE_SHOT, /**< CDMA_NETWORK_BUSY_ONE_SHOT tone: 425Hz 500ms ON, 500ms OFF. */ + TONE_TYPE_CDMA_ABBR_ALERT, /**< CDMA_ABBR_ALERT tone: 1150Hz+770Hz 400ms ON */ + TONE_TYPE_CDMA_SIGNAL_OFF /**< CDMA_SIGNAL_OFF - silent tone */ + +} tone_type_e; + + +/** + * @} + */ + + +/** + * @addtogroup CAPI_MEDIA_TONE_PLAYER_MODULE + * @{ + */ + + +/** + * @brief Plays a tone. + * + * @param[in] tone The tone type to play + * @param[in] type The sound type + * @param[in] duration_ms The tone duration in milliseconds\n + * -1 indicates an infinite duration + * @param[out] id The tone player ID ( can be set to NULL ) + * + * @return 0 on success, otherwise a negative error value. + * @retval #TONE_PLAYER_ERROR_NONE Successful + * @retval #TONE_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TONE_PLAYER_ERROR_INVALID_OPERATION Invalid operation + * + * @see tone_player_stop() + */ +int tone_player_start(tone_type_e tone, sound_type_e type, int duration_ms, int *id); + +/** + * @brief Stops playing the tone. + * + * @param[in] id The tone player ID to stop + * + * @return 0 on success, otherwise a negative error value. + * @retval #TONE_PLAYER_ERROR_NONE Successful + * @retval #TONE_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #TONE_PLAYER_ERROR_INVALID_OPERATION Invalid operation + * + * @see tone_player_start() + */ +int tone_player_stop(int id); + + + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __TIZEN_MEDIA_TONE_PLAYER_H__ */ diff --git a/packaging/capi-media-tone-player.spec b/packaging/capi-media-tone-player.spec new file mode 100755 index 0000000..0beb85a --- /dev/null +++ b/packaging/capi-media-tone-player.spec @@ -0,0 +1,52 @@ +Name: capi-media-tone-player +Summary: A tone player library in Tizen Native API +Version: 0.0.1 +Release: 1 +Group: TO_BE/FILLED_IN +License: TO BE FILLED IN +Source0: %{name}-%{version}.tar.gz +BuildRequires: cmake +BuildRequires: pkgconfig(mm-sound) +BuildRequires: pkgconfig(dlog) +BuildRequires: pkgconfig(capi-base-common) +BuildRequires: pkgconfig(capi-media-sound-manager) +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig + +%description + + +%package devel +Summary: A tone player library in Tizen Native API (Development) +Group: TO_BE/FILLED_IN +Requires: %{name} = %{version}-%{release} + +%description devel + + + +%prep +%setup -q + + +%build +cmake . + + +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + +%files +%{_libdir}/libcapi-media-tone-player.so + +%files devel +%{_includedir}/media/*.h +%{_libdir}/pkgconfig/*.pc diff --git a/src/tone_player.c b/src/tone_player.c new file mode 100755 index 0000000..743a50d --- /dev/null +++ b/src/tone_player.c @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + + +#define LOG_TAG "TIZEN_N_TONE_PLAYER" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int _convert_tone_player_error_code(const char *func, int code){ + int ret = TONE_PLAYER_ERROR_NONE; + char *errorstr = NULL; + switch(code) + { + case MM_ERROR_NONE: + ret = TONE_PLAYER_ERROR_NONE; + errorstr = "ERROR_NONE"; + break; + case TONE_PLAYER_ERROR_INVALID_PARAMETER: + case MM_ERROR_INVALID_ARGUMENT: + case MM_ERROR_SOUND_INVALID_POINTER: + ret = TONE_PLAYER_ERROR_INVALID_PARAMETER; + errorstr = "INVALID_PARAMETER"; + break; + case MM_ERROR_SOUND_INTERNAL: + ret = TONE_PLAYER_ERROR_INVALID_OPERATION; + errorstr = "INVALID_OPERATION"; + break; + } + LOGE( "[%s] %s(0x%08x) : core frameworks error code(0x%08x)",func, errorstr, ret, code); + return ret; +} + + +int tone_player_start(tone_type_e tone, sound_type_e type, int duration, int *id){ + int ret; + int player; + if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_CDMA_SIGNAL_OFF ) + return _convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER); + + ret = mm_sound_play_tone(tone, type , 1, duration, &player); + + if( ret == 0 && id != NULL) + *id = player; + return _convert_tone_player_error_code(__func__, ret); +} + +int tone_player_stop(int id){ + return _convert_tone_player_error_code(__func__, mm_sound_stop_sound(id)); +} + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100755 index 0000000..353da53 --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,21 @@ +SET(fw_test "${fw_name}-test") + +INCLUDE(FindPkgConfig) +pkg_check_modules(${fw_test} REQUIRED mm-sound glib-2.0 gthread-2.0 capi-media-sound-manager) +FOREACH(flag ${${fw_test}_CFLAGS}) + SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") + MESSAGE(${flag}) +ENDFOREACH() + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall") + +#ADD_EXECUTABLE("system-sensor" system-sensor.c) +#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS}) + +aux_source_directory(. sources) +FOREACH(src ${sources}) + GET_FILENAME_COMPONENT(src_name ${src} NAME_WE) + MESSAGE("${src_name}") + ADD_EXECUTABLE(${src_name} ${src}) + TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS}) +ENDFOREACH() diff --git a/test/multimedia_tone_player_test.c b/test/multimedia_tone_player_test.c new file mode 100755 index 0000000..01a1710 --- /dev/null +++ b/test/multimedia_tone_player_test.c @@ -0,0 +1,62 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + + + +#include +#include +#include +#include +#include +#include + +static GMainLoop *g_mainloop = NULL; +static GThread *event_thread; + +gpointer GmainThread(gpointer data){ + g_mainloop = g_main_loop_new (NULL, 0); + g_main_loop_run (g_mainloop); + + return NULL; +} + +void tone_play_test(){ + int i ; + + for( i =0 ; i <= 106 ; i++){ + printf("play %d sound\n", i); + tone_player_start(i, SOUND_TYPE_MEDIA ,500,NULL); + usleep(1000); + + } + +// tone_player_start(SOUND_TONE_DTMF_C, SOUND_TYPE_MEDIA ,100000,NULL); + sleep(1000); +} + +int main(int argc, char**argv) +{ + if( !g_thread_supported() ) + { + g_thread_init(NULL); + } + + GError *gerr = NULL; + event_thread = g_thread_create(GmainThread, NULL, 1, &gerr); + + tone_play_test(); + return 0; +} -- 2.7.4