Re: [PD-dev] Seeking co-maintainers for Scheme for Pd

2024-03-24 Thread Iain Duncan
That sounds reasonable to me!

Happy to transfer it.

On Wed, Mar 20, 2024 at 5:06 AM Dan Wilcox  wrote:

> +1
>
> If people use it, it will be maintained. It's best if someone can act as a
> general maintainer to help coordinate submissions from the general
> community. The pd-externals group makes it relatively easy for this unless
> you want to keep the project within your user space specifically. If
> transferred, you can still be the owner of the repository with full access
> to it.
>
> On Mar 20, 2024, at 12:00 PM, pd-dev-requ...@lists.iem.at wrote:
>
> Message: 1
> Date: Tue, 19 Mar 2024 13:09:27 +0100
> From: IOhannes m zm?lnig 
> To: pd-dev@lists.iem.at
> Subject: Re: [PD-dev] Seeking co-maintainers for Scheme for Pd
> Message-ID: <29d3083f-0419-4c7a-a1b6-fbdb29169...@iem.at>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> On 3/17/24 06:14, Iain Duncan wrote:
>
> It occurred to me thinking further that really one doesn't need to know
> much about Scheme or Lisp, provided one is interested, as I didn't when I
> started! The work is mostly in C. FWIW. :-)
>
>
> how about moving the repository to <https://github.com/pd-externals/> ?
> there are always? some volunteers who can help with bugfixing and the
> like, and if someone is willing to dig deeper into scheme4pd, they can
> always join (and leave, if need be).
>
> in general i think the pd-externals group is a good place for small
> team-maintained externals.
>
>
> personally, i am interested in that external (and have plenty of C
> skills) - but honestly I have other things on my plate as well, so
> couldn't do a full time maintenance o fthe project.
>
> gfmards
> IOhannes
>
>
> 
> Dan Wilcox
> danomatika.com
> robotcowboy.com
>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Seeking co-maintainers for Scheme for Pd

2024-03-24 Thread Iain Duncan
Hi IOhannes (and others) my apologies for the slow response, been settling
into a new job here.

If you are interested in helping out on that external, I would be happy to
move it to pd-externals and not own the repo. If I new there was some
interest and other people interested in hacking on it, I could find some
time to give it some love.

So uh, what exactly do I need to do to make this happen? Does it need a
special license or anything? s7 is BSD licensed so I chose that to begin
with.

iain


On Tue, Mar 19, 2024 at 5:10 AM IOhannes m zmölnig  wrote:

> On 3/17/24 06:14, Iain Duncan wrote:
> > It occurred to me thinking further that really one doesn't need to know
> > much about Scheme or Lisp, provided one is interested, as I didn't when I
> > started! The work is mostly in C. FWIW. :-)
>
> how about moving the repository to <https://github.com/pd-externals/> ?
> there are always¹ some volunteers who can help with bugfixing and the
> like, and if someone is willing to dig deeper into scheme4pd, they can
> always join (and leave, if need be).
>
> in general i think the pd-externals group is a good place for small
> team-maintained externals.
>
>
> personally, i am interested in that external (and have plenty of C
> skills) - but honestly I have other things on my plate as well, so
> couldn't do a full time maintenance o fthe project.
>
> gfmards
> IOhannes
>
> ¹ for various degrees of "always"
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Seeking co-maintainers for Scheme for Pd

2024-03-16 Thread Iain Duncan
It occurred to me thinking further that really one doesn't need to know
much about Scheme or Lisp, provided one is interested, as I didn't when I
started! The work is mostly in C. FWIW. :-)

iain

On Sat, Mar 16, 2024 at 8:17 AM Iain Duncan 
wrote:

> Hello hackers, a couple of years ago I made Scheme for Pd, a sibling
> project of my Scheme for Max external that allows scripting Pd (and Max) in
> s7 Scheme. I'm now into a PhD and am (surprise, surprise) rather busy, but
> there are some things that could be done with the Pd version that would be
> interesting. In a nutshell, it's like a cross between Max's JS object (but
> able to run temporally accurate code) and Common Music 3 (much of which it
> can run, same Scheme interpreter).
>
> For the initial release, I was only interested in solo development as it
> was a master's project. This is a call to see if there are people
> interested in joining on the project so I can bring it back to life. It
> requires a fairly good understanding of writing externals in C and of
> Scheme. It does not (yet) do DSP, only message stuff. There are a number of
> recent developments in the Max version that would be neat to port over if
> there is interest.
>
> The project page is here:
> https://github.com/iainctduncan/scheme-for-pd
>
> Some videos are here:
> https://www.youtube.com/c/musicwithlisp
>
> If you are interested, please email me as well as the list, at
> iainctduncan @{ the mail server that starts with G}.com
>
> thanks
> iain
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Seeking co-maintainers for Scheme for Pd

2024-03-16 Thread Iain Duncan
Hello hackers, a couple of years ago I made Scheme for Pd, a sibling
project of my Scheme for Max external that allows scripting Pd (and Max) in
s7 Scheme. I'm now into a PhD and am (surprise, surprise) rather busy, but
there are some things that could be done with the Pd version that would be
interesting. In a nutshell, it's like a cross between Max's JS object (but
able to run temporally accurate code) and Common Music 3 (much of which it
can run, same Scheme interpreter).

For the initial release, I was only interested in solo development as it
was a master's project. This is a call to see if there are people
interested in joining on the project so I can bring it back to life. It
requires a fairly good understanding of writing externals in C and of
Scheme. It does not (yet) do DSP, only message stuff. There are a number of
recent developments in the Max version that would be neat to port over if
there is interest.

The project page is here:
https://github.com/iainctduncan/scheme-for-pd

Some videos are here:
https://www.youtube.com/c/musicwithlisp

If you are interested, please email me as well as the list, at
iainctduncan @{ the mail server that starts with G}.com

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Question about right hand generic inlet creation

2021-12-08 Thread Iain Duncan
great, thanks very much.

On Tue, Dec 7, 2021 at 10:38 PM IOhannes m zmölnig  wrote:

> Am 8. Dezember 2021 03:52:00 MEZ schrieb Iain Duncan <
> iainduncanli...@gmail.com>:
> >And follow up, if there is a way to make a generic handler for right hand
> >inlets, is there also a way to find out on which inlet the message came
> in?
> >
>
>
> You basically need to create a "proxy" object with a single generic inlet.
> The proxy object is not displayed (but its inlet is attached to and
> displayed on) the parent object.
> It also holds a handle to the parent (so it can forward whatever it
> receives) and probably it's own ID (so it can identify itself)
>
> just grep for 'proxy's 
>
>
> mfg.sfg.jfd
> IOhannes
>
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Question about right hand generic inlet creation

2021-12-07 Thread Iain Duncan
And follow up, if there is a way to make a generic handler for right hand
inlets, is there also a way to find out on which inlet the message came in?

thanks

On Tue, Dec 7, 2021 at 5:57 PM Iain Duncan 
wrote:

> Hi folks, I'm not sure if I'm understanding the externals tutorial
> properly. It seems to me that it is saying that one cannot make a generic
> inlet past the first one, as in something that passes any incoming message
> to the same handler as an array of atoms. Is that the case or am I totally
> misunderstanding that? And if it's not the case, if someone could tell me
> how to make the equivalent of class_addanything happen for other inlets
> than the first, that would be lovely.
>
> thanks!
> iain
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Question about right hand generic inlet creation

2021-12-07 Thread Iain Duncan
Hi folks, I'm not sure if I'm understanding the externals tutorial
properly. It seems to me that it is saying that one cannot make a generic
inlet past the first one, as in something that passes any incoming message
to the same handler as an array of atoms. Is that the case or am I totally
misunderstanding that? And if it's not the case, if someone could tell me
how to make the equivalent of class_addanything happen for other inlets
than the first, that would be lovely.

thanks!
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Helping with building Scheme for Pure Data for windows?

2021-10-11 Thread Iain Duncan
Many thanks to Lucas for his assistance. I'm now building successfully on
windows, so should be able to make a binary release in the next week or so.

iain

On Sun, Oct 10, 2021 at 3:35 PM Iain Duncan 
wrote:

> hi Lucas, that would be wonderful. You definitely don't need to know
> Scheme to help me, I could just do with a hand figuring out compiling on
> windows. :-)  I have done it for my Max version with Visual Studio, but not
> yet tackled using mysys for the Pd version. I will follow up to you
> off-list.
>
> thanks!
> iain
>
> On Sun, Oct 10, 2021 at 3:24 PM Lucas Cordiviola 
> wrote:
>
>> Hi Iain,
>>
>> I don't have time right now to learn scheme but surely can help building
>> for Windows.
>>
>> Are you already on Windows machine?
>>
>> If you like we continue off-list.
>>
>>
>>
>> --
>>
>> Mensaje telepatico asistido por maquinas.
>>
>> On 10/10/2021 2:10 PM, Alexandre Torres Porres wrote:
>> > Lucas usually helps with that ;)
>> >
>> > Em dom., 10 de out. de 2021 às 13:39, Iain Duncan
>> >  escreveu:
>> >
>> > Long shot, but in case there is someone on here who is a) excited
>> > about using Scheme in Pd, and b) conversant with building
>> > externals for windows,  I could definitely do with some help. I
>> > really only know developing on linux and osx. I'm sure I'll manage
>> > on my own, but it will be slower and harder to prioritize.
>> >
>> > thanks!
>> > iain
>> >
>> > ___
>> > Pd-dev mailing list
>> > Pd-dev@lists.iem.at
>> > https://lists.puredata.info/listinfo/pd-dev
>> >
>>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Helping with building Scheme for Pure Data for windows?

2021-10-10 Thread Iain Duncan
hi Lucas, that would be wonderful. You definitely don't need to know Scheme
to help me, I could just do with a hand figuring out compiling on windows.
:-)  I have done it for my Max version with Visual Studio, but not yet
tackled using mysys for the Pd version. I will follow up to you off-list.

thanks!
iain

On Sun, Oct 10, 2021 at 3:24 PM Lucas Cordiviola 
wrote:

> Hi Iain,
>
> I don't have time right now to learn scheme but surely can help building
> for Windows.
>
> Are you already on Windows machine?
>
> If you like we continue off-list.
>
>
>
> --
>
> Mensaje telepatico asistido por maquinas.
>
> On 10/10/2021 2:10 PM, Alexandre Torres Porres wrote:
> > Lucas usually helps with that ;)
> >
> > Em dom., 10 de out. de 2021 às 13:39, Iain Duncan
> >  escreveu:
> >
> > Long shot, but in case there is someone on here who is a) excited
> > about using Scheme in Pd, and b) conversant with building
> > externals for windows,  I could definitely do with some help. I
> > really only know developing on linux and osx. I'm sure I'll manage
> > on my own, but it will be slower and harder to prioritize.
> >
> > thanks!
> > iain
> >
> > ___
> > Pd-dev mailing list
> > Pd-dev@lists.iem.at
> > https://lists.puredata.info/listinfo/pd-dev
> >
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Helping with building Scheme for Pure Data for windows?

2021-10-10 Thread Iain Duncan
Long shot, but in case there is someone on here who is a) excited about
using Scheme in Pd, and b) conversant with building externals for windows,
I could definitely do with some help. I really only know developing on
linux and osx. I'm sure I'll manage on my own, but it will be slower and
harder to prioritize.

thanks!
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] another file path question for sp4d

2021-10-09 Thread Iain Duncan
Thanks Antoine, using canvas_open has fixed my issues and opening from
sub-dirs is working properly as well now.

iain

On Fri, Oct 8, 2021 at 8:55 AM Iain Duncan 
wrote:

