我想做一些实时的声音处理,我听说过supercollider
它看起来很棒,但我想坚持使用python,因为"普通"编程是个问题.
有没有办法将python脚本作为模块加载到supercollider或oposite?
意味着将库导入我的python代码并使用supercollider功能?
我没有在网上找到太多关于它的信息,所以任何帮助都会很棒.
我有以下内容:
int findPar(char* str)
{
int counter=0;
while (*str)
{
if(str[0] == "(") <---- Warning
{
counter++;
}
else if (str[0]== ")") <---- Warning
{
counter--;
}
if (counter<0)
{
return 0;
}
str++;
}
if (counter!=0)
{
return 0;
}
return 1;
}
Run Code Online (Sandbox Code Playgroud)
我得到的警告是int和char之间的比较.
我试着用strcmp做这样的比较(字符串中的第一个char和给定的char):
if (strcmp(str, ")")==0) { stuff }
Run Code Online (Sandbox Code Playgroud)
但即使比较(应该)正确,它也永远不会进入"东西".
我该怎么办?
我有一个需要在聚光灯/定向灯下的模型,
意思是,我需要在模式之间切换(聚光灯和方向).
这是代码和一些解释:
我可以用鼠标移动旋转模型/光源,所以我正在使用
glRotate和glTranslate为此.
一旦用户按下"L"键,我就应该在模式之间切换.
这是闪电的代码:
void LightBall::projectLight(void)
{
if(LIGHT == _lightMode){
printf("Entering LIGHT mode\n"); <--- Supposed to be a directional light
glDisable(GL_LIGHT1);
glEnable(GL_LIGHT0);
glLightfv(GL_LIGHT0, GL_POSITION, _light_position);
}
if(SPOT_LIGHT == _lightMode){
printf("Entering SPOTLIGHT mode\n"); <--- Supposed to be a spotlight
glDisable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glLightfv(GL_LIGHT1, GL_POSITION, _light_position);
glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 10.0);
glLightf(GL_LIGHT1, GL_SPOT_EXPONENT, 2.0);
glLightfv(GL_LIGHT1,GL_SPOT_DIRECTION,_spotlight_position);
}
}
Run Code Online (Sandbox Code Playgroud)
问题是我在它们之间切换时总是得到相同的光模式,
以下是:
在两种光模式之间切换并仍然获得相同光线之后的另一个例子
光源旋转源(小球):

我怎样才能得到想要的结果?
以下是LIGHT0和LIGHT1的定义:
GLfloat light_ambient[] = { 1.0, 0.0, 0.0, 1.0 };
GLfloat light_diffuse[] = { 1.0, 0.0, 0.0, 1.0 };
GLfloat …Run Code Online (Sandbox Code Playgroud) 我试图在第一次登录时获取远程配置值(不仅是在minimumFetchIntervalMillis过期后),这就是我所做的(伪):
yield firebaseConfig.setConfigSettings(15 mins)
yield firebaseConfig.setDefaults()
yield firebaseConfig.fetchAndActivate().then(print values)
Run Code Online (Sandbox Code Playgroud)
但我没有获得用户的正确配置,只有服务器默认配置。
有有效的方法吗?
我正在考虑minimumFetchIntervalMillis在第一次登录时设置为零,并在获取配置后将其设置为 15 分钟,但我不确定这是最好的方法。
有任何想法吗?
firebase react-native google-cloud-functions firebase-remote-config google-cloud-firestore
我无法弄清楚为什么我不能让我的服务器运行emit函数.
这是我的代码:
myServer.prototype = new events.EventEmitter;
function myServer(map, port, server) {
...
this.start = function () {
console.log("here");
this.server.listen(port, function () {
console.log(counterLock);
console.log("here-2");
this.emit('start');
this.isStarted = true;
});
}
listener HERE...
}
Run Code Online (Sandbox Code Playgroud)
听众是:
this.on('start',function(){
console.log("wtf");
});
Run Code Online (Sandbox Code Playgroud)
所有控制台类型都是这样的:
here
here-2
Run Code Online (Sandbox Code Playgroud)
知道它为什么不打印'wtf'?
返回static成员变量的成员函数也应该是static吗?
例如:
struct T {
static int i;
static int getNumber() {
return i;
}
};
Run Code Online (Sandbox Code Playgroud)
应该getNumber是static还是不是?
我有这个函数,它应该为给定的char*设置一定的时间格式:
static void timeStamp(char* time)
{
time(&strTime);<---ERROR
curTime = std::localtime(&strTime);
strftime(time, 8, "%H:%M::", curTime);
}
Run Code Online (Sandbox Code Playgroud)
strTime和curTime声明如下:
tm* curTime;
time_t strTime;
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,我得到:
called object type 'char*' is not a function or function pointer
Run Code Online (Sandbox Code Playgroud)
在标记的地方.
任何想法为什么?
我顺便使用xCode.
我目前在python上使用pyglet作为我的声音库,
图书馆很棒,但它不包含我真正需要的重要功能:
播放某首歌时的频率控制(比方说.mp3),
意思是,我想在播放时降低低音频率或提高频率
某首歌.
它应该有一个可以播放歌曲中某个位置的歌曲的播放器,
一起玩几个.mp3,可以在需要时暂停/停止(pyglet有这些选项)
是否有一个拥有这些功能的python声音库?
我使用mac os 10.8
使用iOS 8.3
我在横向模式下有一个视图,我正在尝试打开一个仅限肖像的视图控制器.每次我尝试打开它,应用程序崩溃.
我已经阅读了这个官方的苹果答案,基本上建议做以下事情:
在app委托中:
@implementation AppDelegate
-(NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
return UIInterfaceOrientationMaskAll;
else /* iphone */
return UIInterfaceOrientationMaskAllButUpsideDown;
}
Run Code Online (Sandbox Code Playgroud)
在我的控制器中:
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
Run Code Online (Sandbox Code Playgroud)
所以我有,但我仍然得到这个崩溃消息:
Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [PUUIAlbumListViewController shouldAutorotate] is returning YES
Run Code Online (Sandbox Code Playgroud)
在项目常规设置中,我有以下(不应根据苹果的答案进行更改):
我可以看到这些函数实际上被调用但没有任何帮助.有什么想法吗?
我之前读过的一些问题:
如何在iOS 6中强制UIViewController为Portrait方向
我有一个特定的 xib 文件,我想对其设置约束。添加纵向约束没问题,但是当我尝试旋转 xib 文件、重新排序视图并设置新的横向约束时,Xcode 不会旋转 xib,并且不可能在纵向模式下创建横向约束。
有什么帮助吗?
添加一些屏幕截图:
2)我想得到什么(大致):