File: CadenciiLauncher.cpp

package info (click to toggle)
cadencii 3.3.9%2Bsvn20110818.r1732-5
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 35,880 kB
  • sloc: cs: 160,836; java: 42,449; cpp: 7,605; ansic: 1,728; perl: 1,087; makefile: 236; php: 142; xml: 117; sh: 21
file content (136 lines) | stat: -rw-r--r-- 3,940 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * CadenciiLauncher.cpp
 * Copyright (C) 2010 kbinani
 *
 * This file is part of org.kbinani.cadencii.
 *
 * org.kbinani.cadencii is free software; you can redistribute it and/or
 * modify it under the terms of the GPLv3 License.
 *
 * org.kbinani.cadencii is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <tchar.h>
#include <vst2.x/audioeffectx.h>
using namespace System;
using namespace System::Threading;
using namespace System::Windows::Forms;
using namespace org::kbinani;
using namespace org::kbinani::cadencii;

void Start( Object^ arg ){
    array<String^>^ args = (array<String^>^)arg;
    Program::Main( args );
}

void RunCadencii( Object^ args, bool wait_for_exit ){
    Thread^ t = gcnew Thread( gcnew ParameterizedThreadStart( Start ) );
    t->SetApartmentState( ApartmentState::STA );
    t->Start( args );
    if( wait_for_exit ){
        while( t->IsAlive ){
            Thread::Sleep( 1000 );
        }
    }
}

int APIENTRY _tWinMain( HINSTANCE hInstance,
                        HINSTANCE hPrevInstance,
                        LPTSTR    lpCmdLine,
                        int       nCmdShow ){
    // command line
    RunCadencii( System::Environment::GetCommandLineArgs(), true );
    return 0;
}

class ClassSlave : public AudioEffectX{
public:
    ClassSlave( audioMasterCallback audioMaster );
    ~ClassSlave();
	// Processing
	virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
	virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);

	// Program
	virtual void setProgramName (char* name);
	virtual void getProgramName (char* name);

	// Parameters
	virtual void setParameter (VstInt32 index, float value);
	virtual float getParameter (VstInt32 index);
	virtual void getParameterLabel (VstInt32 index, char* label);
	virtual void getParameterDisplay (VstInt32 index, char* text);
	virtual void getParameterName (VstInt32 index, char* text);

	virtual bool getEffectName (char* name);
	virtual bool getVendorString (char* text);
	virtual bool getProductString (char* text);
	virtual VstInt32 getVendorVersion ();
};

ClassSlave::ClassSlave( audioMasterCallback audioMaster )
: AudioEffectX( audioMaster, 1, 0 ) // 1 program, 0 parameter.
{
    setNumInputs( 0 );
    setNumOutputs( 2 );
    setUniqueID( 'Cdnc' );
    canProcessReplacing();
}

void ClassSlave::processReplacing( float **in, float **out, VstInt32 samples ){
}

void ClassSlave::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames){
}

void ClassSlave::setProgramName( char *name ){
}

void ClassSlave::getProgramName( char *name ){
}

void ClassSlave::setParameter( VstInt32 index, float value ){
}

float ClassSlave::getParameter(VstInt32 index){
    return 0.0f;
}

void ClassSlave::getParameterLabel(VstInt32 index, char *label){
}

void ClassSlave::getParameterDisplay( VstInt32 index, char* text ){
}

void ClassSlave::getParameterName(VstInt32 index, char *text){
}

bool ClassSlave::getEffectName(char *name){
    vst_strncpy( name, "Cadencii VSTi", kVstMaxEffectNameLen );
    return true;
}

bool ClassSlave::getVendorString( char* text ){
    vst_strncpy( text, "kbinani", kVstMaxVendorStrLen );
    return true;
}

bool ClassSlave::getProductString(char *text){
    vst_strncpy( text, "Cadencii VSTi", kVstMaxProductStrLen );
    return true;
}

VstInt32 ClassSlave::getVendorVersion(){
    return 3100;
}

ClassSlave::~ClassSlave(){
}

AudioEffect* createEffectInstance( audioMasterCallback audioMaster ){
    RunCadencii( gcnew array<String ^>( 0 ), false );
    return new ClassSlave( audioMaster );
}