> Thanks Antoine, re my last point: if the norm is that it should, then
> that's what I'll do. And is why I asked, thanks!
>
> iain
>
> On Fri, Oct 8, 2021 at 8:44 AM Antoine Rousseau 
> wrote:
>
>> the functions "canvas_open()" and "canvas_makefilename()" can do all this
>> for you, in the same way as other data files (texts, arrays, wavs...) are
>> opened.
>>
>> - do *not* traverse through all directories on the Pd search paths
>>>
>>
>> why not?  Is it a problem if it finds "scm/foo.scm" somewhere else? I say
>> that because "canvas_open()" and "canvas_makefilename()" WILL traverse Pd
>> search paths...
>>
>>
>> Antoine
>>
>>
>>
>> Le ven. 8 oct. 2021 à 17:01, Iain Duncan  a
>> écrit :
>>
>>> Hi folks, I want to solicit opinions from the broader Pd dev community
>>> before figuring out how to fix this bug report from Alex:
>>> https://github.com/iainctduncan/scheme-for-pd/issues/15
>>>
>>> His point was that a relative path didn't do what he expected, situation
>>> - an s4pd object created as "sp4d scm/my-file.scm"
>>>
>>> So this is what I think should happen for file searching, but will
>>> change my mind if it is not in accordance with what users would expect. The
>>> handling rules will be the same whether from a a "read {file}" message or
>>> an arg to the object:
>>>
>>> Proposed Rules:
>>> - absolute paths - opened
>>> - single file name paths:
>>>- first look in the canvas directory
>>>- then search all Pd paths
>>> - relative path names (i.e. "s4pd scm/foo.scm"):
>>>   - search in the canvas directory
>>>   - do *not* traverse through all directories on the Pd search paths
>>>
>>> Does that sound right? Or would the expectation be that it would search
>>> for scm/foo.js on all the search paths?
>>>
>>> Related, should it know how to do the right thing to convert unix style
>>> paths on windows?
>>>
>>> Please feel free to comment here or on the github ticket.
>>>
>>> thanks
>>> iain
>>> ___
>>> Pd-dev mailing list
>>> Pd-dev@lists.iem.at
>>> https://lists.puredata.info/listinfo/pd-dev
>>>
>>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] s4pd packaging: issues with [declare -path]

2021-10-09 Thread Iain Duncan
Answering my own question for the archives:

Switching file finding to use canvas_open in the external seems to have
fixed the issue. I can now load successfully with no file path set in
preferences by using [declare -path s4pd]. :-)

iain


On Sat, Oct 9, 2021 at 8:43 AM Iain Duncan 
wrote:

> Re the first point, this is in conflict with what I received from others
> in another thread. So if there are other opinions on this I would still
> like to hear.
>
> Re the second, that's a different issue, and I am literally working on it
> right now. Please note that that ticket was not closed, nor did I indicate
> anywhere that it was solved in rc3.
>
> iain
>
> On Sat, Oct 9, 2021 at 8:38 AM Alexandre Torres Porres 
> wrote:
>
>> You don't and shouldn't need declare at all, you just have a single
>> external and its name is the same as the folder's name "s4pd".
>>
>> The object should be able to load files on the same folder as the help
>> patch or in folders relative to it, but it still can't (with version rc3).
>>
>> Em sáb., 9 de out. de 2021 às 12:09, Iain Duncan <
>> iainduncanli...@gmail.com> escreveu:
>>
>>> Oh I think I might have stumbled on the answer, but confirmation would
>>> be lovely. I was using open_via_path to find the file, is it that I need to
>>> use canvas_open for the declare path to work?
>>>
>>> iain
>>>
>>> On Sat, Oct 9, 2021 at 8:02 AM Iain Duncan 
>>> wrote:
>>>
>>>> Hi folks, I'm still working on the packaging of s4pd with regard to
>>>> finding scheme files, and am almost there, but having some weirdness with
>>>> [declare -path]. It was recommended to me that I advise people in the docs
>>>> to put a [declare -path s4pd] in their patches so that finding scm files
>>>> would "just work".
>>>>
>>>> My understanding is that this would add the s4pd path to their file
>>>> path, meaning that files in that dir should get found, just as if one had
>>>> put it explicitly into the Pd path preferences. However, this doesn't seem
>>>> to do that on MacOS.
>>>>
>>>> I run make install, and it puts my stuff in ~/Library/Pd/, so that
>>>> there is a directory, ~/Library/Pd/s4pd, with all the files, at the same
>>>> level as the external. But if I try to use a patch with an s4pd object and
>>>> a [declare -path s4pd], the declare path appears to make no difference: I
>>>> still need to go add ~/Library/Pd/s4pd to file preferences for the files to
>>>> be found.
>>>>
>>>> Hopefully someone can clear up what is happening here, or my
>>>> misunderstanding of what the declare is supposed to do.
>>>>
>>>> thanks!
>>>>
>>> ___
>>> Pd-dev mailing list
>>> Pd-dev@lists.iem.at
>>> https://lists.puredata.info/listinfo/pd-dev
>>>
>>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] s4pd packaging: issues with [declare -path]

2021-10-09 Thread Iain Duncan
Re the first point, this is in conflict with what I received from others in
another thread. So if there are other opinions on this I would still like
to hear.

Re the second, that's a different issue, and I am literally working on it
right now. Please note that that ticket was not closed, nor did I indicate
anywhere that it was solved in rc3.

iain

On Sat, Oct 9, 2021 at 8:38 AM Alexandre Torres Porres 
wrote:

> You don't and shouldn't need declare at all, you just have a single
> external and its name is the same as the folder's name "s4pd".
>
> The object should be able to load files on the same folder as the help
> patch or in folders relative to it, but it still can't (with version rc3).
>
> Em sáb., 9 de out. de 2021 às 12:09, Iain Duncan <
> iainduncanli...@gmail.com> escreveu:
>
>> Oh I think I might have stumbled on the answer, but confirmation would be
>> lovely. I was using open_via_path to find the file, is it that I need to
>> use canvas_open for the declare path to work?
>>
>> iain
>>
>> On Sat, Oct 9, 2021 at 8:02 AM Iain Duncan 
>> wrote:
>>
>>> Hi folks, I'm still working on the packaging of s4pd with regard to
>>> finding scheme files, and am almost there, but having some weirdness with
>>> [declare -path]. It was recommended to me that I advise people in the docs
>>> to put a [declare -path s4pd] in their patches so that finding scm files
>>> would "just work".
>>>
>>> My understanding is that this would add the s4pd path to their file
>>> path, meaning that files in that dir should get found, just as if one had
>>> put it explicitly into the Pd path preferences. However, this doesn't seem
>>> to do that on MacOS.
>>>
>>> I run make install, and it puts my stuff in ~/Library/Pd/, so that there
>>> is a directory, ~/Library/Pd/s4pd, with all the files, at the same level as
>>> the external. But if I try to use a patch with an s4pd object and a
>>> [declare -path s4pd], the declare path appears to make no difference: I
>>> still need to go add ~/Library/Pd/s4pd to file preferences for the files to
>>> be found.
>>>
>>> Hopefully someone can clear up what is happening here, or my
>>> misunderstanding of what the declare is supposed to do.
>>>
>>> thanks!
>>>
>> ___
>> Pd-dev mailing list
>> Pd-dev@lists.iem.at
>> https://lists.puredata.info/listinfo/pd-dev
>>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] s4pd packaging: issues with [declare -path]

2021-10-09 Thread Iain Duncan
Oh I think I might have stumbled on the answer, but confirmation would be
lovely. I was using open_via_path to find the file, is it that I need to
use canvas_open for the declare path to work?

iain

On Sat, Oct 9, 2021 at 8:02 AM Iain Duncan 
wrote:

> Hi folks, I'm still working on the packaging of s4pd with regard to
> finding scheme files, and am almost there, but having some weirdness with
> [declare -path]. It was recommended to me that I advise people in the docs
> to put a [declare -path s4pd] in their patches so that finding scm files
> would "just work".
>
> My understanding is that this would add the s4pd path to their file path,
> meaning that files in that dir should get found, just as if one had put it
> explicitly into the Pd path preferences. However, this doesn't seem to do
> that on MacOS.
>
> I run make install, and it puts my stuff in ~/Library/Pd/, so that there
> is a directory, ~/Library/Pd/s4pd, with all the files, at the same level as
> the external. But if I try to use a patch with an s4pd object and a
> [declare -path s4pd], the declare path appears to make no difference: I
> still need to go add ~/Library/Pd/s4pd to file preferences for the files to
> be found.
>
> Hopefully someone can clear up what is happening here, or my
> misunderstanding of what the declare is supposed to do.
>
> thanks!
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] s4pd packaging: issues with [declare -path]

2021-10-09 Thread Iain Duncan
Hi folks, I'm still working on the packaging of s4pd with regard to finding
scheme files, and am almost there, but having some weirdness with [declare
-path]. It was recommended to me that I advise people in the docs to put a
[declare -path s4pd] in their patches so that finding scm files would "just
work".

My understanding is that this would add the s4pd path to their file path,
meaning that files in that dir should get found, just as if one had put it
explicitly into the Pd path preferences. However, this doesn't seem to do
that on MacOS.

I run make install, and it puts my stuff in ~/Library/Pd/, so that there is
a directory, ~/Library/Pd/s4pd, with all the files, at the same level as
the external. But if I try to use a patch with an s4pd object and a
[declare -path s4pd], the declare path appears to make no difference: I
still need to go add ~/Library/Pd/s4pd to file preferences for the files to
be found.

Hopefully someone can clear up what is happening here, or my
misunderstanding of what the declare is supposed to do.

thanks!
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] another file path question for sp4d

2021-10-08 Thread Iain Duncan
Thanks Antoine, re my last point: if the norm is that it should, then
that's what I'll do. And is why I asked, thanks!

iain

On Fri, Oct 8, 2021 at 8:44 AM Antoine Rousseau  wrote:

> the functions "canvas_open()" and "canvas_makefilename()" can do all this
> for you, in the same way as other data files (texts, arrays, wavs...) are
> opened.
>
> - do *not* traverse through all directories on the Pd search paths
>>
>
> why not?  Is it a problem if it finds "scm/foo.scm" somewhere else? I say
> that because "canvas_open()" and "canvas_makefilename()" WILL traverse Pd
> search paths...
>
>
> Antoine
>
>
>
> Le ven. 8 oct. 2021 à 17:01, Iain Duncan  a
> écrit :
>
>> Hi folks, I want to solicit opinions from the broader Pd dev community
>> before figuring out how to fix this bug report from Alex:
>> https://github.com/iainctduncan/scheme-for-pd/issues/15
>>
>> His point was that a relative path didn't do what he expected, situation
>> - an s4pd object created as "sp4d scm/my-file.scm"
>>
>> So this is what I think should happen for file searching, but will change
>> my mind if it is not in accordance with what users would expect. The
>> handling rules will be the same whether from a a "read {file}" message or
>> an arg to the object:
>>
>> Proposed Rules:
>> - absolute paths - opened
>> - single file name paths:
>>- first look in the canvas directory
>>- then search all Pd paths
>> - relative path names (i.e. "s4pd scm/foo.scm"):
>>   - search in the canvas directory
>>   - do *not* traverse through all directories on the Pd search paths
>>
>> Does that sound right? Or would the expectation be that it would search
>> for scm/foo.js on all the search paths?
>>
>> Related, should it know how to do the right thing to convert unix style
>> paths on windows?
>>
>> Please feel free to comment here or on the github ticket.
>>
>> thanks
>> iain
>> ___
>> Pd-dev mailing list
>> Pd-dev@lists.iem.at
>> https://lists.puredata.info/listinfo/pd-dev
>>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] another file path question for sp4d

2021-10-08 Thread Iain Duncan
Hi folks, I want to solicit opinions from the broader Pd dev community
before figuring out how to fix this bug report from Alex:
https://github.com/iainctduncan/scheme-for-pd/issues/15

His point was that a relative path didn't do what he expected, situation
- an s4pd object created as "sp4d scm/my-file.scm"

