| 333 | } |
| 334 | |
| 335 | int lnxsound::PlayStream(play_information *play_info) { |
| 336 | int16_t sound_slot; |
| 337 | |
| 338 | ASSERT(play_info != nullptr); |
| 339 | |
| 340 | float volume = std::max(play_info->left_volume, play_info->right_volume); |
| 341 | |
| 342 | if (sound_device == 0) |
| 343 | return -1; |
| 344 | |
| 345 | #ifdef _DEBUG |
| 346 | sound_slot = FindFreeSoundSlot(-1, volume, play_info->priority); |
| 347 | #else |
| 348 | sound_slot = FindFreeSoundSlot(volume, play_info->priority); |
| 349 | #endif |
| 350 | // Out of sound slots |
| 351 | if (sound_slot < 0) { |
| 352 | return -1; |
| 353 | } |
| 354 | |
| 355 | m_total_sounds_played++; |
| 356 | sound_cache[sound_slot].play_info = play_info; |
| 357 | |
| 358 | sound_cache[sound_slot].m_unique_id = MakeUniqueId(sound_slot); |
| 359 | ASSERT(sound_cache[sound_slot].m_unique_id != -1); |
| 360 | |
| 361 | sound_cache[sound_slot].m_buffer_type = SBT_2D; |
| 362 | sound_cache[sound_slot].m_status = SSF_PLAY_STREAMING; |
| 363 | |
| 364 | m_cur_sounds_played++; |
| 365 | |
| 366 | return (sound_cache[sound_slot].m_unique_id); |
| 367 | } |
| 368 | |
| 369 | void lnxsound::SetListener(pos_state *cur_pos) { |
| 370 | if (sound_device == 0) |
no outgoing calls
no test coverage detected