Lempek

Form1.h

Feb 1st, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 64.92 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <cstdio>
  4. #include <string>
  5. #include <Windows.h>
  6. #include <MMSystem.h>
  7. #include <stdio.h>
  8. #include <iostream>
  9. #include "fmod.hpp" //dodatkowa biblioteka zapewniajaca osbluge dzwiekow, w tym brzmienie kilku dzwiekow na raz;)
  10. #include "fmod.h"
  11. #include "fmod_errors.h"
  12. #include "fmod_codec.h"
  13. #include "fmod_dsp.h"
  14. #include "fmod_memoryinfo.h"
  15. #include "fmod_output.h"
  16.  
  17. #pragma comment (lib, "fmodex_vc.lib") //biblioteka fmod
  18. using namespace std;
  19. const int N = 60;
  20. const int K = 20;
  21. // Deklaracja tablicy dźwięków
  22. FMOD::Sound *dzwieki[N];
  23. // Deklaracja tablicy kanałów
  24. FMOD::Channel *kanaly[N];
  25. // Tablica zmiennych typu bool
  26. bool wcisniety[K];
  27.  
  28. namespace piano2 {
  29.  
  30. using namespace System;
  31. using namespace System::ComponentModel;
  32. using namespace System::Collections;
  33. using namespace System::Windows::Forms;
  34. using namespace System::Data;
  35. using namespace System::Drawing;
  36. using namespace System::Media;
  37. using namespace std;
  38.  
  39. /// <summary>
  40. /// Form1 jest tym wlasnie okienkiem, ktore nam wyskakuje z calym interfejsem - pianinem
  41. /// </summary>
  42.  
  43.  
  44.  
  45. public
  46.  
  47. ref class Form1 : public System::Windows::Forms::Form {
  48. public:
  49.  
  50. Form1(void) {
  51. InitializeComponent();
  52.  
  53. }
  54.  
  55. protected:
  56. /// <summary>
  57. /// Clean up any resources being used.
  58. /// </summary>
  59.  
  60. ~Form1() {
  61. if (components) {
  62. delete components;
  63. }
  64. system->release(); //czyszczenie pamieci po calym fmodzie, chyba dziala...
  65. }
  66. //deklarowanie zmiennych- obiektow skladajacych sie na forme
  67. private:
  68. Microsoft::VisualBasic::PowerPacks::ShapeContainer^ shapeContainer1;
  69. private:
  70. Microsoft::VisualBasic::PowerPacks::RectangleShape^ rectangleShape1;
  71. private:
  72. System::Windows::Forms::Button^ buttonW;
  73. private:
  74. System::Windows::Forms::Button^ buttonE;
  75. private:
  76. System::Windows::Forms::Button^ buttonR;
  77. private:
  78. System::Windows::Forms::Button^ buttonT;
  79. private:
  80. System::Windows::Forms::Button^ buttonP;
  81. private:
  82. System::Windows::Forms::Button^ buttonU;
  83. private:
  84. System::Windows::Forms::Button^ buttonZN1;
  85. private:
  86. System::Windows::Forms::Button^ buttonY;
  87. private:
  88. System::Windows::Forms::Button^ buttonI;
  89. private:
  90. System::Windows::Forms::Button^ buttonZN2;
  91. private:
  92. System::Windows::Forms::Button^ buttonO;
  93. private:
  94. System::Windows::Forms::Button^ button2;
  95. private:
  96. System::Windows::Forms::Button^ button7;
  97. private:
  98. System::Windows::Forms::Button^ button5;
  99. private:
  100. System::Windows::Forms::Button^ button4;
  101. private:
  102. System::Windows::Forms::Button^ button8;
  103. private:
  104. System::Windows::Forms::Button^ button9;
  105. private:
  106. System::Windows::Forms::Button^ buttonMIN;
  107. private:
  108. System::Windows::Forms::Button^ buttonROW;
  109. private:
  110. System::Windows::Forms::TrackBar^ trackBar1;
  111. private:
  112. System::Windows::Forms::Button^ buttonQ;
  113. private:
  114. Microsoft::VisualBasic::PowerPacks::RectangleShape^ rectangleShape2;
  115. private:
  116. System::Windows::Forms::Label^ label1;
  117. private:
  118. System::ComponentModel::IContainer^ components;
  119. private:
  120. System::Windows::Forms::Label^ label2;
  121. private:
  122. System::Windows::Forms::Label^ label3;
  123. private:
  124. System::Windows::Forms::Button^ buttonPOD;
  125. private:
  126. System::Windows::Forms::TrackBar^ trackBar2;
  127. private:
  128. System::Windows::Forms::Button^ buttonSTOP;
  129. private:
  130. System::Windows::Forms::ListBox^ listBox1;
  131. private:
  132. System::Windows::Forms::Button^ buttonPAUSE;
  133.  
  134. //zmienne globalne potrzebne do uzycia fmod
  135. private:
  136. FMOD_RESULT result;
  137. private:
  138. FMOD::System *system;
  139. private:
  140. FMOD::Channel *channel;
  141.  
  142. protected:
  143. private:
  144. /// <summary>
  145. /// Required designer variable.
  146. /// </summary>
  147. //przelozenie zmiennych-obiektow na "to co widoczne"
  148. #pragma region Windows Form Designer generated code
  149. #pragma comment( lib, "winmm.lib" )
  150. #pragma comment(lib,"user32.lib")
  151.  
  152. /// <summary>
  153. /// Required method for Designer support - do not modify
  154. /// the contents of this method with the code editor.
  155. /// </summary>
  156.  
  157. void InitializeComponent(void) {
  158. System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
  159. this->buttonW = (gcnew System::Windows::Forms::Button());
  160. this->buttonQ = (gcnew System::Windows::Forms::Button());
  161. this->buttonE = (gcnew System::Windows::Forms::Button());
  162. this->buttonR = (gcnew System::Windows::Forms::Button());
  163. this->buttonT = (gcnew System::Windows::Forms::Button());
  164. this->buttonP = (gcnew System::Windows::Forms::Button());
  165. this->buttonU = (gcnew System::Windows::Forms::Button());
  166. this->buttonZN1 = (gcnew System::Windows::Forms::Button());
  167. this->buttonY = (gcnew System::Windows::Forms::Button());
  168. this->buttonI = (gcnew System::Windows::Forms::Button());
  169. this->buttonZN2 = (gcnew System::Windows::Forms::Button());
  170. this->buttonO = (gcnew System::Windows::Forms::Button());
  171. this->button2 = (gcnew System::Windows::Forms::Button());
  172. this->button7 = (gcnew System::Windows::Forms::Button());
  173. this->button5 = (gcnew System::Windows::Forms::Button());
  174. this->button4 = (gcnew System::Windows::Forms::Button());
  175. this->button8 = (gcnew System::Windows::Forms::Button());
  176. this->button9 = (gcnew System::Windows::Forms::Button());
  177. this->buttonMIN = (gcnew System::Windows::Forms::Button());
  178. this->buttonROW = (gcnew System::Windows::Forms::Button());
  179. this->shapeContainer1 = (gcnew Microsoft::VisualBasic::PowerPacks::ShapeContainer());
  180. this->rectangleShape2 = (gcnew Microsoft::VisualBasic::PowerPacks::RectangleShape());
  181. this->rectangleShape1 = (gcnew Microsoft::VisualBasic::PowerPacks::RectangleShape());
  182. this->trackBar1 = (gcnew System::Windows::Forms::TrackBar());
  183. this->label1 = (gcnew System::Windows::Forms::Label());
  184. this->trackBar2 = (gcnew System::Windows::Forms::TrackBar());
  185. this->label2 = (gcnew System::Windows::Forms::Label());
  186. this->label3 = (gcnew System::Windows::Forms::Label());
  187. this->buttonPOD = (gcnew System::Windows::Forms::Button());
  188. this->buttonSTOP = (gcnew System::Windows::Forms::Button());
  189. this->listBox1 = (gcnew System::Windows::Forms::ListBox());
  190. this->buttonPAUSE = (gcnew System::Windows::Forms::Button());
  191. (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar1))->BeginInit();
  192. (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar2))->BeginInit();
  193. this->SuspendLayout();
  194. //
  195. // buttonW
  196. //
  197. this->buttonW->AllowDrop = true;
  198. this->buttonW->AutoEllipsis = true;
  199. this->buttonW->BackColor = System::Drawing::SystemColors::Control;
  200. this->buttonW->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  201. this->buttonW->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  202. this->buttonW->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  203. this->buttonW->ImageKey = L"(none)";
  204. this->buttonW->Location = System::Drawing::Point(118, 24);
  205. this->buttonW->Name = L"buttonW";
  206. this->buttonW->RightToLeft = System::Windows::Forms::RightToLeft::No;
  207. this->buttonW->Size = System::Drawing::Size(50, 268);
  208. this->buttonW->TabIndex = 0;
  209. this->buttonW->Text = L"W";
  210. this->buttonW->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  211. this->buttonW->UseCompatibleTextRendering = true;
  212. this->buttonW->UseVisualStyleBackColor = true;
  213. this->buttonW->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
  214. this->buttonW->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  215. //
  216. // buttonQ
  217. //
  218. this->buttonQ->AllowDrop = true;
  219. this->buttonQ->AutoEllipsis = true;
  220. this->buttonQ->BackColor = System::Drawing::SystemColors::Control;
  221. this->buttonQ->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  222. this->buttonQ->Cursor = System::Windows::Forms::Cursors::Hand;
  223. this->buttonQ->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  224. static_cast<System::Byte> (238)));
  225. this->buttonQ->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  226. this->buttonQ->Location = System::Drawing::Point(64, 24);
  227. this->buttonQ->Name = L"buttonQ";
  228. this->buttonQ->Size = System::Drawing::Size(50, 268);
  229. this->buttonQ->TabIndex = 0;
  230. this->buttonQ->Text = L"Q";
  231. this->buttonQ->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  232. this->buttonQ->UseCompatibleTextRendering = true;
  233. this->buttonQ->UseVisualStyleBackColor = true;
  234. this->buttonQ->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
  235. this->buttonQ->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  236. //
  237. // buttonE
  238. //
  239. this->buttonE->AllowDrop = true;
  240. this->buttonE->AutoEllipsis = true;
  241. this->buttonE->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  242. this->buttonE->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  243. this->buttonE->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  244. this->buttonE->Location = System::Drawing::Point(172, 24);
  245. this->buttonE->Name = L"buttonE";
  246. this->buttonE->Size = System::Drawing::Size(50, 268);
  247. this->buttonE->TabIndex = 0;
  248. this->buttonE->Text = L" E";
  249. this->buttonE->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  250. this->buttonE->UseCompatibleTextRendering = true;
  251. this->buttonE->UseVisualStyleBackColor = true;
  252. this->buttonE->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
  253. this->buttonE->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  254. //
  255. // buttonR
  256. //
  257. this->buttonR->AllowDrop = true;
  258. this->buttonR->AutoEllipsis = true;
  259. this->buttonR->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  260. this->buttonR->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  261. this->buttonR->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  262. this->buttonR->Location = System::Drawing::Point(226, 24);
  263. this->buttonR->Name = L"buttonR";
  264. this->buttonR->Size = System::Drawing::Size(50, 268);
  265. this->buttonR->TabIndex = 0;
  266. this->buttonR->Text = L" R";
  267. this->buttonR->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  268. this->buttonR->UseCompatibleTextRendering = true;
  269. this->buttonR->UseVisualStyleBackColor = true;
  270. this->buttonR->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
  271. this->buttonR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  272. //
  273. // buttonT
  274. //
  275. this->buttonT->AllowDrop = true;
  276. this->buttonT->AutoEllipsis = true;
  277. this->buttonT->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  278. this->buttonT->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  279. this->buttonT->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  280. this->buttonT->Location = System::Drawing::Point(280, 24);
  281. this->buttonT->Name = L"buttonT";
  282. this->buttonT->Size = System::Drawing::Size(50, 268);
  283. this->buttonT->TabIndex = 0;
  284. this->buttonT->Text = L" T";
  285. this->buttonT->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  286. this->buttonT->UseCompatibleTextRendering = true;
  287. this->buttonT->UseVisualStyleBackColor = true;
  288. this->buttonT->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
  289. this->buttonT->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  290. //
  291. // buttonP
  292. //
  293. this->buttonP->AllowDrop = true;
  294. this->buttonP->AutoEllipsis = true;
  295. this->buttonP->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  296. this->buttonP->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  297. this->buttonP->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  298. this->buttonP->Location = System::Drawing::Point(551, 24);
  299. this->buttonP->Name = L"buttonP";
  300. this->buttonP->Size = System::Drawing::Size(50, 268);
  301. this->buttonP->TabIndex = 0;
  302. this->buttonP->Text = L" P";
  303. this->buttonP->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  304. this->buttonP->UseCompatibleTextRendering = true;
  305. this->buttonP->UseVisualStyleBackColor = true;
  306. this->buttonP->Click += gcnew System::EventHandler(this, &Form1::button11_Click);
  307. this->buttonP->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  308. //
  309. // buttonU
  310. //
  311. this->buttonU->AllowDrop = true;
  312. this->buttonU->AutoEllipsis = true;
  313. this->buttonU->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  314. this->buttonU->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  315. this->buttonU->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  316. this->buttonU->Location = System::Drawing::Point(388, 24);
  317. this->buttonU->Name = L"buttonU";
  318. this->buttonU->Size = System::Drawing::Size(50, 268);
  319. this->buttonU->TabIndex = 0;
  320. this->buttonU->Text = L"U";
  321. this->buttonU->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  322. this->buttonU->UseCompatibleTextRendering = true;
  323. this->buttonU->UseVisualStyleBackColor = true;
  324. this->buttonU->Click += gcnew System::EventHandler(this, &Form1::button8_Click);
  325. this->buttonU->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  326. //
  327. // buttonZN1
  328. //
  329. this->buttonZN1->AllowDrop = true;
  330. this->buttonZN1->AutoEllipsis = true;
  331. this->buttonZN1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  332. this->buttonZN1->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  333. this->buttonZN1->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  334. this->buttonZN1->Location = System::Drawing::Point(605, 24);
  335. this->buttonZN1->Name = L"buttonZN1";
  336. this->buttonZN1->Size = System::Drawing::Size(50, 268);
  337. this->buttonZN1->TabIndex = 0;
  338. this->buttonZN1->Text = L" [";
  339. this->buttonZN1->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  340. this->buttonZN1->UseCompatibleTextRendering = true;
  341. this->buttonZN1->UseVisualStyleBackColor = true;
  342. this->buttonZN1->Click += gcnew System::EventHandler(this, &Form1::button12_Click);
  343. this->buttonZN1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  344. //
  345. // buttonY
  346. //
  347. this->buttonY->AllowDrop = true;
  348. this->buttonY->AutoEllipsis = true;
  349. this->buttonY->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  350. this->buttonY->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  351. this->buttonY->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  352. this->buttonY->Location = System::Drawing::Point(334, 24);
  353. this->buttonY->Name = L"buttonY";
  354. this->buttonY->Size = System::Drawing::Size(50, 268);
  355. this->buttonY->TabIndex = 0;
  356. this->buttonY->Text = L" Y";
  357. this->buttonY->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  358. this->buttonY->UseCompatibleTextRendering = true;
  359. this->buttonY->UseVisualStyleBackColor = true;
  360. this->buttonY->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
  361. this->buttonY->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  362. //
  363. // buttonI
  364. //
  365. this->buttonI->AllowDrop = true;
  366. this->buttonI->AutoEllipsis = true;
  367. this->buttonI->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  368. this->buttonI->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  369. this->buttonI->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  370. this->buttonI->Location = System::Drawing::Point(442, 24);
  371. this->buttonI->Name = L"buttonI";
  372. this->buttonI->Size = System::Drawing::Size(50, 268);
  373. this->buttonI->TabIndex = 0;
  374. this->buttonI->Text = L" I";
  375. this->buttonI->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  376. this->buttonI->UseCompatibleTextRendering = true;
  377. this->buttonI->UseVisualStyleBackColor = true;
  378. this->buttonI->Click += gcnew System::EventHandler(this, &Form1::button9_Click);
  379. this->buttonI->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  380. //
  381. // buttonZN2
  382. //
  383. this->buttonZN2->AllowDrop = true;
  384. this->buttonZN2->AutoEllipsis = true;
  385. this->buttonZN2->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  386. this->buttonZN2->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  387. this->buttonZN2->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  388. this->buttonZN2->Location = System::Drawing::Point(659, 24);
  389. this->buttonZN2->Name = L"buttonZN2";
  390. this->buttonZN2->Size = System::Drawing::Size(50, 268);
  391. this->buttonZN2->TabIndex = 0;
  392. this->buttonZN2->Text = L" ]";
  393. this->buttonZN2->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  394. this->buttonZN2->UseCompatibleTextRendering = true;
  395. this->buttonZN2->UseVisualStyleBackColor = true;
  396. this->buttonZN2->Click += gcnew System::EventHandler(this, &Form1::button13_Click);
  397. this->buttonZN2->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  398. //
  399. // buttonO
  400. //
  401. this->buttonO->AllowDrop = true;
  402. this->buttonO->AutoEllipsis = true;
  403. this->buttonO->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  404. this->buttonO->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  405. this->buttonO->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
  406. this->buttonO->Location = System::Drawing::Point(497, 24);
  407. this->buttonO->Name = L"buttonO";
  408. this->buttonO->Size = System::Drawing::Size(50, 268);
  409. this->buttonO->TabIndex = 0;
  410. this->buttonO->Text = L" O";
  411. this->buttonO->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
  412. this->buttonO->UseCompatibleTextRendering = true;
  413. this->buttonO->UseVisualStyleBackColor = true;
  414. this->buttonO->Click += gcnew System::EventHandler(this, &Form1::button10_Click);
  415. this->buttonO->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  416. //
  417. // button2
  418. //
  419. this->button2->AllowDrop = true;
  420. this->button2->AutoEllipsis = true;
  421. this->button2->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  422. this->button2->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  423. this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;
  424. this->button2->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  425. this->button2->ForeColor = System::Drawing::SystemColors::Control;
  426. this->button2->Location = System::Drawing::Point(100, 24);
  427. this->button2->Name = L"button2";
  428. this->button2->Size = System::Drawing::Size(35, 168);
  429. this->button2->TabIndex = 0;
  430. this->button2->Text = L" 2";
  431. this->button2->UseCompatibleTextRendering = true;
  432. this->button2->UseVisualStyleBackColor = false;
  433. this->button2->Click += gcnew System::EventHandler(this, &Form1::button2a_Click);
  434. this->button2->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  435. //
  436. // button7
  437. //
  438. this->button7->AllowDrop = true;
  439. this->button7->AutoEllipsis = true;
  440. this->button7->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  441. this->button7->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  442. this->button7->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  443. this->button7->ForeColor = System::Drawing::SystemColors::Control;
  444. this->button7->Location = System::Drawing::Point(370, 24);
  445. this->button7->Name = L"button7";
  446. this->button7->Size = System::Drawing::Size(35, 168);
  447. this->button7->TabIndex = 0;
  448. this->button7->Text = L" 7";
  449. this->button7->UseCompatibleTextRendering = true;
  450. this->button7->UseVisualStyleBackColor = false;
  451. this->button7->Click += gcnew System::EventHandler(this, &Form1::button7a_Click);
  452. this->button7->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  453. //
  454. // button5
  455. //
  456. this->button5->AllowDrop = true;
  457. this->button5->AutoEllipsis = true;
  458. this->button5->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  459. this->button5->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  460. this->button5->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  461. this->button5->ForeColor = System::Drawing::SystemColors::Control;
  462. this->button5->Location = System::Drawing::Point(262, 24);
  463. this->button5->Name = L"button5";
  464. this->button5->Size = System::Drawing::Size(35, 168);
  465. this->button5->TabIndex = 0;
  466. this->button5->Text = L" 5";
  467. this->button5->UseCompatibleTextRendering = true;
  468. this->button5->UseVisualStyleBackColor = false;
  469. this->button5->Click += gcnew System::EventHandler(this, &Form1::button5a_Click);
  470. this->button5->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  471. //
  472. // button4
  473. //
  474. this->button4->AllowDrop = true;
  475. this->button4->AutoEllipsis = true;
  476. this->button4->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  477. this->button4->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  478. this->button4->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  479. this->button4->ForeColor = System::Drawing::SystemColors::Control;
  480. this->button4->Location = System::Drawing::Point(208, 24);
  481. this->button4->Name = L"button4";
  482. this->button4->Size = System::Drawing::Size(35, 168);
  483. this->button4->TabIndex = 0;
  484. this->button4->Text = L" 4";
  485. this->button4->UseCompatibleTextRendering = true;
  486. this->button4->UseVisualStyleBackColor = false;
  487. this->button4->Click += gcnew System::EventHandler(this, &Form1::button4a_Click);
  488. this->button4->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  489. //
  490. // button8
  491. //
  492. this->button8->AllowDrop = true;
  493. this->button8->AutoEllipsis = true;
  494. this->button8->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  495. this->button8->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  496. this->button8->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  497. this->button8->ForeColor = System::Drawing::SystemColors::Control;
  498. this->button8->Location = System::Drawing::Point(424, 24);
  499. this->button8->Name = L"button8";
  500. this->button8->Size = System::Drawing::Size(35, 168);
  501. this->button8->TabIndex = 0;
  502. this->button8->Text = L" 8";
  503. this->button8->UseCompatibleTextRendering = true;
  504. this->button8->UseVisualStyleBackColor = false;
  505. this->button8->Click += gcnew System::EventHandler(this, &Form1::button8a_Click);
  506. this->button8->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  507. //
  508. // button9
  509. //
  510. this->button9->AllowDrop = true;
  511. this->button9->AutoEllipsis = true;
  512. this->button9->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  513. this->button9->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  514. this->button9->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  515. this->button9->ForeColor = System::Drawing::SystemColors::Control;
  516. this->button9->Location = System::Drawing::Point(478, 24);
  517. this->button9->Margin = System::Windows::Forms::Padding(0);
  518. this->button9->Name = L"button9";
  519. this->button9->Size = System::Drawing::Size(35, 168);
  520. this->button9->TabIndex = 0;
  521. this->button9->Text = L" 9";
  522. this->button9->UseCompatibleTextRendering = true;
  523. this->button9->UseVisualStyleBackColor = false;
  524. this->button9->Click += gcnew System::EventHandler(this, &Form1::button9a_Click);
  525. this->button9->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  526. //
  527. // buttonMIN
  528. //
  529. this->buttonMIN->AllowDrop = true;
  530. this->buttonMIN->AutoEllipsis = true;
  531. this->buttonMIN->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  532. this->buttonMIN->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  533. this->buttonMIN->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  534. this->buttonMIN->ForeColor = System::Drawing::SystemColors::Control;
  535. this->buttonMIN->Location = System::Drawing::Point(586, 24);
  536. this->buttonMIN->Margin = System::Windows::Forms::Padding(0);
  537. this->buttonMIN->Name = L"buttonMIN";
  538. this->buttonMIN->Size = System::Drawing::Size(35, 168);
  539. this->buttonMIN->TabIndex = 0;
  540. this->buttonMIN->Text = L" -";
  541. this->buttonMIN->UseCompatibleTextRendering = true;
  542. this->buttonMIN->UseVisualStyleBackColor = false;
  543. this->buttonMIN->Click += gcnew System::EventHandler(this, &Form1::button11a_Click);
  544. this->buttonMIN->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  545. //
  546. // buttonROW
  547. //
  548. this->buttonROW->AllowDrop = true;
  549. this->buttonROW->AutoEllipsis = true;
  550. this->buttonROW->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  551. this->buttonROW->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
  552. this->buttonROW->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
  553. this->buttonROW->ForeColor = System::Drawing::SystemColors::Control;
  554. this->buttonROW->Location = System::Drawing::Point(640, 24);
  555. this->buttonROW->Margin = System::Windows::Forms::Padding(0);
  556. this->buttonROW->Name = L"buttonROW";
  557. this->buttonROW->Size = System::Drawing::Size(35, 168);
  558. this->buttonROW->TabIndex = 0;
  559. this->buttonROW->Text = L"=";
  560. this->buttonROW->UseCompatibleTextRendering = true;
  561. this->buttonROW->UseVisualStyleBackColor = false;
  562. this->buttonROW->Click += gcnew System::EventHandler(this, &Form1::button12a_Click);
  563. this->buttonROW->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  564. //
  565. // shapeContainer1
  566. //
  567. this->shapeContainer1->Location = System::Drawing::Point(0, 0);
  568. this->shapeContainer1->Margin = System::Windows::Forms::Padding(0);
  569. this->shapeContainer1->Name = L"shapeContainer1";
  570.  
  571. this->shapeContainer1->Shapes->AddRange(gcnew cli::array < Microsoft::VisualBasic::PowerPacks::Shape^ >(2) {
  572. this->rectangleShape2,
  573. this->rectangleShape1
  574. });
  575. this->shapeContainer1->Size = System::Drawing::Size(765, 395);
  576. this->shapeContainer1->TabIndex = 1;
  577. this->shapeContainer1->TabStop = false;
  578. //
  579. // rectangleShape2
  580. //
  581. this->rectangleShape2->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  582. this->rectangleShape2->BackStyle = Microsoft::VisualBasic::PowerPacks::BackStyle::Opaque;
  583. this->rectangleShape2->CornerRadius = 2;
  584. this->rectangleShape2->FillColor = System::Drawing::Color::LightGray;
  585. this->rectangleShape2->FillGradientColor = System::Drawing::Color::White;
  586. this->rectangleShape2->FillGradientStyle = Microsoft::VisualBasic::PowerPacks::FillGradientStyle::Horizontal;
  587. this->rectangleShape2->FillStyle = Microsoft::VisualBasic::PowerPacks::FillStyle::Solid;
  588. this->rectangleShape2->Location = System::Drawing::Point(58, 319);
  589. this->rectangleShape2->Name = L"rectangleShape2";
  590. this->rectangleShape2->Size = System::Drawing::Size(230, 55);
  591. //
  592. // rectangleShape1
  593. //
  594. this->rectangleShape1->CornerRadius = 5;
  595. this->rectangleShape1->FillColor = System::Drawing::Color::Gray;
  596. this->rectangleShape1->FillGradientColor = System::Drawing::Color::Black;
  597. this->rectangleShape1->FillGradientStyle = Microsoft::VisualBasic::PowerPacks::FillGradientStyle::Vertical;
  598. this->rectangleShape1->FillStyle = Microsoft::VisualBasic::PowerPacks::FillStyle::Solid;
  599. this->rectangleShape1->Location = System::Drawing::Point(57, 17);
  600. this->rectangleShape1->Name = L"rectangleShape1";
  601. this->rectangleShape1->Size = System::Drawing::Size(658, 279);
  602. //
  603. // trackBar1
  604. //
  605. this->trackBar1->BackColor = System::Drawing::SystemColors::ButtonFace;
  606. this->trackBar1->Cursor = System::Windows::Forms::Cursors::Hand;
  607. this->trackBar1->LargeChange = 1;
  608. this->trackBar1->Location = System::Drawing::Point(64, 324);
  609. this->trackBar1->Maximum = 3;
  610. this->trackBar1->Minimum = 1;
  611. this->trackBar1->Name = L"trackBar1";
  612. this->trackBar1->Size = System::Drawing::Size(221, 45);
  613. this->trackBar1->TabIndex = 2;
  614. this->trackBar1->TickStyle = System::Windows::Forms::TickStyle::Both;
  615. this->trackBar1->Value = 2;
  616. this->trackBar1->Scroll += gcnew System::EventHandler(this, &Form1::trackBar1_Scroll);
  617. this->trackBar1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  618. //
  619. // label1
  620. //
  621. this->label1->AccessibleRole = System::Windows::Forms::AccessibleRole::Sound;
  622. this->label1->AutoSize = true;
  623. this->label1->BackColor = System::Drawing::Color::Transparent;
  624. this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
  625. this->label1->Font = (gcnew System::Drawing::Font(L"Gabriola", 39.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  626. static_cast<System::Byte> (238)));
  627. this->label1->ForeColor = System::Drawing::Color::DarkRed;
  628. this->label1->Location = System::Drawing::Point(680, 298);
  629. this->label1->Name = L"label1";
  630. this->label1->Size = System::Drawing::Size(61, 97);
  631. this->label1->TabIndex = 3;
  632. this->label1->Text = L"a";
  633. this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
  634. //
  635. // trackBar2
  636. //
  637. this->trackBar2->LargeChange = 1;
  638. this->trackBar2->Location = System::Drawing::Point(12, 24);
  639. this->trackBar2->Name = L"trackBar2";
  640. this->trackBar2->Orientation = System::Windows::Forms::Orientation::Vertical;
  641. this->trackBar2->Size = System::Drawing::Size(45, 268);
  642. this->trackBar2->TabIndex = 4;
  643. this->trackBar2->Value = 7;
  644. this->trackBar2->Scroll += gcnew System::EventHandler(this, &Form1::trackBar2_Scroll);
  645. //
  646. // label2
  647. //
  648. this->label2->AutoSize = true;
  649. this->label2->Font = (gcnew System::Drawing::Font(L"Courier New", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  650. static_cast<System::Byte> (238)));
  651. this->label2->Location = System::Drawing::Point(9, 9);
  652. this->label2->Name = L"label2";
  653. this->label2->Size = System::Drawing::Size(40, 16);
  654. this->label2->TabIndex = 5;
  655. this->label2->Text = L"Vol:";
  656. //
  657. // label3
  658. //
  659. this->label3->AutoSize = true;
  660. this->label3->Font = (gcnew System::Drawing::Font(L"Courier New", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  661. static_cast<System::Byte> (238)));
  662. this->label3->Location = System::Drawing::Point(223, 362);
  663. this->label3->Name = L"label3";
  664. this->label3->Size = System::Drawing::Size(56, 16);
  665. this->label3->TabIndex = 6;
  666. this->label3->Text = L"Oktawa";
  667. //
  668. // buttonPOD
  669. //
  670. this->buttonPOD->Location = System::Drawing::Point(334, 347);
  671. this->buttonPOD->Name = L"buttonPOD";
  672. this->buttonPOD->Size = System::Drawing::Size(44, 32);
  673. this->buttonPOD->TabIndex = 7;
  674. this->buttonPOD->Text = L"PLAY";
  675. this->buttonPOD->UseVisualStyleBackColor = true;
  676. this->buttonPOD->Click += gcnew System::EventHandler(this, &Form1::buttonPOD_Click);
  677. //
  678. // buttonSTOP
  679. //
  680. this->buttonSTOP->Location = System::Drawing::Point(427, 347);
  681. this->buttonSTOP->Name = L"buttonSTOP";
  682. this->buttonSTOP->Size = System::Drawing::Size(44, 32);
  683. this->buttonSTOP->TabIndex = 8;
  684. this->buttonSTOP->Text = L"STOP";
  685. this->buttonSTOP->UseVisualStyleBackColor = true;
  686. this->buttonSTOP->Click += gcnew System::EventHandler(this, &Form1::buttonSTOP_Click);
  687. //
  688. // listBox1
  689. //
  690. this->listBox1->BackColor = System::Drawing::Color::White;
  691. this->listBox1->Font = (gcnew System::Drawing::Font(L"Courier New", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
  692. static_cast<System::Byte> (238)));
  693. this->listBox1->FormattingEnabled = true;
  694. this->listBox1->ItemHeight = 18;
  695.  
  696. this->listBox1->Items->AddRange(gcnew cli::array < System::Object^ >(3) {
  697. L"Melodia 1", L"Melodia 2", L"Melodia 3"
  698. });
  699. this->listBox1->Location = System::Drawing::Point(334, 319);
  700. this->listBox1->Name = L"listBox1";
  701. this->listBox1->Size = System::Drawing::Size(137, 22);
  702. this->listBox1->TabIndex = 10;
  703. this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox1_SelectedIndexChanged);
  704. //
  705. // buttonPAUSE
  706. //
  707. this->buttonPAUSE->Location = System::Drawing::Point(376, 347);
  708. this->buttonPAUSE->Name = L"buttonPAUSE";
  709. this->buttonPAUSE->Size = System::Drawing::Size(53, 32);
  710. this->buttonPAUSE->TabIndex = 11;
  711. this->buttonPAUSE->Text = L"PAUSE";
  712. this->buttonPAUSE->UseVisualStyleBackColor = true;
  713. this->buttonPAUSE->Click += gcnew System::EventHandler(this, &Form1::buttonPAUSE_Click);
  714. //
  715. // Form1
  716. //
  717. this->AllowDrop = true;
  718. this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
  719. this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
  720. this->BackgroundImage = (cli::safe_cast < System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
  721. this->ClientSize = System::Drawing::Size(765, 395);
  722. this->Controls->Add(this->buttonPAUSE);
  723. this->Controls->Add(this->listBox1);
  724. this->Controls->Add(this->buttonSTOP);
  725. this->Controls->Add(this->buttonPOD);
  726. this->Controls->Add(this->label3);
  727. this->Controls->Add(this->label2);
  728. this->Controls->Add(this->trackBar2);
  729. this->Controls->Add(this->label1);
  730. this->Controls->Add(this->trackBar1);
  731. this->Controls->Add(this->buttonROW);
  732. this->Controls->Add(this->buttonMIN);
  733. this->Controls->Add(this->button9);
  734. this->Controls->Add(this->button2);
  735. this->Controls->Add(this->button8);
  736. this->Controls->Add(this->button4);
  737. this->Controls->Add(this->button5);
  738. this->Controls->Add(this->button7);
  739. this->Controls->Add(this->buttonR);
  740. this->Controls->Add(this->buttonO);
  741. this->Controls->Add(this->buttonE);
  742. this->Controls->Add(this->buttonZN2);
  743. this->Controls->Add(this->buttonQ);
  744. this->Controls->Add(this->buttonI);
  745. this->Controls->Add(this->buttonW);
  746. this->Controls->Add(this->buttonY);
  747. this->Controls->Add(this->buttonZN1);
  748. this->Controls->Add(this->buttonU);
  749. this->Controls->Add(this->buttonP);
  750. this->Controls->Add(this->buttonT);
  751. this->Controls->Add(this->shapeContainer1);
  752. this->Cursor = System::Windows::Forms::Cursors::Hand;
  753. this->DoubleBuffered = true;
  754. this->HelpButton = true;
  755. this->Icon = (cli::safe_cast < System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
  756. this->ImeMode = System::Windows::Forms::ImeMode::Close;
  757. this->KeyPreview = true;
  758. this->MaximizeBox = false;
  759. this->Name = L"Form1";
  760. this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
  761. this->Text = L"Pianino by MMM";
  762. this->TransparencyKey = System::Drawing::Color::FromArgb(static_cast<System::Int32> (static_cast<System::Byte> (224)), static_cast<System::Int32> (static_cast<System::Byte> (224)),
  763. static_cast<System::Int32> (static_cast<System::Byte> (224)));
  764. this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
  765. this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown);
  766. this->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
  767. this->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyUp);
  768. (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar1))->EndInit();
  769. (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar2))->EndInit();
  770. this->ResumeLayout(false);
  771. this->PerformLayout();
  772.  
  773. }
  774. #pragma endregion
  775.  
  776. public:
  777.  
  778. FMOD::System * Sound_init(FMOD::System * asd) //zainicjowanie dzwieku, robimy tylko raz
  779. {
  780.  
  781. this->result = FMOD::System_Create(&asd); // Create the main system object.
  782.  
  783. if (this->result != FMOD_OK) //obsluga bledow
  784. {
  785. MessageBox::Show("FMOD error! (%d) %s\n");
  786.  
  787. }
  788.  
  789. this->result = asd->init(1000, FMOD_INIT_NORMAL, 0); // Initialize FMOD.
  790.  
  791. if (this->result != FMOD_OK) {
  792. MessageBox::Show("FMOD error! (%d) %s\n");
  793.  
  794. }
  795. return asd;
  796. }
  797.  
  798. public:
  799.  
  800. System::Void Play(FMOD::System *asd, int nr) //funkcja odtwarzajaca dzwiek
  801. {
  802. //FMOD::Channel *kanal;
  803. float volume;
  804. volume = (float) (trackBar2->Value) / 10; //pobiera wartosc trackbara2 suwaka od glosnosci, dzieli przez 10 bo setVolume przybiera wartosci od (0.0-1.0)
  805.  
  806. //this->result=asd->createSound(path,FMOD_SOFTWARE, 0, &dzwiek);
  807.  
  808. if (this->result != FMOD_OK) {
  809. MessageBox::Show("FMOD error! asdasd");
  810.  
  811. }
  812.  
  813. asd->playSound(FMOD_CHANNEL_FREE, dzwieki[nr], false, &kanaly[nr]); //odtwarza dzwiek na wolnym kanale
  814. kanaly[nr]->setVolume(volume); //ustawiamy glosnosc
  815. asd->update(); //b.wazne i potrzebne bez tego dzwiek cichnie po 16 odtworzeniach : ) dziwna sprawa.
  816. }
  817.  
  818. public:
  819.  
  820. FMOD::Channel* Play2(FMOD::System *asd, char * path) //druga wersja play na potrzeby odtwarzania podkladu i mozliosci pauzowania
  821. {
  822. FMOD::Channel *kanal;
  823. FMOD::Sound *dzwiek;
  824. float volume;
  825. volume = (float) (trackBar2->Value) / 10;
  826.  
  827. this->result = asd->createSound(path, FMOD_SOFTWARE, 0, &dzwiek);
  828. if (this->result != FMOD_OK) {
  829. MessageBox::Show("FMOD error! asdasd");
  830.  
  831. }
  832.  
  833. asd->playSound(FMOD_CHANNEL_FREE, dzwiek, false, &kanal);
  834. kanal->setVolume(volume);
  835. asd->update();
  836.  
  837. return kanal;
  838. }
  839.  
  840. public:
  841.  
  842. System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { //
  843. label1->Text = L"a "; //wyswietlanie dzwieku granego z boku
  844. if (trackBar1->Value == 1) //zaleznosc od ustawionej gamy na trackbarze1
  845. {
  846. this->Play(system, 0);
  847. } else if (trackBar1->Value == 2) {
  848. this->Play(system, 0);
  849. } else if (trackBar1->Value == 3) {
  850. this->Play(system, 0);
  851. }
  852. }
  853. public:
  854.  
  855. System::Void button2a_Click(System::Object^ sender, System::EventArgs^ e) { //
  856. label1->Text = L"a# ";
  857. if (trackBar1->Value == 1)
  858. this->Play(system, 1);
  859. else if (trackBar1->Value == 2)
  860. this->Play(system, 1);
  861. else if (trackBar1->Value == 3)
  862. this->Play(system, 1);
  863.  
  864.  
  865. }
  866. private:
  867.  
  868. System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
  869. label1->Text = L"h ";
  870. if (trackBar1->Value == 1)
  871. this->Play(system, 2);
  872. else if (trackBar1->Value == 2)
  873. this->Play(system, 2);
  874. else if (trackBar1->Value == 3)
  875. this->Play(system, 2);
  876.  
  877. }
  878. private:
  879.  
  880. System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
  881. label1->Text = L"c ";
  882. if (trackBar1->Value == 1)
  883. this->Play(system, 0);
  884. else if (trackBar1->Value == 2)
  885. this->Play(system, 0);
  886. else if (trackBar1->Value == 3)
  887. this->Play(system, 0);
  888.  
  889.  
  890. }
  891. private:
  892.  
  893. System::Void button4a_Click(System::Object^ sender, System::EventArgs^ e) {
  894. label1->Text = L"c#";
  895. if (trackBar1->Value == 1)
  896. this->Play(system, 0);
  897. else if (trackBar1->Value == 2)
  898. this->Play(system, 0);
  899. else if (trackBar1->Value == 3)
  900. this->Play(system, 0);
  901.  
  902. }
  903. private:
  904.  
  905. System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
  906. label1->Text = L"d ";
  907. if (trackBar1->Value == 1)
  908. this->Play(system, 0);
  909. else if (trackBar1->Value == 2)
  910. this->Play(system, 0);
  911. else if (trackBar1->Value == 3)
  912. this->Play(system, 0);
  913.  
  914. }
  915. private:
  916.  
  917. System::Void button5a_Click(System::Object^ sender, System::EventArgs^ e) {
  918. label1->Text = L"d#";
  919. if (trackBar1->Value == 1)
  920. this->Play(system, 0);
  921. else if (trackBar1->Value == 2)
  922. this->Play(system, 0);
  923. else if (trackBar1->Value == 3)
  924. this->Play(system, 0);
  925.  
  926. }
  927. private:
  928.  
  929. System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {
  930. label1->Text = L"e ";
  931. if (trackBar1->Value == 1)
  932. this->Play(system, 0);
  933. else if (trackBar1->Value == 2)
  934. this->Play(system, 0);
  935. else if (trackBar1->Value == 3)
  936. this->Play(system, 0);
  937.  
  938. }
  939. private:
  940.  
  941. System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {
  942. label1->Text = L"f ";
  943. if (trackBar1->Value == 1)
  944. this->Play(system, 0);
  945. else if (trackBar1->Value == 2)
  946. this->Play(system, 0);
  947. else if (trackBar1->Value == 3)
  948. this->Play(system, 0);
  949.  
  950. }
  951. private:
  952.  
  953. System::Void button7a_Click(System::Object^ sender, System::EventArgs^ e) {
  954. label1->Text = L"f#";
  955. if (trackBar1->Value == 1)
  956. this->Play(system, 0);
  957. else if (trackBar1->Value == 2)
  958. this->Play(system, 0);
  959. else if (trackBar1->Value == 3)
  960. this->Play(system, 0);
  961.  
  962. }
  963. private:
  964.  
  965. System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) {
  966. label1->Text = L"g ";
  967. if (trackBar1->Value == 1)
  968. this->Play(system, 0);
  969. else if (trackBar1->Value == 2)
  970. this->Play(system, 0);
  971. else if (trackBar1->Value == 3)
  972. this->Play(system, 0);
  973.  
  974. }
  975. private:
  976.  
  977. System::Void button8a_Click(System::Object^ sender, System::EventArgs^ e) {
  978. label1->Text = L"g#";
  979. if (trackBar1->Value == 1)
  980. this->Play(system, 0);
  981. else if (trackBar1->Value == 2)
  982. this->Play(system, 0);
  983. else if (trackBar1->Value == 3)
  984. this->Play(system, 0);
  985.  
  986. }
  987. private:
  988.  
  989. System::Void button9_Click(System::Object^ sender, System::EventArgs^ e) {
  990. label1->Text = L"a ";
  991. if (trackBar1->Value == 1)
  992. this->Play(system, 0);
  993. else if (trackBar1->Value == 2)
  994. this->Play(system, 0);
  995. else if (trackBar1->Value == 3)
  996. this->Play(system, 0);
  997.  
  998. }
  999. private:
  1000.  
  1001. System::Void button9a_Click(System::Object^ sender, System::EventArgs^ e) {
  1002. label1->Text = L"a#";
  1003. if (trackBar1->Value == 1)
  1004. this->Play(system, 0);
  1005. else if (trackBar1->Value == 2)
  1006. this->Play(system, 0);
  1007. else if (trackBar1->Value == 3)
  1008. this->Play(system, 0);
  1009.  
  1010. }
  1011. private:
  1012.  
  1013. System::Void button10_Click(System::Object^ sender, System::EventArgs^ e) {
  1014. label1->Text = L"h ";
  1015. if (trackBar1->Value == 1)
  1016. this->Play(system, 0);
  1017. else if (trackBar1->Value == 2)
  1018. this->Play(system, 0);
  1019. else if (trackBar1->Value == 3)
  1020. this->Play(system, 0);
  1021.  
  1022. }
  1023. private:
  1024.  
  1025. System::Void button11_Click(System::Object^ sender, System::EventArgs^ e) {
  1026. label1->Text = L"c ";
  1027. if (trackBar1->Value == 1)
  1028. this->Play(system, 0);
  1029. else if (trackBar1->Value == 2)
  1030. this->Play(system, 0);
  1031. else if (trackBar1->Value == 3)
  1032. this->Play(system, 0);
  1033. }
  1034. private:
  1035.  
  1036. System::Void button11a_Click(System::Object^ sender, System::EventArgs^ e) {
  1037. label1->Text = L"c#";
  1038. if (trackBar1->Value == 1)
  1039. this->Play(system, 0);
  1040. else if (trackBar1->Value == 2)
  1041. this->Play(system, 0);
  1042. else if (trackBar1->Value == 3)
  1043. this->Play(system, 0);
  1044. }
  1045. private:
  1046.  
  1047. System::Void button12_Click(System::Object^ sender, System::EventArgs^ e) {
  1048. label1->Text = L"d ";
  1049. if (trackBar1->Value == 1)
  1050. this->Play(system, 0);
  1051. else if (trackBar1->Value == 2)
  1052. this->Play(system, 0);
  1053. else if (trackBar1->Value == 3)
  1054. this->Play(system, 0);
  1055. }
  1056. private:
  1057.  
  1058. System::Void button12a_Click(System::Object^ sender, System::EventArgs^ e) {
  1059. label1->Text = L"d#";
  1060. if (trackBar1->Value == 1)
  1061. this->Play(system, 0);
  1062. else if (trackBar1->Value == 2)
  1063. this->Play(system, 0);
  1064. else if (trackBar1->Value == 3)
  1065. this->Play(system, 0);
  1066.  
  1067. }
  1068. private:
  1069.  
  1070. System::Void button13_Click(System::Object^ sender, System::EventArgs^ e) {
  1071. label1->Text = L"e ";
  1072. if (trackBar1->Value == 1)
  1073. this->Play(system, 0);
  1074. else if (trackBar1->Value == 2)
  1075. this->Play(system, 0);
  1076. else if (trackBar1->Value == 3)
  1077. this->Play(system, 0);
  1078.  
  1079. }
  1080. private:
  1081.  
  1082. System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
  1083. this->system = this->Sound_init(this->system); //bardzo dobre miejsce do zainicjowania dzwieku tylko raz w programie
  1084. // tablica nazw dzwiekow
  1085. char* nazwy [N];
  1086. FMOD::System *asd = system;
  1087. for (int i; i < 20; i++) nazwy[i] = new char [8];
  1088. nazwy [0] = "a1.wav";
  1089. nazwy [1] = "a2.wav";
  1090. nazwy [2] = "a3.wav";
  1091. nazwy [3] = "a1#.wav";
  1092. nazwy [4] = "a2#.wav";
  1093. nazwy [5] = "a3#.wav";
  1094. nazwy [6] = "h1.wav";
  1095. nazwy [7] = "h2.wav";
  1096. nazwy [8] = "h3.wav";
  1097. nazwy [9] = "a1.wav";
  1098. nazwy [10] = "a1.wav";
  1099. nazwy [11] = "a1.wav";
  1100. nazwy [12] = "a1.wav";
  1101. nazwy [13] = "a1.wav";
  1102. nazwy [14] = "a1.wav";
  1103. nazwy [15] = "a1.wav";
  1104. nazwy [16] = "a1.wav";
  1105. nazwy [17] = "a1.wav";
  1106. nazwy [18] = "a1.wav";
  1107. nazwy [19] = "a1.wav";
  1108.  
  1109. // Tworzymy obiekty
  1110. for (int i = 0; i < 20; i++) {
  1111. this->result = asd->createSound(nazwy[i], FMOD_SOFTWARE, 0, &dzwieki[i]);
  1112. }
  1113. if (this->result != FMOD_OK) {
  1114. MessageBox::Show("FMOD error! asdasd");
  1115. }
  1116.  
  1117. }
  1118. private:
  1119.  
  1120. System::Void trackBar1_Scroll(System::Object^ sender, System::EventArgs^ e) {
  1121. }
  1122. private:
  1123.  
  1124. System::Void Form1_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
  1125.  
  1126.  
  1127. //wylapuje wcisniete klawisze na klawiaturze i odpowiednio gra oraz zmienia kolor klawisza
  1128. switch (e->KeyChar) {
  1129. case (char(113)):
  1130. buttonQ->BackColor = System::Drawing::Color::LightBlue;
  1131. if (wcisniety[0] == false) {
  1132. button2_Click(sender, e);
  1133. wcisniety[0] = true;
  1134. }
  1135. break;
  1136. case (char(50)):
  1137. button2->BackColor = System::Drawing::Color::SteelBlue;
  1138. if (wcisniety[1] == false) {
  1139. button2a_Click(sender, e);
  1140. wcisniety[1] = true;
  1141. }
  1142. break;
  1143. case (char(119)):
  1144. buttonW->BackColor = System::Drawing::Color::LightBlue;
  1145. if (wcisniety[2] == false) {
  1146. button3_Click(sender, e);
  1147. wcisniety[2] = true;
  1148. }
  1149. break;
  1150. case (char(101)):
  1151. buttonE->BackColor = System::Drawing::Color::LightBlue;
  1152. if (wcisniety[3] == false) {
  1153. button4_Click(sender, e);
  1154. wcisniety[3] = true;
  1155. }
  1156. break;
  1157. case (char(52)):
  1158. button4->BackColor = System::Drawing::Color::SteelBlue;
  1159. if (wcisniety[4] == false) {
  1160. button4a_Click(sender, e);
  1161. wcisniety[4] = true;
  1162. }
  1163. break;
  1164. case (char(114)):
  1165. buttonR->BackColor = System::Drawing::Color::LightBlue;
  1166. if (wcisniety[5] == false) {
  1167. button5_Click(sender, e);
  1168. wcisniety[5] = true;
  1169. }
  1170. break;
  1171. case (char(53)):
  1172. button5->BackColor = System::Drawing::Color::SteelBlue;
  1173. if (wcisniety[6] == false) {
  1174. button5a_Click(sender, e);
  1175. wcisniety[6] = true;
  1176. }
  1177. break;
  1178. case (char(116)):
  1179. buttonT->BackColor = System::Drawing::Color::LightBlue;
  1180. if (wcisniety[7] == false) {
  1181. button6_Click(sender, e);
  1182. wcisniety[7] = true;
  1183. }
  1184. break;
  1185. case (char(121)):
  1186. buttonY->BackColor = System::Drawing::Color::LightBlue;
  1187. if (wcisniety[8] == false) {
  1188. button7_Click(sender, e);
  1189. wcisniety[8] = true;
  1190. }
  1191. break;
  1192. case (char(55)):
  1193. button7->BackColor = System::Drawing::Color::SteelBlue;
  1194. if (wcisniety[9] == false) {
  1195. button7a_Click(sender, e);
  1196. wcisniety[9] = true;
  1197. }
  1198. break;
  1199. case (char(117)):
  1200. buttonU->BackColor = System::Drawing::Color::LightBlue;
  1201. if (wcisniety[10] == false) {
  1202. button8_Click(sender, e);
  1203. wcisniety[10] = true;
  1204. }
  1205. break;
  1206. case (char(56)):
  1207. button8->BackColor = System::Drawing::Color::SteelBlue;
  1208. if (wcisniety[11] == false) {
  1209. button8a_Click(sender, e);
  1210. wcisniety[11] = true;
  1211. }
  1212. break;
  1213. case (char(105)):
  1214. buttonI->BackColor = System::Drawing::Color::LightBlue;
  1215. if (wcisniety[12] == false) {
  1216. button9_Click(sender, e);
  1217. wcisniety[12] = true;
  1218. }
  1219.  
  1220. break;
  1221. case (char(57)):
  1222. button9->BackColor = System::Drawing::Color::SteelBlue;
  1223. if (wcisniety[13] == false) {
  1224. button9a_Click(sender, e);
  1225. wcisniety[13] = true;
  1226. }
  1227.  
  1228. break;
  1229. case (char(111)):
  1230. buttonO->BackColor = System::Drawing::Color::LightBlue;
  1231. if (wcisniety[14] == false) {
  1232. button10_Click(sender, e);
  1233. wcisniety[14] = true;
  1234. }
  1235.  
  1236. break;
  1237. case (char(112)):
  1238. buttonP->BackColor = System::Drawing::Color::LightBlue;
  1239. if (wcisniety[15] == false) {
  1240. button11_Click(sender, e);
  1241. wcisniety[15] = true;
  1242. }
  1243.  
  1244. break;
  1245. case (char(45)):
  1246. buttonMIN->BackColor = System::Drawing::Color::SteelBlue;
  1247. if (wcisniety[16] == false) {
  1248. button11a_Click(sender, e);
  1249. wcisniety[16] = true;
  1250. }
  1251. break;
  1252. case (char(91)):
  1253. buttonZN1->BackColor = System::Drawing::Color::LightBlue;
  1254. if (wcisniety[17] == false) {
  1255. button12_Click(sender, e);
  1256. wcisniety[17] = true;
  1257. }
  1258.  
  1259. break;
  1260. case (char(61)):
  1261. buttonROW->BackColor = System::Drawing::Color::SteelBlue;
  1262. if (wcisniety[18] == false) {
  1263. button12a_Click(sender, e);
  1264. wcisniety[18] = true;
  1265. }
  1266.  
  1267. break;
  1268. case (char(93)):
  1269. buttonZN2->BackColor = System::Drawing::Color::LightBlue;
  1270. if (wcisniety[19] == false) {
  1271. button13_Click(sender, e);
  1272. wcisniety[19] = true;
  1273. }
  1274.  
  1275. break;
  1276.  
  1277. /*case(Keys::Left):
  1278. trackBar1->Value-=1;*/
  1279. }
  1280.  
  1281. }
  1282.  
  1283. private:
  1284.  
  1285. System::Void Form1_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
  1286.  
  1287. }
  1288. private:
  1289.  
  1290. System::Void Form1_KeyUp(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
  1291. //na odcisniecie klawisza wraca do swojego naturalnego koloru
  1292. buttonQ->BackColor = System::Drawing::SystemColors::Control;
  1293. buttonQ->UseVisualStyleBackColor = true;
  1294. buttonW->BackColor = System::Drawing::SystemColors::Control;
  1295. buttonW->UseVisualStyleBackColor = true;
  1296. buttonE->BackColor = System::Drawing::SystemColors::Control;
  1297. buttonE->UseVisualStyleBackColor = true;
  1298. buttonR->BackColor = System::Drawing::SystemColors::Control;
  1299. buttonR->UseVisualStyleBackColor = true;
  1300. buttonT->BackColor = System::Drawing::SystemColors::Control;
  1301. buttonT->UseVisualStyleBackColor = true;
  1302. buttonY->BackColor = System::Drawing::SystemColors::Control;
  1303. buttonY->UseVisualStyleBackColor = true;
  1304. buttonU->BackColor = System::Drawing::SystemColors::Control;
  1305. buttonU->UseVisualStyleBackColor = true;
  1306. buttonI->BackColor = System::Drawing::SystemColors::Control;
  1307. buttonI->UseVisualStyleBackColor = true;
  1308. buttonO->BackColor = System::Drawing::SystemColors::Control;
  1309. buttonO->UseVisualStyleBackColor = true;
  1310. buttonP->BackColor = System::Drawing::SystemColors::Control;
  1311. buttonP->UseVisualStyleBackColor = true;
  1312. buttonZN1->BackColor = System::Drawing::SystemColors::Control;
  1313. buttonZN1->UseVisualStyleBackColor = true;
  1314. buttonZN2->BackColor = System::Drawing::SystemColors::Control;
  1315. buttonZN2->UseVisualStyleBackColor = true;
  1316.  
  1317. button2->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1318. button4->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1319. button5->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1320. button7->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1321. button8->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1322. button9->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1323. buttonMIN->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1324. buttonROW->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
  1325. for (int i = 0; i < 20; i++) wcisniety[i] = false;
  1326. }
  1327.  
  1328. private:
  1329.  
  1330. System::Void trackBar2_Scroll(System::Object^ sender, System::EventArgs^ e) {
  1331. }
  1332. public:
  1333.  
  1334. System::Void buttonPOD_Click(System::Object^ sender, System::EventArgs^ e) {
  1335. //przycisk PLAY
  1336. bool pauseSound = false;
  1337. String^ curItem;
  1338. if (listBox1->SelectedIndex >= 0) curItem = listBox1->SelectedItem->ToString();
  1339. //warunek zapewniajacy ze cos zostalo wybrane z listy podkladow (indeks wiekszy od zera, jak nic nie wybrane to indeks ma wartosc -1
  1340. //jesli wybrane mozemy pobrac nazwe tego co zostalo wybrane i przypisac to pod curItem.
  1341.  
  1342.  
  1343.  
  1344.  
  1345. /*KeyPressEventArgs^ a;
  1346. a->KeyChar=char(91);
  1347. Form1_KeyPress(sender,a);
  1348. button12_Click(sender,e);
  1349. Sleep(400);
  1350. button10_Click(sender,e);
  1351. Sleep(300);
  1352. button10_Click(sender,e);
  1353. Sleep(300);*/
  1354. /*FMOD::Channel *kanal1;*/
  1355.  
  1356.  
  1357. channel->isPlaying(&pauseSound); //pobieramy czy jakis podklad jest spauzowany
  1358. switch (pauseSound) {
  1359.  
  1360. case (true): //jezeli tak to go "odpauzowujemy" czyli ustawiamy pauze na false
  1361. channel->setPaused(false);
  1362. break;
  1363.  
  1364. default: //jezeli nie to sprawdzamy jaka melodia zostala wybrana i ja odtwarzamy playem2
  1365.  
  1366. if (curItem == "Melodia 1")channel = Play2(system, "03. Prelude, Act I Les Toreadors.wav");
  1367. else if (curItem == "Melodia 2")channel = Play2(system, "17. Tchaikovsky - Nutcracker Suite.wav");
  1368. else if (curItem == "Melodia 3")channel = Play2(system, "03. Prokofiev - Romeo & Juliet.wav");
  1369. else MessageBox::Show("Nie wybrano melodii.");
  1370. }
  1371. }
  1372. private:
  1373.  
  1374. System::Void buttonSTOP_Click(System::Object^ sender, System::EventArgs^ e) {
  1375. channel->stop(); //zatrzymujemy odtwarzanie podkladu
  1376. // system->release();
  1377. }
  1378. private:
  1379.  
  1380. System::Void checkedListBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
  1381. }
  1382. private:
  1383.  
  1384. System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
  1385. }
  1386. private:
  1387.  
  1388. System::Void buttonPAUSE_Click(System::Object^ sender, System::EventArgs^ e) {
  1389. channel->setPaused(true); //pauzujemy , ustawiamy pauze na true
  1390. }
  1391. };
  1392. }
Advertisement
Add Comment
Please, Sign In to add comment