So this is what I think should happen for file searching, but will change
my mind if it is not in accordance with what users would expect. The
handling rules will be the same whether from a a "read {file}" message or
an arg to the object:

Proposed Rules:
- absolute paths - opened
- single file name paths:
   - first look in the canvas directory
   - then search all Pd paths
- relative path names (i.e. "s4pd scm/foo.scm"):
  - search in the canvas directory
  - do *not* traverse through all directories on the Pd search paths

Does that sound right? Or would the expectation be that it would search for
scm/foo.js on all the search paths?

Related, should it know how to do the right thing to convert unix style
paths on windows?

Please feel free to comment here or on the github ticket.

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Packaging question for Scheme for Pd

2021-10-04 Thread Iain Duncan
Thanks, IOhannes, that sounds sensible. So in order to make it as
homogenous as possible between people who build from source and those who
install the package (as ultimately I would like this to be extension
friendly at the C level), do you think it would be best to just have the
scm files live in the same directory as the C files in the source? Or is
there some suggested approach when using pd lib builder to make this
simple?

thanks
iain

On Mon, Oct 4, 2021 at 8:52 AM IOhannes m zmoelnig  wrote:

> On 10/4/21 5:22 PM, Iain Duncan wrote:
> > of the package ('s4pd') so that this can simply be put in the
> Pd/externals
> > directory? I just need to know what "normal" is for a release package.
>
> yes: ship the scm files besides your external.
>
> the easiest way is to instruct people to load your library with
> [declare -path s4pd -lib s4pd] (which will add .../s4pd to Pd's search
> paths and *also* load the s4pd.pd_linux external).
> in the s4pd_setup() (or better: s4pd_new()) callback, spit out a big fat
> wraning if the scm files cannot be found like:
>  > ERROR: could not find 's4pd.scm'!
>  > ERROR: use [declare -path s4pd -lib s4pd] to load this external
>
> and refuse to create an instance of the interpreter.
>
> to make things a bit nicer, you could *additionally* search for
> "s4pd/s4pd.scm", and only bail out if neither of the two can be found.
>
>
> you could also check how other language bindings do this, e.g. [tclpd]
> or [pdlua]
> (both of which somehow try to get the path of the library file, and then
> use that to load their auxiliary scripts)
>
> gfmnasdr
> IOhannes
>
> [tclpd]
> <
> https://svn.code.sf.net/p/pure-data/svn/trunk/externals/loaders/tclpd/tclpd.c
> >
> [pdlua]
> <
> https://svn.code.sf.net/p/pure-data/svn/trunk/externals/loaders/pdlua/src/pdlua.c
> >
>
> PS: we probably should move these to gitlab :-)
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Packaging question for Scheme for Pd

2021-10-04 Thread Iain Duncan
Hi folks, I need some advice on what is the expected way for a package to
be laid out to avoid confusing users when they try to install. The
situation is that s4pd requires the external, and scm files that come in
the package. In development, I have those in an scm dir, and if you
build from source, that dir needs to be in the Pd search paths. For a non
developer user, I want install to be as simple as possible. Should a
downloadable package just put the scm files and external in the top level
of the package ('s4pd') so that this can simply be put in the Pd/externals
directory? I just need to know what "normal" is for a release package.

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] equivalent of Max attributes for optional keyword object args?

2021-09-24 Thread Iain Duncan
Thanks Christof. I will take a look at signumd!

On Fri, Sep 24, 2021 at 9:04 AM Christof Ressi 
wrote:

> Usually, we would use flags, e.g. in your case something like "-heap
> ".
>
> [sigmund~] object, for example, takes a few flag arguments. You can take
> it as a reference point.
>
> Christof
> On 24.09.2021 17:33, Iain Duncan wrote:
>
> Hi folks, I want to add an optional argument for object creation time to
> Scheme for Pd to allow setting the starting heap size, which can
> dramatically lower garbage collector times. In Scheme for Max 0.3 I added
> the @heap attr. I'm not sure what the normal way to do this kind of thing
> is in Pd. The catch is that this arg needs to be optional (beginners
> shouldn't have to worry about it) and needs to be set at object creation
> time because you can't change the starting heap size after creating the s7
> interpreter. So I'm somewhat reluctant to just add a 3rd integer arg.
> Suggestions welcome!
>
> thanks!
> iain
>
> ___
> Pd-dev mailing 
> listpd-...@lists.iem.athttps://lists.puredata.info/listinfo/pd-dev
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] equivalent of Max attributes for optional keyword object args?

2021-09-24 Thread Iain Duncan
Hi folks, I want to add an optional argument for object creation time to
Scheme for Pd to allow setting the starting heap size, which can
dramatically lower garbage collector times. In Scheme for Max 0.3 I added
the @heap attr. I'm not sure what the normal way to do this kind of thing
is in Pd. The catch is that this arg needs to be optional (beginners
shouldn't have to worry about it) and needs to be set at object creation
time because you can't change the starting heap size after creating the s7
interpreter. So I'm somewhat reluctant to just add a 3rd integer arg.
Suggestions welcome!

thanks!
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] plans for next Pd release

2021-07-13 Thread Iain Duncan
On the topic of minor message related improvements, I hope it's ok to chime
in here, and I apologize if this has been hashed to death already and there
are good reasons for the current state..

I'm doing a lot of making messages out of other objects to send to Scheme
for Pd, and one thing I use all the time in Max is the right hand inlet for
message boxes as a way to set the contents of a message. I'm curious
whether there has been thought about adding that to Pd message boxes. It's
a small thing, but very handy for the kind of patches I wind up making.

thanks!
iain

On Tue, Jul 13, 2021 at 11:15 AM Miller Puckette via Pd-dev <
pd-dev@lists.iem.at> wrote:

> YEah, while I'm meessing with hovering I want ot do something like that
> (but probably just graphical - I don't want to blow anyone out of his/her
> seat
> by accident :)
>
> On Tue, Jul 13, 2021 at 07:11:04PM +0100, Andy Farnell wrote:
> > On Tue, Jul 13, 2021 at 10:22:17AM -0700, Miller Puckette via Pd-dev
> wrote:
> >
> > > PS more ideas of mine (among many):
> > > hot-reloading externs via a message to Pd
> > > use a "unix binding" socket between Pd and pd-gui instead of localhost
> > > generalize number/symbol box to allow displaying entire messages or
> lists
> >
> > All good things, thanks Miller.
> > While we're dreaming: tooltip style message inspection - when
> > active, hover over a wire to see what's flowing or audition audio
> > (maybe through compressor/limiter :)
> > best,
> > Andy
> >
> > > cheers
> > > Miller
>
>
>
> --
>
>
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Question about prepping Scheme for Pure Data external for Deken?

2021-07-12 Thread Iain Duncan
Hi folks, I'm able to spend some time on Scheme for Pure Data again over
the next couple of weeks, and just wanted to check on what I need to have
done to make it easy to install through Deken. For Max, I had to have
successfully compiled binaries for Mac, Windows 32, and Windows 64. Is it
the same for Pd? I assume Linux users will get things either by compiling
from source or a a linux package manager?

thanks!
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] building with pdlib builder on windows

2021-06-26 Thread Iain Duncan
Thanks Lucas. I've been busy getting a paper ready but will be switching
back to working on the Pd packaging next week, I'm sure this will be
helpful.
I'll be in touch!

iain

On Fri, Jun 25, 2021 at 3:19 PM Lucas Cordiviola 
wrote:

> Oh. I forget about this:
>
> you have to copy "libwinpthread-1.dll" & "libdl.dll" (make sure the
> folder where you copy matches the arch of your build) from your msys2
> installation to the same folder where "s4pd.dll" is.
>
> Mensaje telepatico asistido por maquinas.
>
> On 6/25/2021 6:56 PM, Lucas Cordiviola wrote:
> > Hi Ian,
> >
> > any news on this?. I know you didn't ask but this notes i made a weeks
> > ago might help.
> >
> > https://nc.nubegris.com.ar/index.php/s/rMbXSrtRLzYWSDk
> >
> > I got the object running and printing. not sure if it loads properly
> > the .scm files. I got the same results as building for Linux.
> >
> > Hope it helps.
> >
> > :)
> >
> > Mensaje telepatico asistido por maquinas.
> >
> > On 6/14/2021 6:24 PM, Iain Duncan wrote:
> >> great, thanks. I'll get back to you here if I can't figure it out, I
> >> appreciate the help!
> >>
> >> iain
> >>
> >>
> >> On Mon, Jun 14, 2021 at 1:52 PM Christof Ressi
> >> mailto:i...@christofressi.com>> wrote:
> >>
> >> The recommended way is MinGW via msys2. See the "Windows" section
> >> in https://github.com/pure-data/pure-data/blob/master/INSTALL.txt
> >> <https://github.com/pure-data/pure-data/blob/master/INSTALL.txt>.
> >>
> >> Christof
> >>
> >> On 14.06.2021 22:47, Iain Duncan wrote:
> >>> Hi folks, I know windows just enough to be dangerous to myself,
> >>> but would like to at least be able to prepare binaries of s4pd.
> >>> Wondering what the path of least resistance is to compiling on
> >>> windows these days if I'm using pd lib builder. ie mingq, cygwin,
> >>> virtual studio??
> >>>
> >>> thanks
> >>> iain
> >>>
> >>> ___
> >>> Pd-dev mailing list
> >>> Pd-dev@lists.iem.at  <mailto:Pd-dev@lists.iem.at>
> >>> https://lists.puredata.info/listinfo/pd-dev
> >>> <https://lists.puredata.info/listinfo/pd-dev>
> >>
> >>
> >> ___
> >> Pd-dev mailing list
> >> Pd-dev@lists.iem.at
> >> https://lists.puredata.info/listinfo/pd-dev
> >
> >
> >
> > ___
> > Pd-dev mailing list
> > Pd-dev@lists.iem.at
> > https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] More clock questions

2021-06-15 Thread Iain Duncan
Thanks Seb, that's helpful and  gives me some stuff to chew on. Is the code
in which you've done this public?

iain

On Sun, Jun 13, 2021 at 9:40 PM Sebastian Shader via Pd-dev <
pd-dev@lists.iem.at> wrote:

> >1) Is the Pd clock scheduler only accurate to the ms or does it operate
> at
> >higher than ms accuracy? (As in, if I wanted to role my own mechanism
> >closer to what Seb did, how frequently should my master time go off?)
>
> from what I can tell Pd seems to use its own unit of time in order to
> interface better with the audio side of things, (but it's stored in a
> double)
> lua uses double for it's numbers, and I just used milliseconds (partially
> because the pd clocks seem to work/have worked with milliseconds
> primarily/historically)
>
> I'm not sure I understand "how frequently should my master time go off?"
> You have the clock callbacks stored in the priority queue, and use the
> scheduled time (in ms) for the keys the queue is sorted by.
> So in order to "start a delay", you put a callback on the queue. Then to
> start your scheduler, call the underlying t_clock delay with the value of
> the difference between the time of the top value in the queue (which will
> be the earliest callback because you set up the priority queue to sort as a
> min-heap, so that the lowest times get popped out first) and the current
> time.
> Every time you return from the underlying t_clock callback, increment your
> own time by the amount the underlying t_clock was called with/delayed for
> (in milliseconds stored in a double, in my case).
>
> The nice thing about using t_clock is that you don't need to implement the
> delay part yourself, just the priority queue and figuring out when to start
> and stop it. (along with dispatching the callbacks associated with members
> in the queue, wherever those go.)
>
> What I do is put my "main thread" on the queue to start. Every time
> another thread/coroutine is started/sprouted it gets added to the queue.
> Whenever a delay is encountered the current thread will be at the top of
> the queue, so you just have to change the delay time and call some
> downheap() function on the heap to restore the heap property after changing
> the delay time in the priority queue member. (then delay the t_clock by the
> new top member of the queue)
> Every time a coroutine finishes I take it off of the top of the queue.
> (and call another t_clock delay for the new top member, or stop if there
> are none left)
>
> -Seb
>
> -Original Message-
> Message: 2
> Date: Sat, 12 Jun 2021 11:11:12 -0700
> From: Iain Duncan 
> To: pd-dev 
> Subject: [PD-dev] More clock questions
>
> I have a couple more clock/schedule related questions after rereading the
> comments from Miller and Seb.
>
> 1) Is the Pd clock scheduler only accurate to the ms or does it operate at
> higher than ms accuracy? (As in, if I wanted to role my own mechanism
> closer to what Seb did, how frequently should my master time go off?)
>
> 2) Miller made reference to the linked list of clocks that pd iterates
> through. Is that something I could access directly? (and if so, where would
> it live?
>
> 3) if anyone knows good books or online resources for learning more about
> writing scheduler related code, I'm all ears! :-)
>
> thanks
> iain
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] building with pdlib builder on windows

2021-06-14 Thread Iain Duncan
great, thanks. I'll get back to you here if I can't figure it out, I
appreciate the help!

iain


On Mon, Jun 14, 2021 at 1:52 PM Christof Ressi 
wrote:

> The recommended way is MinGW via msys2. See the "Windows" section in
> https://github.com/pure-data/pure-data/blob/master/INSTALL.txt.
>
> Christof
> On 14.06.2021 22:47, Iain Duncan wrote:
>
> Hi folks, I know windows just enough to be dangerous to myself, but would
> like to at least be able to prepare binaries of s4pd. Wondering what the
> path of least resistance is to compiling on windows these days if I'm using
> pd lib builder. ie mingq, cygwin, virtual studio??
>
> thanks
> iain
>
> ___
> Pd-dev mailing 
> listpd-...@lists.iem.athttps://lists.puredata.info/listinfo/pd-dev
>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] building with pdlib builder on windows

2021-06-14 Thread Iain Duncan
Hi folks, I know windows just enough to be dangerous to myself, but would
like to at least be able to prepare binaries of s4pd. Wondering what the
path of least resistance is to compiling on windows these days if I'm using
pd lib builder. ie mingq, cygwin, virtual studio??

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] s4pd help: portable uid-like thing in C?

2021-06-12 Thread Iain Duncan
Hi Christof, you are right, it was a bad idea,  but the good news is that
in the hours since I posted that I managed to get it to work properly. It's
been a while since I did data structures manually in C... :-)

I went for maintaining a double-linked list of clock_info structures that
just stores them as they come in. If the interpreter is reset, or object
freed, or we make a cancel-clocks request, that just gets walked with all
clocks unset, freed, and the memory for the clock info nodes freed. In
normal operation, no extra walking needs to happen as the (not cancelled)
callback takes ownership of the pointers and cleans up as part of it's
execution. The implementation could certainly be more elegant, but it seems
to be robust (not sure I even need the double linking, but it helped me
think about it...) I made a fuzzy tester that assaults the object with
variable tempo'd delay requests, requests to cancel 1 delay, and requests
to cancel all, and resets and I can't make it crash anymore, even
recreating the object. Phew!

Thanks for the help everyone. Will post to the list when the next cut is
ready.

iain






On Sat, Jun 12, 2021 at 2:28 PM Christof Ressi 
wrote:

> Hi,
>
> this is a bit of a XY question. The actual problem is about managing
> clocks. Let's see if we can find a proper solution.
>
> I would assume that you are storing the clock(s) alongside the interpreter
> instance. If you restart the interpret, unset the clock(s) with
> clock_unset(). If you free the instance, free the clock(s) with
> clock_free().
>
> If that somehow doesn't work for you, explain the exact problem and show
> the code.
>
> ---
>
> > It doesn't need to be unique across the world, just the local machine
>
> Why would your ID even need to be unique across the whole machine? I think
> it should be enough that it's unique within the app. In that case, you can
> simply use the memory address of the interpreter instance itself. In fact,
> that's how Pd creates the canvas and object IDs for communicating with the
> Tcl/Tk GUI app.
>
> Christof
> On 12.06.2021 18:50, Iain Duncan wrote:
>
> Hi folks, i'm wrestling away with the schedule functions for
> Scheme-for-Pd, and I think I can make things a lot more reliable if I let
> every instantiation (or restart) of the scheme interpreter have a uid of
> some sort so that on a reset we can just ignore clocks running out on a
> previous instance instead of trying to clean them all up with manual memory
> management. (which approach is giving me segfaults because I'm screwing
> something up)
>
> Can anyone tell me what a smart way of getting a unique identifier would
> be? It doesn't need to be unique across the world, just the local machine,
> so something that was seeded from system time would be fine. I'm not a Real
> C Programmer though, so am not clear what options will just work across all
> OS's, without needing to add dependencies.
>
> thanks!
>
>
> ___
> Pd-dev mailing 
> listpd-...@lists.iem.athttps://lists.puredata.info/listinfo/pd-dev
>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] More clock questions

2021-06-12 Thread Iain Duncan
I have a couple more clock/schedule related questions after rereading the
comments from Miller and Seb.

1) Is the Pd clock scheduler only accurate to the ms or does it operate at
higher than ms accuracy? (As in, if I wanted to role my own mechanism
closer to what Seb did, how frequently should my master time go off?)

2) Miller made reference to the linked list of clocks that pd iterates
through. Is that something I could access directly? (and if so, where would
it live?

3) if anyone knows good books or online resources for learning more about
writing scheduler related code, I'm all ears! :-)

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] s4pd help: portable uid-like thing in C?

2021-06-12 Thread Iain Duncan
Hi folks, i'm wrestling away with the schedule functions for Scheme-for-Pd,
and I think I can make things a lot more reliable if I let every
instantiation (or restart) of the scheme interpreter have a uid of some
sort so that on a reset we can just ignore clocks running out on a previous
instance instead of trying to clean them all up with manual memory
management. (which approach is giving me segfaults because I'm screwing
something up)

Can anyone tell me what a smart way of getting a unique identifier would
be? It doesn't need to be unique across the world, just the local machine,
so something that was seeded from system time would be fine. I'm not a Real
C Programmer though, so am not clear what options will just work across all
OS's, without needing to add dependencies.

thanks!
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Scheme-for-Pd, how to release beta versions, call for testers

2021-06-10 Thread Iain Duncan
Hi folks, I'm only a few days away (I think!) from a first beta release for
Scheme-for-Pd, and am wondering what I'm supposed to do for releasing to
the early testers given I don't want to put it on Deken until it's had the
tires well kicked...

Things I need to sort  - answers or pointers to where to read both
appreciated:

Is it pretty common that people know how to build or should I prepare a
binary for OSX and Windows?

If so, how is that normally bundled up? I need people to have external, the
help patcher and also a set of scm files on their pd search path for it all
to work.

Is there anyone who would be interested in testing out building and
running, both from zipped up packages and cloning and building? There's a
pretty extensive help file, and everything in it should "just work". (haha,
we'll see about that!)

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] using the PD filepath in an external?

2021-06-09 Thread Iain Duncan
Working like a charm now, thanks Miller!

iain

On Wed, Jun 9, 2021 at 3:39 PM Iain Duncan 
wrote:

> Perfect! That one's much more comprehensible for my less-than-stellar C
> chops.  :-)
>
> thanks!
>
> On Wed, Jun 9, 2021 at 3:36 PM Miller Puckette  wrote:
>
>> Exactly.
>>
>> I now see that there's a better example in the binbuf_read_via_canvas()
>> function in m_binbuf.c
>>
>> cheers
>> M
>>
>> On Wed, Jun 09, 2021 at 03:31:17PM -0700, Iain Duncan wrote:
>> > Ah got it, presumably I get what I'm looking for in char *dirresult?
>> >
>> > assumption taken from:
>> > EXTERN int open_via_path(const char *dir, const char *name, const char
>> *ext,
>> > char *dirresult, char **nameresult, unsigned int size, int bin);
>> >
>> > thanks again!
>> >
>> > On Wed, Jun 9, 2021 at 3:28 PM Miller Puckette  wrote:
>> >
>> > > Yeah... open_via_path and scoop up the full path it reports back -
>> then
>> > > close the file and let s7 reopen it :)
>> > >
>> > > M
>> > > On Wed, Jun 09, 2021 at 03:26:35PM -0700, Iain Duncan wrote:
>> > > > Thanks Miller. Looking at that example, this seems to be a way to
>> open
>> > > and
>> > > > read in the whole file into C, which I could do, but the path of
>> least
>> > > > resistance for me so far has been to pass the actual loading to s7.
>> Is
>> > > > there a way to just get the full path for a file found from the Pd
>> > > > filepath? (if not, I suppose I'll read the file in and the
>> eval_string on
>> > > > it or something...)
>> > > >
>> > > > thanks!
>> > > > iain
>> > > >
>> > > >
>> > > > On Wed, Jun 9, 2021 at 3:13 PM Miller Puckette 
>> wrote:
>> > > >
>> > > > > open_via_path() should do it.  See for instance open_soundfile()
>> in
>> > > > > d_soundfile.c
>> > > > >
>> > > > > cheers
>> > > > > M
>> > > > >
>> > > > > On Wed, Jun 09, 2021 at 02:57:16PM -0700, Iain Duncan wrote:
>> > > > > > Hi folks, I tried to google this, but of course am swamped with
>> > > results
>> > > > > on
>> > > > > > how to load things in the patcher instead of what I'm looking
>> for.
>> > > Can
>> > > > > > anyone point me at how to use the filepath to load files in an
>> > > external?
>> > > > > In
>> > > > > > Max I have s4m find the fullpath for the bootstrap files and
>> then
>> > > load
>> > > > > them
>> > > > > > up through s7s native load function with the fullpath. If
>> anyone has
>> > > an
>> > > > > > example of something similar for Pd, that would be lovely!
>> > > > > >
>> > > > > > thanks
>> > > > >
>> > > > > > ___
>> > > > > > Pd-dev mailing list
>> > > > > > Pd-dev@lists.iem.at
>> > > > > >
>> > > > >
>> > >
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=39U4MIEK2DpJZblMb2hW4LrL86NA-Fm7lh9jTc1PtDw=uthX9eWCbvFepVl85UPukc4ORK0FbfTxuf-LSSYwmD0=
>> > > > >
>> > > > >
>> > > > > --
>> > > > >
>> > >
>> > > --
>> > >
>>
>> --
>>
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] using the PD filepath in an external?

2021-06-09 Thread Iain Duncan
Perfect! That one's much more comprehensible for my less-than-stellar C
chops.  :-)

thanks!

On Wed, Jun 9, 2021 at 3:36 PM Miller Puckette  wrote:

