.


:




:

































 

 

 

 


. 2. Assembler. ϳ




1. Delphi 7 / . . .. . - .: -, 2007. - 1216 .

2. Assembler. ϳ . 2- . - .: , 2007. - 637.

3. .. Delphi VCL. - .: -, 2006 . - 944 .

4. .. Delphi. - .: -, 2004. - 880 .

5. . Delphi. / г ; . . .. - 2- ., . - .: ; .: , 2004. - 384 .: .

6. Delphi 7, , . ,
.

7. . , Delphi 7 , . ϳ, 2005 .

8. . . - Delphi

˳

unit Aide_Clavier;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, jpeg, ExtCtrls, StdCtrls;

 

type

TForm2 = class(TForm)

GroupBox1: TGroupBox;

Image1: TImage;

GroupBox2: TGroupBox;

GroupBox3: TGroupBox;

GroupBox4: TGroupBox;

Label13: TLabel;

GroupBox5: TGroupBox;

Label15: TLabel;

Label16: TLabel;

Label17: TLabel;

Label18: TLabel;

Label19: TLabel;

GroupBox6: TGroupBox;

Label22: TLabel;

Label23: TLabel;

GroupBox7: TGroupBox;

Label1: TLabel;

Label2: TLabel;

GroupBox8: TGroupBox;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Label8: TLabel;

Label9: TLabel;

GroupBox9: TGroupBox;

Label10: TLabel;

Label11: TLabel;

Label12: TLabel;

procedure FormCreate(Sender: TObject);

private

{ Dclarations prives }

public

{ Dclarations publiques }

end;

 

var

Form2: TForm2;

 

implementation

 

{$R *.dfm}

 

procedure TForm2.FormCreate(Sender: TObject);

begin

 

end;

 

end.

unit Clavier_AZERTY;

 

interface

 

type

TKeys = Record

Key: Word;

Note: string;

Down: boolean;

end;

 

var

// QWERTY (2->Mi4)

Keys: Array[0..19] of TKeys =(

// :

(Key:81; Note:'La2'; Down:false), // q

(Key:87; Note:'Si2'; Down:false), // w

(Key:69; Note:'Do3'; Down:false), // e

(Key:82; Note:'Re3'; Down:false), // r

(Key:84; Note:'Mi3'; Down:false), // t

(Key:89; Note:'Fa3'; Down:false), // y

(Key:85; Note:'Sol3'; Down:false), // u

(Key:73; Note:'La3'; Down:false), // i

(Key:79; Note:'Si3'; Down:false), // o

(Key:80; Note:'Do4'; Down:false), // p

(Key:219; Note:'Re4'; Down:false), // [

(Key:221; Note:'Mi4'; Down:false), // ]

 

(Key:65; Note:'La2d'; Down:false), // a

(Key:68; Note:'Do3d'; Down:false), // d

(Key:70; Note:'Re3d'; Down:false), // f

(Key:72; Note:'Fa3d'; Down:false), // h

(Key:74; Note:'Sol3d'; Down:false), // j

(Key:75; Note:'La3d'; Down:false), // k

(Key:186; Note:'Do4d'; Down:false), //;

(Key:222; Note:'Re4d'; Down:false) // '

);

 

 

implementation

 

end.

unit Main;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms, Dialogs, ExtCtrls, StdCtrls, ComCtrls, jpeg,

mmSystem, Clavier_AZERTY, Musiques, Notes_Midi, Menus, ToolWin, ActnMan,

ActnCtrls, ActnMenus, Buttons, Aide_Clavier, pngimage, XPMan;

 

type

TForm1 = Class(TForm)

Systeme: TPanel;

imgSysteme: TImage;

imgDo1: TImage;

imgMi1: TImage;

imgRe1: TImage;

imgFa1: TImage;

imgSol1: TImage;

imgLa1: TImage;

imgSi1: TImage;

imgDo2: TImage;

imgRe2: TImage;

imgMi2: TImage;

