Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working, for some reason that I can't find, pthread seems to crash randomly after the second VST is loaded.
Here is what I added to libpd to be able to sync the VSTs :
*z_libpd.h*
EXTERN void libpd_lock(void);
EXTERN void libpd_unlock(void);
z_libpd.c
static pthread_mutex_t libpd_mutex = PTHREAD_MUTEX_INITIALIZER;
void libpd_lock() { pthread_mutex_lock(&libpd_mutex); }
void libpd_unlock() { pthread_mutex_unlock(&libpd_mutex); }
And here is the code of my VST that I made using the JUCE framework (I wont paste the functions I let as the ones generated by JUCE)
PluginProcessor.h
#ifndef PLUGINPROCESSOR_H_INCLUDED
#define PLUGINPROCESSOR_H_INCLUDED
#include "../JuceLibraryCode/JuceHeader.h"
extern "C" { #include "z_libpd.h" #include "m_imp.h" }
class TestMultiInstanceAudioProcessor : public AudioProcessor { public:
TestMultiInstanceAudioProcessor(); ~TestMultiInstanceAudioProcessor(); void prepareToPlay (double sampleRate, int samplesPerBlock); void releaseResources(); void processBlock (AudioSampleBuffer& buffer, MidiBuffer&
midiMessages);
/*
Other auto-generated functions
----
*/
private:
t_pdinstance *_pdInstance; float **_juceIn; float **_juceOut; float *_pdIn; float *_pdOut; float _ticks; float _blockSize; void *_patchHandle;
};
#endif // PLUGINPROCESSOR_H_INCLUDED
PluginProcessor.cpp
#include "PluginProcessor.h"
#include "PluginEditor.h"
TestMultiInstanceAudioProcessor::TestMultiInstanceAudioProcessor() { //Initializing pd instance _pdInstance = pdinstance_new();
/// Init pd and enable dsp libpd_lock(); pd_setinstance(_pdInstance); libpd_init(); libpd_start_message(1); libpd_add_float(1.0f); libpd_finish_message("pd", "dsp"); libpd_unlock(); //Init pd buffers _juceIn = NULL; _juceOut = NULL; _pdIn = NULL; _pdOut = NULL; }
TestMultiInstanceAudioProcessor::~TestMultiInstanceAudioProcessor() { if (_juceIn) { for (int i = 0; i < getNumInputChannels(); ++i) delete _juceIn[i]; delete _juceIn; for (int i = 0; i < getNumOutputChannels(); ++i) delete _juceOut[i]; delete _juceOut; delete _pdIn; delete _pdOut; } delete _pdInstance; }
void TestMultiInstanceAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { //Init libpd audio libpd_lock(); pd_setinstance(_pdInstance); libpd_init_audio(getNumInputChannels(), getNumOutputChannels(), sampleRate); juce::String patchPath = juce::File::getSpecialLocation(juce::File::currentApplicationFile).getParentDirectory().getFullPathName(); _patchHandle = libpd_openfile("440.pd", patchPath.toRawUTF8()); libpd_unlock(); //Init buffers _juceIn = new float*[getNumInputChannels()]; for (int i = 0; i < getNumInputChannels(); ++i) _juceIn[i] = new float[samplesPerBlock]; _juceOut = new float*[getNumOutputChannels()]; for (int i = 0; i < getNumOutputChannels(); ++i) _juceOut[i] = new float[samplesPerBlock]; _pdIn = new float[getNumInputChannels() * samplesPerBlock]; _pdOut = new float[getNumOutputChannels() * samplesPerBlock]; //Settings ticks _ticks = samplesPerBlock / libpd_blocksize(); _blockSize = samplesPerBlock; }
void TestMultiInstanceAudioProcessor::releaseResources() { if (_juceIn) { for (int i = 0; i < getNumInputChannels(); ++i) delete _juceIn[i]; delete _juceIn; for (int i = 0; i < getNumOutputChannels(); ++i) delete _juceOut[i]; delete _juceOut; delete _pdIn; delete _pdOut; _juceIn = NULL; _juceOut = NULL; _pdIn = NULL; _pdOut = NULL; } if (_patchHandle) { libpd_lock(); pd_setinstance(_pdInstance); libpd_closefile(_patchHandle); libpd_unlock(); } }
void TestMultiInstanceAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages) { libpd_lock(); pd_setinstance(_pdInstance); libpd_process_float(_ticks, _pdIn, _pdOut); libpd_unlock(); for (int i = 0; i < _blockSize * getNumOutputChannels(); ++i) for (int channel = 0; channel < getNumOutputChannels(); ++channel) _juceOut[channel][i / getNumOutputChannels()] = _pdOut[i]; for (int channel = 0; channel < getNumOutputChannels(); ++channel) buffer.copyFrom(channel, 0, _juceOut[channel], _blockSize); }
/*
Other autogenerated functions
...
*/
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
Regards
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote:
Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove the pd_setinstance() calls, it doesn't crash (But the sound is ugly, as it was before the multi instance update, which is logic). The weird thing being that it doesn't crash in the VST functions, but it has something to do with those pd_setinstance() calls which are only made on the VST functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote:
Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
On minor thing - you probably have to protect all of the libpd() calls with a lock to keep separate threads from getting to it simultaneously. (It's not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that would protect Pd OK but not the libpd code.
cheers Miller
On Tue, Jul 08, 2014 at 11:56:36AM +0200, Paul-Arthur Sauvageot via Pd-dev wrote:
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove the pd_setinstance() calls, it doesn't crash (But the sound is ugly, as it was before the multi instance update, which is logic). The weird thing being that it doesn't crash in the VST functions, but it has something to do with those pd_setinstance() calls which are only made on the VST functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote:
Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
On minor thing - you probably have to protect all of the libpd() calls with a lock to keep separate threads from getting to it simultaneously. (It's not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that would protect Pd OK but not the libpd code.
I don't understand what you mean by protect libpd calls with a lock. Isn't it what I'm doing with libpd_lock() ?
2014-07-08 12:39 GMT+02:00 Miller Puckette msp@ucsd.edu:
On minor thing - you probably have to protect all of the libpd() calls with a lock to keep separate threads from getting to it simultaneously. (It's not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that would protect Pd OK but not the libpd code.
cheers Miller
On Tue, Jul 08, 2014 at 11:56:36AM +0200, Paul-Arthur Sauvageot via Pd-dev wrote:
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove the pd_setinstance() calls, it doesn't crash (But the sound is ugly, as it
was
before the multi instance update, which is logic). The weird thing being that it doesn't crash in the VST functions, but it has something to do
with
those pd_setinstance() calls which are only made on the VST functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote:
Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
Sorry - I hadn't run into lbpd_lock() but that's almost certainly the think I thought you'd need :) But now I don't know why it's crashing..
M
I don't understand what you mean by protect libpd calls with a lock. Isn't it what I'm doing with libpd_lock() ?
2014-07-08 12:39 GMT+02:00 Miller Puckette msp@ucsd.edu:
On minor thing - you probably have to protect all of the libpd() calls with a lock to keep separate threads from getting to it simultaneously. (It's not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that would protect Pd OK but not the libpd code.
cheers Miller
On Tue, Jul 08, 2014 at 11:56:36AM +0200, Paul-Arthur Sauvageot via Pd-dev wrote:
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove the pd_setinstance() calls, it doesn't crash (But the sound is ugly, as it
was
before the multi instance update, which is logic). The weird thing being that it doesn't crash in the VST functions, but it has something to do
with
those pd_setinstance() calls which are only made on the VST functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote:
Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Hi, I'm also working on it and I have similar issues. Perhaps, the crash comes from "canvas_stop_dsp()". It seems like when you open a patch, the function is called and frees some unallocated memory. I have to investigate a little bit more, there is always a solution but if you find it before, I'll be pleased to know it. My project is in the plugin folder of this repository : https://github.com/CICM/CreamLibrary.
Cheers, Pierre
2014-07-12 11:51 GMT+02:00 Miller Puckette via Pd-dev pd-dev@lists.iem.at:
Sorry - I hadn't run into lbpd_lock() but that's almost certainly the think I thought you'd need :) But now I don't know why it's crashing..
M
I don't understand what you mean by protect libpd calls with a lock.
Isn't
it what I'm doing with libpd_lock() ?
2014-07-08 12:39 GMT+02:00 Miller Puckette msp@ucsd.edu:
On minor thing - you probably have to protect all of the libpd() calls
with
a lock to keep separate threads from getting to it simultaneously.
(It's
not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that
would
protect Pd OK but not the libpd code.
cheers Miller
On Tue, Jul 08, 2014 at 11:56:36AM +0200, Paul-Arthur Sauvageot via
Pd-dev
wrote:
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove
the
pd_setinstance() calls, it doesn't crash (But the sound is ugly, as
it
was
before the multi instance update, which is logic). The weird thing
being
that it doesn't crash in the VST functions, but it has something to
do
with
those pd_setinstance() calls which are only made on the VST
functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote:
Hello,
I'm currently trying to make a VST that uses libpd and the pd update allowing multi instances (via pd_instance). But it's not working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
According to my logs and my debugger, it never crashes in the VST functions, it seems to crash on some pthread functions like pthread_kill but I never use these functions...
Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
Well, that's not the dsp function. Paul-Arthur is right, it seems that the crash occurs during the change of the pd instance. I didn't find a way to secure the function calls but I'm not at all an expert about threads. Perhaps, one solution would be to have thread-safe functions like this : void dsp_tick(t_pdinstance *x) { if (x->pd_dspchain) { t_int *ip; for (ip = x->pd_dspchain; ip; ) ip = (*(t_perfroutine)(*ip))(ip); } } Thus, you can touch a instance while another computes its dsp chain. I think we can have something like this without changing the core of pd if the functions have other names but it's still complicated to implement. In this case, another point would be to change the dsp methods of the dac~ and the adc~ because if we want to call the functions in parallel, they should use io vectors specific to the instance. Am I going too far ?
2014-07-13 11:36 GMT+02:00 Pierre Guillot guillotpierre6@gmail.com:
Hi, I'm also working on it and I have similar issues. Perhaps, the crash comes from "canvas_stop_dsp()". It seems like when you open a patch, the function is called and frees some unallocated memory. I have to investigate a little bit more, there is always a solution but if you find it before, I'll be pleased to know it. My project is in the plugin folder of this repository : https://github.com/CICM/CreamLibrary.
Cheers, Pierre
2014-07-12 11:51 GMT+02:00 Miller Puckette via Pd-dev <pd-dev@lists.iem.at
:
Sorry - I hadn't run into lbpd_lock() but that's almost certainly the
think I thought you'd need :) But now I don't know why it's crashing..
M
I don't understand what you mean by protect libpd calls with a lock.
Isn't
it what I'm doing with libpd_lock() ?
2014-07-08 12:39 GMT+02:00 Miller Puckette msp@ucsd.edu:
On minor thing - you probably have to protect all of the libpd()
calls with
a lock to keep separate threads from getting to it simultaneously.
(It's
not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that
would
protect Pd OK but not the libpd code.
cheers Miller
On Tue, Jul 08, 2014 at 11:56:36AM +0200, Paul-Arthur Sauvageot via
Pd-dev
wrote:
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove
the
pd_setinstance() calls, it doesn't crash (But the sound is ugly, as
it
was
before the multi instance update, which is logic). The weird thing
being
that it doesn't crash in the VST functions, but it has something to
do
with
those pd_setinstance() calls which are only made on the VST
functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote: > Hello, > > I'm currently trying to make a VST that uses libpd and the pd > update allowing multi instances (via pd_instance). But it's not > working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
> According to my logs and my debugger, it never crashes in the
VST
> functions, it seems to crash on some pthread functions like > pthread_kill but I never use these functions... > > Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
Well... if anyone can figure out how to get this to fail reliably on a linux machine I'd be eager to try it too :)
M
On Sun, Jul 13, 2014 at 11:36:10AM +0200, Pierre Guillot wrote:
Hi, I'm also working on it and I have similar issues. Perhaps, the crash comes from "canvas_stop_dsp()". It seems like when you open a patch, the function is called and frees some unallocated memory. I have to investigate a little bit more, there is always a solution but if you find it before, I'll be pleased to know it. My project is in the plugin folder of this repository : https://github.com/CICM/CreamLibrary.
Cheers, Pierre
2014-07-12 11:51 GMT+02:00 Miller Puckette via Pd-dev pd-dev@lists.iem.at:
Sorry - I hadn't run into lbpd_lock() but that's almost certainly the think I thought you'd need :) But now I don't know why it's crashing..
M
I don't understand what you mean by protect libpd calls with a lock.
Isn't
it what I'm doing with libpd_lock() ?
2014-07-08 12:39 GMT+02:00 Miller Puckette msp@ucsd.edu:
On minor thing - you probably have to protect all of the libpd() calls
with
a lock to keep separate threads from getting to it simultaneously.
(It's
not sufficient to just use the "THREAD_LOCK" mechanism in Pd - that
would
protect Pd OK but not the libpd code.
cheers Miller
On Tue, Jul 08, 2014 at 11:56:36AM +0200, Paul-Arthur Sauvageot via
Pd-dev
wrote:
from your host? from juce? fgmsdr IOhannes
I tried with different hosts and the problem is the same. I don't think it comes from JUCE neither. The things is if I remove
the
pd_setinstance() calls, it doesn't crash (But the sound is ugly, as
it
was
before the multi instance update, which is logic). The weird thing
being
that it doesn't crash in the VST functions, but it has something to
do
with
those pd_setinstance() calls which are only made on the VST
functions...
2014-07-08 11:43 GMT+02:00 IOhannes m zmoelnig zmoelnig@iem.at:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
On 2014-07-08 10:54, Paul-Arthur Sauvageot via Pd-dev wrote: > Hello, > > I'm currently trying to make a VST that uses libpd and the pd > update allowing multi instances (via pd_instance). But it's not > working,
i would be very surprised if - at this moment - the multi-instance code *would* be working. afaict, we are making *small* steps towards this goal.
> According to my logs and my debugger, it never crashes in the VST > functions, it seems to crash on some pthread functions like > pthread_kill but I never use these functions... > > Does someone has any idea of where it could come from ?
from your host? from juce?
fgmsdr IOhannes
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Using GnuPG with Icedove - http://www.enigmail.net/
iQIcBAEBCAAGBQJTu70fAAoJELZQGcR/ejb4KdAP/iLrhMFWQ4ZSff8+AX1YnHo/ DO7N/fgkh2AfUiJiqZfLQqZT7DQYIweyOBk0p+vtpFeNZR76D4xuNDOAiC0V5/Nf XWJq/nq40Rg5SL/Gej9fpI0/ahVTovTpnmZt4CgAfKqwb2GVWoqDUBjiZ/hIxffi hH1szv5AeXdDAJp67PxGk/b0zv9m+pi0tS0CB2j5Fh3RlTqTefV6ZKI0cZAv6jth +qQA9OJzEHK4bpNoCMQbtJqr8XbREhD/mG+1yLopnm5fvkUyravVTqqaPczZuqUq YJ7EH4z5FGjeRjDI5k0MRkdu093Iv7w/iWf0HNRQPL8AM4Hm4XdntYI8B1lkYVFg lmxqKjuV9JKaPLzY7ztlxqPxFO7oKy2BQe4Z73F8aBi8w79dGEx+p2CclzC8oLnX arIPCIlA9Ybaie4GCwbMi2REO4/XK/CxgP3YV97FdU3wjE83mBOPcx1RYAWY+XVV 0T3hioln+R95eaBr4EoO6X1vtxhw2IFhEju4AzGmhwQx3Wo3eFfH2Bkf6Crwkl+o 10tWXKfaUZS5lPbkAb04ardPvF8GAs/HXnZBeJGvXSf4TICc6OZILMNFM4yM2rcg uX2lPZqU3bOnrFpyIxR7J/UgV3DsMbfd7nTmUJaY0q6DGoYaiiwAzEyN2hTOGvYx iwiZ9lpCKTQZCpXtt679 =R/3q -----END PGP SIGNATURE-----
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev
-- SAUVAGEOT Paul-Arthur. Développeur C \ C++ \ C#.
Pd-dev mailing list Pd-dev@lists.iem.at http://lists.puredata.info/listinfo/pd-dev