> Exactly.
>
> I now see that there's a better example in the binbuf_read_via_canvas()
> function in m_binbuf.c
>
> cheers
> M
>
> On Wed, Jun 09, 2021 at 03:31:17PM -0700, Iain Duncan wrote:
> > Ah got it, presumably I get what I'm looking for in char *dirresult?
> >
> > assumption taken from:
> > EXTERN int open_via_path(const char *dir, const char *name, const char
> *ext,
> > char *dirresult, char **nameresult, unsigned int size, int bin);
> >
> > thanks again!
> >
> > On Wed, Jun 9, 2021 at 3:28 PM Miller Puckette  wrote:
> >
> > > Yeah... open_via_path and scoop up the full path it reports back - then
> > > close the file and let s7 reopen it :)
> > >
> > > M
> > > On Wed, Jun 09, 2021 at 03:26:35PM -0700, Iain Duncan wrote:
> > > > Thanks Miller. Looking at that example, this seems to be a way to
> open
> > > and
> > > > read in the whole file into C, which I could do, but the path of
> least
> > > > resistance for me so far has been to pass the actual loading to s7.
> Is
> > > > there a way to just get the full path for a file found from the Pd
> > > > filepath? (if not, I suppose I'll read the file in and the
> eval_string on
> > > > it or something...)
> > > >
> > > > thanks!
> > > > iain
> > > >
> > > >
> > > > On Wed, Jun 9, 2021 at 3:13 PM Miller Puckette  wrote:
> > > >
> > > > > open_via_path() should do it.  See for instance open_soundfile() in
> > > > > d_soundfile.c
> > > > >
> > > > > cheers
> > > > > M
> > > > >
> > > > > On Wed, Jun 09, 2021 at 02:57:16PM -0700, Iain Duncan wrote:
> > > > > > Hi folks, I tried to google this, but of course am swamped with
> > > results
> > > > > on
> > > > > > how to load things in the patcher instead of what I'm looking
> for.
> > > Can
> > > > > > anyone point me at how to use the filepath to load files in an
> > > external?
> > > > > In
> > > > > > Max I have s4m find the fullpath for the bootstrap files and then
> > > load
> > > > > them
> > > > > > up through s7s native load function with the fullpath. If anyone
> has
> > > an
> > > > > > example of something similar for Pd, that would be lovely!
> > > > > >
> > > > > > thanks
> > > > >
> > > > > > ___
> > > > > > Pd-dev mailing list
> > > > > > Pd-dev@lists.iem.at
> > > > > >
> > > > >
> > >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=39U4MIEK2DpJZblMb2hW4LrL86NA-Fm7lh9jTc1PtDw=uthX9eWCbvFepVl85UPukc4ORK0FbfTxuf-LSSYwmD0=
> > > > >
> > > > >
> > > > > --
> > > > >
> > >
> > > --
> > >
>
> --
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] using the PD filepath in an external?

2021-06-09 Thread Iain Duncan
Ah got it, presumably I get what I'm looking for in char *dirresult?

assumption taken from:
EXTERN int open_via_path(const char *dir, const char *name, const char *ext,
char *dirresult, char **nameresult, unsigned int size, int bin);

thanks again!

On Wed, Jun 9, 2021 at 3:28 PM Miller Puckette  wrote:

> Yeah... open_via_path and scoop up the full path it reports back - then
> close the file and let s7 reopen it :)
>
> M
> On Wed, Jun 09, 2021 at 03:26:35PM -0700, Iain Duncan wrote:
> > Thanks Miller. Looking at that example, this seems to be a way to open
> and
> > read in the whole file into C, which I could do, but the path of least
> > resistance for me so far has been to pass the actual loading to s7. Is
> > there a way to just get the full path for a file found from the Pd
> > filepath? (if not, I suppose I'll read the file in and the eval_string on
> > it or something...)
> >
> > thanks!
> > iain
> >
> >
> > On Wed, Jun 9, 2021 at 3:13 PM Miller Puckette  wrote:
> >
> > > open_via_path() should do it.  See for instance open_soundfile() in
> > > d_soundfile.c
> > >
> > > cheers
> > > M
> > >
> > > On Wed, Jun 09, 2021 at 02:57:16PM -0700, Iain Duncan wrote:
> > > > Hi folks, I tried to google this, but of course am swamped with
> results
> > > on
> > > > how to load things in the patcher instead of what I'm looking for.
> Can
> > > > anyone point me at how to use the filepath to load files in an
> external?
> > > In
> > > > Max I have s4m find the fullpath for the bootstrap files and then
> load
> > > them
> > > > up through s7s native load function with the fullpath. If anyone has
> an
> > > > example of something similar for Pd, that would be lovely!
> > > >
> > > > thanks
> > >
> > > > ___
> > > > Pd-dev mailing list
> > > > Pd-dev@lists.iem.at
> > > >
> > >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=39U4MIEK2DpJZblMb2hW4LrL86NA-Fm7lh9jTc1PtDw=uthX9eWCbvFepVl85UPukc4ORK0FbfTxuf-LSSYwmD0=
> > >
> > >
> > > --
> > >
>
> --
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] using the PD filepath in an external?

2021-06-09 Thread Iain Duncan
Thanks Miller. Looking at that example, this seems to be a way to open and
read in the whole file into C, which I could do, but the path of least
resistance for me so far has been to pass the actual loading to s7. Is
there a way to just get the full path for a file found from the Pd
filepath? (if not, I suppose I'll read the file in and the eval_string on
it or something...)

thanks!
iain


On Wed, Jun 9, 2021 at 3:13 PM Miller Puckette  wrote:

> open_via_path() should do it.  See for instance open_soundfile() in
> d_soundfile.c
>
> cheers
> M
>
> On Wed, Jun 09, 2021 at 02:57:16PM -0700, Iain Duncan wrote:
> > Hi folks, I tried to google this, but of course am swamped with results
> on
> > how to load things in the patcher instead of what I'm looking for. Can
> > anyone point me at how to use the filepath to load files in an external?
> In
> > Max I have s4m find the fullpath for the bootstrap files and then load
> them
> > up through s7s native load function with the fullpath. If anyone has an
> > example of something similar for Pd, that would be lovely!
> >
> > thanks
>
> > ___
> > Pd-dev mailing list
> > Pd-dev@lists.iem.at
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=39U4MIEK2DpJZblMb2hW4LrL86NA-Fm7lh9jTc1PtDw=uthX9eWCbvFepVl85UPukc4ORK0FbfTxuf-LSSYwmD0=
>
>
> --
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] using the PD filepath in an external?

2021-06-09 Thread Iain Duncan
Hi folks, I tried to google this, but of course am swamped with results on
how to load things in the patcher instead of what I'm looking for. Can
anyone point me at how to use the filepath to load files in an external? In
Max I have s4m find the fullpath for the bootstrap files and then load them
up through s7s native load function with the fullpath. If anyone has an
example of something similar for Pd, that would be lovely!

thanks
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Creating delayed functions in Pd external?

2021-06-09 Thread Iain Duncan
Thanks Christof, will hack further on this today!

iain

On Sun, Jun 6, 2021 at 7:00 PM Christof Ressi 
wrote:

> getbytes() + freebytes()
>
> Christof
> On 07.06.2021 03:56, Iain Duncan wrote:
>
> Ah, ok. I also just realized (necessity being the mother of and all that)
> that I can probably be storing these on the scheme side too, as the actual
> function object is stored there anyway in a hash-table.
>
> Related: in Max they recommend using sysmem_newptr instead of malloc, is
> there a recommended cross-platform Pd replacement for malloc I should be
> using?
>
> thanks!
> iain
>
> On Sun, Jun 6, 2021 at 6:52 PM Miller Puckette  wrote:
>
>> Well, Pd's own scheduler for clocks keeps them in a linked list and chases
>> down it to set and unset them.  So if you did anything smart for the
>> scheme callbacks Pd would see to it that it's still linear time in the
>> number of active callbacks.
>>
>> cheers
>> M
>>
>> On Sun, Jun 06, 2021 at 06:22:41PM -0700, Iain Duncan wrote:
>> > Thanks Miller. That brings up one more question.. ;-)
>> >
>> > In Scheme for Max, the way I do it is I keep a hash-table in C going
>> > with keys that are created on Scheme delay calls, so that one can cancel
>> > clocks by fetching them from the hashtable. In Max, there's a
>> > cross-platform hash-table implementation that I'm using. Is there
>> something
>> > similar for Pd, or if not, is there an approach you would recommend for
>> > keeping a key-value store in C for the clocks by a symbolic key? I
>> guess a
>> > good question might be if this is even necessary, given there can't be
>> > *that* many clocks scheduled for the future. And association list type
>> > thing might do just as well.
>> >
>> > thanks for the help, it's going well, now that I can finally work on it!
>> > ought to have a first alpha folks can play with in the next couple of
>> weeks.
>> > iain
>> >
>> >
>> >
>> > On Sun, Jun 6, 2021 at 5:36 PM Miller Puckette  wrote:
>> >
>> > > clock() is the only mechanism - for repeats, the easiest thing is
>> often
>> > > to just re-use a clock() and re-set it each time it goes off (as in
>> > > the metro obejct).  You can indeed create clock obejcts on the fly -
>> > > that's what pipe does.  But you'll want to keep track of them so you
>> can
>> > > cancel them if the owning object goes away.
>> > >
>> > > cheers
>> > > M
>> > >
>> > > On Sun, Jun 06, 2021 at 05:16:09PM -0700, Iain Duncan wrote:
>> > > > Ah fantastic, thanks. I was looking in pipe and not seeing it, but
>> was
>> > > > probably just lost in other new details and not seeing the forest
>> for the
>> > > > trees. :-)
>> > > >
>> > > > Couple of follow ups:
>> > > > - is there a separate facility for making a repeated callback (ie
>> not
>> > > > one-shot), or does one just do both with clock?
>> > > > - is it safe to make clocks as we need them (ie during a method
>> call, not
>> > > > necessarily at object instantiation time), or is this the kind of
>> thing
>> > > > where for real time use one needs to make a clock pool and a pool
>> manager
>> > > > and all that?
>> > > >
>> > > > thanks!
>> > > > iain
>> > > >
>> > > > On Sun, Jun 6, 2021 at 5:12 PM Miller Puckette 
>> wrote:
>> > > >
>> > > > > Yep, clock_delay() .  Simples example is in Pd's "delay" object,
>> > > x_time.c
>> > > > >
>> > > > > cheers
>> > > > > Miller
>> > > > >
>> > > > > On Sun, Jun 06, 2021 at 04:21:46PM -0700, Iain Duncan wrote:
>> > > > > > Hi folks, I'm hoping someone can point me in the right direction
>> > > here.
>> > > > > I'm
>> > > > > > porting Scheme for Max to pure data and I'm stuck figuring out
>> how
>> > > to get
>> > > > > > delayed functions going. In Max, the SDK has a facility to make
>> > > register
>> > > > > a
>> > > > > > callback to executed at some point in the future, a few
>> different
>> > > ways.
>> > > > > Is
>> > > > > > there a Pd equivalent, and if so, could anyone point m

Re: [PD-dev] Pd-dev Digest, Vol 194, Issue 4

2021-06-08 Thread Iain Duncan
Thanks Seb and Miller. Good suggestion, I've played with both approaches in
the Max version actually. I'll start simple, but thanks for sharing your
code Seb, I may move to that later (or add it as another option).

thank again!
iain

On Mon, Jun 7, 2021 at 3:12 PM Miller Puckette via Pd-dev <
pd-dev@lists.iem.at> wrote:

