コミットメタ情報

リビジョン21285dae9b58ab00e79c8c25fc86267fd95b8d88 (tree)
日時2020-09-06 06:51:47
作者Starg <starg@user...>
コミッターStarg

ログメッセージ

Merge dev41

変更サマリ

差分

--- a/interface/w32g_i.c
+++ b/interface/w32g_i.c
@@ -5601,19 +5601,33 @@ static struct
56015601 } rc_queue[RC_QUEUE_SIZE];
56025602 static volatile int rc_queue_len, rc_queue_beg, rc_queue_end;
56035603
5604+#define TIMW32G_USE_USERMODE_LOCKS
5605+#ifdef TIMW32G_USE_USERMODE_LOCKS
5606+static SRWLOCK w32g_lock_srwlock = SRWLOCK_INIT;
5607+static CONDITION_VARIABLE w32g_lock_cv = CONDITION_VARIABLE_INIT;
5608+#else
56045609 static HANDLE w32g_lock_sem = NULL;
56055610 static HANDLE w32g_empty_sem = NULL;
5611+#endif
56065612
56075613 void w32g_lock(void)
56085614 {
5615+#ifdef TIMW32G_USE_USERMODE_LOCKS
5616+ AcquireSRWLockExclusive(&w32g_lock_srwlock);
5617+#else
56095618 if(w32g_lock_sem)
56105619 WaitForSingleObject(w32g_lock_sem, INFINITE);
5620+#endif
56115621 }
56125622
56135623 void w32g_unlock(void)
56145624 {
5625+#ifdef TIMW32G_USE_USERMODE_LOCKS
5626+ ReleaseSRWLockExclusive(&w32g_lock_srwlock);
5627+#else
56155628 if(w32g_lock_sem)
56165629 ReleaseSemaphore(w32g_lock_sem, 1, NULL);
5630+#endif
56175631 }
56185632
56195633 void w32g_send_rc(int rc, ptr_size_t value)
@@ -5631,26 +5645,45 @@ void w32g_send_rc(int rc, ptr_size_t value)
56315645 rc_queue[rc_queue_end].rc = rc;
56325646 rc_queue[rc_queue_end].value = value;
56335647 rc_queue_end = (rc_queue_end + 1) % RC_QUEUE_SIZE;
5648+#ifdef TIMW32G_USE_USERMODE_LOCKS
5649+ w32g_unlock();
5650+ WakeConditionVariable(&w32g_lock_cv);
5651+#else
56345652 if(w32g_empty_sem)
56355653 ReleaseSemaphore(w32g_empty_sem, 1, NULL);
56365654 w32g_unlock();
5655+#endif
56375656 }
56385657
56395658 int w32g_get_rc(ptr_size_t *value, int wait_if_empty)
56405659 {
56415660 int rc;
5661+#ifdef TIMW32G_USE_USERMODE_LOCKS
5662+ w32g_lock();
5663+#endif
56425664
56435665 while(rc_queue_len == 0)
56445666 {
56455667 if(!wait_if_empty)
5646- return RC_NONE;
5668+ {
5669+#ifdef TIMW32G_USE_USERMODE_LOCKS
5670+ w32g_unlock();
5671+#endif
5672+ return RC_NONE;
5673+ }
5674+#ifdef TIMW32G_USE_USERMODE_LOCKS
5675+ SleepConditionVariableSRW(&w32g_lock_cv, &w32g_lock_srwlock, INFINITE, 0);
5676+#else
56475677 if(w32g_empty_sem)
56485678 WaitForSingleObject(w32g_empty_sem, INFINITE);
5679+#endif
56495680 VOLATILE_TOUCH(rc_queue_len);
56505681 }
56515682
5652- w32g_lock();
5653- rc = rc_queue[rc_queue_beg].rc;
5683+#ifndef TIMW32G_USE_USERMODE_LOCKS
5684+ w32g_lock();
5685+#endif
5686+ rc = rc_queue[rc_queue_beg].rc;
56545687 *value = rc_queue[rc_queue_beg].value;
56555688 rc_queue_len--;
56565689 rc_queue_beg = (rc_queue_beg + 1) % RC_QUEUE_SIZE;
@@ -5664,8 +5697,10 @@ int w32g_open(void)
56645697 SaveSettingTiMidity(st_current);
56655698 memcpy(st_temp, st_current, sizeof(SETTING_TIMIDITY));
56665699
5700+#ifndef TIMW32G_USE_USERMODE_LOCKS
56675701 w32g_lock_sem = CreateSemaphore(NULL, 1, 1, _T("TiMidity Mutex Lock"));
56685702 w32g_empty_sem = CreateSemaphore(NULL, 0, 8, _T("TiMidity Empty Lock"));
5703+#endif
56695704
56705705 hPlayerThread = GetCurrentThread();
56715706 w32g_wait_for_init = 1;
@@ -5703,6 +5738,7 @@ static void terminate_main_thread(void)
57035738 void w32g_close(void)
57045739 {
57055740 terminate_main_thread();
5741+#ifndef TIMW32G_USE_USERMODE_LOCKS
57065742 if(w32g_lock_sem){
57075743 CloseHandle(w32g_lock_sem);
57085744 w32g_lock_sem = NULL;
@@ -5711,6 +5747,7 @@ void w32g_close(void)
57115747 CloseHandle(w32g_empty_sem);
57125748 w32g_empty_sem = NULL;
57135749 }
5750+#endif
57145751 }
57155752
57165753 void w32g_restart(void)
@@ -5718,6 +5755,7 @@ void w32g_restart(void)
57185755 w32g_restart_gui_flag = 1;
57195756
57205757 terminate_main_thread();
5758+#ifndef TIMW32G_USE_USERMODE_LOCKS
57215759 if(w32g_lock_sem){
57225760 CloseHandle(w32g_lock_sem);
57235761 w32g_lock_sem = NULL;
@@ -5726,6 +5764,7 @@ void w32g_restart(void)
57265764 CloseHandle(w32g_empty_sem);
57275765 w32g_empty_sem = NULL;
57285766 }
5767+#endif
57295768
57305769 /* Reset variable */
57315770 hDebugEditWnd = 0;
--- a/timidity/sfz.cpp
+++ b/timidity/sfz.cpp
@@ -1646,6 +1646,7 @@ private:
16461646
16471647 // TODO: support trigger=release
16481648 case TriggerKind::Release:
1649+ if (i == 0)
16491650 {
16501651 auto loc = flatSection.GetLocationForOpCode(OpCodeKind::Trigger);
16511652 ctl->cmsg(
@@ -1668,6 +1669,7 @@ private:
16681669 case TriggerKind::First:
16691670 case TriggerKind::Legato:
16701671 default:
1672+ if (i == 0)
16711673 {
16721674 auto loc = flatSection.GetLocationForOpCode(OpCodeKind::Trigger);
16731675 ctl->cmsg(
@@ -1729,39 +1731,48 @@ private:
17291731
17301732 if (s.seq_length < s.seq_position)
17311733 {
1732- auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SequencePosition);
1734+ if (i == 0)
1735+ {
1736+ auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SequencePosition);
1737+ ctl->cmsg(
1738+ CMSG_WARNING,
1739+ VERB_VERBOSE,
1740+ "%s(%u): 'seq_position' is larger than 'seq_length'; this region will never be played",
1741+ std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
1742+ static_cast<std::uint32_t>(loc.Line)
1743+ );
1744+ }
1745+ }
1746+ }
1747+ else
1748+ {
1749+ if (i == 0)
1750+ {
1751+ auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SequenceLength);
17331752 ctl->cmsg(
17341753 CMSG_WARNING,
17351754 VERB_VERBOSE,
1736- "%s(%u): 'seq_position' is larger than 'seq_length'; this region will never be played",
1755+ "%s(%u): 'seq_length' was specified but 'seq_position' was not; this region will never be played",
17371756 std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
17381757 static_cast<std::uint32_t>(loc.Line)
17391758 );
17401759 }
17411760 }
1742- else
1761+ }
1762+ else if (auto seqPos = flatSection.GetAs<double>(OpCodeKind::SequencePosition))
1763+ {
1764+ if (i == 0)
17431765 {
1744- auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SequenceLength);
1766+ auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SequencePosition);
17451767 ctl->cmsg(
17461768 CMSG_WARNING,
17471769 VERB_VERBOSE,
1748- "%s(%u): 'seq_length' was specified but 'seq_position' was not; this region will never be played",
1770+ "%s(%u): 'seq_position' was specified but 'seq_length' was not",
17491771 std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
17501772 static_cast<std::uint32_t>(loc.Line)
17511773 );
17521774 }
17531775 }
1754- else if (auto seqPos = flatSection.GetAs<double>(OpCodeKind::SequencePosition))
1755- {
1756- auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SequencePosition);
1757- ctl->cmsg(
1758- CMSG_WARNING,
1759- VERB_VERBOSE,
1760- "%s(%u): 'seq_position' was specified but 'seq_length' was not",
1761- std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
1762- static_cast<std::uint32_t>(loc.Line)
1763- );
1764- }
17651776
17661777 if (auto loRand = flatSection.GetAs<double>(OpCodeKind::LoRand))
17671778 {
@@ -1859,15 +1870,18 @@ private:
18591870 // sw_down is invalid; disable it
18601871 s.sw_down = -1;
18611872
1862- auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SwDown);
1863-
1864- ctl->cmsg(
1865- CMSG_WARNING,
1866- VERB_VERBOSE,
1867- "%s(%u): 'sw_down' was specified but it is outside the range specified by 'sw_lokey' and 'sw_hikey'",
1868- std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
1869- static_cast<std::uint32_t>(loc.Line)
1870- );
1873+ if (i == 0)
1874+ {
1875+ auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SwDown);
1876+
1877+ ctl->cmsg(
1878+ CMSG_WARNING,
1879+ VERB_VERBOSE,
1880+ "%s(%u): 'sw_down' was specified but it is outside the range specified by 'sw_lokey' and 'sw_hikey'",
1881+ std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
1882+ static_cast<std::uint32_t>(loc.Line)
1883+ );
1884+ }
18711885 }
18721886 }
18731887 else
@@ -1884,15 +1898,18 @@ private:
18841898 // sw_up is invalid; disable it
18851899 s.sw_up = -1;
18861900
1887- auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SwUp);
1888-
1889- ctl->cmsg(
1890- CMSG_WARNING,
1891- VERB_VERBOSE,
1892- "%s(%u): 'sw_up' was specified but it is outside the range specified by 'sw_lokey' and 'sw_hikey'",
1893- std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
1894- static_cast<std::uint32_t>(loc.Line)
1895- );
1901+ if (i == 0)
1902+ {
1903+ auto loc = flatSection.GetLocationForOpCode(OpCodeKind::SwUp);
1904+
1905+ ctl->cmsg(
1906+ CMSG_WARNING,
1907+ VERB_VERBOSE,
1908+ "%s(%u): 'sw_up' was specified but it is outside the range specified by 'sw_lokey' and 'sw_hikey'",
1909+ std::string(m_Parser.GetPreprocessor().GetFileNameFromID(loc.FileID)).c_str(),
1910+ static_cast<std::uint32_t>(loc.Line)
1911+ );
1912+ }
18961913 }
18971914 }
18981915 else
旧リポジトリブラウザで表示