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() was
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 [in] max_streams Maximum number of active streams
99 * @param [out] pool The handle to the pool that will be created
100 * @return @c 0 on success, otherwise a negative error value
101 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
102 * Invalid parameter (@a pool is NULL or @a max_streams is 0)
103 * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY
104 * Not enough memory to create sound pool
105 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION
106 * Maximal amount of sound pools is exceeded (usually, 32 pools allowed)
108 * @see sound_pool_destroy()
110 sound_pool_error_e sound_pool_create(unsigned max_streams, sound_pool_h *pool);
113 * @brief Destroys sound pool and cleans allocated memory.
114 * @details Stops all streams and unloads all sources associated with pool.
117 * @param [in] pool The handle to the pool that will be destroyed
118 * @return @c 0 on success, otherwise a negative error value
119 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
120 * Invalid parameter (@a pool is NULL or corrupted)
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, const char *file_name,
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 Gets current @a state of @a pool.
184 * @param [in] pool The handle to the sound pool
185 * @param [out] state Current state of @a pool
186 * @return @c 0 on success, otherwise a negative error value
187 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER
188 * Invalid parameter (@a pool is NULL or corrupted, @a tag is NULL)
189 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
192 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
194 * @see sound_pool_create()
195 * @see sound_pool_state_e
197 sound_pool_error_e sound_pool_get_state(sound_pool_h pool,
198 sound_pool_state_e *state);
201 * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_ACTIVE.
204 * @param [in] pool The handle to the sound pool
205 * @return @c 0 on success, otherwise a negative error value
206 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
207 * (@a pool is NULL or corrupted)
208 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or sound pool
209 * is already in @c SOUND_POOL_STATE_ACTIVE state
211 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
213 * @see sound_pool_create()
214 * @see sound_pool_get_state()
215 * @see sound_pool_deactivate()
216 * @see sound_pool_state_e
218 sound_pool_error_e sound_pool_activate(sound_pool_h pool);
221 * @brief Changes current @a state of @a pool to SOUND_POOL_STATE_INACTIVE.
224 * @param [in] pool The handle to the sound pool
225 * @return @c 0 on success, otherwise a negative error value
226 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
227 * (@a pool is NULL or corrupted)
228 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or sound pool
229 * is already in @c SOUND_POOL_STATE_INACTIVE state
231 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
232 * @pre @a pool has to be in SOUND_POOL_STATE_ACTIVE state
234 * @see sound_pool_create()
235 * @see sound_pool_get_state()
236 * @see sound_pool_activate()
237 * @see sound_pool_state_e
239 sound_pool_error_e sound_pool_deactivate(sound_pool_h pool);
242 * @brief Sets callback for handling sound @a pool state change.
245 * @param [in] pool The handle to the sound pool
246 * @param [in] callback The callback that will be called after pool state
247 * will be changed. @a callback will be called
249 * @param [in] data The user data to be passed to the @a callback
250 * @return @c 0 on success, otherwise a negative error value
251 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
252 * (@a pool is NULL or corrupted, or @a callback is NULL)
254 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
255 * @post Use @ref sound_pool_unset_state_change_callback() function to unset the
258 * @see sound_pool_create()
259 * @see sound_pool_pool_state_change_cb
261 sound_pool_error_e sound_pool_set_state_change_callback(sound_pool_h pool,
262 sound_pool_state_change_cb callback, void *user_data);
265 * @brief Unsets callback for handling sound @a pool state change.
268 * @param [in] pool The handle to the pool
269 * @return @c 0 on success, otherwise a negative error value
270 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
271 * (@a pool is NULL or corrupted)
273 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
274 * @pre Set state change callback by calling @ref sound_pool_set_state_change_callback()
276 * @see sound_pool_create()
277 * @see sound_pool_set_state_change_callback()
279 sound_pool_error_e sound_pool_unset_state_change_callback(sound_pool_h pool);
282 * @brief Plays source by @a tag.
283 * @details Creates stream with @a id that can be used to change parameters and
284 * get additional information.
285 * Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING
286 * @remarks In case maximum active streams number after calling
287 * @ref sound_pool_stream_play() was exceeded the stream
288 * with lowest @a priority will be stopped.
289 * Resultant stream volume will depend on global pool volume.
292 * @param [in] pool The handle to the sound pool
293 * @param [in] tag Unique string that identifies source
294 * @param [in] loop Number of times stream will be repeated
295 * (pass 0 if stream should be repeated continuously)
296 * @param [in] volume Stream volume in 0.0~1.0 range
297 * @param [in] priority Stream priority (0 = lowest priority)
298 * @param [in] callback The callback that will be called after stream state
299 * will be changed, or NULL if this callback call
300 * isn't needed. If @a callback is set, then it will
301 * be called asynchronously
302 * @param [in] user_data The user data to be passed to the @a callback
303 * @param [out] id Unique stream identifier that can be used to
304 * change parameters and get additional information
305 * @return @c 0 on success, otherwise a negative error value
306 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
307 * (@a pool is NULL or corrupted, @a tag is NULL, @a volume is out of
308 * 0.0~1.0 range, or @a id is NULL)
309 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No sources tagged by @a tag exist
311 * @retval #SOUND_POOL_ERROR_OUT_OF_MEMORY Not enough memory to allocate new
313 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
315 * @pre Create sound pool handler by calling @ref sound_pool_create()
316 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
317 * @post When playback is finished normally (i.e. @ref sound_pool_stop_stream()
318 * will be not used for stream termination) state will be changed to
319 * SOUND_POOL_STREAM_STATE_FINISHED and memory will be cleared from the
320 * stream allocated resources automatically
322 * @see sound_pool_create()
323 * @see sound_pool_load_source_from_file()
324 * @see sound_pool_set_volume
325 * @see sound_pool_get_volume
327 sound_pool_error_e sound_pool_stream_play(sound_pool_h pool, const char *tag, unsigned loop,
328 float volume, unsigned priority,
329 sound_pool_stream_state_change_cb callback, void *user_data,
333 * @brief Pauses stream by @a id.
334 * @details Sets stream state to SOUND_POOL_STREAM_STATE_PAUSED.
335 * @remarks Stream state has to be SOUND_POOL_STATE_PLAYING
338 * @param [in] pool The handle to the sound pool
339 * @param [in] id Unique stream identifier
340 * @return @c 0 on success, otherwise a negative error value
341 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
342 * (@a pool is NULL or corrupted)
343 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
345 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
346 * the state which is not allowed for pause operation
348 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
349 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
350 * @pre Start stream playback by calling @ref sound_pool_stream_play()
352 * @see sound_pool_create()
353 * @see sound_pool_load_source_from_file()
354 * @see sound_pool_stream_play()
356 sound_pool_error_e sound_pool_stream_pause(sound_pool_h pool, unsigned id);
359 * @brief Resumes stream by @a id.
360 * @details Sets stream state to SOUND_POOL_STREAM_STATE_PLAYING.
361 * @remarks Stream state has to be SOUND_POOL_STATE_PAUSED
364 * @param [in] pool The handle to the sound pool
365 * @param [in] id Unique stream identifier
366 * @return @c 0 on success, otherwise a negative error value
367 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
368 * (@a pool is NULL or corrupted)
369 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
371 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
372 * the state which is not allowed for resume operation
374 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
375 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
376 * @pre Start stream playback by calling @ref sound_pool_stream_play()
377 * @pre Pause stream playback by calling @ref sound_pool_stream_pause()
379 * @see sound_pool_create()
380 * @see sound_pool_load_source_from_file()
381 * @see sound_pool_stream_play()
382 * @see sound_pool_stream_pause()
384 sound_pool_error_e sound_pool_stream_resume(sound_pool_h pool, unsigned id);
387 * @brief Stops stream by @a id.
388 * @details Sets stream state to SOUND_POOL_STREAM_STATE_STOPPED.
389 * After stream was stopped it can not be resumed and @a id value
390 * becomes invalid. Moreover, stream will never gets
391 * @c SOUND_POOL_STREAM_STATE_FINISHED state as it will be terminated
392 * after this function call.
395 * @param [in] pool The handle to the sound pool
396 * @param [in] id Unique stream identifier
397 * @return @c 0 on success, otherwise a negative error value
398 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
399 * (@a pool is NULL or corrupted)
400 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
402 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation or stream is in
403 * the state which is not allowed for stop operation
405 * @pre Create sound pool handler by calling @ref sound_pool_create()
406 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
407 * @pre Start stream playback by calling @ref sound_pool_stream_play()
409 * @see sound_pool_create()
410 * @see sound_pool_load_source_from_file()
411 * @see sound_pool_stream_play()
413 sound_pool_error_e sound_pool_stream_stop(sound_pool_h pool, unsigned id);
416 * @brief Sets pool global volume parameter.
417 * @details Volume of all streams related to @a pool will be scaled
418 * in accordance to global pool volume parameter
419 * (i.e. [stream real volume] = [global volume] * [stream volume],
420 * where [stream volume] is the volume parameter of arbitrary stream).
423 * @param [in] pool The handle to the sound pool
424 * @param [in] volume Pool global volume in 0.0~1.0 range
425 * @return @c 0 on success, otherwise a negative error value
426 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
427 * (@a pool is NULL or corrupted, or @a volume isn't in 0.0~1.0 range)
428 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
430 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
432 * @see sound_pool_create()
434 sound_pool_error_e sound_pool_set_volume(sound_pool_h pool, float volume);
437 * @brief Gets pool global volume parameter.
440 * @param [in] pool The handle to the sound pool
441 * @param [out] volume Pool global volume in 0.0~1.0 range
442 * @return @c 0 on success, otherwise a negative error value
443 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
444 * (@a pool is NULL or corrupted, or @a volume is NULL)
445 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
447 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
449 * @see sound_pool_create()
451 sound_pool_error_e sound_pool_get_volume(sound_pool_h pool, float *volume);
454 * @brief Gets current @a state of stream by @a id.
457 * @param [in] pool The handle to the sound pool
458 * @param [in] id Unique stream identifier
459 * @param [out] state Current state of stream
460 * @return @c 0 on success, otherwise a negative error value
461 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
462 * (@a pool is NULL or corrupted, or @a state is NULL)
463 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
465 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
467 * @pre Create sound pool handler by calling @ref sound_pool_create()
468 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
469 * @pre Start stream playback by calling @ref sound_pool_stream_play()
471 * @see sound_pool_create()
472 * @see sound_pool_load_source_from_file()
473 * @see sound_pool_stream_play()
474 * @see sound_pool_stream_state_e
476 sound_pool_error_e sound_pool_stream_get_state(sound_pool_h pool, unsigned id,
477 sound_pool_stream_state_e *state);
480 * @brief Sets stream @a loop parameter by stream @a id.
483 * @param [in] pool The handle to the sound pool
484 * @param [in] id Unique stream identifier
485 * @param [in] loop Number of times stream will be repeated
486 * (pass 0 if stream should be repeated continuously)
487 * @return @c 0 on success, otherwise a negative error value
488 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
489 * (@a pool is NULL or corrupted)
490 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
492 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
494 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
495 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
496 * @pre Start stream playback by calling @ref sound_pool_stream_play()
498 * @see sound_pool_create()
499 * @see sound_pool_load_source_from_file()
500 * @see sound_pool_stream_play()
502 sound_pool_error_e sound_pool_stream_set_loop(sound_pool_h pool, unsigned id, unsigned loop);
505 * @brief Gets stream @a loop parameter by stream @a id.
508 * @param [in] pool The handle to the sound pool
509 * @param [in] id Unique stream identifier
510 * @param [out] loop Number of times stream will be repeated before
511 * finishing (getting state SOUND_POOL_STREAM_STATE_FINISHED)
512 * and releasing of the memory and resources
513 * @return @c 0 on success, otherwise a negative error value
514 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
515 * (@a pool is NULL or corrupted, or @a loop is NULL)
516 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
518 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
520 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
521 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
522 * @pre Start source playback by calling @ref sound_pool_stream_play()
524 * @see sound_pool_create()
525 * @see sound_pool_load_source_from_file()
526 * @see sound_pool_stream_play()
528 sound_pool_error_e sound_pool_stream_get_loop(sound_pool_h pool, unsigned id, unsigned *loop);
531 * @brief Sets stream volume parameters by stream @a id.
532 * @remarks Resultant stream volume will depend on global pool volume.
535 * @param [in] pool The handle to the sound pool
536 * @param [in] id Unique stream identifier
537 * @param [in] volume Stream volume in 0.0~1.0 range
538 * @return @c 0 on success, otherwise a negative error value
539 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
540 * (@a pool is NULL or corrupted, or @a volume isn't in 0.0~1.0 range)
541 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
543 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
545 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
546 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
547 * @pre Start stream playback by calling @ref sound_pool_stream_play()
549 * @see sound_pool_create()
550 * @see sound_pool_load_source_from_file()
551 * @see sound_pool_stream_play()
552 * @see sound_pool_set_volume
553 * @see sound_pool_get_volume
555 sound_pool_error_e sound_pool_stream_set_volume(sound_pool_h pool, unsigned id,
559 * @brief Gets stream volume parameters by stream @a id.
562 * @param [in] pool The handle to the sound pool
563 * @param [in] id Unique stream identifier
564 * @param [out] volume Stream volume in 0.0~1.0 range
565 * @return @c 0 on success, otherwise a negative error value
566 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
567 * (@a pool is NULL or corrupted, or @a volume is NULL)
568 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
570 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
572 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
573 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
574 * @pre Start stream playback by calling @ref sound_pool_stream_play()
576 * @see sound_pool_create()
577 * @see sound_pool_load_source_from_file()
578 * @see sound_pool_stream_play()
580 sound_pool_error_e sound_pool_stream_get_volume(sound_pool_h pool, unsigned id,
584 * @brief Sets stream priority parameter by stream @a id.
587 * @param [in] pool The handle to the sound pool
588 * @param [in] id Unique stream identifier
589 * @param [in] priority Stream priority (0 = lowest priority)
590 * @return @c 0 on success, otherwise a negative error value
591 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
592 * (@a pool is NULL or corrupted)
593 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
595 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
597 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
598 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
599 * @pre Start stream playback by calling @ref sound_pool_stream_play()
601 * @see sound_pool_create()
602 * @see sound_pool_load_source_from_file()
603 * @see sound_pool_stream_play()
605 sound_pool_error_e sound_pool_stream_set_priority(sound_pool_h pool, unsigned id,
609 * @brief Gets stream priority parameter by stream @a id.
612 * @param [in] pool The handle to the sound pool
613 * @param [in] id Unique stream identifier
614 * @param [in] priority Stream priority (0 = lowest priority)
615 * @return @c 0 on success, otherwise a negative error value
616 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
617 * (@a pool is NULL or corrupted, or @a priority is NULL)
618 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
620 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
622 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
623 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
624 * @pre Start stream playback by calling @ref sound_pool_stream_play()
626 * @see sound_pool_create()
627 * @see sound_pool_load_source_from_file()
628 * @see sound_pool_stream_play()
630 sound_pool_error_e sound_pool_stream_get_priority(sound_pool_h pool, unsigned id,
634 * @brief Sets callback for handling stream state change events.
637 * @param [in] pool The handle to the sound pool
638 * @param [in] id Unique stream identifier
639 * @param [in] callback The callback that will be called after stream state
640 * will be changed. @a callback will be called
642 * @param [in] data The user data to be passed to the @a callback
643 * @return @c 0 on success, otherwise a negative error value
644 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
645 * (@a pool is NULL or corrupted, or @a callback is NULL)
646 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
648 * @retval #SOUND_POOL_ERROR_INVALID_OPERATION Invalid operation
650 * @pre Create sound pool handler by calling @ref sound_pool_create()
651 * @pre Load source to pool by calling @ref sound_pool_load_source_from_file()
652 * @pre Start source playback by calling @ref sound_pool_stream_play()
653 * @post Use @ref sound_pool_stream_unset_state_change_callback() function to
654 * unset the @a callback
656 * @see sound_pool_create()
657 * @see sound_pool_load_source_from_file()
658 * @see sound_pool_stream_play()
659 * @see sound_pool_stream_state_change_cb
661 sound_pool_error_e sound_pool_stream_set_state_change_callback(sound_pool_h pool, unsigned id,
662 sound_pool_stream_state_change_cb callback, void *user_data);
665 * @brief Unsets callback for handling stream state change events.
668 * @param [in] pool The handle to the sound pool
669 * @param [in] id Unique stream identifier
670 * @return @c 0 on success, otherwise a negative error value
671 * @retval #SOUND_POOL_ERROR_INVALID_PARAMETER Invalid parameter
672 * (@a pool is NULL or corrupted)
673 * @retval #SOUND_POOL_ERROR_KEY_NOT_AVAILABLE No streams identified by @a id
676 * @pre Create sound @a pool handler by calling @ref sound_pool_create()
677 * @pre Load source to @a pool by calling @ref sound_pool_load_source_from_file()
678 * @pre Start stream playback by calling @ref sound_pool_stream_play()
679 * @pre Set stream state change callback by calling @ref sound_pool_stream_set_state_change_callback()
681 * @see sound_pool_create()
682 * @see sound_pool_load_source_from_file()
683 * @see sound_pool_stream_play()
684 * @see sound_pool_stream_state_change_cb
686 sound_pool_error_e sound_pool_stream_unset_state_change_callback(sound_pool_h pool,
698 #endif /* __TIZEN_SOUND_POOL_H__ */