imgFa2: TImage;

imgSol2: TImage;

imgLa2: TImage;

imgSi2: TImage;

imgDo3_2: TImage;

imgDo3_1: TImage;

imgRe3: TImage;

imgMi3: TImage;

imgFa3: TImage;

imgSol3: TImage;

imgLa3: TImage;

imgSi3: TImage;

imgDo4: TImage;

imgRe4: TImage;

imgMi4: TImage;

Image23: TImage;

Piano: TPanel;

La1: TShape;

Mi4: TShape;

Re4: TShape;

Do4: TShape;

Si4: TShape;

La4: TShape;

Sol4: TShape;

Fa4: TShape;

Mi3: TShape;

Re3: TShape;

Do3: TShape;

Si3: TShape;

La3: TShape;

Sol3: TShape;

Fa3: TShape;

Mi2: TShape;

Re2: TShape;

Do2: TShape;

Si2: TShape;

La2: TShape;

Sol2: TShape;

Fa2: TShape;

Mi1: TShape;

Re1: TShape;

Do1: TShape;

Si1: TShape;

Sol1: TShape;

Fa1: TShape;

Do1d: TShape;

Fa1d: TShape;

La1d: TShape;

Sol1d: TShape;

Re1d: TShape;

Fa2d: TShape;

La2d: TShape;

Sol2d: TShape;

Re2d: TShape;

Do2d: TShape;

Fa3d: TShape;

La3d: TShape;

Sol3d: TShape;

Re3d: TShape;

Do3d: TShape;

Fa4d: TShape;

La4d: TShape;

Sol4d: TShape;

Re4d: TShape;

Do4d: TShape;

Mi5: TShape;

Re5: TShape;

Do5: TShape;

Si5: TShape;

La5: TShape;

Sol5: TShape;

Fa5: TShape;

Re5d: TShape;

Fa5d: TShape;

La5d: TShape;

Sol5d: TShape;

Do5d: TShape;

Do6: TShape;

imgFa4: TImage;

imgSol4: TImage;

imgLa4: TImage;

imgSi4: TImage;

imgDo5: TImage;

imgDo1d: TImage;

imgRe1d: TImage;

imgFa1d: TImage;

imgSol1d: TImage;

imgLa1d: TImage;

imgDo2d: TImage;

imgRe2d: TImage;

imgFa2d: TImage;

imgSol2d: TImage;

imgLa2d: TImage;

imgDo3d_2: TImage;

imgDo3d_1: TImage;

imgRe3d: TImage;

imgFa3d: TImage;

imgSol3d: TImage;

imgLa3d: TImage;

imgDo4d: TImage;

imgRe4d: TImage;

imgFa4d: TImage;

imgSol4d: TImage;

imgLa4d: TImage;

imgDo5d: TImage;

GroupBox1: TGroupBox;

UpDown1: TUpDown;

lblInstrument: TLabel;

MainMenu1: TMainMenu;

Fic1: TMenuItem;

Edition1: TMenuItem;

Baloo1: TMenuItem;

Fermer1: TMenuItem;

Aide1: TMenuItem;

Player: TGroupBox;

btnPlay: TSpeedButton;

btnPause: TSpeedButton;

btnStop: TSpeedButton;

Groupe_Notes: TGroupBox;

Notes_Alterees: TPanel;

lblDo1d: TLabel;

lblRe1d: TLabel;

lblFa1d: TLabel;

lblSol1d: TLabel;

lblLa1d: TLabel;

lblDo2d: TLabel;

lblRe2d: TLabel;

lblFa2d: TLabel;

lblSol2d: TLabel;

lblLa2d: TLabel;

lblDo3d: TLabel;

lblRe3d: TLabel;

lblFa3d: TLabel;

lblSol3d: TLabel;

lblLa3d: TLabel;

lblDo4d: TLabel;

lblRe4d: TLabel;

lblFa4d: TLabel;

lblSol4d: TLabel;

lblLa4d: TLabel;

