예제 #1
0
파일: Vega.cpp 프로젝트: eriser/VegaVST
Vega::Vega(IPlugInstanceInfo instanceInfo)
  :	IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo),
  lastVirtualKeyboardNoteNumber(virtualKeyboardMinimumNoteNumber - 1)
{
  TRACE;

  CreateParams();
  CreateGraphics();
  CreatePresets();

  mMIDIReceiver.noteOn.Connect(&mVoiceEngine, &VoiceEngine::onNoteOn);
  mMIDIReceiver.noteOff.Connect(&mVoiceEngine, &VoiceEngine::onNoteOff);
}
예제 #2
0
Synthesis::Synthesis(IPlugInstanceInfo instanceInfo)
  :	IPLUG_CTOR(kNumParams, kNumPrograms, instanceInfo),
  lastVirtualKeyboardNoteNumber(virtualKeyboardMinimumNoteNumber - 1)
{
  TRACE;
  
  CreateParams();
  CreateGraphics();
  CreatePresets();
  
  VoiceManager& voiceManager = VoiceManager::getInstance();
  voiceManager.initOpenCL();
  
  //openCLStarted = false;
  
  // connet the noteOn's and noteOff's from mMIDIReceiver to VoiceManager using signals and slots
  mMIDIReceiver.noteOn.Connect(&voiceManager, &VoiceManager::onNoteOn);
  mMIDIReceiver.noteOff.Connect(&voiceManager, &VoiceManager::onNoteOff);
  mMIDIReceiver.sustainChange.Connect(&voiceManager, &VoiceManager::onSustainChange);
  mMIDIReceiver.expressionChange.Connect(&voiceManager, &VoiceManager::onExpressionChange);
  mMIDIReceiver.modChange.Connect(&voiceManager, &VoiceManager::onModChange);
  //mMIDIReceiver.noteOn.Connect(mOscilloscope, &Oscilloscope::updatePixelColors);
}
예제 #3
0
/*
 * Output the parameters for a node creation function.
 */
static int CreateParams(TreeCCContext *context, TreeCCStream *stream,
						TreeCCNode *node, int needComma)
{
	TreeCCField *field;
	if(node->parent)
	{
		needComma = CreateParams(context, stream, node->parent, needComma);
	}
	field = node->fields;
	while(field != 0)
	{
		if((field->flags & TREECC_FIELD_NOCREATE) == 0)
		{
			if(needComma)
			{
				TreeCCStreamPrint(stream, ", ");
			}
			TreeCCStreamPrint(stream, " $%s", /*field->type,*/ field->name);
			needComma = 1;
		}
		field = field->next;
	}
	return needComma;
}
예제 #4
0
/*
 * Build the type declarations for a node type.
 */
