当前位置: 首页>>代码示例>>C++>>正文


C++ UIWindow::FaustUserInterface方法代码示例

本文整理汇总了C++中UIWindow::FaustUserInterface方法的典型用法代码示例。如果您正苦于以下问题:C++ UIWindow::FaustUserInterface方法的具体用法?C++ UIWindow::FaustUserInterface怎么用?C++ UIWindow::FaustUserInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIWindow的用法示例。


在下文中一共展示了UIWindow::FaustUserInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UIWindow

void
App::ReadyToRun()
{
	// faust ui
	UIWindow* uiWindow = new UIWindow(BRect(512, 512, 512 + 320, 512 + 240),
		"UIWindow");
	uiWindow->Show();

	// audio

	//fFaustDSP = new KarplusDSP();
	//fFaustDSP = new FreeverbDSP();
	fFaustDSP = new PitchShifterDSP();
	//fFaustDSP = new DbMeterDSP();
	//fFaustDSP = new MixerDSP();

	fFaustDSP->buildUserInterface(uiWindow->FaustUserInterface());

	// registering our media node
	status_t err;
	fMediaRoster = BMediaRoster::Roster(&err);
	if (fMediaRoster == NULL || err != B_OK) {
		/* the Media Server appears to be dead -- handle that here */
		printf("Oh! The Media Server appears to be dead :(\n");
	} else {
		fMainMediaNode = new GenericAudioFilterNode(fFaustDSP);
		err = fMediaRoster->RegisterNode(fMainMediaNode);
		if (err != B_OK) {
			printf("Error registering the audio node\n");
			return;
		} else
			printf("Registered the audio node successfully\n");
	}

	// connecting main output to the mixer
	media_node	mixerNode;
	err = fMediaRoster->GetAudioMixer(&mixerNode);
	if (err == B_OK) {
		_ConnectAudioNodes(fMainMediaNode->Node(), mixerNode);
	} else {
		printf("Error! Couldn't GetAudioMixer\n");
	}


	// connecting to mediaplayer
	int32 nodeInfoCount = 512;
	live_node_info* nodeInfos = new live_node_info[nodeInfoCount];
	err = fMediaRoster->GetLiveNodes(nodeInfos, &nodeInfoCount);//,
                      //const media_format* hasInput = NULL,
                     // const media_format* hasOutput = NULL,
                     // const char* name = NULL,
                     //uint64 nodeKinds = 0);

    media_node mediaPlayerNode;
    if (err == B_OK) {
    	for (int i = 0; i < nodeInfoCount; i++) {
    		printf("found node '%s' id=%ld\n", nodeInfos[i].name, nodeInfos[i].node.node);
    		if (strcmp(nodeInfos[i].name, "MediaPlayer audio out") == 0) {
    			printf("found 'MediaPlayer Audio Out' try connecting\n");
    			mediaPlayerNode = nodeInfos[i].node;
    			err = _ConnectAudioNodes(mediaPlayerNode, fMainMediaNode->Node());
    			if (err == B_OK)
    				break;
    			// todo stop the loop if succeed
    		}
    	}
    } else {
    	printf("Error! Couldn't get live nodes\n");
    }

}
开发者ID:aldeck,项目名称:faustine,代码行数:71,代码来源:App.cpp


注:本文中的UIWindow::FaustUserInterface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。