| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Channel structures |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-04-10 |
|
| 4 |
+ * Last modification on 2013-04-12 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| ... | ... |
@@ -578,7 +578,7 @@ static const double M_PI = 3.14159265358979323846; |
| 578 | 578 |
#endif |
| 579 | 579 |
|
| 580 | 580 |
// Linear and Cosine interpolation code originally from DeSmuME |
| 581 |
-// B-spline, Hermite, and Optimal come from Olli Niemitalo: |
|
| 581 |
+// B-spline and Osculating come from Olli Niemitalo: |
|
| 582 | 582 |
// http://www.student.oulu.fi/~oniemita/dsp/deip.pdf |
| 583 | 583 |
int32_t Channel::Interpolate() |
| 584 | 584 |
{
|
| ... | ... |
@@ -594,56 +594,31 @@ int32_t Channel::Interpolate() |
| 594 | 594 |
b = a; |
| 595 | 595 |
|
| 596 | 596 |
double c0, c1, c2, c3, c4, c5; |
| 597 |
- if (this->ply->interpolation > INTERPOLATION_2POINTOPTIMAL) |
|
| 597 |
+ if (this->ply->interpolation > INTERPOLATION_COSINE) |
|
| 598 | 598 |
{
|
| 599 | 599 |
int32_t c, z; |
| 600 | 600 |
if (loc + 2 < this->reg.totalLength) |
| 601 | 601 |
c = data[2]; |
| 602 | 602 |
else |
| 603 |
- c = a; |
|
| 603 |
+ c = b; |
|
| 604 | 604 |
if (loc) |
| 605 | 605 |
z = data[-1]; |
| 606 | 606 |
else |
| 607 | 607 |
z = a; |
| 608 | 608 |
|
| 609 |
- if (this->ply->interpolation > INTERPOLATION_4POINTOPTIMAL) |
|
| 609 |
+ if (this->ply->interpolation > INTERPOLATION_4POINTBSPLINE) |
|
| 610 | 610 |
{
|
| 611 | 611 |
int32_t d, y; |
| 612 | 612 |
if (loc + 3 < this->reg.totalLength) |
| 613 | 613 |
d = data[3]; |
| 614 | 614 |
else |
| 615 |
- d = a; |
|
| 615 |
+ d = c; |
|
| 616 | 616 |
if (loc > 1) |
| 617 | 617 |
y = data[-2]; |
| 618 | 618 |
else |
| 619 |
- y = a; |
|
| 619 |
+ y = z; |
|
| 620 | 620 |
|
| 621 |
- if (this->ply->interpolation == INTERPOLATION_6POINTHERMITE) |
|
| 622 |
- {
|
|
| 623 |
- double eighthym2 = 0.125 * y; |
|
| 624 |
- double eleventwentyfourthy2 = 11 / 24.0 * c; |
|
| 625 |
- double twelfthy3 = 1 / 12.0 * d; |
|
| 626 |
- c0 = a; |
|
| 627 |
- c1 = 1 / 12.0 * (y - c) + 2 / 3.0 * (b - z); |
|
| 628 |
- c2 = 13 / 12.0 * z - 25 / 12.0 * a + 1.5 * b - eleventwentyfourthy2 + twelfthy3 - eighthym2; |
|
| 629 |
- c3 = 5 / 12.0 * a - 7 / 12.0 * b + 7 / 24.0 * c - 1 / 24.0 * (y + z + d); |
|
| 630 |
- c4 = eighthym2 - 7 / 12.0 * z + 13 / 12.0 * a - b + eleventwentyfourthy2 - twelfthy3; |
|
| 631 |
- c5 = 1 / 24.0 * (d - y) + 5 / 24.0 * (z - c) + 5 / 12.0 * (b - a); |
|
| 632 |
- return static_cast<int32_t>(((((c5 * ratio + c4) * ratio + c3) * ratio + c2) * ratio + c1) * ratio + c0); |
|
| 633 |
- } |
|
| 634 |
- else if (this->ply->interpolation == INTERPOLATION_6POINTLAGRANGE) |
|
| 635 |
- {
|
|
| 636 |
- float ym1py1 = z + b; |
|
| 637 |
- float twentyfourthym2py2 = 1 / 24.0 * (y + c); |
|
| 638 |
- float c0 = a; |
|
| 639 |
- float c1 = 1 / 20.0 * y - 0.5 * z - 1 / 3.0 * a + b - 0.25 * c + 1 / 30.0 * d; |
|
| 640 |
- float c2 = 2 / 3.0 * ym1py1 - 1.25 * a - twentyfourthym2py2; |
|
| 641 |
- float c3 = 5 / 12.0 * a - 7 / 12.0 * b + 7 / 24.0 * c - 1 / 24.0 * (y + z + d); |
|
| 642 |
- float c4 = 0.25 * a - 1 / 6.0 * ym1py1 + twentyfourthym2py2; |
|
| 643 |
- float c5 = 1 / 120.0 * (d - y) + 1 / 24.0 * (z - c) + 1 / 12.0 * (b - a); |
|
| 644 |
- return static_cast<int32_t>(((((c5 * ratio + c4) * ratio + c3) * ratio + c2) * ratio + c1) * ratio + c0); |
|
| 645 |
- } |
|
| 646 |
- else if (this->ply->interpolation == INTERPOLATION_6POINTBSPLINE) |
|
| 621 |
+ if (this->ply->interpolation == INTERPOLATION_6POINTBSPLINE) |
|
| 647 | 622 |
{
|
| 648 | 623 |
double ym2py2 = y + c, ym1py1 = z + b; |
| 649 | 624 |
double y2mym2 = c - y, y1mym1 = b - z; |
| ... | ... |
@@ -659,65 +634,27 @@ int32_t Channel::Interpolate() |
| 659 | 634 |
else |
| 660 | 635 |
{
|
| 661 | 636 |
ratio -= 0.5; |
| 662 |
- double even1 = b + a, odd1 = b - a; |
|
| 663 |
- double even2 = c + z, odd2 = c - z; |
|
| 664 |
- double even3 = d + y, odd3 = d - y; |
|
| 665 |
- c0 = even1 * 0.41809989254549901 + even2 * 0.08049339946273310 + even3 * 0.00140670799165932; |
|
| 666 |
- c1 = odd1 * 0.32767596257424964 + odd2 * 0.20978189376640677 + odd3 * 0.00859567104974701; |
|
| 667 |
- c2 = even1 * -0.206944618112960001 + even2 * 0.18541689550861262 + even3 * 0.02152772260740132; |
|
| 668 |
- c3 = odd1 * -0.21686095413034051 + odd2 * 0.02509557922091643 + odd3 * 0.02831484751363800; |
|
| 669 |
- c4 = even1 * 0.04163046817137675 + even2 * -0.06244556931623735 + even3 * 0.02081510113314315; |
|
| 670 |
- c5 = odd1 * 0.07990500783668089 + odd2 * -0.03994519162531633 + odd3 * 0.00798609327859495; |
|
| 637 |
+ double even1 = y + d, odd1 = y - d; |
|
| 638 |
+ double even2 = z + c, odd2 = z - c; |
|
| 639 |
+ double even3 = a + b, odd3 = a - b; |
|
| 640 |
+ c0 = 0.01171875 * even1 - 0.09765625 * even2 + 0.5859375 * even3; |
|
| 641 |
+ c1 = 0.2109375 * odd2 - 281 / 192.0 * odd3 - 13 / 384.0 * odd1; |
|
| 642 |
+ c2 = 0.40625 * even2 - 17 / 48.0 * even3 - 5 / 96.0 * even1; |
|
| 643 |
+ c3 = 0.1875 * odd1 - 53 / 48.0 * odd2 + 2.375 * odd3; |
|
| 644 |
+ c4 = 1 / 48.0 * even1 - 0.0625 * even2 + 1 / 24.0 * even3; |
|
| 645 |
+ c5 = 25 / 24.0 * odd2 - 25 / 12.0 * odd3 - 5 / 24.0 * odd1; |
|
| 671 | 646 |
return static_cast<int32_t>(((((c5 * ratio + c4) * ratio + c3) * ratio + c2) * ratio + c1) * ratio + c0); |
| 672 | 647 |
} |
| 673 | 648 |
} |
| 674 |
- else if (this->ply->interpolation == INTERPOLATION_4POINTHERMITE) |
|
| 675 |
- {
|
|
| 676 |
- c0 = a; |
|
| 677 |
- c1 = 0.5 * (b - z); |
|
| 678 |
- c2 = z - 2.5 * a + 2 * b - 0.5 * c; |
|
| 679 |
- c3 = 0.5 * (c - z) + 1.5 * (a - b); |
|
| 680 |
- return static_cast<int32_t>(((c3 * ratio + c2) * ratio + c1) * ratio + c0); |
|
| 681 |
- } |
|
| 682 |
- else if (this->ply->interpolation == INTERPOLATION_4POINTLAGRANGE) |
|
| 683 |
- {
|
|
| 684 |
- float c0 = a; |
|
| 685 |
- float c1 = b - 1 / 3.0 * z - 0.5 * a - 1 / 6.0 * c; |
|
| 686 |
- float c2 = 0.5 * (z + b) - a; |
|
| 687 |
- float c3 = 1 / 6.0 * (c - z) + 0.5 * (a - b); |
|
| 688 |
- return static_cast<int32_t>(((c3 * ratio + c2) * ratio + c1) * ratio + c0); |
|
| 689 |
- } |
|
| 690 |
- else if (this->ply->interpolation == INTERPOLATION_4POINTBSPLINE) |
|
| 649 |
+ else |
|
| 691 | 650 |
{
|
| 692 |
- double zpb = z + b; |
|
| 693 |
- c0 = 1 / 6.0 * zpb + 2 / 3.0 * a; |
|
| 651 |
+ double ym1py1 = z + b; |
|
| 652 |
+ c0 = 1 / 6.0 * ym1py1 + 2 / 3.0 * a; |
|
| 694 | 653 |
c1 = 0.5 * (b - z); |
| 695 |
- c2 = 0.5 * zpb - a; |
|
| 654 |
+ c2 = 0.5 * ym1py1 - a; |
|
| 696 | 655 |
c3 = 0.5 * (a - b) + 1 / 6.0 * (c - z); |
| 697 | 656 |
return static_cast<int32_t>(((c3 * ratio + c2) * ratio + c1) * ratio + c0); |
| 698 | 657 |
} |
| 699 |
- else |
|
| 700 |
- {
|
|
| 701 |
- ratio -= 0.5; |
|
| 702 |
- double even1 = b + a, odd1 = b - a; |
|
| 703 |
- double even2 = c + z, odd2 = c - z; |
|
| 704 |
- c0 = even1 * 0.46822774170144532 + even2 * 0.03177225758005808; |
|
| 705 |
- c1 = odd1 * 0.55890365706150436 + odd2 * 0.14703258836343669; |
|
| 706 |
- c2 = even1 * -0.250153411893796031 + even2 * 0.25015343462990891; |
|
| 707 |
- c3 = odd1 * -0.49800710906733769 + odd2 * 0.16600005174304033; |
|
| 708 |
- c4 = even1 * 0.00064264050033187 + even2 * -0.00064273459469381; |
|
| 709 |
- return static_cast<int32_t>((((c4 * ratio + c3) * ratio + c2) * ratio + c1) * ratio + c0); |
|
| 710 |
- } |
|
| 711 |
- } |
|
| 712 |
- else if (this->ply->interpolation == INTERPOLATION_2POINTOPTIMAL) |
|
| 713 |
- {
|
|
| 714 |
- ratio -= 0.5; |
|
| 715 |
- double even1 = b + a, odd1 = b - a; |
|
| 716 |
- c0 = even1 * 0.50001096675880796; |
|
| 717 |
- c1 = odd1 * 1.03585606328743830; |
|
| 718 |
- c2 = even1 * -0.000131601105693441; |
|
| 719 |
- c3 = odd1 * -0.38606621963374965; |
|
| 720 |
- return static_cast<int32_t>(((c3 * ratio + c2) * ratio + c1) * ratio + c0); |
|
| 721 | 658 |
} |
| 722 | 659 |
else if (this->ply->interpolation == INTERPOLATION_COSINE) |
| 723 | 660 |
{
|
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* SSEQ Player - Constants/Macros |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-04-10 |
|
| 4 |
+ * Last modification on 2013-04-12 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Adapted from source code of FeOS Sound System |
| 7 | 7 |
* By fincs |
| ... | ... |
@@ -56,15 +56,9 @@ enum Interpolation |
| 56 | 56 |
INTERPOLATION_NONE, |
| 57 | 57 |
INTERPOLATION_LINEAR, |
| 58 | 58 |
INTERPOLATION_COSINE, |
| 59 |
- INTERPOLATION_2POINTOPTIMAL, |
|
| 60 |
- INTERPOLATION_4POINTHERMITE, |
|
| 61 |
- INTERPOLATION_4POINTLAGRANGE, |
|
| 62 | 59 |
INTERPOLATION_4POINTBSPLINE, |
| 63 |
- INTERPOLATION_4POINTOPTIMAL, |
|
| 64 |
- INTERPOLATION_6POINTHERMITE, |
|
| 65 |
- INTERPOLATION_6POINTLAGRANGE, |
|
| 66 |
- INTERPOLATION_6POINTBSPLINE, |
|
| 67 |
- INTERPOLATION_6POINTOPTIMAL |
|
| 60 |
+ INTERPOLATION_6POINTOSCULATING, |
|
| 61 |
+ INTERPOLATION_6POINTBSPLINE |
|
| 68 | 62 |
}; |
| 69 | 63 |
|
| 70 | 64 |
#endif |
| ... | ... |
@@ -1,7 +1,7 @@ |
| 1 | 1 |
/* |
| 2 | 2 |
* xSF - NCSF configuration |
| 3 | 3 |
* By Naram Qashat (CyberBotX) [cyberbotx@cyberbotx.com] |
| 4 |
- * Last modification on 2013-04-10 |
|
| 4 |
+ * Last modification on 2013-04-12 |
|
| 5 | 5 |
* |
| 6 | 6 |
* Partially based on the vio*sf framework |
| 7 | 7 |
*/ |
| ... | ... |
@@ -42,8 +42,8 @@ public: |
| 42 | 42 |
|
| 43 | 43 |
unsigned XSFConfig::initSampleRate = 44100; |
| 44 | 44 |
std::wstring XSFConfig::commonName = L"NCSF Decoder"; |
| 45 |
-std::wstring XSFConfig::versionNumber = L"1.3"; |
|
| 46 |
-unsigned XSFConfig_NCSF::initInterpolation = 7; |
|
| 45 |
+std::wstring XSFConfig::versionNumber = L"1.4"; |
|
| 46 |
+unsigned XSFConfig_NCSF::initInterpolation = 5; |
|
| 47 | 47 |
std::wstring XSFConfig_NCSF::initMutes = L"0000000000000000"; |
| 48 | 48 |
|
| 49 | 49 |
XSFConfig *XSFConfig::Create() |
| ... | ... |
@@ -98,15 +98,9 @@ INT_PTR CALLBACK XSFConfig_NCSF::ConfigDialogProc(HWND hwndDlg, UINT uMsg, WPARA |
| 98 | 98 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"None")); |
| 99 | 99 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Linear")); |
| 100 | 100 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"Cosine")); |
| 101 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"2-point, 3rd-order Optimal 16x")); |
|
| 102 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"4-point, 3rd-order Hermite")); |
|
| 103 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"4-point, 3rd-order Lagrange")); |
|
| 104 | 101 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"4-point, 3rd-order B-spline")); |
| 105 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"4-point, 4th-order Optimal 16x")); |
|
| 106 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"6-point, 5th-order Hermite")); |
|
| 107 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"6-point, 5th-order Lagrange")); |
|
| 102 |
+ SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"6-point, 5th-order Osculating")); |
|
| 108 | 103 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"6-point, 5th-order B-spline")); |
| 109 |
- SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(L"6-point, 5th-order Optimal 16x")); |
|
| 110 | 104 |
SendMessageW(GetDlgItem(hwndDlg, idInterpolation), CB_SETCURSEL, this->interpolation, 0); |
| 111 | 105 |
// Mutes |
| 112 | 106 |
for (int x = 0, numMutes = this->mutes.size(); x < numMutes; ++x) |