OSDN Git Service

Phrase2IRCompiler::GetVelocity(): 値の微調整
authorstarg <starg@users.osdn.me>
Mon, 29 Aug 2016 03:50:30 +0000 (12:50 +0900)
committerstarg <starg@users.osdn.me>
Mon, 29 Aug 2016 03:50:30 +0000 (12:50 +0900)
src/ast2ir/phrase2ir.cpp
src/parser/action_state_phrase.hpp

index cb189bd..db984d1 100644 (file)
@@ -324,7 +324,14 @@ int Phrase2IRCompiler::GetNetDuration(int duration, const boost::optional<AST::N
 
 int Phrase2IRCompiler::GetVelocity(const boost::optional<AST::NoteAccents>& accents)
 {
-    return std::min(accents.is_initialized() ? 72 + accents->Accents * 12 : 72, 127);
+    if (accents.is_initialized())
+    {
+        return std::min(static_cast<int>(std::lround(std::pow(1.2, accents.value().Accents) * 72)), 127);
+    }
+    else
+    {
+        return 72;
+    }
 }
 
 IR::BlockReference Phrase2IRCompiler::AllocBlock()
index f63e7ab..0c22945 100644 (file)
@@ -305,7 +305,7 @@ public:
         st.ASTNode.Accents = ASTNode;
     }
 
-    AST::NoteAccents ASTNode;
+    AST::NoteAccents ASTNode = {};
 };
 
 template<typename TRule>