> Seb's way is more work than mine but can achieve much higher performance.
> (Incidentally, it's the approack Barry Vercoe took in his synthetic
> performer
> of 1984 - the 4X gave him, I think, 256 "clocks" and he just used one of
> them
> to wake him up every millisecond.
>
>
> cheers
> Miller
> On Mon, Jun 07, 2021 at 09:09:37PM +, Sebastian Shader via Pd-dev
> wrote:
> > In my WIP pdlua scripting library??
> https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sebshader_lscoreI=DwIFaQ=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=fs1umRNWvWKgFPdv579MPzkVXMxlZbPGudp3p96wYcw=cOIw7ZYTWKm1EDsWEvU0kO3j05p6m0dXi0R1vNIKRws=
> use 1 clock from pdlua for timing but then use my own
> heap/priority-queue-based scheduler as a wrapper for it.So if I need a new
> delay/clock I add it to my own scheduling queue, and then the priority
> queue pops the (next time - current time) for the??underlying t_clock that
> pdlua uses every time a delay occurs.(and then the clocks are used for
> delays within coroutine yields so you can write music)In my case I also
> need a lot more manipulations of the scheduling queues though (my next
> project is to have 1 scheduling queue peraccelerando/ritardando group so a
> tree of descendants of an ancestor coroutine that sprouted them can
> accelerando/ritardando together)
> > -Seb
> >
> > -----Original Message-
> >
> > Date: Sun, 6 Jun 2021 18:52:17 -0700
> > From: Miller Puckette 
> > To: Iain Duncan 
> > Cc: pd-dev 
> > Subject: Re: [PD-dev] Creating delayed functions in Pd external?
> > Message-ID: <20210607015217.4fb2ym5rl27d7...@ucsd.edu>
> > Content-Type: text/plain; charset=us-ascii
> >
> > Well, Pd's own scheduler for clocks keeps them in a linked list and
> chases
> > down it to set and unset them.?? So if you did anything smart for the
> > scheme callbacks Pd would see to it that it's still linear time in the
> > number of active callbacks.
> >
> > cheers
> > M
> >
> > On Sun, Jun 06, 2021 at 06:22:41PM -0700, Iain Duncan wrote:
> > > Thanks Miller. That brings up one more question.. ;-)
> > >
> > > In Scheme for Max, the way I do it is I keep a hash-table in C going
> > > with keys that are created on Scheme delay calls, so that one can
> cancel
> > > clocks by fetching them from the hashtable. In Max, there's a
> > > cross-platform hash-table implementation that I'm using. Is there
> something
> > > similar for Pd, or if not, is there an approach you would recommend for
> > > keeping a key-value store in C for the clocks by a symbolic key? I
> guess a
> > > good question might be if this is even necessary, given there can't be
> > > *that* many clocks scheduled for the future. And association list type
> > > thing might do just as well.
> > >
> > > thanks for the help, it's going well, now that I can finally work on
> it!
> > > ought to have a first alpha folks can play with in the next couple of
> weeks.
> > > iain
> > >
> > >
> > >
> > > On Sun, Jun 6, 2021 at 5:36 PM Miller Puckette  wrote:
> > >
> > > > clock() is the only mechanism - for repeats, the easiest thing is
> often
> > > > to just re-use a clock() and re-set it each time it goes off (as in
> > > > the metro obejct).?? You can indeed create clock obejcts on the fly -
> > > > that's what pipe does.?? But you'll want to keep track of them so
> you can
> > > > cancel them if the owning object goes away.
> > > >
> > > > cheers
> > > > M
> > > >
> > > > On Sun, Jun 06, 2021 at 05:16:09PM -0700, Iain Duncan wrote:
> > > > > Ah fantastic, thanks. I was looking in pipe and not seeing it, but
> was
> > > > > probably just lost in other new details and not seeing the forest
> for the
> > > > > trees. :-)
> > > > >
> > > > > Couple of follow ups:
> > > > > - is there a separate facility for making a repeated callback (ie
> not
> > > > > one-shot), or does one just do both with clock?
> > > > > - is it safe to make clocks as we need them (ie during a method
> call, not
> > > > > necessarily at object in

Re: [PD-dev] Creating delayed functions in Pd external?

2021-06-06 Thread Iain Duncan
Ah, ok. I also just realized (necessity being the mother of and all that)
that I can probably be storing these on the scheme side too, as the actual
function object is stored there anyway in a hash-table.

Related: in Max they recommend using sysmem_newptr instead of malloc, is
there a recommended cross-platform Pd replacement for malloc I should be
using?

thanks!
iain

On Sun, Jun 6, 2021 at 6:52 PM Miller Puckette  wrote:

> Well, Pd's own scheduler for clocks keeps them in a linked list and chases
> down it to set and unset them.  So if you did anything smart for the
> scheme callbacks Pd would see to it that it's still linear time in the
> number of active callbacks.
>
> cheers
> M
>
> On Sun, Jun 06, 2021 at 06:22:41PM -0700, Iain Duncan wrote:
> > Thanks Miller. That brings up one more question.. ;-)
> >
> > In Scheme for Max, the way I do it is I keep a hash-table in C going
> > with keys that are created on Scheme delay calls, so that one can cancel
> > clocks by fetching them from the hashtable. In Max, there's a
> > cross-platform hash-table implementation that I'm using. Is there
> something
> > similar for Pd, or if not, is there an approach you would recommend for
> > keeping a key-value store in C for the clocks by a symbolic key? I guess
> a
> > good question might be if this is even necessary, given there can't be
> > *that* many clocks scheduled for the future. And association list type
> > thing might do just as well.
> >
> > thanks for the help, it's going well, now that I can finally work on it!
> > ought to have a first alpha folks can play with in the next couple of
> weeks.
> > iain
> >
> >
> >
> > On Sun, Jun 6, 2021 at 5:36 PM Miller Puckette  wrote:
> >
> > > clock() is the only mechanism - for repeats, the easiest thing is often
> > > to just re-use a clock() and re-set it each time it goes off (as in
> > > the metro obejct).  You can indeed create clock obejcts on the fly -
> > > that's what pipe does.  But you'll want to keep track of them so you
> can
> > > cancel them if the owning object goes away.
> > >
> > > cheers
> > > M
> > >
> > > On Sun, Jun 06, 2021 at 05:16:09PM -0700, Iain Duncan wrote:
> > > > Ah fantastic, thanks. I was looking in pipe and not seeing it, but
> was
> > > > probably just lost in other new details and not seeing the forest
> for the
> > > > trees. :-)
> > > >
> > > > Couple of follow ups:
> > > > - is there a separate facility for making a repeated callback (ie not
> > > > one-shot), or does one just do both with clock?
> > > > - is it safe to make clocks as we need them (ie during a method
> call, not
> > > > necessarily at object instantiation time), or is this the kind of
> thing
> > > > where for real time use one needs to make a clock pool and a pool
> manager
> > > > and all that?
> > > >
> > > > thanks!
> > > > iain
> > > >
> > > > On Sun, Jun 6, 2021 at 5:12 PM Miller Puckette  wrote:
> > > >
> > > > > Yep, clock_delay() .  Simples example is in Pd's "delay" object,
> > > x_time.c
> > > > >
> > > > > cheers
> > > > > Miller
> > > > >
> > > > > On Sun, Jun 06, 2021 at 04:21:46PM -0700, Iain Duncan wrote:
> > > > > > Hi folks, I'm hoping someone can point me in the right direction
> > > here.
> > > > > I'm
> > > > > > porting Scheme for Max to pure data and I'm stuck figuring out
> how
> > > to get
> > > > > > delayed functions going. In Max, the SDK has a facility to make
> > > register
> > > > > a
> > > > > > callback to executed at some point in the future, a few different
> > > ways.
> > > > > Is
> > > > > > there a Pd equivalent, and if so, could anyone point me at
> resources
> > > or
> > > > > > code for it?  I basically just need to be able to have a callback
> > > fire
> > > > > off
> > > > > > at the right time with one argument, which can be void pointer
> to the
> > > > > rest
> > > > > > of the stuff i want to get.
> > > > > >
> > > > > > thanks!
> > > > > > iain
> > > > >
> > > > > > ___
> > > > > > Pd-dev mailing list
> > > > > > Pd-dev@lists.iem.at
> > > > > >
> > > > >
> > >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=uekrR-wLMB9CDNku0beRkRmoSJoExinRbBSlb0UQknQ=98jkGlO1FFE0Ea5fhSopCbZt6bmZH580Y0IUfgX4Rwk=
> > > > >
> > > > >
> > > > > --
> > > > >
> > >
> > > --
> > >
>
> --
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Creating delayed functions in Pd external?

2021-06-06 Thread Iain Duncan
Thanks Miller. That brings up one more question.. ;-)

In Scheme for Max, the way I do it is I keep a hash-table in C going
with keys that are created on Scheme delay calls, so that one can cancel
clocks by fetching them from the hashtable. In Max, there's a
cross-platform hash-table implementation that I'm using. Is there something
similar for Pd, or if not, is there an approach you would recommend for
keeping a key-value store in C for the clocks by a symbolic key? I guess a
good question might be if this is even necessary, given there can't be
*that* many clocks scheduled for the future. And association list type
thing might do just as well.

thanks for the help, it's going well, now that I can finally work on it!
ought to have a first alpha folks can play with in the next couple of weeks.
iain



On Sun, Jun 6, 2021 at 5:36 PM Miller Puckette  wrote:

> clock() is the only mechanism - for repeats, the easiest thing is often
> to just re-use a clock() and re-set it each time it goes off (as in
> the metro obejct).  You can indeed create clock obejcts on the fly -
> that's what pipe does.  But you'll want to keep track of them so you can
> cancel them if the owning object goes away.
>
> cheers
> M
>
> On Sun, Jun 06, 2021 at 05:16:09PM -0700, Iain Duncan wrote:
> > Ah fantastic, thanks. I was looking in pipe and not seeing it, but was
> > probably just lost in other new details and not seeing the forest for the
> > trees. :-)
> >
> > Couple of follow ups:
> > - is there a separate facility for making a repeated callback (ie not
> > one-shot), or does one just do both with clock?
> > - is it safe to make clocks as we need them (ie during a method call, not
> > necessarily at object instantiation time), or is this the kind of thing
> > where for real time use one needs to make a clock pool and a pool manager
> > and all that?
> >
> > thanks!
> > iain
> >
> > On Sun, Jun 6, 2021 at 5:12 PM Miller Puckette  wrote:
> >
> > > Yep, clock_delay() .  Simples example is in Pd's "delay" object,
> x_time.c
> > >
> > > cheers
> > > Miller
> > >
> > > On Sun, Jun 06, 2021 at 04:21:46PM -0700, Iain Duncan wrote:
> > > > Hi folks, I'm hoping someone can point me in the right direction
> here.
> > > I'm
> > > > porting Scheme for Max to pure data and I'm stuck figuring out how
> to get
> > > > delayed functions going. In Max, the SDK has a facility to make
> register
> > > a
> > > > callback to executed at some point in the future, a few different
> ways.
> > > Is
> > > > there a Pd equivalent, and if so, could anyone point me at resources
> or
> > > > code for it?  I basically just need to be able to have a callback
> fire
> > > off
> > > > at the right time with one argument, which can be void pointer to the
> > > rest
> > > > of the stuff i want to get.
> > > >
> > > > thanks!
> > > > iain
> > >
> > > > ___
> > > > Pd-dev mailing list
> > > > Pd-dev@lists.iem.at
> > > >
> > >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=uekrR-wLMB9CDNku0beRkRmoSJoExinRbBSlb0UQknQ=98jkGlO1FFE0Ea5fhSopCbZt6bmZH580Y0IUfgX4Rwk=
> > >
> > >
> > > --
> > >
>
> --
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] Creating delayed functions in Pd external?

2021-06-06 Thread Iain Duncan
Ah fantastic, thanks. I was looking in pipe and not seeing it, but was
probably just lost in other new details and not seeing the forest for the
trees. :-)

Couple of follow ups:
- is there a separate facility for making a repeated callback (ie not
one-shot), or does one just do both with clock?
- is it safe to make clocks as we need them (ie during a method call, not
necessarily at object instantiation time), or is this the kind of thing
where for real time use one needs to make a clock pool and a pool manager
and all that?

thanks!
iain

On Sun, Jun 6, 2021 at 5:12 PM Miller Puckette  wrote:

> Yep, clock_delay() .  Simples example is in Pd's "delay" object, x_time.c
>
> cheers
> Miller
>
> On Sun, Jun 06, 2021 at 04:21:46PM -0700, Iain Duncan wrote:
> > Hi folks, I'm hoping someone can point me in the right direction here.
> I'm
> > porting Scheme for Max to pure data and I'm stuck figuring out how to get
> > delayed functions going. In Max, the SDK has a facility to make register
> a
> > callback to executed at some point in the future, a few different ways.
> Is
> > there a Pd equivalent, and if so, could anyone point me at resources or
> > code for it?  I basically just need to be able to have a callback fire
> off
> > at the right time with one argument, which can be void pointer to the
> rest
> > of the stuff i want to get.
> >
> > thanks!
> > iain
>
> > ___
> > Pd-dev mailing list
> > Pd-dev@lists.iem.at
> >
> https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.puredata.info_listinfo_pd-2Ddev=DwICAg=-35OiAkTchMrZOngvJPOeA=XprZV3Fxus2L1LCw80hE4Q=uekrR-wLMB9CDNku0beRkRmoSJoExinRbBSlb0UQknQ=98jkGlO1FFE0Ea5fhSopCbZt6bmZH580Y0IUfgX4Rwk=
>
>
> --
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] Creating delayed functions in Pd external?

