| 1762 | } |
| 1763 | |
| 1764 | bool VSTWrapper::StoreSettings(const VSTSettings& vstSettings) const |
| 1765 | { |
| 1766 | // First, make sure settings are compatibile with the plugin |
| 1767 | if ((vstSettings.mUniqueID != mAEffect->uniqueID) || |
| 1768 | // (vstSettings.mVersion != mAEffect->version) || |
| 1769 | (vstSettings.mNumParams != mAEffect->numParams) ) |
| 1770 | { |
| 1771 | return false; |
| 1772 | } |
| 1773 | |
| 1774 | |
| 1775 | // Try using the chunk first (if available) |
| 1776 | auto &chunk = vstSettings.mChunk; |
| 1777 | if (!chunk.empty()) |
| 1778 | { |
| 1779 | VstPatchChunkInfo info = { 1, mAEffect->uniqueID, mAEffect->version, mAEffect->numParams, "" }; |
| 1780 | callSetChunk(true, chunk.size(), const_cast<char *>(chunk.data()), &info); |
| 1781 | } |
| 1782 | |
| 1783 | |
| 1784 | // Settings (like the message) may store both a chunk, and also accumulated |
| 1785 | // slider movements to reapply after the chunk change. Or it might be |
| 1786 | // no chunk and id-value pairs only |
| 1787 | |
| 1788 | constCallDispatcher(effBeginSetProgram, 0, 0, NULL, 0.0); |
| 1789 | |
| 1790 | ForEachParameter |
| 1791 | ( |
| 1792 | [&](const ParameterInfo& pi) |
| 1793 | { |
| 1794 | const auto itr = vstSettings.mParamsMap.find(pi.mName); |
| 1795 | if (itr != vstSettings.mParamsMap.end()) |
| 1796 | { |
| 1797 | const float& value = *(itr->second); |
| 1798 | |
| 1799 | if (value >= -1.0 && value <= 1.0) |
| 1800 | { |
| 1801 | callSetParameter(pi.mID, value); |
| 1802 | } |
| 1803 | } |
| 1804 | return true; |
| 1805 | } |
| 1806 | ); |
| 1807 | |
| 1808 | constCallDispatcher(effEndSetProgram, 0, 0, NULL, 0.0); |
| 1809 | |
| 1810 | return true; |
| 1811 | } |
| 1812 | |
| 1813 | ComponentInterfaceSymbol VSTWrapper::GetSymbol() const |
| 1814 | { |
no test coverage detected