static void BuildTypeDecls(TreeCCContext *context,
						   TreeCCNode *node)
{
	TreeCCStream *stream;
	int needComma;
	const char *constructorAccess;
	TreeCCField *field;
	int isAbstract;

	/* Ignore if this is an enumerated type node */
	if((node->flags & (TREECC_NODE_ENUM | TREECC_NODE_ENUM_VALUE)) != 0)
	{
		return;
	}
	/* Determine if this class has abstract virtuals */
	isAbstract = TreeCCNodeHasAbstracts(context, node);

	/* Output the class header */
	stream = node->source;
	
	if(node->parent)
	{
		/*
		TreeCCStreamPrint(stream, "    public new const int KIND = %d;\n\n",
						  node->number);
		*/
		TreeCCStreamPrint(stream, "define('%s_KIND',%d);\n",
						  node->name,node->number);
	}
	else
	{
		/*
		TreeCCStreamPrint(stream, "    public const int KIND = %d;\n\n",
						  node->number);
		*/
		TreeCCStreamPrint(stream, "define('%s_KIND', %d);\n",
						  node->name,node->number);
	}
	
	if(node->parent)
	{
		/* Inherit from a specified parent type */
		if(isAbstract)
		{
			TreeCCStreamPrint(stream, "class %s extends %s\n{\n",
							  node->name, node->parent->name);
		}
		else
		{
			TreeCCStreamPrint(stream, "class %s extends %s\n{\n",
							  node->name, node->parent->name);
		}
	}
	else
	{
		/* This type is the base of a class hierarchy */
		if(isAbstract)
		{
			TreeCCStreamPrint(stream, "class %s\n{\n",
							  node->name);
		}
		else
		{
			TreeCCStreamPrint(stream, "class %s\n{\n", node->name);
		}

		/* Declare the node kind member variable */
		TreeCCStreamPrint(stream, "    var $kind__;\n");

		/* Declare the filename and linenum fields if we are tracking lines */
		if(context->track_lines)
		{
			TreeCCStreamPrint(stream, "    var $filename__;\n");
			TreeCCStreamPrint(stream, "    var $linenum__;\n");
		}
		TreeCCStreamPrint(stream, "\n");

		/* Declare the public methods for access to the above fields */
		TreeCCStreamPrint(stream,
				"    function getKind() { return $this->kind__; }\n");
		if(context->track_lines)
		{
			TreeCCStreamPrint(stream,
				"    function getFilename() { return $this->filename__; }\n");
			TreeCCStreamPrint(stream,
				"    function getLinenum() { return $this->linenum__; }\n");
			TreeCCStreamPrint(stream,
			 	"    function setFilename($filename) "
					"{ $this->filename__ = $filename; }\n");
			TreeCCStreamPrint(stream,
				"    function setLinenum($linenum) "
					"{ $this->linenum__ = $linenum; }\n");
		}
		TreeCCStreamPrint(stream, "\n");
	}

	/* Declare the kind value */
	

	/* Declare the fields */
	if(node->fields)
	{
		DeclareFields(context, stream, node);
		TreeCCStreamPrint(stream, "\n");
	}

	/* Declare the constructor for the node type */
	if(context->reentrant)
	{
		/* Re-entrant systems use a factory to create the nodes.
		   C# doesn't have a notion of "access by members of
		   the namespace only".  The closest is "internal", but
		   even that isn't quite right, so we always use "public" */
		/*constructorAccess = "public "; */
		constructorAccess = ""; 
	}
	else
	{
		/* Non-reentrant systems can construct nodes directly,
		   unless the node happens to be abstract, in which
		   case we force the constructor to be protected */
		if((node->flags & TREECC_NODE_ABSTRACT) != 0)
		{
			/* constructorAccess = "protected "; */
			constructorAccess = "";
		}
		else
		{
			/* constructorAccess = "public "; */
			constructorAccess = "";
		}
	}
	TreeCCStreamPrint(stream, "    function %s%s(", constructorAccess, node->name);
	if(context->reentrant)
	{
		/* TreeCCStreamPrint(stream, "%s state__", context->state_type); */
		TreeCCStreamPrint(stream, "&$state__"); 
		needComma = 1;
	}
	else
	{
		needComma = 0;
	}
	CreateParams(context, stream, node, needComma);
	TreeCCStreamPrint(stream, ")\n");
	 TreeCCStreamPrint(stream, "    {\n"); 
	/* Call the parent class constructor */
	if(node->parent)
	{
		TreeCCStreamPrint(stream, "        parent::%s (",node->parent->name);
		if(context->reentrant)
		{
			TreeCCStreamPrint(stream, "&$state__");
			needComma = 1;
		}
		else
		{
			needComma = 0;
		}
		InheritParamsSource(context, stream, node->parent, needComma);
		TreeCCStreamPrint(stream, ");\n");
	}

	/* Set the node kind */

	TreeCCStreamPrint(stream, "        $this->kind__ = %s_KIND;\n",node->name);

	/* Track the filename and line number if necessary */
	if(context->track_lines && !(node->parent))
	{
		if(context->reentrant)
		{
			TreeCCStreamPrint(stream,
					"        $this->filename__ = $state__->currFilename();\n");
			TreeCCStreamPrint(stream,
					"        $this->linenum__ = $state__->currLinenum();\n");
		}
		else
		{
			TreeCCStreamPrint(stream,
					"        $_tmp = &%s::getState(); $this->filename__ = $_tmp->currFilename();\n",
					context->state_type);
			TreeCCStreamPrint(stream,
					"        $_tmp = &%s::getState(); $this->linenum__ = $_tmp->currLinenum();\n",
					context->state_type);
		}
	}

	/* Initialize the fields that are specific to this node type */
	field = node->fields;
	while(field != 0)
	{
		if((field->flags & TREECC_FIELD_NOCREATE) == 0)
		{
			TreeCCStreamPrint(stream, "        $this->%s = $%s;\n",
							  field->name, field->name);
		}
		else if(field->value)
		{
			TreeCCStreamPrint(stream, "        $this->%s = $%s;\n",
							  field->name, field->value);
		}
		field = field->next;
	}
	TreeCCStreamPrint(stream, "    }\n\n");

	/* Implement the virtual functions */
	ImplementVirtuals(context, stream, node, node);

	/* Declare the "isA" and "getKindName" helper methods */
	if(node->parent)
	{
		TreeCCStreamPrint(stream, "    function isA($kind)\n");
	}
	else
	{
		TreeCCStreamPrint(stream, "    function isA($kind)\n");
	}
	TreeCCStreamPrint(stream, "    {\n");
	TreeCCStreamPrint(stream, "        if($kind == %s_KIND)\n",node->name);
	TreeCCStreamPrint(stream, "            return 1;\n");
	TreeCCStreamPrint(stream, "        else\n");
	if(node->parent)
	{
		TreeCCStreamPrint(stream, "            return parent::isA($kind);\n");
	}
	else
	{
		TreeCCStreamPrint(stream, "            return 0;\n");
	}
	TreeCCStreamPrint(stream, "    }\n\n");
	if(node->parent)
	{
		TreeCCStreamPrint(stream, "    function getKindName()\n");
	}
	else
	{
		TreeCCStreamPrint(stream, "    function getKindName()\n");
	}
	TreeCCStreamPrint(stream, "    {\n");
	TreeCCStreamPrint(stream, "        return \"%s\";\n", node->name);
	TreeCCStreamPrint(stream, "    }\n");

	/* Output the class footer */
	TreeCCStreamPrint(stream, "}\n\n");
}
예제 #5
0
BOOL CLauncher::ReadFromFile(LPCTSTR fname)
{
	FILE*	fp;
	TCHAR	line_buf[TMP_BUF_SIZE];
	LPTSTR	p;

#ifdef _UNICODE
	if(_tfopen_s(&fp, fname, _T("rt, ccs=UTF-8"))) return FALSE;
#else
	if(_tfopen_s(&fp, fname, _T("rt"))) return FALSE;
#endif
	CreateParams();		
	RemoveAll();
	TCHAR*	context = NULL;
	for(;;)
	{
		if(!_fgetts(line_buf, TMP_BUF_SIZE, fp)) break;
		
		p = _tcspbrk(line_buf, _T(";\r\n"));
		if(p) *p = _T('\0');
		p = TrimLeft(line_buf);

		if(p[0] == _T('@'))
		{
			FlashParams();
			_tcscpy_s(m_params.title, TMP_BUF_SIZE, p+1);
		}
		else if(p[0] == _T('P'))
		{
			p = TrimLeft(p+1);
			_tcscpy_s(m_params.module_path, TMP_BUF_SIZE, p);
		}
		else if(p[0] == _T('A'))
		{
			p = TrimLeft(p+1);
			_tcscpy_s(m_params.arg, TMP_BUF_SIZE, p);
		}
		else if(p[0] == _T('W'))
		{
			p = TrimLeft(p+1);
			_tcscpy_s(m_params.workdirectory, TMP_BUF_SIZE, p);
		}
		else if(p[0] == _T('C'))
		{
			p = TrimLeft(p+1);
			_tcscpy_s(m_params.checkpath, TMP_BUF_SIZE, p);
		}
		else if(p[0] == _T('N'))
		{
			p = TrimLeft(p+1);
			_tcscpy_s(m_params.checktitle, TMP_BUF_SIZE, p);
		}
		else if(p[0] == _T('I'))
		{
			context = NULL;
			p = TrimLeft(p+1);
			LPTSTR	file  = _tcstok_s(p, _T(","), &context);
			_tcscpy_s(m_params.iconpath, TMP_BUF_SIZE, file);
			LPTSTR	index = _tcstok_s(NULL, _T(","), &context);
			if(index !=NULL)
			{
				int num = _tstoi(index);
				m_params.iconindex = num;
			}
		}
	}
	FlashParams();
	DestroyParams();
	fclose(fp);
	return TRUE;
}