2021-06-06 Thread Iain Duncan
Hi folks, I'm hoping someone can point me in the right direction here. I'm
porting Scheme for Max to pure data and I'm stuck figuring out how to get
delayed functions going. In Max, the SDK has a facility to make register a
callback to executed at some point in the future, a few different ways. Is
there a Pd equivalent, and if so, could anyone point me at resources or
code for it?  I basically just need to be able to have a callback fire off
at the right time with one argument, which can be void pointer to the rest
of the stuff i want to get.

thanks!
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] example external code to browse?

2021-04-12 Thread Iain Duncan
thanks Christof, the lua one is likely to be a great resource for me!

iain


On Mon, Apr 12, 2021 at 8:46 AM Christof Ressi 
wrote:

> Here are a couple of Pd externals you could study to get you started:
> https://github.com/pd-externals
>
> Also, the pdlua external might be of interest, but it uses rather advanced
> techniques: https://github.com/agraef/pd-lua/blob/master/pdlua.c
>
> Christof
> On 11.04.2021 01:00, Iain Duncan wrote:
>
> Hi everyone, I'm working now on a PureData port of Scheme For Max, but am
> hitting some obstacles and am wondering if anyone can point me at sample
> external code that can be browsed somewhere? (I'm very new to Pd).
> Specifically I'm looking for stuff that involves event oriented handling
> and dynamic methods, symbols, etc. (basically all the non-dsp stuff). I've
> seen the github how to but that's not covering much in the way of working
> with symbols extensively.
>
> thanks!
>
> iain
>
> ___
> Pd-dev mailing 
> listpd-...@lists.iem.athttps://lists.puredata.info/listinfo/pd-dev
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] example external code to browse?

2021-04-10 Thread Iain Duncan
Hi everyone, I'm working now on a PureData port of Scheme For Max, but am
hitting some obstacles and am wondering if anyone can point me at sample
external code that can be browsed somewhere? (I'm very new to Pd).
Specifically I'm looking for stuff that involves event oriented handling
and dynamic methods, symbols, etc. (basically all the non-dsp stuff). I've
seen the github how to but that's not covering much in the way of working
with symbols extensively.

thanks!

iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] pd-lib-builder question (on osx)

2020-10-28 Thread Iain Duncan
Hey thanks for that, I was aware I was cargo-culting there haha, so the
explanation is much appreciated. :-)

iain

On Wed, Oct 28, 2020 at 9:29 AM IOhannes m zmoelnig  wrote:

> On 10/28/20 12:09 AM, Iain Duncan wrote:
> > cflags = -I . -L . -l s7
>
> if this works, then it's only because you somehow managed to have a
> libs7.so (or libs7.a) file lying around, against which it linked.
>
> afaict, this is not a safe assumption
>
> gdfmasdr
> IOhannes
>
> and some more nitpicking:
>
> i think it's better style to omit the spaces after the -I/-L/-l flags:
> cflags = -I. -L. -ls7
>
> also the "-I." is only useful if you happen to use includes with
> angled-brackets (e.g. '#include ') as opposed to includes with
> quotes (e.g. '#include "s7.h"').
> if you want to include the local header file anyhow (rather than some
> system-installed header of the same name) you should use
> includes-with-quotes rather than add '-I' to the cflags.
>
> and "-L" and "-l" are really linker flags.
> you should *not* add them to cflags.
> instead of "ldlibs" resp. "ldflags".
>
>
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] pd-lib-builder question (on osx)

2020-10-27 Thread Iain Duncan
Ah thanks, that did it! I also figured out I could build by adding

cflags = -I . -L . -l s7

but that did seem to be defeating the whole purpose the of the magic make
file.

Compiling now, thanks!
iain

On Tue, Oct 27, 2020 at 4:03 PM Christof Ressi 
wrote:

> Hi,
>
> here's the explanation:
> https://github.com/pure-data/pd-lib-builder/blob/e6cff665a3a30a967c72c382c6fe92bcdedd7b44/Makefile.pdlibbuilder#L45
>
> "class.sources" assumes one source per class. What you need is 
> ".class.sources",
> i.e. "s4pd.class.sources = s4pd.c s7.c"
>
> "common.sources" would have worked too, you just made a typo ;-) However,
> I think the solution above is clearer, as "common.sources" is really meant
> for the case where you have *multiple* classes with same shared code.
>
> Christof
> On 27.10.2020 23:44, Iain Duncan wrote:
>
> Hi devs, I'm trying to get pd-lib-builder working, but I think my lack of
> C building experience has me stuck. I was able to get my empty helloworld
> working ok, but not managing to link in S7.
>
> My project has one C file, and needs to also include s7.h and build s7.c
> I've included my (not working) Makefile below. When I try the below s7 does
> get compiled, producing an s7.o file, but instead of static linking I get
> an s7.pd_darwin file with all of the S7 stuff (it's big) and a tiny
> s4pd.pd_darwin file. And the external tries to load an s7 function and
> fails. Any tips much appreciated!
>
> thanks,
> Iain
>
> My Makefile:
>
> # library name
> lib.name = s4pd
>
> # tried these too, to no avail
> #lib.setup.sources = s7.c
> #common.source = s7.c
>
> # input source file (class name == source file basename)
> class.sources = s4pd.c s7.c
>
> # all extra files to be included in binary distribution of the library
> datafiles = README.md
>
> # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
> PDLIBBUILDER_DIR=pd-lib-builder/
> include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
>
> ___
> Pd-dev mailing 
> listpd-...@lists.iem.athttps://lists.puredata.info/listinfo/pd-dev
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] pd-lib-builder question (on osx)

2020-10-27 Thread Iain Duncan
Hi devs, I'm trying to get pd-lib-builder working, but I think my lack of C
building experience has me stuck. I was able to get my empty helloworld
working ok, but not managing to link in S7.

My project has one C file, and needs to also include s7.h and build s7.c
I've included my (not working) Makefile below. When I try the below s7 does
get compiled, producing an s7.o file, but instead of static linking I get
an s7.pd_darwin file with all of the S7 stuff (it's big) and a tiny
s4pd.pd_darwin file. And the external tries to load an s7 function and
fails. Any tips much appreciated!

thanks,
Iain

My Makefile:

# library name
lib.name = s4pd

# tried these too, to no avail
#lib.setup.sources = s7.c
#common.source = s7.c

# input source file (class name == source file basename)
class.sources = s4pd.c s7.c

# all extra files to be included in binary distribution of the library
datafiles = README.md

# include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder'
PDLIBBUILDER_DIR=pd-lib-builder/
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] implementing pools of clocks?

2020-10-25 Thread Iain Duncan
Ok cool. Thanks Miller, I will definitely look at the pipe code.

Is there an external that has become the defacto version of a transport or
anything like that? I would like to support common use cases in the most
helpful way possible.

On Sun, Oct 25, 2020 at 8:32 AM Christof Ressi 
wrote:

> Hi, Pd doesn't have a notion of global transport time, it just knows about
> logical time. People can (and have) build their own transport abstractions
> on top of that.
>
> For further inspiration you could look into Supercollider's TempoClock
> class. The idea is that each TempoClock can have its own logical time and
> tempo. Changing the time or tempo of a TempoClock affects all Routines that
> are scheduled on this clock. You can, of course, have more than one
> TempoClock at the same time.
>
> Christof
> On 25.10.2020 16:16, Iain Duncan wrote:
>
> Thanks Christof, that is helpful again, and also encouraging as it
> describes pretty well what I've done so far in the Max version. :-)
>
> I've enabled both one shot clocks (storing them in a hashtable owned by
> the external) and periodic timers. The one shot clocks exist in both a
> transport aware and transport ignorant format for working with and
> quantizing off the Max global transport, and there are periodic timers for
> both too. (The transport time stops when the transport is stopped, the
> other is just a general X ms timer). I have also ensured the callback
> handle gets passed back so that any timer or clock can be cancelled from
> Scheme user-space. (is there such a thing as a global transport in PD?)
>
> I was actually planning on something like you described in Scheme space: a
> user defined scheduler running off the timers. I will look into priority
> queues. I had one thought, which I have not seen much, and was part of the
> reason I was asking on here about schedulers. I would like to ensure the
> user can run multiple transports at once, and hop around in time without
> glitches. I was thinking that instead of using just a priority queue, I
> would do something like a two stage structure, perhaps with a hashmap or
> some other fast-read-anywhere structure with entries representing a time
> period, and holding priority queues for each period. This would be to
> enable the system to seek instantly to the bar (say) and iterate through
> the queue/list for that bar. Wondering if anyone has used or seen this type
> of pattern or has suggestions? Basically I want to make sure random access
> in time will work ok even if the number of events in the schedule is very
> high, thus allowing us to blur the lines between a scheduler and a full
> blown sequencer engine. Thoughts, suggestions, and warnings are all welcome.
>
> iain
>
> On Sun, Oct 25, 2020 at 4:21 AM Christof Ressi 
> wrote:
>
>> Actually, there is no need to use a clock for every scheduled LISP
>> function. You can also maintain a seperate scheduler, which is just a
>> priority queue for callback functions. In C++, you could use a
>> std::map. "double" is the desired (future) system
>> time, which you can get with "clock_getsystimeafter".
>>
>> Then you create a *single* clock in the setup function *) with a tick
>> method that reschedules itself periodically (e.g. clock_delay(x, 1) ). In
>> the tick method, you get the current logical time with
>> "clock_getlogicaltime", walk over the priority queue and dispatch + remove
>> all items which have a time equal or lower. You have to be careful about
>> possible recursion, though, because calling a scheduled LISP function might
>> itself schedule another function. In the case of std::map, however, it is
>> safe, because insertion doesn't invalidate iterators.
>>
>> Some more ideas:
>>
>> Personally, I like to have both one-shot functions and repeated
>> functions, being able to change the time/interval and also cancel them. For
>> this, it is useful that the API returns some kind of identifier for each
>> callback (e.g. an integer ID). This is what Javascript does with
>> "setTimeout"/"clearTimeout" and "setInterval"/"clearInterval". I use a very
>> similar system for the Lua scripting API of my 2D game engine, but I also
>> have "resetTimeout" and "resetInterval" functions.
>>
>> On the other hand, you could also have a look at the scheduling API of
>> the Supercollider, which is a bit different: if a routine yields a number
>> N, it means that the routine will be scheduled again after N seconds.
>>
>> Generally, having periodic timers is very convenient in a musical
>> environment :-)
>>
>> Christof
>>
>> *)

Re: [PD-dev] implementing pools of clocks?

2020-10-25 Thread Iain Duncan
Thanks Christof, that is helpful again, and also encouraging as it
describes pretty well what I've done so far in the Max version. :-)

I've enabled both one shot clocks (storing them in a hashtable owned by the
external) and periodic timers. The one shot clocks exist in both a
transport aware and transport ignorant format for working with and
quantizing off the Max global transport, and there are periodic timers for
both too. (The transport time stops when the transport is stopped, the
other is just a general X ms timer). I have also ensured the callback
handle gets passed back so that any timer or clock can be cancelled from
Scheme user-space. (is there such a thing as a global transport in PD?)