lblDo5d: TLabel;

lblRe5d: TLabel;

lblFa5d: TLabel;

lblSol5d: TLabel;

lblLa5d: TLabel;

Notes_Primaires: TPanel;

lblDo1: TLabel;

lblRe1: TLabel;

lblMi1: TLabel;

lblFa1: TLabel;

lblSol1: TLabel;

lblLa1: TLabel;

lblSi1: TLabel;

lblDo2: TLabel;

lblRe2: TLabel;

lblMi2: TLabel;

lblFa2: TLabel;

lblSol2: TLabel;

lblLa2: TLabel;

lblSi2: TLabel;

lblDo3: TLabel;

lblRe3: TLabel;

lblMi3: TLabel;

lblFa3: TLabel;

lblSol3: TLabel;

lblLa3: TLabel;

lblSi3: TLabel;

lblDo4: TLabel;

lblRe4: TLabel;

lblMi4: TLabel;

lblFa4: TLabel;

lblSol4: TLabel;

lblLa4: TLabel;

lblSi4: TLabel;

lblDo5: TLabel;

lblRe5: TLabel;

lblMi5: TLabel;

lblFa5: TLabel;

lblSol5: TLabel;

lblLa5: TLabel;

lblSi5: TLabel;

lblDo6: TLabel;

Image1: TImage;

lblNote: TLabel;

GroupBox2: TGroupBox;

N1: TMenuItem;

XPManifest1: TXPManifest;

Label1: TLabel;

Label2: TLabel;

Procedure FormCreate(Sender: TObject);

procedure FormPaint(Sender: TObject);

Procedure FormDestroy(Sender: TObject);

procedure PianoMouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure PianoMouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);

procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);

procedure UpDown1Click(Sender: TObject; Button: TUDBtnType);

procedure Baloo1Click(Sender: TObject);

procedure Fermer1Click(Sender: TObject);

procedure PianoToucheDown(Touche: string);

procedure PianoToucheUp(Touche: string);

procedure btnPauseClick(Sender: TObject);

procedure btnPlayClick(Sender: TObject);

procedure btnStopClick(Sender: TObject);

procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);

procedure Melodie;

procedure Accompagnement;

procedure Aide1Click(Sender: TObject);

procedure N1Click(Sender: TObject);

procedure lblInstrumentClick(Sender: TObject);

