test
| Revision | 696bb6d90ed33fda36c72ed490c61b2270ca1971 (tree) |
|---|---|
| Time | 2011-08-21 19:42:43 |
| Author | tyiki badwell <miria@user...> |
| Commiter | tyiki badwell |
画面を用意してみる
| @@ -11,11 +11,11 @@ using namespace System::Security::Permissions; | ||
| 11 | 11 | // アセンブリに関連付けられている情報を変更するには、 |
| 12 | 12 | // これらの属性値を変更してください。 |
| 13 | 13 | // |
| 14 | -[assembly:AssemblyTitleAttribute("MomijiTestSequencerWavecpp")]; | |
| 14 | +[assembly:AssemblyTitleAttribute("MomijiTestSequencerWave")]; | |
| 15 | 15 | [assembly:AssemblyDescriptionAttribute("")]; |
| 16 | 16 | [assembly:AssemblyConfigurationAttribute("")]; |
| 17 | 17 | [assembly:AssemblyCompanyAttribute("xx laboratory")]; |
| 18 | -[assembly:AssemblyProductAttribute("MomijiTestSequencerWavecpp")]; | |
| 18 | +[assembly:AssemblyProductAttribute("MomijiTestSequencerWave")]; | |
| 19 | 19 | [assembly:AssemblyCopyrightAttribute("Copyright (c) xx laboratory 2011")]; |
| 20 | 20 | [assembly:AssemblyTrademarkAttribute("")]; |
| 21 | 21 | [assembly:AssemblyCultureAttribute("")]; |
| @@ -0,0 +1,3 @@ | ||
| 1 | +#include "StdAfx.h" | |
| 2 | +#include "Form1.h" | |
| 3 | + |
| @@ -0,0 +1,236 @@ | ||
| 1 | +#pragma once | |
| 2 | +#using <Momiji.Core.dll> | |
| 3 | +namespace MomijiTestSequencerWave { | |
| 4 | + | |
| 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; | |
| 11 | + | |
| 12 | + | |
| 13 | + /// <summary> | |
| 14 | + /// Form1 の概要 | |
| 15 | + /// </summary> | |
| 16 | + public ref class Form1 : public System::Windows::Forms::Form | |
| 17 | + { | |
| 18 | + public: | |
| 19 | + Form1(void) | |
| 20 | + { | |
| 21 | + InitializeComponent(); | |
| 22 | + // | |
| 23 | + //TODO: ここにコンストラクター コードを追加します | |
| 24 | + // | |
| 25 | + } | |
| 26 | + | |
| 27 | + protected: | |
| 28 | + /// <summary> | |
| 29 | + /// 使用中のリソースをすべてクリーンアップします。 | |
| 30 | + /// </summary> | |
| 31 | + ~Form1() | |
| 32 | + { | |
| 33 | + if (components) | |
| 34 | + { | |
| 35 | + delete components; | |
| 36 | + } | |
| 37 | + } | |
| 38 | + private: System::Windows::Forms::ComboBox^ comboBox1; | |
| 39 | + protected: | |
| 40 | + private: System::Windows::Forms::Button^ button1; | |
| 41 | + private: System::Windows::Forms::NumericUpDown^ numericUpDown1; | |
| 42 | + | |
| 43 | + private: | |
| 44 | + /// <summary> | |
| 45 | + /// 必要なデザイナー変数です。 | |
| 46 | + /// </summary> | |
| 47 | + System::ComponentModel::Container ^components; | |
| 48 | + | |
| 49 | +#pragma region Windows Form Designer generated code | |
| 50 | + /// <summary> | |
| 51 | + /// デザイナー サポートに必要なメソッドです。このメソッドの内容を | |
| 52 | + /// コード エディターで変更しないでください。 | |
| 53 | + /// </summary> | |
| 54 | + void InitializeComponent(void) | |
| 55 | + { | |
| 56 | + this->comboBox1 = (gcnew System::Windows::Forms::ComboBox()); | |
| 57 | + this->button1 = (gcnew System::Windows::Forms::Button()); | |
| 58 | + this->numericUpDown1 = (gcnew System::Windows::Forms::NumericUpDown()); | |
| 59 | + (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->BeginInit(); | |
| 60 | + this->SuspendLayout(); | |
| 61 | + // | |
| 62 | + // comboBox1 | |
| 63 | + // | |
| 64 | + this->comboBox1->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList; | |
| 65 | + this->comboBox1->FormattingEnabled = true; | |
| 66 | + this->comboBox1->Location = System::Drawing::Point(13, 13); | |
| 67 | + this->comboBox1->Name = L"comboBox1"; | |
| 68 | + this->comboBox1->Size = System::Drawing::Size(501, 20); | |
| 69 | + this->comboBox1->TabIndex = 0; | |
| 70 | + // | |
| 71 | + // button1 | |
| 72 | + // | |
| 73 | + this->button1->Location = System::Drawing::Point(439, 39); | |
| 74 | + this->button1->Name = L"button1"; | |
| 75 | + this->button1->Size = System::Drawing::Size(75, 23); | |
| 76 | + this->button1->TabIndex = 1; | |
| 77 | + this->button1->Text = L"button1"; | |
| 78 | + this->button1->UseVisualStyleBackColor = true; | |
| 79 | + this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click); | |
| 80 | + // | |
| 81 | + // numericUpDown1 | |
| 82 | + // | |
| 83 | + this->numericUpDown1->Location = System::Drawing::Point(313, 39); | |
| 84 | + this->numericUpDown1->Maximum = System::Decimal(gcnew cli::array< System::Int32 >(4) {44100, 0, 0, 0}); | |
| 85 | + this->numericUpDown1->Minimum = System::Decimal(gcnew cli::array< System::Int32 >(4) {1, 0, 0, 0}); | |
| 86 | + this->numericUpDown1->Name = L"numericUpDown1"; | |
| 87 | + this->numericUpDown1->Size = System::Drawing::Size(120, 19); | |
| 88 | + this->numericUpDown1->TabIndex = 2; | |
| 89 | + this->numericUpDown1->Value = System::Decimal(gcnew cli::array< System::Int32 >(4) {4410, 0, 0, 0}); | |
| 90 | + // | |
| 91 | + // Form1 | |
| 92 | + // | |
| 93 | + this->AutoScaleDimensions = System::Drawing::SizeF(6, 12); | |
| 94 | + this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; | |
| 95 | + this->ClientSize = System::Drawing::Size(526, 74); | |
| 96 | + this->Controls->Add(this->numericUpDown1); | |
| 97 | + this->Controls->Add(this->button1); | |
| 98 | + this->Controls->Add(this->comboBox1); | |
| 99 | + this->Name = L"Form1"; | |
| 100 | + this->Text = L"Form1"; | |
| 101 | + this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing); | |
| 102 | + this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load); | |
| 103 | + (cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->numericUpDown1))->EndInit(); | |
| 104 | + this->ResumeLayout(false); | |
| 105 | + | |
| 106 | + } | |
| 107 | +#pragma endregion | |
| 108 | + private: | |
| 109 | + System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { | |
| 110 | + | |
| 111 | + auto list = | |
| 112 | + gcnew System::Collections::Generic::List<System::Collections::Generic::KeyValuePair<System::String^, Momiji::Interop::Winmm::WaveOutCapabilities>>(); | |
| 113 | + System::UInt32 nums = Momiji::Core::Wave::Out::Device<System::Byte>::GetNumDevices(); | |
| 114 | + | |
| 115 | + for (System::UInt32 idx = 0; idx < nums; idx++) { | |
| 116 | + | |
| 117 | + try | |
| 118 | + { | |
| 119 | + auto cap = Momiji::Core::Wave::Out::Device<System::Byte>::GetCapabilities(idx); | |
| 120 | + auto pair = System::Collections::Generic::KeyValuePair<System::String^, Momiji::Interop::Winmm::WaveOutCapabilities>(cap.productName, cap); | |
| 121 | + list->Add(pair); | |
| 122 | + } | |
| 123 | + catch(Exception^ e) | |
| 124 | + { | |
| 125 | + Console::WriteLine(e->ToString()); | |
| 126 | + } | |
| 127 | + } | |
| 128 | + | |
| 129 | + this->comboBox1->DisplayMember = "Key"; | |
| 130 | + this->comboBox1->DataSource = list; | |
| 131 | + | |
| 132 | + } | |
| 133 | + | |
| 134 | + private: | |
| 135 | + ref class TestWave | |
| 136 | + { | |
| 137 | + Momiji::Sequencer::Wave::WaveStream^ s; | |
| 138 | + Momiji::Core::Wave::Out::Device<System::Byte>^ o; | |
| 139 | + System::UInt32 _samplesPerBuffer; | |
| 140 | + | |
| 141 | + private: | |
| 142 | + void OnDone(System::Object^ sender, System::EventArgs^ args) | |
| 143 | + { | |
| 144 | + o->Send(s->Read(this->_samplesPerBuffer)); | |
| 145 | + } | |
| 146 | + | |
| 147 | + public: | |
| 148 | + TestWave(System::String^ fileName, System::UInt32 samplesPerBuffer) | |
| 149 | + : _samplesPerBuffer(samplesPerBuffer) | |
| 150 | + { | |
| 151 | + s = gcnew Momiji::Sequencer::Wave::WaveStream(fileName); | |
| 152 | + auto wfx = s->format; | |
| 153 | + | |
| 154 | + auto count = (wfx.samplesPerSecond / this->_samplesPerBuffer) + 2; | |
| 155 | + | |
| 156 | + Console::WriteLine("samplesPerBuffer {0} count {1}", this->_samplesPerBuffer, count); | |
| 157 | + | |
| 158 | + o = gcnew Momiji::Core::Wave::Out::Device<System::Byte>( | |
| 159 | + 0, | |
| 160 | + wfx.channels, | |
| 161 | + wfx.samplesPerSecond, | |
| 162 | + wfx.bitsPerSample, | |
| 163 | + ( | |
| 164 | + Momiji::Interop::Winmm::WaveFormatExtensiblePart::SPEAKER::FRONT_LEFT | |
| 165 | + | Momiji::Interop::Winmm::WaveFormatExtensiblePart::SPEAKER::FRONT_RIGHT | |
| 166 | + ), | |
| 167 | + Momiji::Interop::Ks::StaticKs::SUBTYPE_PCM, | |
| 168 | + this->_samplesPerBuffer | |
| 169 | + ); | |
| 170 | + | |
| 171 | + o->OnDone += gcnew System::EventHandler<System::EventArgs^>(this, &TestWave::OnDone); | |
| 172 | + | |
| 173 | + for (auto i = 0; i < count; i++) | |
| 174 | + { | |
| 175 | + o->Send(s->Read(this->_samplesPerBuffer)); | |
| 176 | + } | |
| 177 | + | |
| 178 | + } | |
| 179 | + | |
| 180 | + ~TestWave() | |
| 181 | + { | |
| 182 | + this->!TestWave(); | |
| 183 | + } | |
| 184 | + | |
| 185 | + !TestWave() | |
| 186 | + { | |
| 187 | + if (o != nullptr) | |
| 188 | + { | |
| 189 | + o->OnDone -= gcnew System::EventHandler<System::EventArgs^>(this, &TestWave::OnDone); | |
| 190 | + delete o; | |
| 191 | + } | |
| 192 | + | |
| 193 | + if (s != nullptr) | |
| 194 | + { | |
| 195 | + delete s; | |
| 196 | + } | |
| 197 | + } | |
| 198 | + }; | |
| 199 | + | |
| 200 | + TestWave^ w; | |
| 201 | + | |
| 202 | + System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { | |
| 203 | + System::String^ fileName; | |
| 204 | + System::Windows::Forms::OpenFileDialog^ dialog = gcnew System::Windows::Forms::OpenFileDialog(); | |
| 205 | + try | |
| 206 | + { | |
| 207 | + dialog->InitialDirectory = System::IO::Directory::GetCurrentDirectory(); | |
| 208 | + dialog->Filter = "wave|*.wav"; | |
| 209 | + if (dialog->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) | |
| 210 | + { | |
| 211 | + Console::WriteLine("============ 取り消し"); | |
| 212 | + return; | |
| 213 | + } | |
| 214 | + | |
| 215 | + fileName = dialog->FileName; | |
| 216 | + } | |
| 217 | + finally | |
| 218 | + { | |
| 219 | + delete dialog; | |
| 220 | + } | |
| 221 | + | |
| 222 | + if (w != nullptr) { | |
| 223 | + delete w; | |
| 224 | + w = nullptr; | |
| 225 | + } | |
| 226 | + w = gcnew TestWave(fileName, System::Decimal::ToInt32(numericUpDown1->Value)); | |
| 227 | + } | |
| 228 | + private: | |
| 229 | + System::Void Form1_FormClosing(System::Object^ sender, System::Windows::Forms::FormClosingEventArgs^ e) { | |
| 230 | + if (w != nullptr) { | |
| 231 | + delete w; | |
| 232 | + w = nullptr; | |
| 233 | + } | |
| 234 | + } | |
| 235 | +}; | |
| 236 | +} |
| @@ -0,0 +1,120 @@ | ||
| 1 | +<?xml version="1.0" encoding="utf-8"?> | |
| 2 | +<root> | |
| 3 | + <!-- | |
| 4 | + Microsoft ResX Schema | |
| 5 | + | |
| 6 | + Version 2.0 | |
| 7 | + | |
| 8 | + The primary goals of this format is to allow a simple XML format | |
| 9 | + that is mostly human readable. The generation and parsing of the | |
| 10 | + various data types are done through the TypeConverter classes | |
| 11 | + associated with the data types. | |
| 12 | + | |
| 13 | + Example: | |
| 14 | + | |
| 15 | + ... ado.net/XML headers & schema ... | |
| 16 | + <resheader name="resmimetype">text/microsoft-resx</resheader> | |
| 17 | + <resheader name="version">2.0</resheader> | |
| 18 | + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> | |
| 19 | + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> | |
| 20 | + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> | |
| 21 | + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> | |
| 22 | + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> | |
| 23 | + <value>[base64 mime encoded serialized .NET Framework object]</value> | |
| 24 | + </data> | |
| 25 | + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> | |
| 26 | + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> | |
| 27 | + <comment>This is a comment</comment> | |
| 28 | + </data> | |
| 29 | + | |
| 30 | + There are any number of "resheader" rows that contain simple | |
| 31 | + name/value pairs. | |
| 32 | + | |
| 33 | + Each data row contains a name, and value. The row also contains a | |
| 34 | + type or mimetype. Type corresponds to a .NET class that support | |
| 35 | + text/value conversion through the TypeConverter architecture. | |
| 36 | + Classes that don't support this are serialized and stored with the | |
| 37 | + mimetype set. | |
| 38 | + | |
| 39 | + The mimetype is used for serialized objects, and tells the | |
| 40 | + ResXResourceReader how to depersist the object. This is currently not | |
| 41 | + extensible. For a given mimetype the value must be set accordingly: | |
| 42 | + | |
| 43 | + Note - application/x-microsoft.net.object.binary.base64 is the format | |
| 44 | + that the ResXResourceWriter will generate, however the reader can | |
| 45 | + read any of the formats listed below. | |
| 46 | + | |
| 47 | + mimetype: application/x-microsoft.net.object.binary.base64 | |
| 48 | + value : The object must be serialized with | |
| 49 | + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter | |
| 50 | + : and then encoded with base64 encoding. | |
| 51 | + | |
| 52 | + mimetype: application/x-microsoft.net.object.soap.base64 | |
| 53 | + value : The object must be serialized with | |
| 54 | + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter | |
| 55 | + : and then encoded with base64 encoding. | |
| 56 | + | |
| 57 | + mimetype: application/x-microsoft.net.object.bytearray.base64 | |
| 58 | + value : The object must be serialized into a byte array | |
| 59 | + : using a System.ComponentModel.TypeConverter | |
| 60 | + : and then encoded with base64 encoding. | |
| 61 | + --> | |
| 62 | + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> | |
| 63 | + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> | |
| 64 | + <xsd:element name="root" msdata:IsDataSet="true"> | |
| 65 | + <xsd:complexType> | |
| 66 | + <xsd:choice maxOccurs="unbounded"> | |
| 67 | + <xsd:element name="metadata"> | |
| 68 | + <xsd:complexType> | |
| 69 | + <xsd:sequence> | |
| 70 | + <xsd:element name="value" type="xsd:string" minOccurs="0" /> | |
| 71 | + </xsd:sequence> | |
| 72 | + <xsd:attribute name="name" use="required" type="xsd:string" /> | |
| 73 | + <xsd:attribute name="type" type="xsd:string" /> | |
| 74 | + <xsd:attribute name="mimetype" type="xsd:string" /> | |
| 75 | + <xsd:attribute ref="xml:space" /> | |
| 76 | + </xsd:complexType> | |
| 77 | + </xsd:element> | |
| 78 | + <xsd:element name="assembly"> | |
| 79 | + <xsd:complexType> | |
| 80 | + <xsd:attribute name="alias" type="xsd:string" /> | |
| 81 | + <xsd:attribute name="name" type="xsd:string" /> | |
| 82 | + </xsd:complexType> | |
| 83 | + </xsd:element> | |
| 84 | + <xsd:element name="data"> | |
| 85 | + <xsd:complexType> | |
| 86 | + <xsd:sequence> | |
| 87 | + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |
| 88 | + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> | |
| 89 | + </xsd:sequence> | |
| 90 | + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> | |
| 91 | + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> | |
| 92 | + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> | |
| 93 | + <xsd:attribute ref="xml:space" /> | |
| 94 | + </xsd:complexType> | |
| 95 | + </xsd:element> | |
| 96 | + <xsd:element name="resheader"> | |
| 97 | + <xsd:complexType> | |
| 98 | + <xsd:sequence> | |
| 99 | + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> | |
| 100 | + </xsd:sequence> | |
| 101 | + <xsd:attribute name="name" type="xsd:string" use="required" /> | |
| 102 | + </xsd:complexType> | |
| 103 | + </xsd:element> | |
| 104 | + </xsd:choice> | |
| 105 | + </xsd:complexType> | |
| 106 | + </xsd:element> | |
| 107 | + </xsd:schema> | |
| 108 | + <resheader name="resmimetype"> | |
| 109 | + <value>text/microsoft-resx</value> | |
| 110 | + </resheader> | |
| 111 | + <resheader name="version"> | |
| 112 | + <value>2.0</value> | |
| 113 | + </resheader> | |
| 114 | + <resheader name="reader"> | |
| 115 | + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
| 116 | + </resheader> | |
| 117 | + <resheader name="writer"> | |
| 118 | + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> | |
| 119 | + </resheader> | |
| 120 | +</root> | |
| \ No newline at end of file |
| @@ -0,0 +1,20 @@ | ||
| 1 | +// Momiji.Test.Sequencer.Midi.cpp : メイン プロジェクト ファイルです。 | |
| 2 | + | |
| 3 | +#include "stdafx.h" | |
| 4 | +#include "Form1.h" | |
| 5 | + | |
| 6 | +#using <System.Windows.Forms.dll> | |
| 7 | + | |
| 8 | +using namespace System; | |
| 9 | + | |
| 10 | +[System::STAThread] | |
| 11 | +int main(array<System::String ^> ^args) | |
| 12 | +{ | |
| 13 | + // コントロールが作成される前に、Windows XP ビジュアル効果を有効にします | |
| 14 | + MomijiTestSequencerWave::Application::EnableVisualStyles(); | |
| 15 | + MomijiTestSequencerWave::Application::SetCompatibleTextRenderingDefault(false); | |
| 16 | + | |
| 17 | + // メイン ウィンドウを作成して、実行します | |
| 18 | + MomijiTestSequencerWave::Application::Run(gcnew MomijiTestSequencerWave::Form1()); | |
| 19 | + return 0; | |
| 20 | +} |
| @@ -1,132 +0,0 @@ | ||
| 1 | -// Momiji.Test.Sequencer.Midi.cpp : メイン プロジェクト ファイルです。 | |
| 2 | - | |
| 3 | -#include "stdafx.h" | |
| 4 | - | |
| 5 | -#using <Momiji.Core.dll> | |
| 6 | -#using <System.Windows.Forms.dll> | |
| 7 | - | |
| 8 | -using namespace System; | |
| 9 | - | |
| 10 | -ref class TestWave | |
| 11 | -{ | |
| 12 | - Momiji::Sequencer::Wave::WaveStream^ s; | |
| 13 | - Momiji::Core::Wave::Out::Device<System::Byte>^ o; | |
| 14 | - System::UInt32 samplesPerBuffer; | |
| 15 | - | |
| 16 | -private: | |
| 17 | - void OnDone(System::Object^ sender, System::EventArgs^ args) | |
| 18 | - { | |
| 19 | - o->Send(s->Read(samplesPerBuffer)); | |
| 20 | - } | |
| 21 | - | |
| 22 | -public: | |
| 23 | - TestWave(System::String^ fileName) | |
| 24 | - { | |
| 25 | - s = gcnew Momiji::Sequencer::Wave::WaveStream(fileName); | |
| 26 | - auto wfx = s->format; | |
| 27 | - | |
| 28 | - samplesPerBuffer = 800; | |
| 29 | - | |
| 30 | - auto count = (wfx.samplesPerSecond / samplesPerBuffer) + 2; | |
| 31 | - | |
| 32 | - Console::WriteLine("samplesPerBuffer {0} count {1}", samplesPerBuffer, count); | |
| 33 | - | |
| 34 | - o = gcnew Momiji::Core::Wave::Out::Device<System::Byte>( | |
| 35 | - 0, | |
| 36 | - wfx.channels, | |
| 37 | - wfx.samplesPerSecond, | |
| 38 | - wfx.bitsPerSample, | |
| 39 | - ( | |
| 40 | - Momiji::Interop::Winmm::WaveFormatExtensiblePart::SPEAKER::FRONT_LEFT | |
| 41 | - | Momiji::Interop::Winmm::WaveFormatExtensiblePart::SPEAKER::FRONT_RIGHT | |
| 42 | - ), | |
| 43 | - Momiji::Interop::Ks::StaticKs::SUBTYPE_PCM, | |
| 44 | - samplesPerBuffer | |
| 45 | - ); | |
| 46 | - | |
| 47 | - o->OnDone += gcnew System::EventHandler<System::EventArgs^>(this, &TestWave::OnDone); | |
| 48 | - | |
| 49 | - for (auto i = 0; i < count; i++) | |
| 50 | - { | |
| 51 | - o->Send(s->Read(samplesPerBuffer)); | |
| 52 | - } | |
| 53 | - | |
| 54 | - } | |
| 55 | - | |
| 56 | - ~TestWave() | |
| 57 | - { | |
| 58 | - this->!TestWave(); | |
| 59 | - } | |
| 60 | - | |
| 61 | - !TestWave() | |
| 62 | - { | |
| 63 | - if (o != nullptr) | |
| 64 | - { | |
| 65 | - o->OnDone -= gcnew System::EventHandler<System::EventArgs^>(this, &TestWave::OnDone); | |
| 66 | - delete o; | |
| 67 | - } | |
| 68 | - | |
| 69 | - if (s != nullptr) | |
| 70 | - { | |
| 71 | - delete s; | |
| 72 | - } | |
| 73 | - } | |
| 74 | -}; | |
| 75 | - | |
| 76 | - | |
| 77 | -void test9() | |
| 78 | -{ | |
| 79 | - System::String^ fileName; | |
| 80 | - System::Windows::Forms::OpenFileDialog^ dialog = gcnew System::Windows::Forms::OpenFileDialog(); | |
| 81 | - try | |
| 82 | - { | |
| 83 | - dialog->InitialDirectory = System::IO::Directory::GetCurrentDirectory(); | |
| 84 | - dialog->Filter = "wave|*.wav"; | |
| 85 | - if (dialog->ShowDialog() == System::Windows::Forms::DialogResult::Cancel) | |
| 86 | - { | |
| 87 | - Console::WriteLine("============ 取り消し"); | |
| 88 | - return; | |
| 89 | - } | |
| 90 | - | |
| 91 | - fileName = dialog->FileName; | |
| 92 | - } | |
| 93 | - finally | |
| 94 | - { | |
| 95 | - delete dialog; | |
| 96 | - } | |
| 97 | - | |
| 98 | - TestWave^ w; | |
| 99 | - try | |
| 100 | - { | |
| 101 | - w = gcnew TestWave(fileName); | |
| 102 | - System::Console::ReadLine(); | |
| 103 | - } | |
| 104 | - catch(Exception^ e) | |
| 105 | - { | |
| 106 | - Console::WriteLine(e->ToString()); | |
| 107 | - } | |
| 108 | - finally | |
| 109 | - { | |
| 110 | - if (w != nullptr) | |
| 111 | - { | |
| 112 | - delete w; | |
| 113 | - } | |
| 114 | - } | |
| 115 | -} | |
| 116 | - | |
| 117 | - | |
| 118 | - | |
| 119 | - | |
| 120 | -[System::STAThread] | |
| 121 | -int main(array<System::String ^> ^args) | |
| 122 | -{ | |
| 123 | - Console::WriteLine("====================================================test8"); | |
| 124 | - test9(); | |
| 125 | - System::GC::Collect(); | |
| 126 | - System::GC::WaitForPendingFinalizers(); | |
| 127 | - System::GC::Collect(); | |
| 128 | - | |
| 129 | - Console::WriteLine("===================================================="); | |
| 130 | - System::Console::ReadLine(); | |
| 131 | - return 0; | |
| 132 | -} |
| @@ -11,10 +11,11 @@ | ||
| 11 | 11 | </ProjectConfiguration> |
| 12 | 12 | </ItemGroup> |
| 13 | 13 | <PropertyGroup Label="Globals"> |
| 14 | - <ProjectGuid>{F9AA2A43-5DD4-4CA4-89AE-7790C50AC422}</ProjectGuid> | |
| 14 | + <ProjectGuid>{2657B6E0-7B03-487A-A149-9EDB09E0848F}</ProjectGuid> | |
| 15 | 15 | <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
| 16 | 16 | <Keyword>ManagedCProj</Keyword> |
| 17 | - <RootNamespace>MomijiTestSequencerWavecpp</RootNamespace> | |
| 17 | + <RootNamespace>MomijiTestSequencerWave</RootNamespace> | |
| 18 | + <ProjectName>Momiji.Test.Sequencer.Wave</ProjectName> | |
| 18 | 19 | </PropertyGroup> |
| 19 | 20 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
| 20 | 21 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
| @@ -75,6 +76,8 @@ | ||
| 75 | 76 | <ItemGroup> |
| 76 | 77 | <Reference Include="System" /> |
| 77 | 78 | <Reference Include="System.Data" /> |
| 79 | + <Reference Include="System.Drawing" /> | |
| 80 | + <Reference Include="System.Windows.Forms" /> | |
| 78 | 81 | <Reference Include="System.Xml" /> |
| 79 | 82 | </ItemGroup> |
| 80 | 83 | <ItemGroup> |
| @@ -82,6 +85,9 @@ | ||
| 82 | 85 | <None Include="ReadMe.txt" /> |
| 83 | 86 | </ItemGroup> |
| 84 | 87 | <ItemGroup> |
| 88 | + <ClInclude Include="Form1.h"> | |
| 89 | + <FileType>CppForm</FileType> | |
| 90 | + </ClInclude> | |
| 85 | 91 | <ClInclude Include="resource.h" /> |
| 86 | 92 | <ClInclude Include="stdafx.h" /> |
| 87 | 93 | </ItemGroup> |
| @@ -90,12 +96,19 @@ | ||
| 90 | 96 | </ItemGroup> |
| 91 | 97 | <ItemGroup> |
| 92 | 98 | <ClCompile Include="AssemblyInfo.cpp" /> |
| 93 | - <ClCompile Include="Momiji.Test.Sequencer.Wave.cpp.cpp" /> | |
| 99 | + <ClCompile Include="Form1.cpp" /> | |
| 100 | + <ClCompile Include="Momiji.Test.Sequencer.Wave.cpp" /> | |
| 94 | 101 | <ClCompile Include="stdafx.cpp"> |
| 95 | 102 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> |
| 96 | 103 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> |
| 97 | 104 | </ClCompile> |
| 98 | 105 | </ItemGroup> |
| 106 | + <ItemGroup> | |
| 107 | + <EmbeddedResource Include="Form1.resx"> | |
| 108 | + <DependentUpon>Form1.h</DependentUpon> | |
| 109 | + <SubType>Designer</SubType> | |
| 110 | + </EmbeddedResource> | |
| 111 | + </ItemGroup> | |
| 99 | 112 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
| 100 | 113 | <ImportGroup Label="ExtensionTargets"> |
| 101 | 114 | </ImportGroup> |
| @@ -27,6 +27,9 @@ | ||
| 27 | 27 | <ClInclude Include="resource.h"> |
| 28 | 28 | <Filter>ヘッダー ファイル</Filter> |
| 29 | 29 | </ClInclude> |
| 30 | + <ClInclude Include="Form1.h"> | |
| 31 | + <Filter>ヘッダー ファイル</Filter> | |
| 32 | + </ClInclude> | |
| 30 | 33 | </ItemGroup> |
| 31 | 34 | <ItemGroup> |
| 32 | 35 | <ResourceCompile Include="app.rc"> |
| @@ -34,14 +37,22 @@ | ||
| 34 | 37 | </ResourceCompile> |
| 35 | 38 | </ItemGroup> |
| 36 | 39 | <ItemGroup> |
| 37 | - <ClCompile Include="Momiji.Test.Sequencer.Wave.cpp.cpp"> | |
| 38 | - <Filter>ソース ファイル</Filter> | |
| 39 | - </ClCompile> | |
| 40 | 40 | <ClCompile Include="AssemblyInfo.cpp"> |
| 41 | 41 | <Filter>ソース ファイル</Filter> |
| 42 | 42 | </ClCompile> |
| 43 | 43 | <ClCompile Include="stdafx.cpp"> |
| 44 | 44 | <Filter>ソース ファイル</Filter> |
| 45 | 45 | </ClCompile> |
| 46 | + <ClCompile Include="Form1.cpp"> | |
| 47 | + <Filter>ソース ファイル</Filter> | |
| 48 | + </ClCompile> | |
| 49 | + <ClCompile Include="Momiji.Test.Sequencer.Wave.cpp"> | |
| 50 | + <Filter>ソース ファイル</Filter> | |
| 51 | + </ClCompile> | |
| 52 | + </ItemGroup> | |
| 53 | + <ItemGroup> | |
| 54 | + <EmbeddedResource Include="Form1.resx"> | |
| 55 | + <Filter>リソース ファイル</Filter> | |
| 56 | + </EmbeddedResource> | |
| 46 | 57 | </ItemGroup> |
| 47 | 58 | </Project> |
| \ No newline at end of file |