I was actually planning on something like you described in Scheme space: a
user defined scheduler running off the timers. I will look into priority
queues. I had one thought, which I have not seen much, and was part of the
reason I was asking on here about schedulers. I would like to ensure the
user can run multiple transports at once, and hop around in time without
glitches. I was thinking that instead of using just a priority queue, I
would do something like a two stage structure, perhaps with a hashmap or
some other fast-read-anywhere structure with entries representing a time
period, and holding priority queues for each period. This would be to
enable the system to seek instantly to the bar (say) and iterate through
the queue/list for that bar. Wondering if anyone has used or seen this type
of pattern or has suggestions? Basically I want to make sure random access
in time will work ok even if the number of events in the schedule is very
high, thus allowing us to blur the lines between a scheduler and a full
blown sequencer engine. Thoughts, suggestions, and warnings are all welcome.

iain

On Sun, Oct 25, 2020 at 4:21 AM Christof Ressi 
wrote:

> Actually, there is no need to use a clock for every scheduled LISP
> function. You can also maintain a seperate scheduler, which is just a
> priority queue for callback functions. In C++, you could use a
> std::map. "double" is the desired (future) system
> time, which you can get with "clock_getsystimeafter".
>
> Then you create a *single* clock in the setup function *) with a tick
> method that reschedules itself periodically (e.g. clock_delay(x, 1) ). In
> the tick method, you get the current logical time with
> "clock_getlogicaltime", walk over the priority queue and dispatch + remove
> all items which have a time equal or lower. You have to be careful about
> possible recursion, though, because calling a scheduled LISP function might
> itself schedule another function. In the case of std::map, however, it is
> safe, because insertion doesn't invalidate iterators.
>
> Some more ideas:
>
> Personally, I like to have both one-shot functions and repeated functions,
> being able to change the time/interval and also cancel them. For this, it
> is useful that the API returns some kind of identifier for each callback
> (e.g. an integer ID). This is what Javascript does with
> "setTimeout"/"clearTimeout" and "setInterval"/"clearInterval". I use a very
> similar system for the Lua scripting API of my 2D game engine, but I also
> have "resetTimeout" and "resetInterval" functions.
>
> On the other hand, you could also have a look at the scheduling API of the
> Supercollider, which is a bit different: if a routine yields a number N, it
> means that the routine will be scheduled again after N seconds.
>
> Generally, having periodic timers is very convenient in a musical
> environment :-)
>
> Christof
>
> *) Don't just store the clock in a global variable, because Pd can have
> several instances. Instead, put the clock in a struct which you allocate in
> the setup function. The clock gets this struct as the owner.
>
> typedef struct _myscheduler { t_clock *clock; } t_myscheduler; // this
> would also be a good place to store the priority queue
>
> t_scheduler *x = getbytes(sizeof(t_myscheduler));
>
> t_clock *clock = clock_new(x, (t_method)myscheduler_tick);
>
> x->clock = clock;
> On 25.10.2020 02:02, Iain Duncan wrote:
>
> Thanks Christof, that's very helpful.
>
> iain
>
> On Sat, Oct 24, 2020 at 5:53 PM Christof Ressi 
> wrote:
>
>> But if you're still worried, creating a pool of objects of the same size
>> is actually quite easy, just use a
>> https://en.wikipedia.org/wiki/Free_list.
>>
>> Christof
>> On 25.10.2020 02:45, Christof Ressi wrote:
>>
>> A) Am I right, both about being bad, and about clock pre-allocation and
>> pooling being a decent solution?
>> B) Does anyone have tips on how one should implement and use said clock
>> pool?
>>
&

Re: [PD-dev] implementing pools of clocks?

2020-10-24 Thread Iain Duncan
Thanks Christof, that's very helpful.

iain

On Sat, Oct 24, 2020 at 5:53 PM Christof Ressi 
wrote:

> But if you're still worried, creating a pool of objects of the same size
> is actually quite easy, just use a https://en.wikipedia.org/wiki/Free_list
> .
>
> Christof
> On 25.10.2020 02:45, Christof Ressi wrote:
>
> A) Am I right, both about being bad, and about clock pre-allocation and
> pooling being a decent solution?
> B) Does anyone have tips on how one should implement and use said clock
> pool?
>
> ad A), basically yes, but in Pd you can get away with it. Pd's scheduler
> doesn't run in the actual audio callback (unless you run Pd in "callback"
> mode) and is more tolerant towards operations that are not exactly realtime
> friendly (e.g. memory allocation, file IO, firing lots of messages, etc.).
> The audio callback and scheduler thread exchange audio samples via a
> lockfree ringbuffer. The "delay" parameter actually sets the size of this
> ringbuffer, and a larger size allows for larger CPU spikes.
>
> In practice, allocating a small struct is pretty fast even with the
> standard memory allocator, so in the case of Pd it's nothing to worry
> about. In Pd land, external authors don't really care too much about
> realtime safety, simply because Pd itself doesn't either.
>
> ---
>
> Now, in SuperCollider things are different. Scsynth and Supernova are
> quite strict regarding realtime safety because DSP runs in the audio
> callback. In fact, they use a special realtime allocator in case a plugin
> needs to allocate memory in the audio thread. Supercollider also has a
> seperate non-realtime thread where you would execute asynchronous commands,
> like loading a soundfile into a buffer.
>
> Finally, all sequencing and scheduling runs in a different program
> (sclang). Sclang sends OSC bundles to scsynth, with timestamps in the near
> future. Conceptually, this is a bit similar to Pd's ringbuffer scheduler,
> with the difference that DSP itself never blocks. If Sclang blocks, OSC
> messages will simply arrive late at the Server.
>
> Christof
> On 25.10.2020 02:10, Iain Duncan wrote:
>
> Hi folks, I'm working on an external for Max and PD embedding the S7
> scheme interpreter. It's mostly intended to do things at event level, (algo
> comp, etc) so I have been somewhat lazy around real time issues so far. But
> I'd like to make sure it's as robust as it can be, and can be used for as
> much as possible. Right now, I'm pretty sure I'm being a bad
> real-time-coder. When the user wants to delay a function call, ie  (delay
> 100 foo-fun), I'm doing the following:
>
> - callable foo-fun gets registered in a scheme hashtable with a gensym
> unique handle
> - C function gets called with the handle
> - C code makes a clock, storing it in a hashtable (in C) by the handle,
> and passing it a struct (I call it the "clock callback info struct") with
> the references it needs for it's callback
> - when the clock callback fires, it gets passed a void pointer to the
> clock-callback-info-struct, uses it to get the cb handle and the ref to the
> external (because the callback only gets one arg), calls back into Scheme
> with said handle
> - Scheme gets the callback out of it's registry and executes the stashed
> function
>
> This is working well, but I am both allocating and deallocating memory
> in those functions: for the clock, and for the info struct I use to pass
> around the reference to the external and the handle. Given that I want to
> be treating this code as high priority, and having it execute as
> timing-accurate as possible, I assume I should not be allocating and
> freeing in those functions, because I could get blocked on the memory
> calls, correct? I think I should probably have a pre-allocated pool of
> clocks and their associated info structs so that when a delay call comes
> in, we get one from the pool, and only do memory management if the pool is
> empty. (and allow the user to set some reasonable config value of the clock
> pool). I'm thinking RAM is cheap, clocks are small, people aren't likely to
> have more than 1000 delay functions running concurrently or something at
> once, and they can be allocated from the init routine.
>
> My questions:
> A) Am I right, both about being bad, and about clock pre-allocation and
> pooling being a decent solution?
> B) Does anyone have tips on how one should implement and use said clock
> pool?
>
> I suppose I should probably also be ensuring the Scheme hash-table doesn't
> do any unplanned allocation too, but I can bug folks on the S7 mailing list
> for that one...
>
> Thanks!
> iain
>
> ___
>

[PD-dev] implementing pools of clocks?

2020-10-24 Thread Iain Duncan
Hi folks, I'm working on an external for Max and PD embedding the S7 scheme
interpreter. It's mostly intended to do things at event level, (algo comp,
etc) so I have been somewhat lazy around real time issues so far. But I'd
like to make sure it's as robust as it can be, and can be used for as much
as possible. Right now, I'm pretty sure I'm being a bad real-time-coder.
When the user wants to delay a function call, ie  (delay 100 foo-fun), I'm
doing the following:

- callable foo-fun gets registered in a scheme hashtable with a gensym
unique handle
- C function gets called with the handle
- C code makes a clock, storing it in a hashtable (in C) by the handle, and
passing it a struct (I call it the "clock callback info struct") with the
references it needs for it's callback
- when the clock callback fires, it gets passed a void pointer to the
clock-callback-info-struct, uses it to get the cb handle and the ref to the
external (because the callback only gets one arg), calls back into Scheme
with said handle
- Scheme gets the callback out of it's registry and executes the stashed
function

This is working well, but I am both allocating and deallocating memory
in those functions: for the clock, and for the info struct I use to pass
around the reference to the external and the handle. Given that I want to
be treating this code as high priority, and having it execute as
timing-accurate as possible, I assume I should not be allocating and
freeing in those functions, because I could get blocked on the memory
calls, correct? I think I should probably have a pre-allocated pool of
clocks and their associated info structs so that when a delay call comes
in, we get one from the pool, and only do memory management if the pool is
empty. (and allow the user to set some reasonable config value of the clock
pool). I'm thinking RAM is cheap, clocks are small, people aren't likely to
have more than 1000 delay functions running concurrently or something at
once, and they can be allocated from the init routine.

My questions:
A) Am I right, both about being bad, and about clock pre-allocation and
pooling being a decent solution?
B) Does anyone have tips on how one should implement and use said clock
pool?

I suppose I should probably also be ensuring the Scheme hash-table doesn't
do any unplanned allocation too, but I can bug folks on the S7 mailing list
for that one...

Thanks!
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


Re: [PD-dev] How to learn about writing schedulers?

2020-10-24 Thread Iain Duncan
Thanks for those tips Christof, that's just the kind of thing I was looking
for.

iain

On Sat, Oct 24, 2020 at 2:30 PM Christof Ressi 
wrote:

> Hi,
>
> I think the following is a good introduction:
> http://www.rossbencina.com/code/real-time-audio-programming-101-time-waits-for-nothing
>
> Of course, there's also Miller's book "The Theory and Technique of
> Electronic Music", which has some sections about scheduling and control
> streams.
>
> Personally, I learned a lot from studying both Pd and Supercollider
> (scsynth + sclang), as they have very different approaches.
>
> Christof
> On 24.10.2020 19:48, Iain Duncan wrote:
>
> I hope this is ok on this list, please let me know if it should instead be
> on PD-OT.
>
> I'm looking for resources on learning how to write soft-real time
> scheduler engines for sequencing tools: patterns, data structures,
> tradeoffs of different approaches, etc. I'm interested in seeing how PD
> does it, but if anyone also knows of good books, sites, or otherwise that
> get into this topic deeply, I'd love to hear of them. It seems rather hard
> to find this kind of stuff, or maybe I just don't know where to look!
>
> thanks
> iain
>
> ___
> Pd-dev mailing 
> listpd-...@lists.iem.athttps://lists.puredata.info/listinfo/pd-dev
>
> ___
> Pd-dev mailing list
> Pd-dev@lists.iem.at
> https://lists.puredata.info/listinfo/pd-dev
>
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev


[PD-dev] How to learn about writing schedulers?

2020-10-24 Thread Iain Duncan
I hope this is ok on this list, please let me know if it should instead be
on PD-OT.

I'm looking for resources on learning how to write soft-real time scheduler
engines for sequencing tools: patterns, data structures, tradeoffs of
different approaches, etc. I'm interested in seeing how PD does it, but if
anyone also knows of good books, sites, or otherwise that get into this
topic deeply, I'd love to hear of them. It seems rather hard to find this
kind of stuff, or maybe I just don't know where to look!

thanks
iain
___
Pd-dev mailing list
Pd-dev@lists.iem.at
https://lists.puredata.info/listinfo/pd-dev