This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.IO; | |
using Sanford.Multimedia.Midi; | |
public class MidiTest : MonoBehaviour | |
{ | |
[System.Serializable] | |
public class MidiData | |
{ | |
// All the note data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.IO; | |
using Sanford.Multimedia.Midi; | |
public class MidiTest : MonoBehaviour | |
{ | |
[System.Serializable] | |
public class MidiData | |
{ | |
// All the note data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
force_inline __m128 fastCubicInterpolate(const mono_float* const* buffers, __m128i indices, __m128 t_to) { | |
const __m128 kMultNext = _mm_set1_ps(-1.0f / 6.0f); | |
const __m128 kMultTo = _mm_set1_ps(1.0f / 2.0f); | |
const __m128 kMultFrom = _mm_set1_ps(-1.0f / 2.0f); | |
const __m128 kMultPrev = _mm_set1_ps(1.0f / 6.0f); | |
const __m128 one = _mm_set1_ps(1.0f); | |
const __m128 two = _mm_set1_ps(2.0f); | |
__m128 t_prev = _mm_sub_ps(t_to, two); | |
__m128 t_from = _mm_sub_ps(t_to, one); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float32x4x2_t swap_low = vtrnq_f32(row0.value, row1.value); | |
float32x4x2_t swap_high = vtrnq_f32(row2.value, row3.value); | |
row0 = vextq_f32(vextq_f32(swap_low.val[0], swap_low.val[0], 2), swap_high.val[0], 2); | |
row1 = vextq_f32(vextq_f32(swap_low.val[1], swap_low.val[1], 2), swap_high.val[1], 2); | |
row2 = vextq_f32(swap_low.val[0], vextq_f32(swap_high.val[0], swap_high.val[0], 2), 2); | |
row3 = vextq_f32(swap_low.val[1], vextq_f32(swap_high.val[1], swap_high.val[1], 2), 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float powerScale(mono_float value, mono_float power) { | |
static constexpr float kMinPower = 0.01f; | |
if (fabsf(power) < kMinPower) | |
return value; | |
float numerator = mopo::futils::exp(power * value) - 1.0f; | |
float denominator = mopo::futils::exp(power) - 1.0f; | |
return numerator / denominator; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
forcedinline poly_float getOptimalInterpolationValues(mono_float mono_t) { | |
static const poly_float kOptimalOne(0.00224072707074864375f, 0.20184198969656244725f, | |
0.59244492420272312725f, 0.20345744715566445625f); | |
static const poly_float kOptimalTwo(-0.0059513775678254975f, -0.456633315206820491f, | |
-0.035736698832993691f, 0.4982319203618311775f); | |
static const poly_float kOptimalThree(0.093515484757265265f, 0.294278871937834749f, | |
-0.786648885977648931f, 0.398765058036740415f); | |
static const poly_float kOptimalFour(-0.10174985775982505f, 0.36030925263849456f, | |
-0.36030925263849456, 0.10174985775982505f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const poly_float kCubicOne(0.0f, 1.0f, 0.0f, 0.0f); | |
static const poly_float kCubicTwo(-1.0f, -1.0f, 1.0f, 1.0f); | |
static const poly_float kCubicThree(-2.0f, -2.0f, -2.0f, -1.0f); | |
static const poly_float kCubicMult(-1.0f / 6.0f, 1.0f / 2.0f, -1.0f / 2.0f, 1.0f / 6.0f); | |
forcedinline poly_float getCubicInterpolationValues(poly_float t) { | |
return kCubicMult * (t + kCubicOne) * (t + kCubicTwo) * (t + kCubicThree); | |
} | |