diff options
author | Rui <rui.minetest@gmail.com> | 2017-06-11 20:58:26 +0900 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-11 13:58:26 +0200 |
commit | ff73c7a5da6ab8ac0bb678ebf25b83e805397029 (patch) | |
tree | 1e91e8226000250c4636bbb188330d105c85d019 /src/network | |
parent | 03ff53e16bafe1aaa278625864c546a525d08dfc (diff) | |
download | minetest-ff73c7a5da6ab8ac0bb678ebf25b83e805397029.tar.gz minetest-ff73c7a5da6ab8ac0bb678ebf25b83e805397029.tar.bz2 minetest-ff73c7a5da6ab8ac0bb678ebf25b83e805397029.zip |
Sound: Add pitch option (#5960)
* Sound: Add pitch option
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/clientpackethandler.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp index 9eb6d8dca..caaf24d80 100644 --- a/src/network/clientpackethandler.cpp +++ b/src/network/clientpackethandler.cpp @@ -764,6 +764,7 @@ void Client::handleCommand_PlaySound(NetworkPacket* pkt) [23 + len] u16 object_id [25 + len] bool loop [26 + len] f32 fade + [30 + len] f32 pitch */ s32 server_id; @@ -774,29 +775,31 @@ void Client::handleCommand_PlaySound(NetworkPacket* pkt) v3f pos; u16 object_id; bool loop; - float fade = 0; + float fade = 0.0f; + float pitch = 1.0f; *pkt >> server_id >> name >> gain >> type >> pos >> object_id >> loop; try { *pkt >> fade; + *pkt >> pitch; } catch (PacketError &e) {}; // Start playing int client_id = -1; switch(type) { case 0: // local - client_id = m_sound->playSound(name, loop, gain, fade); + client_id = m_sound->playSound(name, loop, gain, fade, pitch); break; case 1: // positional - client_id = m_sound->playSoundAt(name, loop, gain, pos); + client_id = m_sound->playSoundAt(name, loop, gain, pos, pitch); break; case 2: { // object ClientActiveObject *cao = m_env.getActiveObject(object_id); if (cao) pos = cao->getPosition(); - client_id = m_sound->playSoundAt(name, loop, gain, pos); + client_id = m_sound->playSoundAt(name, loop, gain, pos, pitch); // TODO: Set up sound to move with object break; } |