* 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.
+* limitations under the License.
*/
*/
/**
- * @brief Enumerations of error codes for wav player
+ * @brief Enumeration of error codes for wav player.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
- TONE_PLAYER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ 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_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported (Since 3.0) */
} tone_player_error_e;
/**
- * @brief Enumerations of tone
+ * @brief Enumeration of tone.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum
{
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_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 */
/**
+ * @deprecated Deprecated since 3.0. Use tone_player_start_with_stream_info() instead.
* @brief Plays a tone.
*
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
+ * @remarks Sound can be mixed with other sounds if you don't control the sound session in sound-manager module since 3.0.\n
+ * You can refer to @ref CAPI_MEDIA_SUOND_MANAGER_MODULE.
+ *
* @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.
+ * @param[in] duration_ms The tone duration in milliseconds \n
+ * @c -1 indicates an infinite duration.
+ * @param[out] id The tone player ID ( can be set to @c NULL )
+ *
+ * @return @c 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_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 Plays a tone with stream information of sound-manager.
+ *
+ * @since_tizen 3.0
+ *
+ * @param[in] tone The tone type to play
+ * @param[in] stream_info The sound stream information handle
+ * @param[in] duration_ms The tone duration in milliseconds \n
+ * @c -1 indicates an infinite duration.
+ * @param[out] id The tone player ID ( can be set to @c NULL )
+ *
+ * @return @c 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
+ * @retval #TONE_PLAYER_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @see tone_player_stop()
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_destroy_stream_information()
+ */
+int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration_ms, int *id);
+
/**
* @brief Stops playing the tone.
*
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ *
* @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
+ * @retval #TONE_PLAYER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #TONE_PLAYER_ERROR_INVALID_OPERATION Invalid operation
*
* @see tone_player_start()
*/
* 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.
+* limitations under the License.
*/
#define LOG_TAG "CAPI_MEDIA_TONE_PLAYER"
#include <sound_manager.h>
+#include <sound_manager_internal.h>
#include <tone_player.h>
#include <mm_sound.h>
#include <mm_sound_private.h>
errorstr = "ERROR_NONE";
break;
case TONE_PLAYER_ERROR_INVALID_PARAMETER:
- case MM_ERROR_INVALID_ARGUMENT:
+ case MM_ERROR_INVALID_ARGUMENT:
case MM_ERROR_SOUND_INVALID_POINTER:
ret = TONE_PLAYER_ERROR_INVALID_PARAMETER;
errorstr = "INVALID_PARAMETER";
return __convert_tone_player_error_code(__func__, ret);
}
+int tone_player_start_with_stream_info(tone_type_e tone, sound_stream_info_h stream_info, int duration, int * id){
+ int ret;
+ int player;
+ double vol = 1.0;
+ char *stream_type = NULL;
+ int stream_id;
+
+ if( tone < TONE_TYPE_DEFAULT || tone > TONE_TYPE_USER_DEFINED_HIGH_FRE )
+ return __convert_tone_player_error_code(__func__, TONE_PLAYER_ERROR_INVALID_PARAMETER);
+
+ ret = sound_manager_get_type_from_stream_information(stream_info, &stream_type);
+ if( ret )
+ return __convert_tone_player_error_code(__func__, ret);
+ ret = sound_manager_get_index_from_stream_information(stream_info, &stream_id);
+ if( ret )
+ return __convert_tone_player_error_code(__func__, ret);
+
+ ret = mm_sound_play_tone_with_stream_info(tone, stream_type, stream_id, vol, 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));