Update sound position in a level.
| 873 | |
| 874 | // Update sound position in a level. |
| 875 | bool Sound_UpdateEffectPosition(int index, Pose *position, bool force) |
| 876 | { |
| 877 | if (index >= SOUND_MAX_CHANNELS || index < 0) |
| 878 | return false; |
| 879 | |
| 880 | if (position) |
| 881 | { |
| 882 | BASS_CHANNELINFO info; |
| 883 | BASS_ChannelGetInfo(SoundSlot[index].Channel, &info); |
| 884 | if (info.flags & BASS_SAMPLE_3D) |
| 885 | { |
| 886 | SoundSlot[index].Origin.x = position->Position.x; |
| 887 | SoundSlot[index].Origin.y = position->Position.y; |
| 888 | SoundSlot[index].Origin.z = position->Position.z; |
| 889 | |
| 890 | auto pos = BASS_3DVECTOR(position->Position.x, position->Position.y, position->Position.z); |
| 891 | auto rot = BASS_3DVECTOR(position->Orientation.x, position->Orientation.y, position->Orientation.z); |
| 892 | BASS_ChannelSet3DPosition(SoundSlot[index].Channel, &pos, &rot, NULL); |
| 893 | BASS_Apply3D(); |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | // Reset activity flag, important for looped samples |
| 898 | if (BASS_ChannelIsActive(SoundSlot[index].Channel)) |
| 899 | SoundSlot[index].State = SoundState::Idle; |
| 900 | |
| 901 | return true; |
| 902 | } |
| 903 | |
| 904 | // Update gain and pitch. |
| 905 | bool Sound_UpdateEffectAttributes(int index, float pitch, float gain) |
no test coverage detected