Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <cstdio>
- #include <string>
- #include <Windows.h>
- #include <MMSystem.h>
- #include <stdio.h>
- #include <iostream>
- #include "fmod.hpp" //dodatkowa biblioteka zapewniajaca osbluge dzwiekow, w tym brzmienie kilku dzwiekow na raz;)
- #include "fmod.h"
- #include "fmod_errors.h"
- #include "fmod_codec.h"
- #include "fmod_dsp.h"
- #include "fmod_memoryinfo.h"
- #include "fmod_output.h"
- #pragma comment (lib, "fmodex_vc.lib") //biblioteka fmod
- using namespace std;
- const int N = 60;
- const int K = 20;
- // Deklaracja tablicy dźwięków
- FMOD::Sound *dzwieki[N];
- // Deklaracja tablicy kanałów
- FMOD::Channel *kanaly[N];
- // Tablica zmiennych typu bool
- bool wcisniety[K];
- namespace piano2 {
- using namespace System;
- using namespace System::ComponentModel;
- using namespace System::Collections;
- using namespace System::Windows::Forms;
- using namespace System::Data;
- using namespace System::Drawing;
- using namespace System::Media;
- using namespace std;
- /// <summary>
- /// Form1 jest tym wlasnie okienkiem, ktore nam wyskakuje z calym interfejsem - pianinem
- /// </summary>
- public
- ref class Form1 : public System::Windows::Forms::Form {
- public:
- Form1(void) {
- InitializeComponent();
- }
- protected:
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- ~Form1() {
- if (components) {
- delete components;
- }
- system->release(); //czyszczenie pamieci po calym fmodzie, chyba dziala...
- }
- //deklarowanie zmiennych- obiektow skladajacych sie na forme
- private:
- Microsoft::VisualBasic::PowerPacks::ShapeContainer^ shapeContainer1;
- private:
- Microsoft::VisualBasic::PowerPacks::RectangleShape^ rectangleShape1;
- private:
- System::Windows::Forms::Button^ buttonW;
- private:
- System::Windows::Forms::Button^ buttonE;
- private:
- System::Windows::Forms::Button^ buttonR;
- private:
- System::Windows::Forms::Button^ buttonT;
- private:
- System::Windows::Forms::Button^ buttonP;
- private:
- System::Windows::Forms::Button^ buttonU;
- private:
- System::Windows::Forms::Button^ buttonZN1;
- private:
- System::Windows::Forms::Button^ buttonY;
- private:
- System::Windows::Forms::Button^ buttonI;
- private:
- System::Windows::Forms::Button^ buttonZN2;
- private:
- System::Windows::Forms::Button^ buttonO;
- private:
- System::Windows::Forms::Button^ button2;
- private:
- System::Windows::Forms::Button^ button7;
- private:
- System::Windows::Forms::Button^ button5;
- private:
- System::Windows::Forms::Button^ button4;
- private:
- System::Windows::Forms::Button^ button8;
- private:
- System::Windows::Forms::Button^ button9;
- private:
- System::Windows::Forms::Button^ buttonMIN;
- private:
- System::Windows::Forms::Button^ buttonROW;
- private:
- System::Windows::Forms::TrackBar^ trackBar1;
- private:
- System::Windows::Forms::Button^ buttonQ;
- private:
- Microsoft::VisualBasic::PowerPacks::RectangleShape^ rectangleShape2;
- private:
- System::Windows::Forms::Label^ label1;
- private:
- System::ComponentModel::IContainer^ components;
- private:
- System::Windows::Forms::Label^ label2;
- private:
- System::Windows::Forms::Label^ label3;
- private:
- System::Windows::Forms::Button^ buttonPOD;
- private:
- System::Windows::Forms::TrackBar^ trackBar2;
- private:
- System::Windows::Forms::Button^ buttonSTOP;
- private:
- System::Windows::Forms::ListBox^ listBox1;
- private:
- System::Windows::Forms::Button^ buttonPAUSE;
- //zmienne globalne potrzebne do uzycia fmod
- private:
- FMOD_RESULT result;
- private:
- FMOD::System *system;
- private:
- FMOD::Channel *channel;
- protected:
- private:
- /// <summary>
- /// Required designer variable.
- /// </summary>
- //przelozenie zmiennych-obiektow na "to co widoczne"
- #pragma region Windows Form Designer generated code
- #pragma comment( lib, "winmm.lib" )
- #pragma comment(lib,"user32.lib")
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- void InitializeComponent(void) {
- System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
- this->buttonW = (gcnew System::Windows::Forms::Button());
- this->buttonQ = (gcnew System::Windows::Forms::Button());
- this->buttonE = (gcnew System::Windows::Forms::Button());
- this->buttonR = (gcnew System::Windows::Forms::Button());
- this->buttonT = (gcnew System::Windows::Forms::Button());
- this->buttonP = (gcnew System::Windows::Forms::Button());
- this->buttonU = (gcnew System::Windows::Forms::Button());
- this->buttonZN1 = (gcnew System::Windows::Forms::Button());
- this->buttonY = (gcnew System::Windows::Forms::Button());
- this->buttonI = (gcnew System::Windows::Forms::Button());
- this->buttonZN2 = (gcnew System::Windows::Forms::Button());
- this->buttonO = (gcnew System::Windows::Forms::Button());
- this->button2 = (gcnew System::Windows::Forms::Button());
- this->button7 = (gcnew System::Windows::Forms::Button());
- this->button5 = (gcnew System::Windows::Forms::Button());
- this->button4 = (gcnew System::Windows::Forms::Button());
- this->button8 = (gcnew System::Windows::Forms::Button());
- this->button9 = (gcnew System::Windows::Forms::Button());
- this->buttonMIN = (gcnew System::Windows::Forms::Button());
- this->buttonROW = (gcnew System::Windows::Forms::Button());
- this->shapeContainer1 = (gcnew Microsoft::VisualBasic::PowerPacks::ShapeContainer());
- this->rectangleShape2 = (gcnew Microsoft::VisualBasic::PowerPacks::RectangleShape());
- this->rectangleShape1 = (gcnew Microsoft::VisualBasic::PowerPacks::RectangleShape());
- this->trackBar1 = (gcnew System::Windows::Forms::TrackBar());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->trackBar2 = (gcnew System::Windows::Forms::TrackBar());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->buttonPOD = (gcnew System::Windows::Forms::Button());
- this->buttonSTOP = (gcnew System::Windows::Forms::Button());
- this->listBox1 = (gcnew System::Windows::Forms::ListBox());
- this->buttonPAUSE = (gcnew System::Windows::Forms::Button());
- (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar1))->BeginInit();
- (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar2))->BeginInit();
- this->SuspendLayout();
- //
- // buttonW
- //
- this->buttonW->AllowDrop = true;
- this->buttonW->AutoEllipsis = true;
- this->buttonW->BackColor = System::Drawing::SystemColors::Control;
- this->buttonW->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonW->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonW->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonW->ImageKey = L"(none)";
- this->buttonW->Location = System::Drawing::Point(118, 24);
- this->buttonW->Name = L"buttonW";
- this->buttonW->RightToLeft = System::Windows::Forms::RightToLeft::No;
- this->buttonW->Size = System::Drawing::Size(50, 268);
- this->buttonW->TabIndex = 0;
- this->buttonW->Text = L"W";
- this->buttonW->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonW->UseCompatibleTextRendering = true;
- this->buttonW->UseVisualStyleBackColor = true;
- this->buttonW->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
- this->buttonW->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonQ
- //
- this->buttonQ->AllowDrop = true;
- this->buttonQ->AutoEllipsis = true;
- this->buttonQ->BackColor = System::Drawing::SystemColors::Control;
- this->buttonQ->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonQ->Cursor = System::Windows::Forms::Cursors::Hand;
- this->buttonQ->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte> (238)));
- this->buttonQ->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonQ->Location = System::Drawing::Point(64, 24);
- this->buttonQ->Name = L"buttonQ";
- this->buttonQ->Size = System::Drawing::Size(50, 268);
- this->buttonQ->TabIndex = 0;
- this->buttonQ->Text = L"Q";
- this->buttonQ->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonQ->UseCompatibleTextRendering = true;
- this->buttonQ->UseVisualStyleBackColor = true;
- this->buttonQ->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
- this->buttonQ->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonE
- //
- this->buttonE->AllowDrop = true;
- this->buttonE->AutoEllipsis = true;
- this->buttonE->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonE->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonE->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonE->Location = System::Drawing::Point(172, 24);
- this->buttonE->Name = L"buttonE";
- this->buttonE->Size = System::Drawing::Size(50, 268);
- this->buttonE->TabIndex = 0;
- this->buttonE->Text = L" E";
- this->buttonE->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonE->UseCompatibleTextRendering = true;
- this->buttonE->UseVisualStyleBackColor = true;
- this->buttonE->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
- this->buttonE->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonR
- //
- this->buttonR->AllowDrop = true;
- this->buttonR->AutoEllipsis = true;
- this->buttonR->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonR->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonR->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonR->Location = System::Drawing::Point(226, 24);
- this->buttonR->Name = L"buttonR";
- this->buttonR->Size = System::Drawing::Size(50, 268);
- this->buttonR->TabIndex = 0;
- this->buttonR->Text = L" R";
- this->buttonR->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonR->UseCompatibleTextRendering = true;
- this->buttonR->UseVisualStyleBackColor = true;
- this->buttonR->Click += gcnew System::EventHandler(this, &Form1::button5_Click);
- this->buttonR->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonT
- //
- this->buttonT->AllowDrop = true;
- this->buttonT->AutoEllipsis = true;
- this->buttonT->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonT->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonT->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonT->Location = System::Drawing::Point(280, 24);
- this->buttonT->Name = L"buttonT";
- this->buttonT->Size = System::Drawing::Size(50, 268);
- this->buttonT->TabIndex = 0;
- this->buttonT->Text = L" T";
- this->buttonT->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonT->UseCompatibleTextRendering = true;
- this->buttonT->UseVisualStyleBackColor = true;
- this->buttonT->Click += gcnew System::EventHandler(this, &Form1::button6_Click);
- this->buttonT->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonP
- //
- this->buttonP->AllowDrop = true;
- this->buttonP->AutoEllipsis = true;
- this->buttonP->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonP->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonP->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonP->Location = System::Drawing::Point(551, 24);
- this->buttonP->Name = L"buttonP";
- this->buttonP->Size = System::Drawing::Size(50, 268);
- this->buttonP->TabIndex = 0;
- this->buttonP->Text = L" P";
- this->buttonP->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonP->UseCompatibleTextRendering = true;
- this->buttonP->UseVisualStyleBackColor = true;
- this->buttonP->Click += gcnew System::EventHandler(this, &Form1::button11_Click);
- this->buttonP->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonU
- //
- this->buttonU->AllowDrop = true;
- this->buttonU->AutoEllipsis = true;
- this->buttonU->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonU->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonU->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonU->Location = System::Drawing::Point(388, 24);
- this->buttonU->Name = L"buttonU";
- this->buttonU->Size = System::Drawing::Size(50, 268);
- this->buttonU->TabIndex = 0;
- this->buttonU->Text = L"U";
- this->buttonU->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonU->UseCompatibleTextRendering = true;
- this->buttonU->UseVisualStyleBackColor = true;
- this->buttonU->Click += gcnew System::EventHandler(this, &Form1::button8_Click);
- this->buttonU->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonZN1
- //
- this->buttonZN1->AllowDrop = true;
- this->buttonZN1->AutoEllipsis = true;
- this->buttonZN1->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonZN1->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonZN1->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonZN1->Location = System::Drawing::Point(605, 24);
- this->buttonZN1->Name = L"buttonZN1";
- this->buttonZN1->Size = System::Drawing::Size(50, 268);
- this->buttonZN1->TabIndex = 0;
- this->buttonZN1->Text = L" [";
- this->buttonZN1->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonZN1->UseCompatibleTextRendering = true;
- this->buttonZN1->UseVisualStyleBackColor = true;
- this->buttonZN1->Click += gcnew System::EventHandler(this, &Form1::button12_Click);
- this->buttonZN1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonY
- //
- this->buttonY->AllowDrop = true;
- this->buttonY->AutoEllipsis = true;
- this->buttonY->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonY->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonY->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonY->Location = System::Drawing::Point(334, 24);
- this->buttonY->Name = L"buttonY";
- this->buttonY->Size = System::Drawing::Size(50, 268);
- this->buttonY->TabIndex = 0;
- this->buttonY->Text = L" Y";
- this->buttonY->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonY->UseCompatibleTextRendering = true;
- this->buttonY->UseVisualStyleBackColor = true;
- this->buttonY->Click += gcnew System::EventHandler(this, &Form1::button7_Click);
- this->buttonY->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonI
- //
- this->buttonI->AllowDrop = true;
- this->buttonI->AutoEllipsis = true;
- this->buttonI->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonI->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonI->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonI->Location = System::Drawing::Point(442, 24);
- this->buttonI->Name = L"buttonI";
- this->buttonI->Size = System::Drawing::Size(50, 268);
- this->buttonI->TabIndex = 0;
- this->buttonI->Text = L" I";
- this->buttonI->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonI->UseCompatibleTextRendering = true;
- this->buttonI->UseVisualStyleBackColor = true;
- this->buttonI->Click += gcnew System::EventHandler(this, &Form1::button9_Click);
- this->buttonI->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonZN2
- //
- this->buttonZN2->AllowDrop = true;
- this->buttonZN2->AutoEllipsis = true;
- this->buttonZN2->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonZN2->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonZN2->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonZN2->Location = System::Drawing::Point(659, 24);
- this->buttonZN2->Name = L"buttonZN2";
- this->buttonZN2->Size = System::Drawing::Size(50, 268);
- this->buttonZN2->TabIndex = 0;
- this->buttonZN2->Text = L" ]";
- this->buttonZN2->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonZN2->UseCompatibleTextRendering = true;
- this->buttonZN2->UseVisualStyleBackColor = true;
- this->buttonZN2->Click += gcnew System::EventHandler(this, &Form1::button13_Click);
- this->buttonZN2->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonO
- //
- this->buttonO->AllowDrop = true;
- this->buttonO->AutoEllipsis = true;
- this->buttonO->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonO->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonO->ForeColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonO->Location = System::Drawing::Point(497, 24);
- this->buttonO->Name = L"buttonO";
- this->buttonO->Size = System::Drawing::Size(50, 268);
- this->buttonO->TabIndex = 0;
- this->buttonO->Text = L" O";
- this->buttonO->TextAlign = System::Drawing::ContentAlignment::BottomCenter;
- this->buttonO->UseCompatibleTextRendering = true;
- this->buttonO->UseVisualStyleBackColor = true;
- this->buttonO->Click += gcnew System::EventHandler(this, &Form1::button10_Click);
- this->buttonO->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // button2
- //
- this->button2->AllowDrop = true;
- this->button2->AutoEllipsis = true;
- this->button2->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->button2->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->button2->DialogResult = System::Windows::Forms::DialogResult::Cancel;
- this->button2->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->button2->ForeColor = System::Drawing::SystemColors::Control;
- this->button2->Location = System::Drawing::Point(100, 24);
- this->button2->Name = L"button2";
- this->button2->Size = System::Drawing::Size(35, 168);
- this->button2->TabIndex = 0;
- this->button2->Text = L" 2";
- this->button2->UseCompatibleTextRendering = true;
- this->button2->UseVisualStyleBackColor = false;
- this->button2->Click += gcnew System::EventHandler(this, &Form1::button2a_Click);
- this->button2->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // button7
- //
- this->button7->AllowDrop = true;
- this->button7->AutoEllipsis = true;
- this->button7->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->button7->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->button7->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->button7->ForeColor = System::Drawing::SystemColors::Control;
- this->button7->Location = System::Drawing::Point(370, 24);
- this->button7->Name = L"button7";
- this->button7->Size = System::Drawing::Size(35, 168);
- this->button7->TabIndex = 0;
- this->button7->Text = L" 7";
- this->button7->UseCompatibleTextRendering = true;
- this->button7->UseVisualStyleBackColor = false;
- this->button7->Click += gcnew System::EventHandler(this, &Form1::button7a_Click);
- this->button7->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // button5
- //
- this->button5->AllowDrop = true;
- this->button5->AutoEllipsis = true;
- this->button5->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->button5->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->button5->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->button5->ForeColor = System::Drawing::SystemColors::Control;
- this->button5->Location = System::Drawing::Point(262, 24);
- this->button5->Name = L"button5";
- this->button5->Size = System::Drawing::Size(35, 168);
- this->button5->TabIndex = 0;
- this->button5->Text = L" 5";
- this->button5->UseCompatibleTextRendering = true;
- this->button5->UseVisualStyleBackColor = false;
- this->button5->Click += gcnew System::EventHandler(this, &Form1::button5a_Click);
- this->button5->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // button4
- //
- this->button4->AllowDrop = true;
- this->button4->AutoEllipsis = true;
- this->button4->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->button4->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->button4->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->button4->ForeColor = System::Drawing::SystemColors::Control;
- this->button4->Location = System::Drawing::Point(208, 24);
- this->button4->Name = L"button4";
- this->button4->Size = System::Drawing::Size(35, 168);
- this->button4->TabIndex = 0;
- this->button4->Text = L" 4";
- this->button4->UseCompatibleTextRendering = true;
- this->button4->UseVisualStyleBackColor = false;
- this->button4->Click += gcnew System::EventHandler(this, &Form1::button4a_Click);
- this->button4->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // button8
- //
- this->button8->AllowDrop = true;
- this->button8->AutoEllipsis = true;
- this->button8->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->button8->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->button8->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->button8->ForeColor = System::Drawing::SystemColors::Control;
- this->button8->Location = System::Drawing::Point(424, 24);
- this->button8->Name = L"button8";
- this->button8->Size = System::Drawing::Size(35, 168);
- this->button8->TabIndex = 0;
- this->button8->Text = L" 8";
- this->button8->UseCompatibleTextRendering = true;
- this->button8->UseVisualStyleBackColor = false;
- this->button8->Click += gcnew System::EventHandler(this, &Form1::button8a_Click);
- this->button8->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // button9
- //
- this->button9->AllowDrop = true;
- this->button9->AutoEllipsis = true;
- this->button9->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->button9->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->button9->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->button9->ForeColor = System::Drawing::SystemColors::Control;
- this->button9->Location = System::Drawing::Point(478, 24);
- this->button9->Margin = System::Windows::Forms::Padding(0);
- this->button9->Name = L"button9";
- this->button9->Size = System::Drawing::Size(35, 168);
- this->button9->TabIndex = 0;
- this->button9->Text = L" 9";
- this->button9->UseCompatibleTextRendering = true;
- this->button9->UseVisualStyleBackColor = false;
- this->button9->Click += gcnew System::EventHandler(this, &Form1::button9a_Click);
- this->button9->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonMIN
- //
- this->buttonMIN->AllowDrop = true;
- this->buttonMIN->AutoEllipsis = true;
- this->buttonMIN->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonMIN->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonMIN->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonMIN->ForeColor = System::Drawing::SystemColors::Control;
- this->buttonMIN->Location = System::Drawing::Point(586, 24);
- this->buttonMIN->Margin = System::Windows::Forms::Padding(0);
- this->buttonMIN->Name = L"buttonMIN";
- this->buttonMIN->Size = System::Drawing::Size(35, 168);
- this->buttonMIN->TabIndex = 0;
- this->buttonMIN->Text = L" -";
- this->buttonMIN->UseCompatibleTextRendering = true;
- this->buttonMIN->UseVisualStyleBackColor = false;
- this->buttonMIN->Click += gcnew System::EventHandler(this, &Form1::button11a_Click);
- this->buttonMIN->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // buttonROW
- //
- this->buttonROW->AllowDrop = true;
- this->buttonROW->AutoEllipsis = true;
- this->buttonROW->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->buttonROW->BackgroundImageLayout = System::Windows::Forms::ImageLayout::None;
- this->buttonROW->Font = (gcnew System::Drawing::Font(L"Courier New", 20.25F));
- this->buttonROW->ForeColor = System::Drawing::SystemColors::Control;
- this->buttonROW->Location = System::Drawing::Point(640, 24);
- this->buttonROW->Margin = System::Windows::Forms::Padding(0);
- this->buttonROW->Name = L"buttonROW";
- this->buttonROW->Size = System::Drawing::Size(35, 168);
- this->buttonROW->TabIndex = 0;
- this->buttonROW->Text = L"=";
- this->buttonROW->UseCompatibleTextRendering = true;
- this->buttonROW->UseVisualStyleBackColor = false;
- this->buttonROW->Click += gcnew System::EventHandler(this, &Form1::button12a_Click);
- this->buttonROW->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // shapeContainer1
- //
- this->shapeContainer1->Location = System::Drawing::Point(0, 0);
- this->shapeContainer1->Margin = System::Windows::Forms::Padding(0);
- this->shapeContainer1->Name = L"shapeContainer1";
- this->shapeContainer1->Shapes->AddRange(gcnew cli::array < Microsoft::VisualBasic::PowerPacks::Shape^ >(2) {
- this->rectangleShape2,
- this->rectangleShape1
- });
- this->shapeContainer1->Size = System::Drawing::Size(765, 395);
- this->shapeContainer1->TabIndex = 1;
- this->shapeContainer1->TabStop = false;
- //
- // rectangleShape2
- //
- this->rectangleShape2->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- this->rectangleShape2->BackStyle = Microsoft::VisualBasic::PowerPacks::BackStyle::Opaque;
- this->rectangleShape2->CornerRadius = 2;
- this->rectangleShape2->FillColor = System::Drawing::Color::LightGray;
- this->rectangleShape2->FillGradientColor = System::Drawing::Color::White;
- this->rectangleShape2->FillGradientStyle = Microsoft::VisualBasic::PowerPacks::FillGradientStyle::Horizontal;
- this->rectangleShape2->FillStyle = Microsoft::VisualBasic::PowerPacks::FillStyle::Solid;
- this->rectangleShape2->Location = System::Drawing::Point(58, 319);
- this->rectangleShape2->Name = L"rectangleShape2";
- this->rectangleShape2->Size = System::Drawing::Size(230, 55);
- //
- // rectangleShape1
- //
- this->rectangleShape1->CornerRadius = 5;
- this->rectangleShape1->FillColor = System::Drawing::Color::Gray;
- this->rectangleShape1->FillGradientColor = System::Drawing::Color::Black;
- this->rectangleShape1->FillGradientStyle = Microsoft::VisualBasic::PowerPacks::FillGradientStyle::Vertical;
- this->rectangleShape1->FillStyle = Microsoft::VisualBasic::PowerPacks::FillStyle::Solid;
- this->rectangleShape1->Location = System::Drawing::Point(57, 17);
- this->rectangleShape1->Name = L"rectangleShape1";
- this->rectangleShape1->Size = System::Drawing::Size(658, 279);
- //
- // trackBar1
- //
- this->trackBar1->BackColor = System::Drawing::SystemColors::ButtonFace;
- this->trackBar1->Cursor = System::Windows::Forms::Cursors::Hand;
- this->trackBar1->LargeChange = 1;
- this->trackBar1->Location = System::Drawing::Point(64, 324);
- this->trackBar1->Maximum = 3;
- this->trackBar1->Minimum = 1;
- this->trackBar1->Name = L"trackBar1";
- this->trackBar1->Size = System::Drawing::Size(221, 45);
- this->trackBar1->TabIndex = 2;
- this->trackBar1->TickStyle = System::Windows::Forms::TickStyle::Both;
- this->trackBar1->Value = 2;
- this->trackBar1->Scroll += gcnew System::EventHandler(this, &Form1::trackBar1_Scroll);
- this->trackBar1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- //
- // label1
- //
- this->label1->AccessibleRole = System::Windows::Forms::AccessibleRole::Sound;
- this->label1->AutoSize = true;
- this->label1->BackColor = System::Drawing::Color::Transparent;
- this->label1->FlatStyle = System::Windows::Forms::FlatStyle::Flat;
- this->label1->Font = (gcnew System::Drawing::Font(L"Gabriola", 39.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte> (238)));
- this->label1->ForeColor = System::Drawing::Color::DarkRed;
- this->label1->Location = System::Drawing::Point(680, 298);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(61, 97);
- this->label1->TabIndex = 3;
- this->label1->Text = L"a";
- this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
- //
- // trackBar2
- //
- this->trackBar2->LargeChange = 1;
- this->trackBar2->Location = System::Drawing::Point(12, 24);
- this->trackBar2->Name = L"trackBar2";
- this->trackBar2->Orientation = System::Windows::Forms::Orientation::Vertical;
- this->trackBar2->Size = System::Drawing::Size(45, 268);
- this->trackBar2->TabIndex = 4;
- this->trackBar2->Value = 7;
- this->trackBar2->Scroll += gcnew System::EventHandler(this, &Form1::trackBar2_Scroll);
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Font = (gcnew System::Drawing::Font(L"Courier New", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte> (238)));
- this->label2->Location = System::Drawing::Point(9, 9);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(40, 16);
- this->label2->TabIndex = 5;
- this->label2->Text = L"Vol:";
- //
- // label3
- //
- this->label3->AutoSize = true;
- this->label3->Font = (gcnew System::Drawing::Font(L"Courier New", 9.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte> (238)));
- this->label3->Location = System::Drawing::Point(223, 362);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(56, 16);
- this->label3->TabIndex = 6;
- this->label3->Text = L"Oktawa";
- //
- // buttonPOD
- //
- this->buttonPOD->Location = System::Drawing::Point(334, 347);
- this->buttonPOD->Name = L"buttonPOD";
- this->buttonPOD->Size = System::Drawing::Size(44, 32);
- this->buttonPOD->TabIndex = 7;
- this->buttonPOD->Text = L"PLAY";
- this->buttonPOD->UseVisualStyleBackColor = true;
- this->buttonPOD->Click += gcnew System::EventHandler(this, &Form1::buttonPOD_Click);
- //
- // buttonSTOP
- //
- this->buttonSTOP->Location = System::Drawing::Point(427, 347);
- this->buttonSTOP->Name = L"buttonSTOP";
- this->buttonSTOP->Size = System::Drawing::Size(44, 32);
- this->buttonSTOP->TabIndex = 8;
- this->buttonSTOP->Text = L"STOP";
- this->buttonSTOP->UseVisualStyleBackColor = true;
- this->buttonSTOP->Click += gcnew System::EventHandler(this, &Form1::buttonSTOP_Click);
- //
- // listBox1
- //
- this->listBox1->BackColor = System::Drawing::Color::White;
- this->listBox1->Font = (gcnew System::Drawing::Font(L"Courier New", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte> (238)));
- this->listBox1->FormattingEnabled = true;
- this->listBox1->ItemHeight = 18;
- this->listBox1->Items->AddRange(gcnew cli::array < System::Object^ >(3) {
- L"Melodia 1", L"Melodia 2", L"Melodia 3"
- });
- this->listBox1->Location = System::Drawing::Point(334, 319);
- this->listBox1->Name = L"listBox1";
- this->listBox1->Size = System::Drawing::Size(137, 22);
- this->listBox1->TabIndex = 10;
- this->listBox1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::listBox1_SelectedIndexChanged);
- //
- // buttonPAUSE
- //
- this->buttonPAUSE->Location = System::Drawing::Point(376, 347);
- this->buttonPAUSE->Name = L"buttonPAUSE";
- this->buttonPAUSE->Size = System::Drawing::Size(53, 32);
- this->buttonPAUSE->TabIndex = 11;
- this->buttonPAUSE->Text = L"PAUSE";
- this->buttonPAUSE->UseVisualStyleBackColor = true;
- this->buttonPAUSE->Click += gcnew System::EventHandler(this, &Form1::buttonPAUSE_Click);
- //
- // Form1
- //
- this->AllowDrop = true;
- this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->BackgroundImage = (cli::safe_cast < System::Drawing::Image^ >(resources->GetObject(L"$this.BackgroundImage")));
- this->ClientSize = System::Drawing::Size(765, 395);
- this->Controls->Add(this->buttonPAUSE);
- this->Controls->Add(this->listBox1);
- this->Controls->Add(this->buttonSTOP);
- this->Controls->Add(this->buttonPOD);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->trackBar2);
- this->Controls->Add(this->label1);
- this->Controls->Add(this->trackBar1);
- this->Controls->Add(this->buttonROW);
- this->Controls->Add(this->buttonMIN);
- this->Controls->Add(this->button9);
- this->Controls->Add(this->button2);
- this->Controls->Add(this->button8);
- this->Controls->Add(this->button4);
- this->Controls->Add(this->button5);
- this->Controls->Add(this->button7);
- this->Controls->Add(this->buttonR);
- this->Controls->Add(this->buttonO);
- this->Controls->Add(this->buttonE);
- this->Controls->Add(this->buttonZN2);
- this->Controls->Add(this->buttonQ);
- this->Controls->Add(this->buttonI);
- this->Controls->Add(this->buttonW);
- this->Controls->Add(this->buttonY);
- this->Controls->Add(this->buttonZN1);
- this->Controls->Add(this->buttonU);
- this->Controls->Add(this->buttonP);
- this->Controls->Add(this->buttonT);
- this->Controls->Add(this->shapeContainer1);
- this->Cursor = System::Windows::Forms::Cursors::Hand;
- this->DoubleBuffered = true;
- this->HelpButton = true;
- this->Icon = (cli::safe_cast < System::Drawing::Icon^ >(resources->GetObject(L"$this.Icon")));
- this->ImeMode = System::Windows::Forms::ImeMode::Close;
- this->KeyPreview = true;
- this->MaximizeBox = false;
- this->Name = L"Form1";
- this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
- this->Text = L"Pianino by MMM";
- this->TransparencyKey = System::Drawing::Color::FromArgb(static_cast<System::Int32> (static_cast<System::Byte> (224)), static_cast<System::Int32> (static_cast<System::Byte> (224)),
- static_cast<System::Int32> (static_cast<System::Byte> (224)));
- this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
- this->KeyDown += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyDown);
- this->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler(this, &Form1::Form1_KeyPress);
- this->KeyUp += gcnew System::Windows::Forms::KeyEventHandler(this, &Form1::Form1_KeyUp);
- (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar1))->EndInit();
- (cli::safe_cast < System::ComponentModel::ISupportInitialize^ >(this->trackBar2))->EndInit();
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- public:
- FMOD::System * Sound_init(FMOD::System * asd) //zainicjowanie dzwieku, robimy tylko raz
- {
- this->result = FMOD::System_Create(&asd); // Create the main system object.
- if (this->result != FMOD_OK) //obsluga bledow
- {
- MessageBox::Show("FMOD error! (%d) %s\n");
- }
- this->result = asd->init(1000, FMOD_INIT_NORMAL, 0); // Initialize FMOD.
- if (this->result != FMOD_OK) {
- MessageBox::Show("FMOD error! (%d) %s\n");
- }
- return asd;
- }
- public:
- System::Void Play(FMOD::System *asd, int nr) //funkcja odtwarzajaca dzwiek
- {
- //FMOD::Channel *kanal;
- float volume;
- volume = (float) (trackBar2->Value) / 10; //pobiera wartosc trackbara2 suwaka od glosnosci, dzieli przez 10 bo setVolume przybiera wartosci od (0.0-1.0)
- //this->result=asd->createSound(path,FMOD_SOFTWARE, 0, &dzwiek);
- if (this->result != FMOD_OK) {
- MessageBox::Show("FMOD error! asdasd");
- }
- asd->playSound(FMOD_CHANNEL_FREE, dzwieki[nr], false, &kanaly[nr]); //odtwarza dzwiek na wolnym kanale
- kanaly[nr]->setVolume(volume); //ustawiamy glosnosc
- asd->update(); //b.wazne i potrzebne bez tego dzwiek cichnie po 16 odtworzeniach : ) dziwna sprawa.
- }
- public:
- FMOD::Channel* Play2(FMOD::System *asd, char * path) //druga wersja play na potrzeby odtwarzania podkladu i mozliosci pauzowania
- {
- FMOD::Channel *kanal;
- FMOD::Sound *dzwiek;
- float volume;
- volume = (float) (trackBar2->Value) / 10;
- this->result = asd->createSound(path, FMOD_SOFTWARE, 0, &dzwiek);
- if (this->result != FMOD_OK) {
- MessageBox::Show("FMOD error! asdasd");
- }
- asd->playSound(FMOD_CHANNEL_FREE, dzwiek, false, &kanal);
- kanal->setVolume(volume);
- asd->update();
- return kanal;
- }
- public:
- System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) { //
- label1->Text = L"a "; //wyswietlanie dzwieku granego z boku
- if (trackBar1->Value == 1) //zaleznosc od ustawionej gamy na trackbarze1
- {
- this->Play(system, 0);
- } else if (trackBar1->Value == 2) {
- this->Play(system, 0);
- } else if (trackBar1->Value == 3) {
- this->Play(system, 0);
- }
- }
- public:
- System::Void button2a_Click(System::Object^ sender, System::EventArgs^ e) { //
- label1->Text = L"a# ";
- if (trackBar1->Value == 1)
- this->Play(system, 1);
- else if (trackBar1->Value == 2)
- this->Play(system, 1);
- else if (trackBar1->Value == 3)
- this->Play(system, 1);
- }
- private:
- System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"h ";
- if (trackBar1->Value == 1)
- this->Play(system, 2);
- else if (trackBar1->Value == 2)
- this->Play(system, 2);
- else if (trackBar1->Value == 3)
- this->Play(system, 2);
- }
- private:
- System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"c ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button4a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"c#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"d ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button5a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"d#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button6_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"e ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button7_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"f ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button7a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"f#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button8_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"g ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button8a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"g#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button9_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"a ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button9a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"a#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button10_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"h ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button11_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"c ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button11a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"c#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button12_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"d ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button12a_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"d#";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void button13_Click(System::Object^ sender, System::EventArgs^ e) {
- label1->Text = L"e ";
- if (trackBar1->Value == 1)
- this->Play(system, 0);
- else if (trackBar1->Value == 2)
- this->Play(system, 0);
- else if (trackBar1->Value == 3)
- this->Play(system, 0);
- }
- private:
- System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
- this->system = this->Sound_init(this->system); //bardzo dobre miejsce do zainicjowania dzwieku tylko raz w programie
- // tablica nazw dzwiekow
- char* nazwy [N];
- FMOD::System *asd = system;
- for (int i; i < 20; i++) nazwy[i] = new char [8];
- nazwy [0] = "a1.wav";
- nazwy [1] = "a2.wav";
- nazwy [2] = "a3.wav";
- nazwy [3] = "a1#.wav";
- nazwy [4] = "a2#.wav";
- nazwy [5] = "a3#.wav";
- nazwy [6] = "h1.wav";
- nazwy [7] = "h2.wav";
- nazwy [8] = "h3.wav";
- nazwy [9] = "a1.wav";
- nazwy [10] = "a1.wav";
- nazwy [11] = "a1.wav";
- nazwy [12] = "a1.wav";
- nazwy [13] = "a1.wav";
- nazwy [14] = "a1.wav";
- nazwy [15] = "a1.wav";
- nazwy [16] = "a1.wav";
- nazwy [17] = "a1.wav";
- nazwy [18] = "a1.wav";
- nazwy [19] = "a1.wav";
- // Tworzymy obiekty
- for (int i = 0; i < 20; i++) {
- this->result = asd->createSound(nazwy[i], FMOD_SOFTWARE, 0, &dzwieki[i]);
- }
- if (this->result != FMOD_OK) {
- MessageBox::Show("FMOD error! asdasd");
- }
- }
- private:
- System::Void trackBar1_Scroll(System::Object^ sender, System::EventArgs^ e) {
- }
- private:
- System::Void Form1_KeyPress(System::Object^ sender, System::Windows::Forms::KeyPressEventArgs^ e) {
- //wylapuje wcisniete klawisze na klawiaturze i odpowiednio gra oraz zmienia kolor klawisza
- switch (e->KeyChar) {
- case (char(113)):
- buttonQ->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[0] == false) {
- button2_Click(sender, e);
- wcisniety[0] = true;
- }
- break;
- case (char(50)):
- button2->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[1] == false) {
- button2a_Click(sender, e);
- wcisniety[1] = true;
- }
- break;
- case (char(119)):
- buttonW->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[2] == false) {
- button3_Click(sender, e);
- wcisniety[2] = true;
- }
- break;
- case (char(101)):
- buttonE->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[3] == false) {
- button4_Click(sender, e);
- wcisniety[3] = true;
- }
- break;
- case (char(52)):
- button4->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[4] == false) {
- button4a_Click(sender, e);
- wcisniety[4] = true;
- }
- break;
- case (char(114)):
- buttonR->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[5] == false) {
- button5_Click(sender, e);
- wcisniety[5] = true;
- }
- break;
- case (char(53)):
- button5->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[6] == false) {
- button5a_Click(sender, e);
- wcisniety[6] = true;
- }
- break;
- case (char(116)):
- buttonT->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[7] == false) {
- button6_Click(sender, e);
- wcisniety[7] = true;
- }
- break;
- case (char(121)):
- buttonY->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[8] == false) {
- button7_Click(sender, e);
- wcisniety[8] = true;
- }
- break;
- case (char(55)):
- button7->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[9] == false) {
- button7a_Click(sender, e);
- wcisniety[9] = true;
- }
- break;
- case (char(117)):
- buttonU->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[10] == false) {
- button8_Click(sender, e);
- wcisniety[10] = true;
- }
- break;
- case (char(56)):
- button8->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[11] == false) {
- button8a_Click(sender, e);
- wcisniety[11] = true;
- }
- break;
- case (char(105)):
- buttonI->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[12] == false) {
- button9_Click(sender, e);
- wcisniety[12] = true;
- }
- break;
- case (char(57)):
- button9->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[13] == false) {
- button9a_Click(sender, e);
- wcisniety[13] = true;
- }
- break;
- case (char(111)):
- buttonO->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[14] == false) {
- button10_Click(sender, e);
- wcisniety[14] = true;
- }
- break;
- case (char(112)):
- buttonP->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[15] == false) {
- button11_Click(sender, e);
- wcisniety[15] = true;
- }
- break;
- case (char(45)):
- buttonMIN->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[16] == false) {
- button11a_Click(sender, e);
- wcisniety[16] = true;
- }
- break;
- case (char(91)):
- buttonZN1->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[17] == false) {
- button12_Click(sender, e);
- wcisniety[17] = true;
- }
- break;
- case (char(61)):
- buttonROW->BackColor = System::Drawing::Color::SteelBlue;
- if (wcisniety[18] == false) {
- button12a_Click(sender, e);
- wcisniety[18] = true;
- }
- break;
- case (char(93)):
- buttonZN2->BackColor = System::Drawing::Color::LightBlue;
- if (wcisniety[19] == false) {
- button13_Click(sender, e);
- wcisniety[19] = true;
- }
- break;
- /*case(Keys::Left):
- trackBar1->Value-=1;*/
- }
- }
- private:
- System::Void Form1_KeyDown(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
- }
- private:
- System::Void Form1_KeyUp(System::Object^ sender, System::Windows::Forms::KeyEventArgs^ e) {
- //na odcisniecie klawisza wraca do swojego naturalnego koloru
- buttonQ->BackColor = System::Drawing::SystemColors::Control;
- buttonQ->UseVisualStyleBackColor = true;
- buttonW->BackColor = System::Drawing::SystemColors::Control;
- buttonW->UseVisualStyleBackColor = true;
- buttonE->BackColor = System::Drawing::SystemColors::Control;
- buttonE->UseVisualStyleBackColor = true;
- buttonR->BackColor = System::Drawing::SystemColors::Control;
- buttonR->UseVisualStyleBackColor = true;
- buttonT->BackColor = System::Drawing::SystemColors::Control;
- buttonT->UseVisualStyleBackColor = true;
- buttonY->BackColor = System::Drawing::SystemColors::Control;
- buttonY->UseVisualStyleBackColor = true;
- buttonU->BackColor = System::Drawing::SystemColors::Control;
- buttonU->UseVisualStyleBackColor = true;
- buttonI->BackColor = System::Drawing::SystemColors::Control;
- buttonI->UseVisualStyleBackColor = true;
- buttonO->BackColor = System::Drawing::SystemColors::Control;
- buttonO->UseVisualStyleBackColor = true;
- buttonP->BackColor = System::Drawing::SystemColors::Control;
- buttonP->UseVisualStyleBackColor = true;
- buttonZN1->BackColor = System::Drawing::SystemColors::Control;
- buttonZN1->UseVisualStyleBackColor = true;
- buttonZN2->BackColor = System::Drawing::SystemColors::Control;
- buttonZN2->UseVisualStyleBackColor = true;
- button2->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- button4->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- button5->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- button7->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- button8->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- button9->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- buttonMIN->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- buttonROW->BackColor = System::Drawing::SystemColors::ActiveCaptionText;
- for (int i = 0; i < 20; i++) wcisniety[i] = false;
- }
- private:
- System::Void trackBar2_Scroll(System::Object^ sender, System::EventArgs^ e) {
- }
- public:
- System::Void buttonPOD_Click(System::Object^ sender, System::EventArgs^ e) {
- //przycisk PLAY
- bool pauseSound = false;
- String^ curItem;
- if (listBox1->SelectedIndex >= 0) curItem = listBox1->SelectedItem->ToString();
- //warunek zapewniajacy ze cos zostalo wybrane z listy podkladow (indeks wiekszy od zera, jak nic nie wybrane to indeks ma wartosc -1
- //jesli wybrane mozemy pobrac nazwe tego co zostalo wybrane i przypisac to pod curItem.
- /*KeyPressEventArgs^ a;
- a->KeyChar=char(91);
- Form1_KeyPress(sender,a);
- button12_Click(sender,e);
- Sleep(400);
- button10_Click(sender,e);
- Sleep(300);
- button10_Click(sender,e);
- Sleep(300);*/
- /*FMOD::Channel *kanal1;*/
- channel->isPlaying(&pauseSound); //pobieramy czy jakis podklad jest spauzowany
- switch (pauseSound) {
- case (true): //jezeli tak to go "odpauzowujemy" czyli ustawiamy pauze na false
- channel->setPaused(false);
- break;
- default: //jezeli nie to sprawdzamy jaka melodia zostala wybrana i ja odtwarzamy playem2
- if (curItem == "Melodia 1")channel = Play2(system, "03. Prelude, Act I Les Toreadors.wav");
- else if (curItem == "Melodia 2")channel = Play2(system, "17. Tchaikovsky - Nutcracker Suite.wav");
- else if (curItem == "Melodia 3")channel = Play2(system, "03. Prokofiev - Romeo & Juliet.wav");
- else MessageBox::Show("Nie wybrano melodii.");
- }
- }
- private:
- System::Void buttonSTOP_Click(System::Object^ sender, System::EventArgs^ e) {
- channel->stop(); //zatrzymujemy odtwarzanie podkladu
- // system->release();
- }
- private:
- System::Void checkedListBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- private:
- System::Void listBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {
- }
- private:
- System::Void buttonPAUSE_Click(System::Object^ sender, System::EventArgs^ e) {
- channel->setPaused(true); //pauzujemy , ustawiamy pauze na true
- }
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment