[Csnd-dev] long-standing diskin/diskin2 issue

Victor Lazzarini <[email protected]>
Newsgroups gmane.comp.audio.csound.devel
Message-ID <[email protected]>
Hi everyone, 

some advice needed here.
While marking some student work, I came across an issue in diskin/diskin2 that seems to be long standing
and maybe someone might have come across this and dismissed it.

The code I was looking at was reading a stereo file peaking near 0dbfs, but the output from diskin was
double that (and so causing samples out of range). After several checks, I figured the problem was
with diskin. Then I noticed the code was using the same variable for left and right

asig, asig diskin …

so I went to look at the sources and saw that diskin does some summing to these variables as
part of its process. Normally, you would think that it would just overwrite them, but it is
actually using them for some internal buffering. The result is that if the same variable is used,
we get the strange effect of the two file channels being mixed up (and possibly other effects depending
on diskin/diskin2 parameters).

So I am in two minds about this:

1 - it is user error: we should throw an init error.

2 - it is not user error and diskin is not behaving properly.

I don’t actually like the fact the opcode uses the output variable for buffering, but we probably have
similar cases elsewhere. The simplest thing is to treat it as 1 and document it in the manual.
Interestingly it is a similar issue I have encountered with pass-by-reference UDOs 
(see https://github.com/csound/csound/issues/2061)

What do you think?
========================
Prof. Victor Lazzarini
Maynooth University
Ireland
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.