如何在 JCollider 中构造具有超过 5 个参数的 UGen
JCollider 是 SuperCollider 声音合成服务器的 Java 客户端。
在构造 UGen 时,它有一个愚蠢的任意限制,即 5 个参数。 (请参阅此处的 UGen 文档)我指的是 ar 方法。他们为可变数量的参数制作了该方法的多个副本,但他们停在 5 个,而我需要 7 个。这些便利函数在定义时看起来像这样。
public static GraphElem kr( String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5 )
{
return UGen.construct( name, kControlRate, -1, new GraphElem[] { in1, in2, in3, in4, in5 });
}
我自己尝试使用 UGen.construct 方法,但从我尝试使用它的地方(在不同的包中)显然“不可见”。
然后,我尝试通过将便利方法扩展到同样愚蠢的任意限制 7 来修复 JCollider 源代码中的问题,但可惜的是,由于 ant 脚本问题,我无法编译它。
使用超过 5 个参数的 UGen.ar() 的正确方法是什么?
JCollider is a Java client for the SuperCollider sound synthesis server.
It has a stupid arbitrary limit of 5 arguments when constructing UGens. (see Documentation for UGen here) I'm referring to the ar method. They made made multiple copies of that method for variable numbers of arguments, but they stopped at 5 and I need 7. Those convenience functions look like this where they are defined.
public static GraphElem kr( String name, GraphElem in1, GraphElem in2, GraphElem in3, GraphElem in4, GraphElem in5 )
{
return UGen.construct( name, kControlRate, -1, new GraphElem[] { in1, in2, in3, in4, in5 });
}
I tried just using the UGen.construct method myself, but it's apparently "not visible" from where I'm trying to use it (in a different package).
I then tried fixing this in the JCollider source by just extending the convenience methods to the equally stupid arbitrary limit of 7, but alas I couldn't compile it due to an ant script problem.
What is the correct way to use UGen.ar() with more than 5 arguments?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当时我写的是 Java 1.4。所以我认为 5 是一个很好的数字:)(事实上它涵盖了一些合理的百分比,例如 98% 左右的 ugens)。您仍然可以使用粘贴内容的内部部分来解决它,而无需触及源代码,例如调用 UGen.construct( name, kControlRate, -1, new GraphElem[] { in1, in2, in3, in4, in5 , in6, in7, ... }); 显然现在您会选择 Java 5 风格的可变参数。
如果您愿意使用其他语言,请尝试 ScalaCollider,这是一种更流畅的体验。
At the time I wrote that it was Java 1.4. So I decided that 5 was a good number :) (in fact it covers some reasonable percentage like 98% or so of the ugens). You can still use the inner part of what you pasted to work around it without touching the source, e.g. call
UGen.construct( name, kControlRate, -1, new GraphElem[] { in1, in2, in3, in4, in5, in6, in7, ... });
Obviously nowadays you'd go for Java 5 style varargs.If you are willing to use another language, give ScalaCollider a try, it's a much smoother experience.
我设法解决了 ant 构建问题并重新编译 JCollider,并将限制增加到 7。
I managed to get around the ant build problem and recompile JCollider with the increased limit of 7.