procedure lblNoteClick(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

Form1: TForm1;

MidiOut: hMidiOut;

Instrument: string;

BPM: integer;

Pause: boolean;

Stop: boolean;

 

implementation

 

uses Unit_Main_Droite, Unit_Main_Gauche, Unit3;

 

{$R *.dfm}

 

 

procedure TForm1.btnPauseClick(Sender: TObject);

begin

midiOutShortMsg(MidiOut, $00007BB0);

Stop:= false;

Pause:= true;

btnPlay.Visible:= true;

btnPause.Visible:= false;

end;

 

procedure TForm1.btnPlayClick(Sender: TObject);

begin

Stop:= false;

Pause:= false;

btnPlay.Visible:= false;

btnPause.Visible:= true;

end;

 

procedure TForm1.btnStopClick(Sender: TObject);

begin

midiOutShortMsg(MidiOut, $00007BB0);

Pause:= false;

Stop:= true;

end;

 

procedure TForm1.Fermer1Click(Sender: TObject);

begin

Stop:= true;

application.terminate;

end;

 

{--------------------- -------------------------}

 

procedure TForm1.Aide1Click(Sender: TObject);

begin

Form2.Show;

end;

 

procedure TForm1.Baloo1Click(Sender: TObject);

begin

Pause:= false;

Stop:= false;

Player.Visible:= true;

BPM:= 350;

Instrument:= '00';

Melodie;

Melodie;

Player.Visible:= false;

end;

 

procedure TForm1.Melodie;

var

MD: TMain_Droite;

begin

 

// TMain_Droite ()

MD:= TMain_Droite.Create(False);

 

//

Accompagnement;

 

Repeat

Application.ProcessMessages;

if Stop then MD.ThreadTerminated:= true;

if Pause then MD.Suspended:= true;

//if MD.Suspended AND NOT Pause then MD.Resume;

until MD.ThreadTerminated;

 

end;

procedure TForm1.N1Click(Sender: TObject);

begin

About.Show;

end;

 

procedure TForm1.Accompagnement;

var

MG: TMain_Gauche;

begin

MG:= TMain_Gauche.Create(False);

 

Repeat

Application.ProcessMessages;

if Stop then MG.ThreadTerminated:= true;

if Pause then MG.Suspended:= true;

if MG.Suspended AND NOT Pause then MG.Resume;

until MG.ThreadTerminated;

 

end;

 

 

{--------------------- ---------------------------}

 

Procedure TForm1.FormCreate(Sender: TObject);

var

Res: DWORD; msg: String;

Begin

Res:= midiOutOpen(@MidiOut, MIDI_MAPPER, Handle, 0, CALLBACK_WINDOW);

If Res <> 0 Then Begin

Case Res Of

MMSYSERR_BADDEVICEID: msg:= 'Priphrique invalide';

MMSYSERR_ALLOCATED: msg:= 'Priphrique dja allou';

MMSYSERR_NOMEM: msg:= 'Mmoire insuffisante';

MIDIERR_NOMAP: msg:= 'Mapper MIDI non trouv';

MIDIERR_NODEVICE: msg:= 'Priphrique non trouv';

Else msg:= 'Erreur inconnue';

End;

MessageBox(Form1.Handle, pChar(msg), '', MB_OK);

Close;

End;

 

 

Instrument:='00';

 

 

BPM:=1;

 

 

Pause:= false;

Stop:= false;

End;

 

procedure TForm1.FormPaint(Sender: TObject);

begin

Form1.SetFocus;

end;

 

procedure TForm1.lblInstrumentClick(Sender: TObject);

begin

 

end;

 

procedure TForm1.lblNoteClick(Sender: TObject);

begin

 

end;

 

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);

begin

Stop:= true;

end;

 

Procedure TForm1.FormDestroy(Sender: TObject);

Begin

midiOutShortMsg(MidiOut, $00007BB0);

midiOutClose(MidiOut);

End;

 

 

procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;

Shift: TShiftState);

var

i,j: integer;

Touche: string;

begin

for i:= 0 to Length(Keys) - 1 do

begin

if Keys[i].Key = Key then

begin

Touche:= Keys[i].Note;

if Keys[i].Down = false then

begin

for j:= 0 to Length(Notes) - 1 do

if Notes[j].Note=Touche then Notes[j].Down:=true;

PianoToucheDown(Touche);

Keys[i].Down:= true;

end;

end;

end;

end;

 

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);

var

i, j: integer;

Touche: string;

begin

for i:= 0 to Length(Keys) - 1 do

begin

if Keys[i].Key = Key then

begin

Touche:= Keys[i].Note;

Keys[i].Down:= false;

for j:= 0 to Length(Notes) - 1 do

if Notes[j].Note=Touche then Notes[j].Down:=false;

PianoToucheUp(Touche);

end;

end;

end;

 

procedure TForm1.PianoMouseDown(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

var

Touche: string;

begin

Touche:= TShape(Sender).Name;

if Button=mbLeft then

PianoToucheDown(Touche);

end;

 

procedure TForm1.PianoMouseUp(Sender: TObject; Button: TMouseButton;

Shift: TShiftState; X, Y: Integer);

var

Touche: string;

i: integer;

Note:Cardinal;

begin

Touche:= TShape(Sender).Name;

if Button=mbLeft then

PianoToucheUp(Touche);

end;

 

procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);

var

InstrumentINT: integer;

begin

lblInstrument.Caption:= IntToStr(UpDown1.Position);

if Length(lblInstrument.Caption)=1 then lblInstrument.Caption:= '0' + lblInstrument.Caption;

