[PD-dev] Libpd multi instance on a VST host

Pierre Guillot via Pd-dev pd-dev at lists.iem.at
Sun Jul 13 19:52:38 CEST 2014


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 at 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 at 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 at 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 at 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 at lists.iem.at
>> > > > http://lists.puredata.info/listinfo/pd-dev
>> > >
>> > >
>> >
>> >
>> > --
>> > SAUVAGEOT Paul-Arthur.
>> > Développeur C \ C++ \ C#.
>>
>> _______________________________________________
>> Pd-dev mailing list
>> Pd-dev at lists.iem.at
>> http://lists.puredata.info/listinfo/pd-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20140713/252588e0/attachment.html>


More information about the Pd-dev mailing list