OLA plugin sending garbage to high channels - proposed patch included
Posted: Sat Jul 11, 2015 6:53 am
I was finally able to get the OLA plugin working on my Mac by rolling back my OLA version to 0.9.5. When I did that and started output to OLA I noted that the channels higher than the ones I was manipulating in the interface were filled with what looked like random data. I think the issue is that the QLC+ engine only sends the active channels to the plugin but the OLA plugin is sending all 512 DMX channels to the olad socket. Basically the code which copies the data into the output buffer is not filling in the rest of the buffer with zeros.
Here is a proposed patch to plugins/ola/olaouthread.cpp. It is untested because I have not been able to get a clean build of QLC+ on my machine.
Here is a proposed patch to plugins/ola/olaouthread.cpp. It is untested because I have not been able to get a clean build of QLC+ on my machine.
Code: Select all
*** olaoutthread.cpp.orig 2015-07-10 23:49:43.000000000 -0700
--- olaoutthread.cpp 2015-07-10 23:54:48.000000000 -0700
***************
*** 104,113 ****
*/
int OlaOutThread::write_dmx(unsigned int universe, const QByteArray& data)
{
- m_data.universe = universe;
- memcpy(m_data.data, data.data(), data.size());
if (m_pipe)
m_pipe->Send((uint8_t*) &m_data, sizeof(m_data));
return 0;
}
--- 104,123 ----
*/
int OlaOutThread::write_dmx(unsigned int universe, const QByteArray& data)
{
if (m_pipe)
+ {
+ const int src_sz = data.size();
+ Q_ASSERT(src_sz <= sizeof(m_data.data));
+
+ m_data.universe = universe;
+ memcpy(m_data.data, data.data(), src_sz);
+
+ // if a full src buffer was not provided, fill the rest of the dst buffer with zeroes.
+ if (src_sz < sizeof(m_data.data))
+ memset(m_data.data+src_sz, 0, sizeof(m_data.data)-src_sz);
+
m_pipe->Send((uint8_t*) &m_data, sizeof(m_data));
+ }
return 0;
}