Skip to content

Commit

Permalink
- LV2 Plugin-in worker/schedule fix: make request/response
Browse files Browse the repository at this point in the history
  ringbuffer writes in one go, hopefully atomic (suggested
  patch by Stefan Westerfeld, while on SpectMorph, thanks).
  • Loading branch information
rncbc committed Sep 22, 2016
1 parent 2365469 commit 0bb4d55
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 21 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Qtractor - An Audio/MIDI multi-track sequencer
ChangeLog


GIT HEAD

- LV2 Plugin-in worker/schedule fix: make request/response
ringbuffer writes in one go, hopefully atomic (suggested
patch by Stefan Westerfeld, while on SpectMorph, thanks).


0.7.9 2016-09-21 Snobbier Graviton Beta

- JACK buffer-size change handling has been deeply improved,
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(Qtractor, 0.7.9.1, rncbc@rncbc.org, qtractor)
AC_INIT(Qtractor, 0.7.9.2, rncbc@rncbc.org, qtractor)

AC_CONFIG_SRCDIR(src/qtractor.cpp)
AC_CONFIG_HEADERS(src/config.h)
Expand Down
22 changes: 18 additions & 4 deletions src/qtractorLv2Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,15 @@ qtractorLv2Worker::~qtractorLv2Worker (void)
// Schedule work.
void qtractorLv2Worker::schedule ( uint32_t size, const void *data )
{
::jack_ringbuffer_write(m_pRequests, (const char *) &size, sizeof(size));
::jack_ringbuffer_write(m_pRequests, (const char *) data, size);
const uint32_t request_size = size + sizeof(size);

if (::jack_ringbuffer_write_space(m_pRequests) < request_size) {
char request_data[request_size];
::memcpy(request_data, &size, sizeof(size));
::memcpy(request_data + sizeof(size), data, size);
::jack_ringbuffer_write(m_pRequests,
(const char *) &request_data, request_size);
}

if (g_pWorkerThread)
g_pWorkerThread->sync(this);
Expand All @@ -499,8 +506,15 @@ void qtractorLv2Worker::schedule ( uint32_t size, const void *data )
// Response work.
void qtractorLv2Worker::respond ( uint32_t size, const void *data )
{
::jack_ringbuffer_write(m_pResponses, (const char *) &size, sizeof(size));
::jack_ringbuffer_write(m_pResponses, (const char *) data, size);
const uint32_t response_size = size + sizeof(size);

if (::jack_ringbuffer_write_space(m_pResponses) < response_size) {
char response_data[response_size];
::memcpy(response_data, &size, sizeof(size));
::memcpy(response_data + sizeof(size), data, size);
::jack_ringbuffer_write(m_pResponses,
(const char *) &response_data, response_size);
}
}

// Commit work.
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,13 +747,13 @@ Stopa: &quot;%1&quot; Vstup: &quot;%2&quot; Výstup: &quot;%3&quot;</translation
<translation>Autorské právo: </translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>Projekt: </translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>Autor: </translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,13 @@ Spur: &quot;%1&quot; Eingang: &quot;%2&quot; Ausgang: &quot;%3&quot;</translatio
<translation>Copyright:</translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>Projekt: </translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>Autor: </translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ Fin: %3 Duración: %4</translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>Autor: </translation>
</message>
Expand All @@ -334,7 +334,7 @@ Fin: %3 Duración: %4</translation>
<translation>Derechos de copia: </translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>Proyecto: </translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,13 +747,13 @@ Piste: &quot;%1&quot; Entrée: &quot;%2&quot; Sortie: &quot;%3&quot;</translatio
<translation>Copyright :</translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>Projet: </translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>Auteur: </translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,13 +748,13 @@ Traccia: &quot;%1&quot; Ingresso: &quot;%2&quot; Uscita: &quot;%3&quot;</transla
<translation>Copyright: </translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>Progetto: </translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>Autore: </translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,13 @@ Track: &quot;%1&quot; Input: &quot;%2&quot; Output: &quot;%3&quot;</source>
<translation>コピーライト:</translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>プロジェクト:</translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>作者:</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ MIDI: </translation>
<translation>gravador de sequência</translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation>Projeto: </translation>
</message>
Expand Down Expand Up @@ -656,7 +656,7 @@ Pista: &quot;%1&quot; Entrada: &quot;%2&quot; Saída: &quot;%3&quot;</translatio
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation>Autor:</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions src/translations/qtractor_ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,13 @@ Track: &quot;%1&quot; Input: &quot;%2&quot; Output: &quot;%3&quot;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qtractorLv2Plugin.cpp" line="2037"/>
<location filename="../qtractorLv2Plugin.cpp" line="2051"/>
<source>Project: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qtractorLadspaPlugin.cpp" line="143"/>
<location filename="../qtractorLv2Plugin.cpp" line="2045"/>
<location filename="../qtractorLv2Plugin.cpp" line="2059"/>
<source>Author: </source>
<translation type="unfinished"></translation>
</message>
Expand Down

0 comments on commit 0bb4d55

Please sign in to comment.