2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_SOUND_POOL_H__
18 #define __TIZEN_SOUND_POOL_H__
20 #include "sound_pool_type.h"
28 * @brief This file contains Tizen Sound Pool API.
32 * @addtogroup CAPI_SOUND_POOL_MODULE
37 * @brief Called when sound pool state is changed.
40 * @param [in] pool The handle to the sound pool
41 * @param [in] prev_state Previous pool state
42 * @param [in] cur_state Current pool state
43 * @param [in] user_data The user data passed from the code where
44 * @ref sound_pool_set_state_change_callback() was
47 * @pre Create sound pool handler by calling @ref sound_pool_create()
48 * @pre Call @ref sound_pool_set_state_change_callback()
50 * @see sound_pool_create()
51 * @see sound_pool_set_state_change_callback()
52 * @see sound_pool_state_e
54 typedef void (*sound_pool_state_change_cb) (sound_pool_h pool,
55 sound_pool_state_e prev_state, sound_pool_state_e cur_state,
59 * @brief Called when sound pool stream state is changed.
62 * @param [in] pool The handle to the sound pool
63 * @param [in] tag Unique string that identifies source which was used
65 * @param [in] id Unique stream identifier
66 * @param [in] prev_state Previous stream state
67 * @param [in] cur_state Current stream state
68 * @param [in] data The user data passed from the code where
69 * @ref sound_pool_stream_set_state_change_callback()
72 * @pre Create sound pool handler by calling @ref sound_pool_create()
73 * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
74 * @pre Start source playback by calling @ref sound_pool_stream_play()
75 * @pre Call @ref sound_pool_stream_set_state_change_callback()
77 * @see sound_pool_create()
78 * @see sound_pool_load_source_from_file()
79 * @see sound_pool_stream_play()
80 * @see sound_pool_stream_set_state_change_callback()
81 * @see sound_pool_stream_state_e
83 typedef void (*sound_pool_stream_state_change_cb) (sound_pool_h pool,
84 const char *tag, unsigned id, sound_pool_stream_state_e prev_state,
85 sound_pool_stream_state_e cur_state, void *user_data);
88 * @brief Creates sound pool instance that can be used for sound sources
90 * @details Up to 32 sound pools can be created. Several pools can be active
91 * at the same time. Streams can be in playing state only when pool is
93 * @remarks When pool has been created, pool state is
94 * SOUND_POOL_STATE_INACTIVE. To activate a pool use
95 * @ref sound_pool_activate() function.
98 * @param [out] pool The handle to the pool that will be created
99 * @return @c 0 on success, otherwise a negative error value
100 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
101 * Invalid parameter (@a pool is NULL)
102 * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY
103 * Not enough memory to create sound pool
104 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION
105 * Maximal amount of sound pools is exceeded (usually, 32 pools allowed)
107 * @see sound_pool_destroy()
109 sound_pool_error_e sound_pool_create(sound_pool_h *pool);
112 * @brief Destroys sound pool and cleans allocated memory.
113 * @details Stops all streams and unloads all sources associated with pool.
116 * @param [in] pool The handle to the pool that will be destroyed
117 * @return @c 0 on success, otherwise a negative error value
118 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
119 * Invalid parameter (@a pool is NULL or corrupted)
120 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
122 * @pre Create sound pool handler by calling @ref sound_pool_create()
124 * @see sound_pool_create()
126 sound_pool_error_e sound_pool_destroy(sound_pool_h pool);
129 * @brief Loads sound source data from file to pool.
130 * @details After calling this routine the source can be accessed by its @a tag.
131 * @remarks Input data can be either raw or encoded.
132 * Each of loaded sources must have unique @a tag
133 * It is synchronous operation.
136 * @param [in] pool The handle to the sound pool
137 * @param [in] file_name The name of file that contains sound data
138 * @param [in] tag Unique string that will be used to identify source
139 * @return @c 0 on success, otherwise a negative error value
140 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
141 * Invalid parameter (@a pool is NULL or corrupted, @a file_name is
142 * NULL, @a tag is NULL or @a tag/@a file_name length is too long)
143 * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY Not enough memory to allocate source
144 * @retval #SOUND_POOL_ERROR_NO_SUCH_FILE No file determined by @a file_name
145 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
147 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
148 * @post Unload source from pool by calling @ref sound_pool_unload_source()
150 * @see sound_pool_create()
151 * @see sound_pool_destroy()
152 * @see sound_pool_unload_source()
154 sound_pool_error_e sound_pool_load_source_from_file(sound_pool_h pool,
155 const char *file_name, const char *tag);
158 * @brief Unloads source from @a pool.
159 * @details Cleans memory. It is synchronous operation.
160 * @remarks The usage of @a tag name that was associated with unloaded source
161 * has no effect. It can be reused as well.
164 * @param [in] pool The handle to the sound pool
165 * @param [in] tag Unique string that identifies source
166 * @return @c 0 on success, otherwise a negative error value
167 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
168 * Invalid parameter (@a pool is NULL or corrupted, @a tag is NULL)
169 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
172 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
173 * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
175 * @see sound_pool_create()
176 * @see sound_pool_load_source_from_file()
178 sound_pool_error_e sound_pool_unload_source(sound_pool_h pool, const char *tag);
181 * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_ACTIVE.
182 * @remarks When activation is performed, all suspended streams with highest
183 * priority in the pool will resume their playback. Paused streams will
184 * remain their state.
187 * @param [in] pool The handle to the sound pool
188 * @return @c 0 on success, otherwise a negative error value
189 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
190 * (@a pool is NULL or corrupted)
191 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or sound pool
192 * is already in @c SOUND_POOL_STATE_ACTIVE state
194 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
196 * @see sound_pool_create()
197 * @see sound_pool_get_state()
198 * @see sound_pool_deactivate()
199 * @see sound_pool_state_e
201 sound_pool_error_e sound_pool_activate(sound_pool_h pool);
204 * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_INACTIVE.
205 * @remarks When deactivation is performed, all playing streams in the pool will
206 * be suspended (change state to SOUND_POOL_STREAM_STATE_SUSPENDED).
207 * Paused streams will remain their state.
210 * @param [in] pool The handle to the sound pool
211 * @return @c 0 on success, otherwise a negative error value
212 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
213 * (@a pool is NULL or corrupted)
214 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or sound pool
215 * is already in @c SOUND_POOL_STATE_INACTIVE state
217 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
218 * @pre @a pool has to be in SOUND_POOL_STATE_ACTIVE state
220 * @see sound_pool_create()
221 * @see sound_pool_get_state()
222 * @see sound_pool_activate()
223 * @see sound_pool_state_e
225 sound_pool_error_e sound_pool_deactivate(sound_pool_h pool);
228 * @brief Sets pool global volume parameter.
229 * @details Volume of all streams related to @a pool will be scaled
230 * in accordance to global pool volume parameter
231 * (i.e. [stream real volume] = [global volume] * [stream volume],
232 * where [stream volume] is the volume parameter of arbitrary stream).
235 * @param [in] pool The handle to the sound pool
236 * @param [in] volume Pool global volume in 0.0~1.0 range
237 * @return @c 0 on success, otherwise a negative error value
238 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
239 * (@a pool is NULL or corrupted, or @a volume isn't in 0.0~1.0 range)
240 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
242 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
244 * @see sound_pool_create()
246 sound_pool_error_e sound_pool_set_volume(sound_pool_h pool, float volume);
249 * @brief Gets pool global volume parameter.
252 * @param [in] pool The handle to the sound pool
253 * @param [out] volume Pool global volume in 0.0~1.0 range
254 * @return @c 0 on success, otherwise a negative error value
255 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
256 * (@a pool is NULL or corrupted, or @a volume is NULL)
258 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
260 * @see sound_pool_create()
262 sound_pool_error_e sound_pool_get_volume(sound_pool_h pool, float *volume);
265 * @brief Gets current @a state of @a pool.
268 * @param [in] pool The handle to the sound pool
269 * @param [out] state Current state of @a pool
270 * @return @c 0 on success, otherwise a negative error value
271 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
272 * Invalid parameter (@a pool is NULL or corrupted, @a tag is NULL)
274 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
276 * @see sound_pool_create()
277 * @see sound_pool_state_e
279 sound_pool_error_e sound_pool_get_state(sound_pool_h pool,
280 sound_pool_state_e *state);
283 * @brief Sets callback for handling sound @a pool state change.
286 * @param [in] pool The handle to the sound pool
287 * @param [in] callback The callback that will be called after pool state
288 * will be changed. @a callback will be called
290 * @param [in] user_data The user data to be passed to the @a callback
291 * @return @c 0 on success, otherwise a negative error value
292 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
293 * (@a pool is NULL or corrupted, or @a callback is NULL)
295 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
296 * @post Use @ref sound_pool_unset_state_change_callback() function to unset the
299 * @see sound_pool_create()
300 * @see sound_pool_pool_state_change_cb
302 sound_pool_error_e sound_pool_set_state_change_callback(sound_pool_h pool,
303 sound_pool_state_change_cb callback, void *user_data);
306 * @brief Unsets callback for handling sound @a pool state change.
309 * @param [in] pool The handle to the pool
310 * @return @c 0 on success, otherwise a negative error value
311 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
312 * (@a pool is NULL or corrupted)
314 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
315 * @pre Set state change callback by calling
316 * @ref sound_pool_set_state_change_callback()
318 * @see sound_pool_create()
319 * @see sound_pool_set_state_change_callback()
321 sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
324 * @brief Plays source by @a tag.
325 * @details Creates stream with @a id that can be used to change parameters and
326 * get additional information.
327 * Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING
328 * @remarks Resultant stream volume will depend on global pool volume.
331 * @param [in] pool The handle to the sound pool
332 * @param [in] tag Unique string that identifies source
333 * @param [in] loop Number of times stream will be repeated
334 * (pass 0 if stream should be repeated continuously)
335 * @param [in] volume Stream volume in 0.0~1.0 range
336 * @param [in] priority Stream priority (0 = lowest priority). Check
337 * @ref sound_pool_stream_set_priority() documentation
338 * for details on prioritization rules.
339 * @param [in] callback The callback that will be called after stream state
340 * will be changed, or NULL if this callback call
341 * isn't needed. If @a callback is set, then it will
342 * be called asynchronously
343 * @param [in] user_data The user data to be passed to the @a callback
344 * @param [out] id Unique stream identifier that can be used to
345 * change parameters and get additional information
346 * @return @c 0 on success, otherwise a negative error value
347 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
348 * (@a pool is NULL or corrupted, @a tag is NULL, @a volume is out of
349 * 0.0~1.0 range, or @a id is NULL)
350 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
352 * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY Not enough memory to allocate new
354 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
356 * @pre Create sound pool handler by calling @ref sound_pool_create()
357 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
358 * @post When playback is finished normally (i.e. @ref sound_pool_stream_stop()
359 * will be not used for stream termination) state will be changed to
360 * SOUND_POOL_STREAM_STATE_FINISHED and memory will be cleared from the
361 * stream allocated resources automatically
363 * @see sound_pool_create()
364 * @see sound_pool_load_source_from_file()
365 * @see sound_pool_set_volume
366 * @see sound_pool_get_volume
368 sound_pool_error_e sound_pool_stream_play(sound_pool_h pool, const char *tag,
369 unsigned loop, float volume, unsigned priority,
370 sound_pool_stream_state_change_cb callback, void *user_data,
374 * @brief Pauses stream by @a id.
375 * @details Sets stream state to SOUND_POOL_STREAM_STATE_PAUSED.
376 * @remarks Stream state has to be SOUND_POOL_STATE_PLAYING
379 * @param [in] pool The handle to the sound pool
380 * @param [in] id Unique stream identifier
381 * @return @c 0 on success, otherwise a negative error value
382 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
383 * (@a pool is NULL or corrupted)
384 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
386 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
387 * the state which is not allowed for pause operation
389 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
390 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
391 * @pre Start stream playback by calling @ref sound_pool_stream_play()
393 * @see sound_pool_create()
394 * @see sound_pool_load_source_from_file()
395 * @see sound_pool_stream_play()
397 sound_pool_error_e sound_pool_stream_pause(sound_pool_h pool, unsigned id);
400 * @brief Resumes stream by @a id.
401 * @details Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING.
402 * @remarks Stream state has to be SOUND_POOL_STATE_PAUSED
405 * @param [in] pool The handle to the sound pool
406 * @param [in] id Unique stream identifier
407 * @return @c 0 on success, otherwise a negative error value
408 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
409 * (@a pool is NULL or corrupted)
410 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
412 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
413 * the state which is not allowed for resume operation
415 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
416 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
417 * @pre Start stream playback by calling @ref sound_pool_stream_play()
418 * @pre Pause stream playback by calling @ref sound_pool_stream_pause()
420 * @see sound_pool_create()
421 * @see sound_pool_load_source_from_file()
422 * @see sound_pool_stream_play()
423 * @see sound_pool_stream_pause()
425 sound_pool_error_e sound_pool_stream_resume(sound_pool_h pool, unsigned id);
428 * @brief Stops stream by @a id.
429 * @details Sets stream state to SOUND_POOL_STREAM_STATE_STOPPED.
430 * After stream was stopped it can not be resumed and @a id value
431 * becomes invalid. Moreover, stream will never gets
432 * @c SOUND_POOL_STREAM_STATE_FINISHED state as it will be terminated
433 * after this function call.
436 * @param [in] pool The handle to the sound pool
437 * @param [in] id Unique stream identifier
438 * @return @c 0 on success, otherwise a negative error value
439 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
440 * (@a pool is NULL or corrupted)
441 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
443 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
444 * the state which is not allowed for stop operation
446 * @pre Create sound pool handler by calling @ref sound_pool_create()
447 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
448 * @pre Start stream playback by calling @ref sound_pool_stream_play()
450 * @see sound_pool_create()
451 * @see sound_pool_load_source_from_file()
452 * @see sound_pool_stream_play()
454 sound_pool_error_e sound_pool_stream_stop(sound_pool_h pool, unsigned id);
457 * @brief Sets stream @a loop parameter by stream @a id.
460 * @param [in] pool The handle to the sound pool
461 * @param [in] id Unique stream identifier
462 * @param [in] loop Number of times stream will be repeated
463 * (pass 0 if stream should be repeated continuously)
464 * @return @c 0 on success, otherwise a negative error value
465 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
466 * (@a pool is NULL or corrupted)
467 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
469 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
471 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
472 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
473 * @pre Start stream playback by calling @ref sound_pool_stream_play()
475 * @see sound_pool_create()
476 * @see sound_pool_load_source_from_file()
477 * @see sound_pool_stream_play()
479 sound_pool_error_e sound_pool_stream_set_loop(sound_pool_h pool, unsigned id,
483 * @brief Gets stream @a loop parameter by stream @a id.
486 * @param [in] pool The handle to the sound pool
487 * @param [in] id Unique stream identifier
488 * @param [out] loop Number of times stream will be repeated before
489 * finishing (getting state SOUND_POOL_STREAM_STATE_FINISHED)
490 * and releasing of the memory and resources
491 * @return @c 0 on success, otherwise a negative error value
492 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
493 * (@a pool is NULL or corrupted, or @a loop is NULL)
494 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
497 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
498 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
499 * @pre Start source playback by calling @ref sound_pool_stream_play()
501 * @see sound_pool_create()
502 * @see sound_pool_load_source_from_file()
503 * @see sound_pool_stream_play()
505 sound_pool_error_e sound_pool_stream_get_loop(sound_pool_h pool, unsigned id,
509 * @brief Sets stream volume parameters by stream @a id.
510 * @remarks Resultant stream volume will depend on global pool volume.
513 * @param [in] pool The handle to the sound pool
514 * @param [in] id Unique stream identifier
515 * @param [in] volume Stream volume in 0.0~1.0 range
516 * @return @c 0 on success, otherwise a negative error value
517 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
518 * (@a pool is NULL or corrupted, or @a volume isn't in 0.0~1.0 range)
519 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
521 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
523 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
524 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
525 * @pre Start stream playback by calling @ref sound_pool_stream_play()
527 * @see sound_pool_create()
528 * @see sound_pool_load_source_from_file()
529 * @see sound_pool_stream_play()
530 * @see sound_pool_set_volume
531 * @see sound_pool_get_volume
533 sound_pool_error_e sound_pool_stream_set_volume(sound_pool_h pool, unsigned id,
537 * @brief Gets stream volume parameters by stream @a id.
540 * @param [in] pool The handle to the sound pool
541 * @param [in] id Unique stream identifier
542 * @param [out] volume Stream volume in 0.0~1.0 range
543 * @return @c 0 on success, otherwise a negative error value
544 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
545 * (@a pool is NULL or corrupted, or @a volume is NULL)
546 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
549 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
550 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
551 * @pre Start stream playback by calling @ref sound_pool_stream_play()
553 * @see sound_pool_create()
554 * @see sound_pool_load_source_from_file()
555 * @see sound_pool_stream_play()
557 sound_pool_error_e sound_pool_stream_get_volume(sound_pool_h pool, unsigned id,
561 * @brief Sets stream priority parameter by stream @a id.
562 * @remarks Only streams with highest priority in the active Sound Pool can be
563 * played. If at least one stream with highest priority gets
564 * #SOUND_POOL_STREAM_STATE_PLAYING state, then all has been playing
565 * streams with lower priorities will be transfered to the
566 * #SOUND_POOL_STREAM_STATE_SUSPENDED state. If there is no more
567 * playing streams in some priority group (group of streams with the
568 * same priority), then all suspended previously streams in the group
569 * with one level lower priority will be resumed. For example, if we
570 * have N suspended streams in 'LOW' group, M suspended streams in
571 * 'MEDIUM' group and K playing streams in 'HIGH' group then the
572 * following rules are valid: When all K streams in HIGH priority group
573 * will be finished, paused, or stopped and Sound Pool is in active
574 * state, only then M streams from MEDIUM priority group will be
575 * resumed. When all M+K streams from HIGH and MEDIUM priority groups
576 * will be finished, paused or stopped and Sound Pool is in active
577 * state, only then N streams from LOW priority group will be resumed.
578 * Transfering at least one stream from higher priority group will lead
579 * to suspending of all the streams from lower priorities group(s).
580 * Priorities don't make any effect in inactive Sound Pools. But after
581 * pool activation, all mentioned rules will be applied.
584 * @param [in] pool The handle to the sound pool
585 * @param [in] id Unique stream identifier
586 * @param [in] priority Stream priority (0 = lowest priority)
587 * @return @c 0 on success, otherwise a negative error value
588 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
589 * (@a pool is NULL or corrupted)
590 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
592 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
594 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
595 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
596 * @pre Start stream playback by calling @ref sound_pool_stream_play()
598 * @see sound_pool_create()
599 * @see sound_pool_load_source_from_file()
600 * @see sound_pool_stream_play()
602 sound_pool_error_e sound_pool_stream_set_priority(sound_pool_h pool, unsigned id,
606 * @brief Gets stream priority parameter by stream @a id.
609 * @param [in] pool The handle to the sound pool
610 * @param [in] id Unique stream identifier
611 * @param [out] priority Stream priority (0 = lowest priority). Check
612 * @ref sound_pool_stream_set_priority() documentation
613 * for details on prioritization rules.
614 * @return @c 0 on success, otherwise a negative error value
615 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
616 * (@a pool is NULL or corrupted, or @a priority is NULL)
617 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
620 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
621 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
622 * @pre Start stream playback by calling @ref sound_pool_stream_play()
624 * @see sound_pool_create()
625 * @see sound_pool_load_source_from_file()
626 * @see sound_pool_stream_play()
628 sound_pool_error_e sound_pool_stream_get_priority(sound_pool_h pool, unsigned id,
632 * @brief Gets current @a state of stream by @a id.
635 * @param [in] pool The handle to the sound pool
636 * @param [in] id Unique stream identifier
637 * @param [out] state Current state of stream
638 * @return @c 0 on success, otherwise a negative error value
639 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
640 * (@a pool is NULL or corrupted, or @a state is NULL)
641 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
644 * @pre Create sound pool handler by calling @ref sound_pool_create()
645 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
646 * @pre Start stream playback by calling @ref sound_pool_stream_play()
648 * @see sound_pool_create()
649 * @see sound_pool_load_source_from_file()
650 * @see sound_pool_stream_play()
651 * @see sound_pool_stream_state_e
653 sound_pool_error_e sound_pool_stream_get_state(sound_pool_h pool, unsigned id,
654 sound_pool_stream_state_e *state);
657 * @brief Sets callback for handling stream state change events.
660 * @param [in] pool The handle to the sound pool
661 * @param [in] id Unique stream identifier
662 * @param [in] callback The callback that will be called after stream state
663 * will be changed. @a callback will be called
665 * @param [in] user_data The user data to be passed to the @a callback
666 * @return @c 0 on success, otherwise a negative error value
667 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
668 * (@a pool is NULL or corrupted, or @a callback is NULL)
669 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
671 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
673 * @pre Create sound pool handler by calling @ref sound_pool_create()
674 * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
675 * @pre Start source playback by calling @ref sound_pool_stream_play()
676 * @post Use @ref sound_pool_stream_unset_state_change_callback() function to
677 * unset the @a callback
679 * @see sound_pool_create()
680 * @see sound_pool_load_source_from_file()
681 * @see sound_pool_stream_play()
682 * @see sound_pool_stream_state_change_cb
684 sound_pool_error_e sound_pool_stream_set_state_change_callback(sound_pool_h pool,
685 unsigned id, sound_pool_stream_state_change_cb callback, void *user_data);
688 * @brief Unsets callback for handling stream state change events.
691 * @param [in] pool The handle to the sound pool
692 * @param [in] id Unique stream identifier
693 * @return @c 0 on success, otherwise a negative error value
694 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
695 * (@a pool is NULL or corrupted)
696 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
699 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
700 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
701 * @pre Start stream playback by calling @ref sound_pool_stream_play()
702 * @pre Set stream state change callback by calling @ref sound_pool_stream_set_state_change_callback()
704 * @see sound_pool_create()
705 * @see sound_pool_load_source_from_file()
706 * @see sound_pool_stream_play()
707 * @see sound_pool_stream_state_change_cb
709 sound_pool_error_e sound_pool_stream_unset_state_change_callback(sound_pool_h pool,
721 #endif /* __TIZEN_SOUND_POOL_H__ */