Csound Csound-dev Csound-tekno Search About

Re: source code

Date1999-02-25 13:47
FromMichael Gogins
SubjectRe: source code
Thanks for this most useful and informative summary.

-----Original Message-----
From: rasmus ekman 
To: Antoine Lefebvre 
Cc: Csound list 
Date: Thursday, February 25, 1999 7:58 AM
Subject: Re: source code


>Antoine Lefebvre wrote:
>> 
>> Can someone tell me the role of the important file. I mean not the
>> opcode but the main part, parser, main...
>
>Found my old notes, hope they're not too confused/erroneous.
>
>main() (in Main.c) parses command line, opens input files, sorts 
>score etc. The last few lines of main() calls otran() (in Otran.c) and 
>musmon() (in Musmon.c). 
>otran() is top of orchestra parsing, 
>musmon() does the score playing or "performance" part.
>
>otran() calls rdorchfile() (in Rdorc.c) to input the full orchestra 
>text, then it calls getoptext() (in Rdorc.c) to input single lines of 
>instrument code. 
>rdorchfile() does the macro collection and substitution, comment 
>filtering etc. 
>otran() checks syntax of Csound opcodes in the orchestra statements
>that it gets from getoptext(), and then builds up a task list for each 
>instrument, ie the sequence of opcode calls that constitute the
>instr's performance.
>
>musmon() sets up realtime and/or file output, calls oload() (in Oload.c)
>to initialise all opcodes (get ftables, set defaults etc), and then calls 
>playevents() (in Musmon.c), which does the actual performance. 
>
>playevents() gets all kinds of input: midi realtime, score events 
>from the sorted .sco file, score events started at realtime etc. 
>It calls insert() (in Insert.c) to put the instrument instances 
>into a playlist; a linked chain of EVTBLK structs. 
>
>playevents() counts down k-rate, and calls kperf() (in Insert.c). 
>kperf() goes through the task list of each active instrument in the 
>playlist, and makes the actual calls to the k- and a-rate opcode 
>functions used by each instrument. 
>
>The text of each instr...endin block in the orc file is stored 
>in structs: INSTRTXT, OPTXT etc. During performance INSDS and OPDS 
>structs hold the separate instrument instances. They are copied from 
>the instr template in INSTRTXT/OPTXT in insert().
>If instr 7 is called five times it will thus exist in five individual 
>(or sequential) copies. 
>
>All these structs are declared in Cs.h. They contain pointers to 
>the instrument text, to each other and to the corresponding opcode 
>functions, so it is quite feasible even for a beginner like myself
>to see what's going on by single-stepping through a Csound performance 
>in your favourite debugger. 
>
>All this stuff is (scantily, but still) commented, so you'll find 
>your way in the program flow. Changing stuff without breaking it 
>is trickier.
>
>Have fun,
>
>        re