Instrument:= lblInstrument.Caption;

end;

 

procedure TForm1.PianoToucheDown(Touche: string);

var

i: integer;

Note: cardinal;

begin

for i:= 0 to Length(Notes) - 1 do

begin

if Notes[i].Note=Touche then

begin

lblInstrument.Caption:= Instrument;

Note:= StrToInt('$007F' + Notes[i].SonMidi + '90');

midiOutShortMsg(MidiOut, StrToInt('$0000' + Instrument + 'C0'));

midiOutShortMsg(MidiOut, Note);

lblNote.Caption:= Touche;

lblNote.Visible:= true;

if Copy(Touche, Length(Touche), 1)<>'d' then

begin

Notes_Primaires.Visible:= true;

Notes_Alterees.Visible:= false;

end

else

begin

Notes_Primaires.Visible:= false;

Notes_Alterees.Visible:= true;

end;

TImage(FindComponent('lbl' + Touche)).Visible:= true;

if i<50 then

begin

if Touche='Do3' then

begin

TImage(FindComponent('imgDo3_1')).Visible:= true;

TImage(FindComponent('imgDo3_2')).Visible:= true;

end

else if Touche='Do3d' then

begin

TImage(FindComponent('imgDo3d_1')).Visible:= true;

TImage(FindComponent('imgDo3d_2')).Visible:= true;

end

else TImage(Form1.FindComponent('img' + Touche)).Visible:= true;

end;

if TShape(FindComponent(Touche)).Brush.Color=clWhite then

TShape(FindComponent(Touche)).Brush.Color:=clRed

else if TShape(FindComponent(Touche)).Brush.Color=clBlack then

TShape(FindComponent(Touche)).Brush.Color:=clLime;

end;

end;

end;

 

procedure TForm1.PianoToucheUp(Touche: string);

var

i: integer;

Note:Cardinal;

begin

for i:= 0 to Length(Notes) - 1 do

begin

 

if Notes[i].Note=Touche then

begin

Note:= StrToInt('$007F' + Notes[i].SonMidi + '80');

midiOutShortMsg(MidiOut, Note);

if (Notes[i].Down=false) then

begin

if i<50 then

begin

if Touche='Do3' then

begin

TImage(FindComponent('imgDo3_1')).Visible:= false;

TImage(FindComponent('imgDo3_2')).Visible:= false;

end

else if Touche='Do3d' then

begin

TImage(FindComponent('imgDo3d_1')).Visible:= false;

TImage(FindComponent('imgDo3d_2')).Visible:= false;

end

else TImage(Form1.FindComponent('img' + Touche)).Visible:= false;

end;

lblNote.Visible:= false;

if Copy(Touche, Length(Touche), 1)<>'d' then

begin

Notes_Primaires.Visible:= false;

Notes_Alterees.Visible:= true;

end

else

begin

Notes_Primaires.Visible:= true;

Notes_Alterees.Visible:= false;

end;

TImage(FindComponent('lbl' + Touche)).Visible:= false;

if TShape(FindComponent(Touche)).Brush.Color=clRed then

TShape(FindComponent(Touche)).Brush.Color:=clWhite

else if TShape(FindComponent(Touche)).Brush.Color=clLime then

TShape(FindComponent(Touche)).Brush.Color:=clBlack;

end;

 

end;

end;

end;

 

 

end.

unit Musiques;

 

interface

 

type

TMusiques = Record

Note1: string;

Note2: string;

Note3: string;

Note4: string;

Duree: single;

end;

const

