test
| Revision | b411a8e9ccd9e00165aba1b9b4802fadb15ec23b (tree) |
|---|---|
| Time | 2011-08-21 19:44:55 |
| Author | tyiki badwell <miria@user...> |
| Commiter | tyiki badwell |
ProcessEventsの修正
| @@ -702,6 +702,10 @@ namespace Host { | ||
| 702 | 702 | |
| 703 | 703 | System::Int32 Master::ProcessEvents(array<Interop::Vst::VstEvent>^ events) |
| 704 | 704 | { |
| 705 | + #ifdef _DEBUG | |
| 706 | + System::Console::WriteLine("[{0}] start",__FUNCTION__); | |
| 707 | + #endif | |
| 708 | + | |
| 705 | 709 | auto e = gcnew Interop::Vst::VstEvents(); |
| 706 | 710 | e->numEvents = events->Length; |
| 707 | 711 |
| @@ -723,9 +727,20 @@ namespace Host { | ||
| 723 | 727 | |
| 724 | 728 | for (int idx = 0; idx < e->numEvents; idx++) |
| 725 | 729 | { |
| 730 | + auto ev = events[idx]; | |
| 731 | + ev.byteSize = | |
| 732 | + InteropServices::Marshal::SizeOf(Interop::Vst::VstEvents::typeid) | |
| 733 | + -(InteropServices::Marshal::SizeOf(System::Int32::typeid) + InteropServices::Marshal::SizeOf(System::Int32::typeid)) //VSTの仕様だとこの分はサイズから除くことになっている | |
| 734 | + ; | |
| 735 | + | |
| 726 | 736 | auto eventPtr = InteropServices::Marshal::AllocHGlobal(InteropServices::Marshal::SizeOf(Interop::Vst::VstEvent::typeid)); |
| 727 | 737 | eventPtrs[idx] = eventPtr; |
| 728 | - InteropServices::Marshal::StructureToPtr(events[idx], eventPtr, false); | |
| 738 | + | |
| 739 | + InteropServices::Marshal::StructureToPtr(ev, eventPtr, false); | |
| 740 | + | |
| 741 | + //#ifdef _DEBUG | |
| 742 | + System::Console::WriteLine("[{0}] {1}",__FUNCTION__, ev.ToString()); | |
| 743 | + //#endif | |
| 729 | 744 | } |
| 730 | 745 | InteropServices::Marshal::Copy(eventPtrs, 0, cursor, e->numEvents); |
| 731 | 746 |
| @@ -753,6 +768,9 @@ namespace Host { | ||
| 753 | 768 | } |
| 754 | 769 | InteropServices::Marshal::FreeHGlobal(ptr); |
| 755 | 770 | } |
| 771 | + #ifdef _DEBUG | |
| 772 | + System::Console::WriteLine("[{0}] end",__FUNCTION__); | |
| 773 | + #endif | |
| 756 | 774 | } |
| 757 | 775 | |
| 758 | 776 | System::Int32 Master::StartProcess() |
| @@ -512,7 +512,7 @@ namespace Vst { | ||
| 512 | 512 | [InteropServices::FieldOffset(12)] VstMidiEventFlags flags; //< @see VstMidiEventFlags |
| 513 | 513 | [InteropServices::FieldOffset(16)] System::Int32 noteLength; //< (in sample frames) of entire note, if available, else 0 |
| 514 | 514 | [InteropServices::FieldOffset(20)] System::Int32 noteOffset; //< offset (in sample frames) into note from note start if available, else 0 |
| 515 | - [InteropServices::FieldOffset(24)] System::Byte midiData; //< 1 to 3 MIDI bytes; midiData[3] is reserved (zero) | |
| 515 | + [InteropServices::FieldOffset(24)] System::Int32 midiData; //< 1 to 3 MIDI bytes; midiData[3] is reserved (zero) | |
| 516 | 516 | [InteropServices::FieldOffset(24)] System::Byte midiData0; //< 1 to 3 MIDI bytes; midiData[3] is reserved (zero) |
| 517 | 517 | [InteropServices::FieldOffset(25)] System::Byte midiData1; |
| 518 | 518 | [InteropServices::FieldOffset(26)] System::Byte midiData2; |
| @@ -528,6 +528,20 @@ namespace Vst { | ||
| 528 | 528 | [InteropServices::FieldOffset(24)] System::IntPtr sysexDump; //< sysex dump |
| 529 | 529 | [InteropServices::FieldOffset(28)] System::IntPtr resvd2; //< zero (Reserved for future use) |
| 530 | 530 | //------------------------------------------------------------------------------------------------------- |
| 531 | + | |
| 532 | + virtual System::String^ ToString() override | |
| 533 | + { | |
| 534 | + if (type == VstEventTypes::kVstMidiType) { | |
| 535 | + return | |
| 536 | + "type["+type.ToString("F")+"] byteSize["+byteSize+"] deltaFrames["+deltaFrames+"] flags["+flags.ToString("F")+"] noteLength["+noteLength+" noteOffset["+noteOffset+"] midiData["+midiData.ToString("X")+":"+midiData0.ToString("X")+":"+midiData1.ToString("X")+":"+midiData2.ToString("X")+":"+midiData3.ToString("X")+"] detune["+detune+"] noteOffVelocity["+noteOffVelocity+"]"; | |
| 537 | + } else if (type == VstEventTypes::kVstSysExType) { | |
| 538 | + return | |
| 539 | + "type["+type.ToString("F")+"] byteSize["+byteSize+"] deltaFrames["+deltaFrames+"] _flags["+_flags+"] dumpBytes["+dumpBytes+" sysexDump["+sysexDump+"]"; | |
| 540 | + } else { | |
| 541 | + return | |
| 542 | + "type["+type.ToString("F")+"] byteSize["+byteSize+"] deltaFrames["+deltaFrames+"] _flags["+_flags+"]"; | |
| 543 | + } | |
| 544 | + } | |
| 531 | 545 | }; |
| 532 | 546 | |
| 533 | 547 |
| @@ -0,0 +1,40 @@ | ||
| 1 | +#include "stdafx.h" | |
| 2 | + | |
| 3 | +using namespace System; | |
| 4 | +using namespace System::Reflection; | |
| 5 | +using namespace System::Runtime::CompilerServices; | |
| 6 | +using namespace System::Runtime::InteropServices; | |
| 7 | +using namespace System::Security::Permissions; | |
| 8 | + | |
| 9 | +// | |
| 10 | +// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 | |
| 11 | +// アセンブリに関連付けられている情報を変更するには、 | |
| 12 | +// これらの属性値を変更してください。 | |
| 13 | +// | |
| 14 | +[assembly:AssemblyTitleAttribute("MomijiTestVstController")]; | |
| 15 | +[assembly:AssemblyDescriptionAttribute("")]; | |
| 16 | +[assembly:AssemblyConfigurationAttribute("")]; | |
| 17 | +[assembly:AssemblyCompanyAttribute("xx laboratory")]; | |
| 18 | +[assembly:AssemblyProductAttribute("MomijiTestVstController")]; | |
| 19 | +[assembly:AssemblyCopyrightAttribute("Copyright (c) xx laboratory 2011")]; | |
| 20 | +[assembly:AssemblyTrademarkAttribute("")]; | |
| 21 | +[assembly:AssemblyCultureAttribute("")]; | |
| 22 | + | |
| 23 | +// | |
| 24 | +// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: | |
| 25 | +// | |
| 26 | +// Major Version | |
| 27 | +// Minor Version | |
| 28 | +// Build Number | |
| 29 | +// Revision | |
| 30 | +// | |
| 31 | +// すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を | |
| 32 | +// 既定値にすることができます: | |
| 33 | + | |
| 34 | +[assembly:AssemblyVersionAttribute("1.0.*")]; | |
| 35 | + | |
| 36 | +[assembly:ComVisible(false)]; | |
| 37 | + | |
| 38 | +[assembly:CLSCompliantAttribute(true)]; | |
| 39 | + | |
| 40 | +[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)]; |
| @@ -0,0 +1,456 @@ | ||
| 1 | +#include "stdafx.h" | |
| 2 | + | |
| 3 | +#using <Momiji.Core.dll> | |
| 4 | +#using <System.Windows.Forms.dll> | |
| 5 | + | |
| 6 | +using namespace System; | |
| 7 | +using namespace System::Runtime; | |
| 8 | + | |
| 9 | +public ref class Controller | |
| 10 | +{ | |
| 11 | +private: | |
| 12 | + Momiji::Core::ITimer^ _timer; | |
| 13 | + Momiji::Core::IStream^ _stream; | |
| 14 | + Momiji::Core::IOut^ _out; | |
| 15 | + | |
| 16 | + Momiji::Core::Vst::Host::Master^ _host; | |
| 17 | + | |
| 18 | + void OnInterval(System::Double deltaTime) | |
| 19 | + { | |
| 20 | + #ifdef _DEBUG | |
| 21 | + System::Console::WriteLine("[{0}][{1}]",__FUNCTION__, deltaTime); | |
| 22 | + #endif | |
| 23 | + auto stream = this->_stream; | |
| 24 | + auto out = this->_out; | |
| 25 | + auto host = this->_host; | |
| 26 | + if (stream == nullptr) | |
| 27 | + { | |
| 28 | + #ifdef _DEBUG | |
| 29 | + System::Console::WriteLine("[{0}]シーケンサが無いので何もしません",__FUNCTION__); | |
| 30 | + #endif | |
| 31 | + return; | |
| 32 | + } | |
| 33 | + if (out == nullptr) | |
| 34 | + { | |
| 35 | + #ifdef _DEBUG | |
| 36 | + System::Console::WriteLine("[{0}]出力が無いので何もしません",__FUNCTION__); | |
| 37 | + #endif | |
| 38 | + return; | |
| 39 | + } | |
| 40 | + if (host == nullptr) | |
| 41 | + { | |
| 42 | + #ifdef _DEBUG | |
| 43 | + System::Console::WriteLine("[{0}]VSTが無いので何もしません",__FUNCTION__); | |
| 44 | + #endif | |
| 45 | + return; | |
| 46 | + } | |
| 47 | + | |
| 48 | + auto sample = 2205;//44100 * deltaTime; | |
| 49 | + | |
| 50 | + auto events = gcnew Collections::Generic::List<Momiji::Interop::Vst::VstEvent>; | |
| 51 | + auto packets = stream->GetStreamPacket(deltaTime); | |
| 52 | + auto startTick = 0; | |
| 53 | + for each(auto packet in packets) | |
| 54 | + { | |
| 55 | + auto midi = dynamic_cast<Momiji::Core::Midi::ShortData^>(packet->data); | |
| 56 | + if (midi == nullptr) | |
| 57 | + { | |
| 58 | + continue; | |
| 59 | + } | |
| 60 | + | |
| 61 | + if (startTick == 0) {startTick = midi->tick;} | |
| 62 | + auto delta = (midi->tick - startTick); | |
| 63 | + | |
| 64 | + auto e = Momiji::Interop::Vst::VstEvent(); | |
| 65 | + e.type = Momiji::Interop::Vst::VstEvent::VstEventTypes::kVstMidiType; | |
| 66 | + e.flags = Momiji::Interop::Vst::VstEvent::VstMidiEventFlags::kVstMidiEventIsRealtime; | |
| 67 | + e.deltaFrames = (sample < delta) ? sample : delta; | |
| 68 | + e.midiData = midi->shortData; | |
| 69 | + events->Add(e); | |
| 70 | + } | |
| 71 | + host->ProcessEvents(events->ToArray()); | |
| 72 | + | |
| 73 | + auto inBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,sample); | |
| 74 | + auto outBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,sample); | |
| 75 | + host->Process(inBuffer, outBuffer, outBuffer->Length()); | |
| 76 | + | |
| 77 | + auto data = gcnew array<System::Single>(sample * 2); | |
| 78 | + auto pos = 0; | |
| 79 | + for (int idx = 0; idx < sample; idx++) | |
| 80 | + { | |
| 81 | + data[pos++] = outBuffer->GetBuffer()[0][idx]; | |
| 82 | + data[pos++] = outBuffer->GetBuffer()[1][idx]; | |
| 83 | + } | |
| 84 | + | |
| 85 | + auto buffer = gcnew Momiji::Core::Wave::WaveData<System::Single>(0, data); | |
| 86 | + out->Send(buffer); | |
| 87 | + } | |
| 88 | + | |
| 89 | +public: | |
| 90 | + Controller() | |
| 91 | + { | |
| 92 | + #ifdef _DEBUG | |
| 93 | + System::Console::WriteLine("[{0}]",__FUNCTION__); | |
| 94 | + #endif | |
| 95 | + } | |
| 96 | + | |
| 97 | + ~Controller() | |
| 98 | + { | |
| 99 | + #ifdef _DEBUG | |
| 100 | + System::Console::WriteLine("[{0}]",__FUNCTION__); | |
| 101 | + #endif | |
| 102 | + this->!Controller(); | |
| 103 | + } | |
| 104 | + | |
| 105 | + void Start() | |
| 106 | + { | |
| 107 | + #ifdef _DEBUG | |
| 108 | + System::Console::WriteLine("[{0}]",__FUNCTION__); | |
| 109 | + #endif | |
| 110 | + if (this->_timer != nullptr) | |
| 111 | + { | |
| 112 | + this->_timer->Start(500); | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 116 | + void Stop() | |
| 117 | + { | |
| 118 | + #ifdef _DEBUG | |
| 119 | + System::Console::WriteLine("[{0}]",__FUNCTION__); | |
| 120 | + #endif | |
| 121 | + if (this->_timer != nullptr) | |
| 122 | + { | |
| 123 | + this->_timer->Stop(); | |
| 124 | + } | |
| 125 | + } | |
| 126 | + | |
| 127 | +protected: | |
| 128 | + !Controller() | |
| 129 | + { | |
| 130 | + #ifdef _DEBUG | |
| 131 | + System::Console::WriteLine("[{0}]",__FUNCTION__); | |
| 132 | + #endif | |
| 133 | + this->Stop(); | |
| 134 | + } | |
| 135 | + | |
| 136 | +public: | |
| 137 | + void Assign(Momiji::Core::ITimer^ timer) | |
| 138 | + { | |
| 139 | + auto e = gcnew Momiji::Core::ITimer::Event(this, &Controller::OnInterval); | |
| 140 | + if (this->_timer != nullptr) | |
| 141 | + { | |
| 142 | + this->_timer->OnInterval -= e; | |
| 143 | + } | |
| 144 | + | |
| 145 | + this->_timer = timer; | |
| 146 | + this->_timer->OnInterval += e; | |
| 147 | + } | |
| 148 | + | |
| 149 | + void Assign(Momiji::Core::IStream^ stream) | |
| 150 | + { | |
| 151 | + this->_stream = stream; | |
| 152 | + } | |
| 153 | + | |
| 154 | + void Assign(Momiji::Core::IOut^ out) | |
| 155 | + { | |
| 156 | + this->_out = out; | |
| 157 | + } | |
| 158 | + | |
| 159 | + void Assign(Momiji::Core::Vst::Host::Master^ host) | |
| 160 | + { | |
| 161 | + this->_host = host; | |
| 162 | + } | |
| 163 | + | |
| 164 | +}; | |
| 165 | + | |
| 166 | + | |
| 167 | +void test0() | |
| 168 | +{ | |
| 169 | + auto vstFileName = System::String::Empty; | |
| 170 | + { | |
| 171 | + auto dialog = gcnew System::Windows::Forms::OpenFileDialog(); | |
| 172 | + try | |
| 173 | + { | |
| 174 | + dialog->InitialDirectory = System::IO::Directory::GetCurrentDirectory(); | |
| 175 | + dialog->Filter = "vst|*.dll"; | |
| 176 | + if (dialog->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) | |
| 177 | + { | |
| 178 | + Console::WriteLine("============ 取り消し"); | |
| 179 | + return; | |
| 180 | + } | |
| 181 | + | |
| 182 | + vstFileName = dialog->FileName; | |
| 183 | + } | |
| 184 | + finally | |
| 185 | + { | |
| 186 | + delete dialog; | |
| 187 | + } | |
| 188 | + } | |
| 189 | + | |
| 190 | + auto smfFileName = System::String::Empty; | |
| 191 | + { | |
| 192 | + auto dialog = gcnew System::Windows::Forms::OpenFileDialog(); | |
| 193 | + try | |
| 194 | + { | |
| 195 | + dialog->InitialDirectory = System::IO::Directory::GetCurrentDirectory(); | |
| 196 | + dialog->Filter = "smf|*.mid"; | |
| 197 | + if (dialog->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) | |
| 198 | + { | |
| 199 | + Console::WriteLine("============ 取り消し"); | |
| 200 | + return; | |
| 201 | + } | |
| 202 | + | |
| 203 | + smfFileName = dialog->FileName; | |
| 204 | + } | |
| 205 | + finally | |
| 206 | + { | |
| 207 | + delete dialog; | |
| 208 | + } | |
| 209 | + } | |
| 210 | + | |
| 211 | + Momiji::Core::ITimer^ t; | |
| 212 | + Momiji::Core::IStream^ s; | |
| 213 | + Momiji::Core::Wave::Out::Devices<System::Single>^ o; | |
| 214 | + Momiji::Core::Vst::Host::Master^ h; | |
| 215 | + Controller^ c; | |
| 216 | + try | |
| 217 | + { | |
| 218 | + t = gcnew Momiji::Core::Timer::MMTimer(); | |
| 219 | + s = gcnew Momiji::Sequencer::Midi::Smf::SmfStream(smfFileName); | |
| 220 | + o = gcnew Momiji::Core::Wave::Out::Devices<System::Single>(); | |
| 221 | + o->AddPort( | |
| 222 | + 0, | |
| 223 | + 2, | |
| 224 | + 44110, | |
| 225 | + System::Runtime::InteropServices::Marshal::SizeOf(System::Single::typeid) * 8, | |
| 226 | + ( | |
| 227 | + Momiji::Interop::Winmm::WaveFormatExtensiblePart::SPEAKER::FRONT_LEFT | |
| 228 | + | Momiji::Interop::Winmm::WaveFormatExtensiblePart::SPEAKER::FRONT_RIGHT | |
| 229 | + ), | |
| 230 | + Momiji::Interop::Ks::StaticKs::SUBTYPE_IEEE_FLOAT, | |
| 231 | + 44110 | |
| 232 | + ); | |
| 233 | + | |
| 234 | + h = gcnew Momiji::Core::Vst::Host::Master(vstFileName); | |
| 235 | + h->SetSampleRate(44100); | |
| 236 | + h->SetBlockSize(512); | |
| 237 | + h->StartProcess(); | |
| 238 | + | |
| 239 | + c = gcnew Controller(); | |
| 240 | + c->Assign(t); | |
| 241 | + c->Assign(s); | |
| 242 | + c->Assign(o); | |
| 243 | + c->Assign(h); | |
| 244 | + | |
| 245 | + c->Start(); | |
| 246 | + Console::WriteLine("============ enter でstop"); | |
| 247 | + System::Console::ReadLine(); | |
| 248 | + c->Stop(); | |
| 249 | + | |
| 250 | + Console::WriteLine("============ enter でstart"); | |
| 251 | + System::Console::ReadLine(); | |
| 252 | + c->Start(); | |
| 253 | + | |
| 254 | + Console::WriteLine("============ enter でstop - rewind - start"); | |
| 255 | + System::Console::ReadLine(); | |
| 256 | + c->Stop(); | |
| 257 | + s->Rewind(); | |
| 258 | + | |
| 259 | + c->Start(); | |
| 260 | + Console::WriteLine("============ enter でstop"); | |
| 261 | + System::Console::ReadLine(); | |
| 262 | + c->Stop(); | |
| 263 | + } | |
| 264 | + catch(Exception^ e) | |
| 265 | + { | |
| 266 | + Console::WriteLine(e->ToString()); | |
| 267 | + } | |
| 268 | + finally | |
| 269 | + { | |
| 270 | + if (c != nullptr) | |
| 271 | + { | |
| 272 | + delete c; | |
| 273 | + } | |
| 274 | + | |
| 275 | + if (h != nullptr) | |
| 276 | + { | |
| 277 | + delete h; | |
| 278 | + } | |
| 279 | + if (s != nullptr) | |
| 280 | + { | |
| 281 | + delete s; | |
| 282 | + } | |
| 283 | + if (t != nullptr) | |
| 284 | + { | |
| 285 | + delete t; | |
| 286 | + } | |
| 287 | + if (o != nullptr) | |
| 288 | + { | |
| 289 | + delete o; | |
| 290 | + } | |
| 291 | + } | |
| 292 | + | |
| 293 | + /* | |
| 294 | + auto host = gcnew Momiji::Core::Vst::Host::Master(fileName); | |
| 295 | + try | |
| 296 | + { | |
| 297 | + host->SetSampleRate(44100); | |
| 298 | + host->SetBlockSize(512); | |
| 299 | + | |
| 300 | + Console::WriteLine("ProgramName[{0}]", host->GetProgramName()); | |
| 301 | + Console::WriteLine("EffectName[{0}]", host->GetEffectName()); | |
| 302 | + Console::WriteLine("VendorString[{0}]", host->GetVendorString()); | |
| 303 | + Console::WriteLine("ProductString[{0}]", host->GetProductString()); | |
| 304 | + | |
| 305 | + //host->GetParameterProperties(0); | |
| 306 | + auto pinProps = host->GetOutputProperties(0); | |
| 307 | + Console::WriteLine( | |
| 308 | + "[{0}][{1:f}][{2:f}][{3}]", | |
| 309 | + pinProps->label, | |
| 310 | + pinProps->flags, | |
| 311 | + pinProps->arrangementType, | |
| 312 | + pinProps->shortLabel | |
| 313 | + ); | |
| 314 | + | |
| 315 | + for(auto idx = 0; idx < host->GetNumParams(); idx++) | |
| 316 | + { | |
| 317 | + //Momiji::Interop::Vst::VstParameterProperties^ props = host->GetParameterProperties(idx); | |
| 318 | + Console::WriteLine( | |
| 319 | + "[{0,4}][{1,30}][{2,30}][{3,30}][{4}]", | |
| 320 | + idx, | |
| 321 | + host->GetParameterName(idx), | |
| 322 | + host->GetParameterDisplay(idx), | |
| 323 | + host->GetParameterLabel(idx), | |
| 324 | + host->GetParameter(idx) | |
| 325 | + ); | |
| 326 | + } | |
| 327 | + | |
| 328 | + auto out = | |
| 329 | + gcnew Momiji::Core::Wave::Out::Device<System::Single>( | |
| 330 | + 0, | |
| 331 | + 1, | |
| 332 | + 44110, | |
| 333 | + System::Runtime::InteropServices::Marshal::SizeOf(System::Single::typeid) * 8, | |
| 334 | + ( | |
| 335 | + Momiji::Interop::Winmm::WaveFormat::SPEAKER::FRONT_LEFT | |
| 336 | + | Momiji::Interop::Winmm::WaveFormat::SPEAKER::FRONT_RIGHT | |
| 337 | + ), | |
| 338 | + Momiji::Interop::Setupapi::StaticKsDataFormatSubType::IEEE_FLOAT | |
| 339 | + ); | |
| 340 | + | |
| 341 | + try | |
| 342 | + { | |
| 343 | + { | |
| 344 | + auto events = gcnew Collections::Generic::List<Momiji::Interop::Vst::VstEvent^>; | |
| 345 | + { | |
| 346 | + auto e = gcnew Momiji::Interop::Vst::VstEvent(); | |
| 347 | + e->type = Momiji::Interop::Vst::VstEvent::VstEventTypes::kVstMidiType; | |
| 348 | + e->flags = Momiji::Interop::Vst::VstEvent::VstMidiEventFlags::kVstMidiEventIsRealtime; | |
| 349 | + e->deltaFrames = 0; | |
| 350 | + e->midiData0 = 0x90; | |
| 351 | + e->midiData1 = 0x51; | |
| 352 | + e->midiData2 = 0x7F; | |
| 353 | + events->Add(e); | |
| 354 | + } | |
| 355 | + { | |
| 356 | + auto e = gcnew Momiji::Interop::Vst::VstEvent(); | |
| 357 | + e->type = Momiji::Interop::Vst::VstEvent::VstEventTypes::kVstMidiType; | |
| 358 | + e->flags = Momiji::Interop::Vst::VstEvent::VstMidiEventFlags::kVstMidiEventIsRealtime; | |
| 359 | + e->deltaFrames = 200; | |
| 360 | + e->midiData0 = 0x91; | |
| 361 | + e->midiData1 = 0x55; | |
| 362 | + e->midiData2 = 0x7F; | |
| 363 | + events->Add(e); | |
| 364 | + } | |
| 365 | + { | |
| 366 | + auto e = gcnew Momiji::Interop::Vst::VstEvent(); | |
| 367 | + e->type = Momiji::Interop::Vst::VstEvent::VstEventTypes::kVstMidiType; | |
| 368 | + e->flags = Momiji::Interop::Vst::VstEvent::VstMidiEventFlags::kVstMidiEventIsRealtime; | |
| 369 | + e->deltaFrames = 200; | |
| 370 | + e->midiData0 = 0x93; | |
| 371 | + e->midiData1 = 0x68; | |
| 372 | + e->midiData2 = 0x7F; | |
| 373 | + events->Add(e); | |
| 374 | + } | |
| 375 | + | |
| 376 | + host->ProcessEvents(events->ToArray()); | |
| 377 | + host->StartProcess(); | |
| 378 | + } | |
| 379 | + | |
| 380 | + | |
| 381 | + host->StartProcess(); | |
| 382 | + | |
| 383 | + Console::WriteLine("====================================================test0"); | |
| 384 | + { | |
| 385 | + auto inBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 386 | + auto outBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 387 | + host->Process(inBuffer, outBuffer, outBuffer->Length()); | |
| 388 | + out->Send(outBuffer->GetBuffer()[0]); | |
| 389 | + } | |
| 390 | +// System::Console::ReadLine(); | |
| 391 | + | |
| 392 | + Console::WriteLine("====================================================test0"); | |
| 393 | + { | |
| 394 | + auto inBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 395 | + auto outBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 396 | + host->Process(inBuffer, outBuffer, outBuffer->Length()); | |
| 397 | + out->Send(outBuffer->GetBuffer()[0]); | |
| 398 | + } | |
| 399 | +// System::Console::ReadLine(); | |
| 400 | + | |
| 401 | + Console::WriteLine("====================================================test0"); | |
| 402 | + { | |
| 403 | + auto inBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 404 | + auto outBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 405 | + host->Process(inBuffer, outBuffer, outBuffer->Length()); | |
| 406 | + out->Send(outBuffer->GetBuffer()[0]); | |
| 407 | + } | |
| 408 | + System::Console::ReadLine(); | |
| 409 | + | |
| 410 | + Console::WriteLine("====================================================test0"); | |
| 411 | + { | |
| 412 | + auto inBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 413 | + auto outBuffer = gcnew Momiji::Core::Vst::Buffer::VstBuffer<System::Single>(2,40000); | |
| 414 | + host->Process(inBuffer, outBuffer, outBuffer->Length()); | |
| 415 | + out->Send(outBuffer->GetBuffer()[0]); | |
| 416 | + } | |
| 417 | + System::Console::ReadLine(); | |
| 418 | + | |
| 419 | + host->StopProcess(); | |
| 420 | + System::Console::ReadLine(); | |
| 421 | + } | |
| 422 | + finally | |
| 423 | + { | |
| 424 | + delete out; | |
| 425 | + } | |
| 426 | + } | |
| 427 | + finally | |
| 428 | + { | |
| 429 | + delete host; | |
| 430 | + } | |
| 431 | + | |
| 432 | + */ | |
| 433 | +} | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | +[System::STAThread] | |
| 438 | +int main(array<System::String ^> ^args) | |
| 439 | +{ | |
| 440 | + Console::WriteLine("====================================================test0"); | |
| 441 | + try | |
| 442 | + { | |
| 443 | + test0(); | |
| 444 | + } | |
| 445 | + catch(Exception^ e) | |
| 446 | + { | |
| 447 | + Console::WriteLine("exception: {0}", e); | |
| 448 | + } | |
| 449 | + System::GC::Collect(); | |
| 450 | + System::GC::WaitForPendingFinalizers(); | |
| 451 | + System::GC::Collect(); | |
| 452 | + | |
| 453 | + Console::WriteLine("===================================================="); | |
| 454 | + System::Console::ReadLine(); | |
| 455 | + return 0; | |
| 456 | +} |
| @@ -0,0 +1,104 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | + <ItemGroup Label="ProjectConfigurations"> | |
| 4 | + <ProjectConfiguration Include="Debug|Win32"> | |
| 5 | + <Configuration>Debug</Configuration> | |
| 6 | + <Platform>Win32</Platform> | |
| 7 | + </ProjectConfiguration> | |
| 8 | + <ProjectConfiguration Include="Release|Win32"> | |
| 9 | + <Configuration>Release</Configuration> | |
| 10 | + <Platform>Win32</Platform> | |
| 11 | + </ProjectConfiguration> | |
| 12 | + </ItemGroup> | |
| 13 | + <PropertyGroup Label="Globals"> | |
| 14 | + <ProjectGuid>{0492D8F3-11E5-475A-9E85-813F4A42F314}</ProjectGuid> | |
| 15 | + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |
| 16 | + <Keyword>ManagedCProj</Keyword> | |
| 17 | + <RootNamespace>MomijiTestVstController</RootNamespace> | |
| 18 | + </PropertyGroup> | |
| 19 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | |
| 20 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | |
| 21 | + <ConfigurationType>Application</ConfigurationType> | |
| 22 | + <UseDebugLibraries>true</UseDebugLibraries> | |
| 23 | + <CLRSupport>Safe</CLRSupport> | |
| 24 | + <CharacterSet>Unicode</CharacterSet> | |
| 25 | + </PropertyGroup> | |
| 26 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | |
| 27 | + <ConfigurationType>Application</ConfigurationType> | |
| 28 | + <UseDebugLibraries>false</UseDebugLibraries> | |
| 29 | + <CLRSupport>Safe</CLRSupport> | |
| 30 | + <CharacterSet>Unicode</CharacterSet> | |
| 31 | + </PropertyGroup> | |
| 32 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | |
| 33 | + <ImportGroup Label="ExtensionSettings"> | |
| 34 | + </ImportGroup> | |
| 35 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 36 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 37 | + </ImportGroup> | |
| 38 | + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 39 | + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | |
| 40 | + </ImportGroup> | |
| 41 | + <PropertyGroup Label="UserMacros" /> | |
| 42 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 43 | + <LinkIncremental>true</LinkIncremental> | |
| 44 | + </PropertyGroup> | |
| 45 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 46 | + <LinkIncremental>false</LinkIncremental> | |
| 47 | + </PropertyGroup> | |
| 48 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | |
| 49 | + <ClCompile> | |
| 50 | + <WarningLevel>Level3</WarningLevel> | |
| 51 | + <Optimization>Disabled</Optimization> | |
| 52 | + <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 53 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
| 54 | + <AdditionalUsingDirectories>E:\Labo\Vc\MIDIDLL\Momiji_Main\Release;%(AdditionalUsingDirectories)</AdditionalUsingDirectories> | |
| 55 | + <CompileAsManaged>Safe</CompileAsManaged> | |
| 56 | + </ClCompile> | |
| 57 | + <Link> | |
| 58 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 59 | + <AdditionalDependencies> | |
| 60 | + </AdditionalDependencies> | |
| 61 | + </Link> | |
| 62 | + </ItemDefinitionGroup> | |
| 63 | + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | |
| 64 | + <ClCompile> | |
| 65 | + <WarningLevel>Level3</WarningLevel> | |
| 66 | + <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |
| 67 | + <PrecompiledHeader>Use</PrecompiledHeader> | |
| 68 | + <AdditionalUsingDirectories>E:\Labo\Vc\MIDIDLL\Momiji_Main\Release;%(AdditionalUsingDirectories)</AdditionalUsingDirectories> | |
| 69 | + <CompileAsManaged>Safe</CompileAsManaged> | |
| 70 | + </ClCompile> | |
| 71 | + <Link> | |
| 72 | + <GenerateDebugInformation>true</GenerateDebugInformation> | |
| 73 | + <AdditionalDependencies> | |
| 74 | + </AdditionalDependencies> | |
| 75 | + </Link> | |
| 76 | + </ItemDefinitionGroup> | |
| 77 | + <ItemGroup> | |
| 78 | + <Reference Include="System" /> | |
| 79 | + <Reference Include="System.Data" /> | |
| 80 | + <Reference Include="System.Xml" /> | |
| 81 | + </ItemGroup> | |
| 82 | + <ItemGroup> | |
| 83 | + <None Include="app.ico" /> | |
| 84 | + <None Include="ReadMe.txt" /> | |
| 85 | + </ItemGroup> | |
| 86 | + <ItemGroup> | |
| 87 | + <ClInclude Include="resource.h" /> | |
| 88 | + <ClInclude Include="stdafx.h" /> | |
| 89 | + </ItemGroup> | |
| 90 | + <ItemGroup> | |
| 91 | + <ResourceCompile Include="app.rc" /> | |
| 92 | + </ItemGroup> | |
| 93 | + <ItemGroup> | |
| 94 | + <ClCompile Include="AssemblyInfo.cpp" /> | |
| 95 | + <ClCompile Include="Momiji.Test.Vst.Controller.cpp" /> | |
| 96 | + <ClCompile Include="stdafx.cpp"> | |
| 97 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> | |
| 98 | + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> | |
| 99 | + </ClCompile> | |
| 100 | + </ItemGroup> | |
| 101 | + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | |
| 102 | + <ImportGroup Label="ExtensionTargets"> | |
| 103 | + </ImportGroup> | |
| 104 | +</Project> | |
| \ No newline at end of file |
| @@ -0,0 +1,47 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | + <ItemGroup> | |
| 4 | + <Filter Include="ソース ファイル"> | |
| 5 | + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | |
| 6 | + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | |
| 7 | + </Filter> | |
| 8 | + <Filter Include="ヘッダー ファイル"> | |
| 9 | + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | |
| 10 | + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | |
| 11 | + </Filter> | |
| 12 | + <Filter Include="リソース ファイル"> | |
| 13 | + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | |
| 14 | + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | |
| 15 | + </Filter> | |
| 16 | + </ItemGroup> | |
| 17 | + <ItemGroup> | |
| 18 | + <None Include="ReadMe.txt" /> | |
| 19 | + <None Include="app.ico"> | |
| 20 | + <Filter>リソース ファイル</Filter> | |
| 21 | + </None> | |
| 22 | + </ItemGroup> | |
| 23 | + <ItemGroup> | |
| 24 | + <ClInclude Include="stdafx.h"> | |
| 25 | + <Filter>ヘッダー ファイル</Filter> | |
| 26 | + </ClInclude> | |
| 27 | + <ClInclude Include="resource.h"> | |
| 28 | + <Filter>ヘッダー ファイル</Filter> | |
| 29 | + </ClInclude> | |
| 30 | + </ItemGroup> | |
| 31 | + <ItemGroup> | |
| 32 | + <ResourceCompile Include="app.rc"> | |
| 33 | + <Filter>リソース ファイル</Filter> | |
| 34 | + </ResourceCompile> | |
| 35 | + </ItemGroup> | |
| 36 | + <ItemGroup> | |
| 37 | + <ClCompile Include="Momiji.Test.Vst.Controller.cpp"> | |
| 38 | + <Filter>ソース ファイル</Filter> | |
| 39 | + </ClCompile> | |
| 40 | + <ClCompile Include="AssemblyInfo.cpp"> | |
| 41 | + <Filter>ソース ファイル</Filter> | |
| 42 | + </ClCompile> | |
| 43 | + <ClCompile Include="stdafx.cpp"> | |
| 44 | + <Filter>ソース ファイル</Filter> | |
| 45 | + </ClCompile> | |
| 46 | + </ItemGroup> | |
| 47 | +</Project> | |
| \ No newline at end of file |
| @@ -0,0 +1,3 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
| 3 | +</Project> | |
| \ No newline at end of file |
| @@ -0,0 +1,37 @@ | ||
| 1 | +======================================================================== | |
| 2 | + アプリケーション: Momiji.Test.Vst.Controller プロジェクトの概要 | |
| 3 | +======================================================================== | |
| 4 | + | |
| 5 | +この Momiji.Test.Vst.Controller アプリケーションは、AppWizard により作成されました。 | |
| 6 | + | |
| 7 | +このファイルには、Momiji.Test.Vst.Controller アプリケー | |
| 8 | +ションを構成する各ファイルの内容の概要が含まれています。 | |
| 9 | + | |
| 10 | +Momiji.Test.Vst.Controller.vcxproj | |
| 11 | + これは、アプリケーション ウィザードを使用して生成された VC++ | |
| 12 | + プロジェクトのメイン プロジェクト ファイルです。 | |
| 13 | + ファイルを生成した Visual C++ のバージョンに関する情報と、アプリケーション | |
| 14 | + ウィザードで選択されたプラットフォーム、 | |
| 15 | + 構成、およびプロジェクト機能に関する情報が含まれています。 | |
| 16 | + | |
| 17 | +Momiji.Test.Vst.Controller.vcxproj.filters | |
| 18 | + これは、アプリケーション ウィザードで生成された VC++ プロジェクトのフィルター | |
| 19 | + ファイルです。 | |
| 20 | + このファイルには、プロジェクト内のファイルとフィルターとの間の関連付けに関する | |
| 21 | + 情報が含まれています。 | |
| 22 | + この関連付けは、特定のノードで同様の拡張子を持つファイルのグループ化を | |
| 23 | + 示すために IDE で使用されます (たとえば、".cpp" ファイルは "ソース ファイル" | |
| 24 | + フィルターに関連付けられています)。 | |
| 25 | + | |
| 26 | +Momiji.Test.Vst.Controller.cpp | |
| 27 | + これは、メインのアプリケーション ソース ファイルです。 | |
| 28 | + | |
| 29 | +AssemblyInfo.cpp | |
| 30 | + アセンブリ メタデータを変更するカスタム属性が含まれています。 | |
| 31 | + | |
| 32 | +///////////////////////////////////////////////////////////////////////////// | |
| 33 | +その他のメモ : | |
| 34 | + | |
| 35 | +AppWizard では "TODO:" を使用して、ユーザーが追加またはカスタマイズする必要のあるソース コードを示します。 | |
| 36 | + | |
| 37 | +///////////////////////////////////////////////////////////////////////////// |
| @@ -0,0 +1,3 @@ | ||
| 1 | +//{{NO_DEPENDENCIES}} | |
| 2 | +// Microsoft Visual C++ generated include file. | |
| 3 | +// Used by app.rc |
| @@ -0,0 +1,7 @@ | ||
| 1 | +// stdafx.cpp : 標準インクルード Momiji.Test.Vst.Controller.pch のみを | |
| 2 | +// 含むソース ファイルは、プリコンパイル済みヘッダーになります。 | |
| 3 | +// stdafx.obj にはプリコンパイル済み型情報が含まれます。 | |
| 4 | + | |
| 5 | +#include "stdafx.h" | |
| 6 | + | |
| 7 | + |
| @@ -0,0 +1,8 @@ | ||
| 1 | +// stdafx.h : 標準のシステム インクルード ファイルのインクルード ファイル、または | |
| 2 | +// 参照回数が多く、かつあまり変更されない、プロジェクト専用のインクルード ファイル | |
| 3 | +// を記述します。 | |
| 4 | +// | |
| 5 | + | |
| 6 | +#pragma once | |
| 7 | + | |
| 8 | +// TODO: プログラムに必要な追加ヘッダーをここで参照してください。 |