Re: Who talks to whom?

[email protected] Sun, 1 Mar 2020 22:21:51 -0600
Newsgroups gmane.comp.audio.supercollider.devel
Message-ID <CAB_zQYu6vQYLEpQ+1uLqxs911oGqeJKh0iZ70jqHLxBsvCro-A@mail.gmail.com>
On Sun, Mar 1, 2020 at 9:09 PM <[email protected]> wrote:

> All,
>
> This is my first sc-dev post; I've only been here about a month. I have
> been programming all my life -- I'm not a young man -- including a stint
> programming audio microcode, 16 channel filters, audio UI, etc. for a
> living. So feel free to talk freely. :) I'm trying to learn the SC
> architecure as I get more familiar with the code.
>

welcome! glad to have you here.

>
> I have downloaded the source kit and am trying to understand who talks to
> whom. I can't find a document or a diagram that describes how the
> applications of the default environment -- sc-ide, sclang, and scserver --
> inter-communicate. When I type a one-liner in sc-ide, how does it make its
> way to sclang and eventually to scserver to be played? And in what various
> formats?
>

for communication between language and server, you will want to review:
- https://doc.sccode.org/Reference/Server-Architecture.html
- https://doc.sccode.org/Guides/ClientVsServer.html

the server and IDE do not communicate.

for communication between language and IDE, communication happens via pipes
and a local socket connection, with the IDE acting as the server. the pipe
is used by the IDE to write to sclang's stdin only, AFAIK. the socket is
used both ways. IDE->sclang (ad hoc serialized protocol) to give document
management requests, sclang->IDE (YAML) to make requests and transmit
introspection information. some relevant code is:
- QtCollider/LanguageClient.{h,cpp} - basic interface to sclang
- QtCollider/QcApplication.{h,cpp} -
- editors/sc-ide/core/sc_process.{hpp,cpp}
- editors/sc-ide/primitives/sc_ipc_client.{hpp,cpp} -- this is technically
in the wrong folder (oops), it belongs to the sclang component

i'm only about 75% sure i got that overview right, so it's probably best to
read the code carefully.

>
> This basic understanding will help me get myself situated as I continue
> reading the code. And my apologies ahead of time if I've simply missed
> pre-existing documentation.
>

no need to apologize. to my knowledge there is no existing documentation
for the way the language and IDE communicate, which probably has to do with
the urgency with which the IDE was written. if you do get to a point where
you are confident about it, feel free to polish up any notes you might have
as a markdown document (or perhaps some better format?) and submit that as
a PR, i think everyone would benefit from that!

-brian