Musique1_MD: Array[0..27] of TMusiques =(

(Duree:1;)

,(Note1:'Do3'; Duree:1;)

,(Note1:'Re3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

 

,(Duree:1;)

,(Note1:'La3'; Duree:2;)

,(Note1:'Sol3d';Duree:1;)

 

,(Note1:'La3'; Duree:1;)

,(Note1:'Sol3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

 

,(Note1:'Sol3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

,(Note1:'Sol3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

 

,(Note1:'Sol3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

,(Note1:'Re3'; Duree:1;)

,(Note1:'Do3'; Duree:1;)

 

,(Note1:'Fa3'; Duree:1;)

,(Note1:'Do3'; Duree:1;)

,(Note1:'Fa3'; Duree:1;)

,(Note1:'La3'; Duree:1;)

 

,(Note1:'Re4'; Duree:1;)

,(Note1:'Do4'; Duree:1;)

,(Note1:'La3d'; Duree:1;)

,(Note1:'La3'; Duree:1;)

 

,(Note1:'Sol3'; Duree:4;)

);

 

Musique1_MG: Array[0..30] of TMusiques =(

(Duree:4;)

 

,(Note1:'Fa1'; Duree:1;)

,(Duree:1;)

,(Note1:'Do1';Duree:1;)

,(Duree:1;)

 

,(Note1:'Fa1'; Duree:1;)

,(Duree:1;)

,(Note1:'La1';Duree:1;)

,(Duree:1;)

 

,(Note1:'La1d'; Duree:1;)

,(Duree:1;)

,(Note1:'Fa1';Duree:1;)

,(Duree:1;)

 

,(Note1:'La1d'; Duree:1;)

,(Duree:1;)

,(Note1:'Sol1';Duree:1;)

,(Duree:1;)

 

,(Note1:'Fa1'; Duree:1;)

,(Duree:1;)

,(Note1:'Re1d';Duree:1;)

,(Duree:1;)

 

,(Note1:'Re1'; Duree:1;)

,(Duree:1;)

,(Note1:'Fa1d';Duree:1;)

,(Duree:1;)

 

,(Note1:'Sol1'; Duree:1;)

,(Note1:'La1'; Duree:1;)

,(Note1:'La1d';Duree:1;)

,(Note1:'La1d'; Duree:1;)

 

,(Note1:'Do2'; Duree:1;)

,(Duree:3;)

);

 

{

// Accompagnement "Accords" (Main Gauche)

Musique1_MG: Array[0..8] of TMusiques =(

(Duree:4;)

 

,(Note1:'Fa2'; Note2:'La2'; Note3:'Do3'; Note4:'Mi3'; Duree:4;)

 

,(Note1:'Fa2'; Note2:'La2'; Note3:'Do3'; Note4:'Re3d'; Duree:4;)

 

,(Note1:'Fa2'; Note2:'La2'; Note3:'Do3d'; Note4:'Re3'; Duree:4;)

 

,(Note1:'Fa2'; Note2:'Sol2'; Note3:'La3d'; Note4:'Re3'; Duree:4;)

 

,(Note1:'Fa2'; Note2:'La2'; Note3:'Do3'; Note4:'Re3'; Duree:2;)

,(Note1:'Sol2'; Note2:'La2'; Note3:'Do3'; Note4:'Re3d'; Duree:2;)

 

,(Note1:'Fa2d'; Note2:'La2'; Note3:'Do3'; Note4:'Re3'; Duree:4;)

 

,(Note1:'Fa2'; Note2:'Sol2'; Note3:'Si2'; Note4:'Re3'; Duree:4;)

 

); }

 

 

implementation

 

end.

unit Notes_Midi;

 

interface

 

type

TNotes = Record

Note: string;

SonMidi: string;

Down: boolean;

end;

 

var

Notes: Array[0..60] of TNotes =(

 

(Note:'Do1'; SonMidi:'24'; Down: false;),

(Note:'Do1d'; SonMidi:'25'; Down: false;),

(Note:'Re1'; SonMidi:'26'; Down: false;),

(Note:'Re1d'; SonMidi:'27'; Down: false;),

(Note:'Mi1'; SonMidi:'28'; Down: false;),

(Note:'Fa1'; SonMidi:'29'; Down: false;),

(Note:'Fa1d'; SonMidi:'2A'; Down: false;),

(Note:'Sol1'; SonMidi:'2B'; Down: false;),

(Note:'Sol1d'; SonMidi:'2C'; Down: false;),

(Note:'La1'; SonMidi:'2D'; Down: false;),

(Note:'La1d'; SonMidi:'2E'; Down: false;),

(Note:'Si1'; SonMidi:'2F'; Down: false;),

 

(Note:'Do2'; SonMidi:'30'; Down: false;),

(Note:'Do2d'; SonMidi:'31'; Down: false;),

(Note:'Re2'; SonMidi:'32'; Down: false;),

(Note:'Re2d'; SonMidi:'33'; Down: false;),

(Note:'Mi2'; SonMidi:'34'; Down: false;),

(Note:'Fa2'; SonMidi:'35'; Down: false;),

(Note:'Fa2d'; SonMidi:'36'; Down: false;),

(Note:'Sol2'; SonMidi:'37'; Down: false;),

(Note:'Sol2d'; SonMidi:'38'; Down: false;),

(Note:'La2'; SonMidi:'39'; Down: false;),

(Note:'La2d'; SonMidi:'3A'; Down: false;),

(Note:'Si2'; SonMidi:'3B'; Down: false;),

 

(Note:'Do3'; SonMidi:'3C'; Down: false;),

(Note:'Do3d'; SonMidi:'3D'; Down: false;),

(Note:'Re3'; SonMidi:'3E'; Down: false;),

(Note:'Re3d'; SonMidi:'3F'; Down: false;),

(Note:'Mi3'; SonMidi:'40'; Down: false;),

(Note:'Fa3'; SonMidi:'41'; Down: false;),

(Note:'Fa3d'; SonMidi:'42'; Down: false;),

(Note:'Sol3'; SonMidi:'43'; Down: false;),

(Note:'Sol3d'; SonMidi:'44'; Down: false;),

(Note:'La3'; SonMidi:'45'; Down: false;),

(Note:'La3d'; SonMidi:'46'; Down: false;),

(Note:'Si3'; SonMidi:'47'; Down: false;),

 

(Note:'Do4'; SonMidi:'48'; Down: false;),

(Note:'Do4d'; SonMidi:'49'; Down: false;),

(Note:'Re4'; SonMidi:'4A'; Down: false;),

(Note:'Re4d'; SonMidi:'4B'; Down: false;),

(Note:'Mi4'; SonMidi:'4C'; Down: false;),

(Note:'Fa4'; SonMidi:'4D'; Down: false;),

(Note:'Fa4d'; SonMidi:'4E'; Down: false;),

(Note:'Sol4'; SonMidi:'4F'; Down: false;),

(Note:'Sol4d'; SonMidi:'50'; Down: false;),

(Note:'La4'; SonMidi:'51'; Down: false;),

(Note:'La4d'; SonMidi:'52'; Down: false;),

(Note:'Si4'; SonMidi:'53'; Down: false;),

 

(Note:'Do5'; SonMidi:'54'; Down: false;),

(Note:'Do5d'; SonMidi:'55'; Down: false;),

(Note:'Re5'; SonMidi:'56'; Down: false;),

(Note:'Re5d'; SonMidi:'57'; Down: false;),

(Note:'Mi5'; SonMidi:'58'; Down: false;),

(Note:'Fa5'; SonMidi:'59'; Down: false;),

(Note:'Fa5d'; SonMidi:'5A'; Down: false;),

(Note:'Sol5'; SonMidi:'5B'; Down: false;),

(Note:'Sol5d'; SonMidi:'5C'; Down: false;),

(Note:'La5'; SonMidi:'5D'; Down: false;),

(Note:'La5d'; SonMidi:'5E'; Down: false;),

(Note:'Si5'; SonMidi:'5F'; Down: false;),

 

(Note:'Do6'; SonMidi:'60'; Down: false;)

);

 

implementation

 

end.

unit Unit3;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, ExtCtrls, StdCtrls;

 

type

TAbout = class(TForm)

Image1: TImage;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Button1: TButton;

procedure Button1Click(Sender: TObject);

procedure FormCreate(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

var

About: TAbout;

 

implementation

 

{$R *.dfm}

 

procedure TAbout.Button1Click(Sender: TObject);

begin

close

end;

 

procedure TAbout.FormCreate(Sender: TObject);

begin

 

end;

 

end.

unit Unit_Main_Droite;

 

interface

 

uses

Main, Classes, Forms, SysUtils, ExtCtrls, Graphics,

mmSystem, Notes_MIDI, Musiques;

 

type

TMain_Droite = Class(TThread)

private

idNote: integer;

procedure OnTerminateProcedure(Sender: TObject);

protected

procedure ToucheDown;

procedure ToucheUp;

procedure Execute; override;

public

ThreadTerminated: Boolean;

constructor Create(Suspended: Boolean);

end;

 

 

implementation

 

constructor TMain_Droite.Create(Suspended: Boolean);

begin

FreeOnTerminate:= True;

inherited Create(Suspended);

OnTerminate:= OnTerminateProcedure;

ThreadTerminated:= False;

end;

 

procedure TMain_Droite.ToucheDown;

begin

Form1.PianoToucheDown(Musique1_MD[idNote].Note1);

end;

 

procedure TMain_Droite.ToucheUp;

begin

Form1.PianoToucheUp(Musique1_MD[idNote].Note1);

end;

 

procedure TMain_Droite.Execute;

var

i: integer;

begin

 

for i:= 0 to Length(Musique1_MD)-1 do

begin

if ThreadTerminated then exit;

idNote:= i;

 

if Musique1_MD[i].Note1<>'' then

Synchronize(ToucheDown);

 

Sleep(Round(((60/BPM)*1000) * Musique1_MD[i].Duree));

 

if Musique1_MD[i].Note1<>'' then

Synchronize(ToucheUp);

end;

 

end;

 

procedure TMain_Droite.OnTerminateProcedure(Sender: TObject);

begin

ThreadTerminated:=True;

end;

 

end.

unit Unit_Main_Gauche;

 

interface

 

uses

Main, Classes, Forms, SysUtils, ExtCtrls, Graphics,

mmSystem, Notes_MIDI, Musiques;

 

type

TMain_Gauche = class(TThread)

private

idNote: integer;

procedure OnTerminateProcedure(Sender: TObject);

protected

procedure ToucheDown;

procedure ToucheUp;

procedure Execute; override;

public

ThreadTerminated: Boolean;

constructor Create(Suspended: Boolean);

end;

 

 

implementation

 

constructor TMain_Gauche.Create(Suspended: Boolean);

begin

FreeOnTerminate:= True;

inherited Create(Suspended);

OnTerminate:= OnTerminateProcedure;

ThreadTerminated:= False;

end;

 

procedure TMain_Gauche.ToucheDown;

begin

Form1.PianoToucheDown(Musique1_MG[idNote].Note1);

end;

 

procedure TMain_Gauche.ToucheUp;

begin

Form1.PianoToucheUp(Musique1_MG[idNote].Note1);

end;

 

procedure TMain_Gauche.Execute;

var

i: integer;

begin

 

for i:= 0 to Length(Musique1_MG)-1 do

begin

if ThreadTerminated then exit;

idNote:= i;

 

if Musique1_MG[i].Note1<>'' then

Synchronize(ToucheDown);

 

Sleep(Round(((60/BPM)*1000) * Musique1_MG[i].Duree));

 

if Musique1_MG[i].Note1<>'' then

Synchronize(ToucheUp);

end;

 

end;

 

procedure TMain_Gauche.OnTerminateProcedure(Sender: TObject);

begin

ThreadTerminated:=True;

end;

 

end.





:


: 2015-11-05; !; : 523 |


:

:

: , .
==> ...

768 - | 730 -


© 2015-2024 lektsii.org - -

: 0.502 .