2 #using <Momiji.Core.dll>
3 namespace MomijiTestSequencerMidi {
5 using namespace System;
6 using namespace System::ComponentModel;
7 using namespace System::Collections;
8 using namespace System::Windows::Forms;
9 using namespace System::Data;
10 using namespace System::Drawing;
13 /// Form1
\82Ì
\8aT
\97v
15 public ref class Form1 : public System::Windows::Forms::Form
20 InitializeComponent();
22 //TODO:
\82±
\82±
\82É
\83R
\83\93\83X
\83g
\83\89\83N
\83^
\81[
\83R
\81[
\83h
\82ð
\92Ç
\89Á
\82µ
\82Ü
\82·
28 ///
\8eg
\97p
\92\86\82Ì
\83\8a\83\
\81[
\83X
\82ð
\82·
\82×
\82Ä
\83N
\83\8a\81[
\83\93\83A
\83b
\83v
\82µ
\82Ü
\82·
\81B
37 private: System::Windows::Forms::ComboBox^ comboBox1;
38 private: System::Windows::Forms::Button^ button1;
39 private: Momiji::Core::ITimer^ t;
40 private: Momiji::Core::IStream^ s;
41 private: Momiji::Core::Midi::Out::Devices^ o;
42 private: Momiji::Controler::Player^ p;
43 private: System::Windows::Forms::Button^ button2;
48 ///
\95K
\97v
\82È
\83f
\83U
\83C
\83i
\81[
\95Ï
\90\94\82Å
\82·
\81B
50 System::ComponentModel::Container ^components;
52 #pragma region Windows Form Designer generated code
54 ///
\83f
\83U
\83C
\83i
\81[
\83T
\83|
\81[
\83g
\82É
\95K
\97v
\82È
\83\81\83\
\83b
\83h
\82Å
\82·
\81B
\82±
\82Ì
\83\81\83\
\83b
\83h
\82Ì
\93à
\97e
\82ð
55 ///
\83R
\81[
\83h
\83G
\83f
\83B
\83^
\81[
\82Å
\95Ï
\8dX
\82µ
\82È
\82¢
\82Å
\82
\82¾
\82³
\82¢
\81B
57 void InitializeComponent(void)
59 this->comboBox1 = (gcnew System::Windows::Forms::ComboBox());
60 this->button1 = (gcnew System::Windows::Forms::Button());
61 this->button2 = (gcnew System::Windows::Forms::Button());
62 this->SuspendLayout();
66 this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
67 this->comboBox1->FormattingEnabled = true;
68 this->comboBox1->Location = System::Drawing::Point(12, 12);
69 this->comboBox1->Name = L"comboBox1";
70 this->comboBox1->Size = System::Drawing::Size(513, 20);
71 this->comboBox1->TabIndex = 0;
75 this->button1->Location = System::Drawing::Point(13, 39);
76 this->button1->Name = L"button1";
77 this->button1->Size = System::Drawing::Size(75, 23);
78 this->button1->TabIndex = 1;
79 this->button1->Text = L"START";
80 this->button1->UseVisualStyleBackColor = true;
81 this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
85 this->button2->Location = System::Drawing::Point(95, 39);
86 this->button2->Name = L"button2";
87 this->button2->Size = System::Drawing::Size(75, 23);
88 this->button2->TabIndex = 2;
89 this->button2->Text = L"STOP";
90 this->button2->UseVisualStyleBackColor = true;
91 this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
95 this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
96 this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
97 this->ClientSize = System::Drawing::Size(537, 73);
98 this->Controls->Add(this->button2);
99 this->Controls->Add(this->button1);
100 this->Controls->Add(this->comboBox1);
101 this->Name = L"Form1";
102 this->Text = L"Form1";
103 this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
104 this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
105 this->ResumeLayout(false);
109 private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
112 gcnew System::Collections::Generic::List<System::Collections::Generic::KeyValuePair<System::String^, Momiji::Interop::Winmm::MidiOutCapabilities^>>();
113 System::UInt32 nums = Momiji::Core::Midi::Out::Device::GetNumDevices();
115 for (System::UInt32 idx = 0; idx < nums; idx++) {
119 auto cap = Momiji::Core::Midi::Out::Device::GetCapabilities(idx);
120 auto pair = System::Collections::Generic::KeyValuePair<System::String^, Momiji::Interop::Winmm::MidiOutCapabilities^>(cap->productName, cap);
125 Console::WriteLine(e->ToString());
129 this->comboBox1->DisplayMember = "Key";
130 this->comboBox1->DataSource = list;
134 private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
135 System::String^ fileName;
136 System::Windows::Forms::OpenFileDialog^ dialog = gcnew System::Windows::Forms::OpenFileDialog();
139 dialog->InitialDirectory = System::IO::Directory::GetCurrentDirectory();
140 dialog->Filter = "midi|*.mid";
141 if (dialog->ShowDialog() == System::Windows::Forms::DialogResult::Cancel)
143 Console::WriteLine("============
\8eæ
\82è
\8fÁ
\82µ");
147 fileName = dialog->FileName;
154 this->button2_Click(this, e);
156 t = gcnew Momiji::Core::Timer::MMTimer();
157 s = gcnew Momiji::Sequencer::Midi::Smf::SmfStream(fileName);
158 o = gcnew Momiji::Core::Midi::Out::Devices();
159 o->AddPort(this->comboBox1->SelectedIndex);
161 p = gcnew Momiji::Controler::Player();
168 private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
189 private: System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) {
190 this->button2_Click(this, e);