Nicht angemeldet.
Hier können Sie Ihre eigenen Skripte und UDF's veröffentlichen undanderen zum Download anbieten oder von anderen herunterladen
Opt('CaretCoordMode', 1) #include <misc.au3> $weiss = 17 Dim $k[99] $k[1] = 523 $k[$weiss + 1] = 554 $k[2] = 587 $k[$weiss + 2] = 622 $k[3] = 659 $k[4] = 698 $k[$weiss + 3] = 740 $k[5] = 784 $k[$weiss + 4] = 830 $k[6] = 880 $k[$weiss + 5] = 932 $k[7] = 988 $k[8] = 1046 $k[$weiss + 6] = 1108 $k[9] = 1174 $k[$weiss + 7] = 1244 $k[10] = 1318 $k[11] = 1397 $k[$weiss + 8] = 1480 $k[12] = 1568 $k[$weiss + 9] = 1661 $k[13] = 1760 $k[$weiss + 10] = 1864 $k[14] = 1975 $k[15] = 2093 $k[$weiss + 11] = 2217 $k[16] = 2349 $k[$weiss + 12] = 2489 $k[17] = 2637 Dim $tasten[99] Dim $tasten_farbe[99] Dim $xpos[99] Dim $ypos[99] Dim $objw[99] Dim $objh[99] Global $keynr = 0 $gui = GUICreate("Coderz-Beeper-Piano", 530, 173, Default, Default, 0x80000, 0x80) GUICtrlCreateLabel("Coderz-Beeper-Piano", 5, 5, 300, 30) GUICtrlSetFont(-1, 20, 900) $playbutton = GUICtrlCreateButton("Play", 10, 125, 50, 22) GUICtrlSetState(-1, 128) $pausebutton = GUICtrlCreateButton("Pause", 65, 125, 70, 22) GUICtrlSetState(-1, 128) GUICtrlSetBkColor(-1, 0xFFFFFF) $dellastbutton = GUICtrlCreateButton("letzte Taste entfernen", 140, 125, 120, 22) GUICtrlSetState(-1, 128) $stopmusicbutton = GUICtrlCreateButton("Playmode abbrechen", 400, 125, 120, 22) GUICtrlSetState(-1, 128) $savebutton = 0 $save = GUICtrlCreateButton("Speichern", 330, 5, 60, 30) GUICtrlSetColor(-1, 0xcccccc) $open = GUICtrlCreateButton("Öffnen", 395, 5, 60, 30) GUICtrlSetColor(-1, 0x000000) $rec = GUICtrlCreateButton("Record", 460, 5, 60, 30) GUICtrlSetColor(-1, 0x000000) $reccode = "" $recording = 0 $key_y = 40 ; Weiß $x = 7 taste($x, $key_y) For $i = 2 To $weiss $x += 30 taste($x, $key_y) Next ; Schwarz $x = 29 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) $x += 60 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) $x += 60 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) $x += 60 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) $x += 60 taste($x, $key_y, 1) $x += 30 taste($x, $key_y, 1) GUISetState() $dur = 150 $duriance = 100 While 1 $g = GUIGetMsg() If $g = -3 Then Exit If WinActive($gui) Then While _IsPressed(01) $pos = WinGetCaretPos() For $i = $keynr To 1 Step -1 $m = MouseGetPos() $m[0] -= $pos[0] $m[1] -= $pos[1] If $m[0] >= $xpos[$i] And $m[0] <= $xpos[$i] + $objw[$i] Then If $m[1] >= $ypos[$i] And $m[1] <= $ypos[$i] + $objh[$i] Then If $tasten_farbe[$i] <> "0" Then GUICtrlSetBkColor($tasten_farbe[$i], 0xff0000) Else GUICtrlSetBkColor($tasten[$i], 0xff0000) EndIf If $recording Then If StringLen($reccode) > 0 Then $reccode &= "," $reccode &= $k[$i] EndIf Beep($k[$i], $duriance) If $tasten_farbe[$i] <> "0" Then GUICtrlSetBkColor($tasten_farbe[$i], 0xffffff) Else GUICtrlSetBkColor($tasten[$i], 0x000000) EndIf ExitLoop EndIf EndIf Next WEnd If $g = $playbutton Then EndIf If $recording And $g = $pausebutton Then GUICtrlSetBkColor($pausebutton, 0xFF0000) If StringLen($reccode) > 0 Then $reccode &= "," $reccode &= "1" Sleep(100) GUICtrlSetBkColor($pausebutton, 0xFFFFFF) EndIf If $g = $dellastbutton Then If StringLen($reccode) > 0 Then While StringLen($reccode) > 0 And StringRight($reccode, 1) <> "," $reccode = StringTrimRight($reccode, 1) WEnd Beep(100, 10) Beep(120, 10) Beep(140, 10) Beep(180, 10) Beep(200, 10) $reccode = StringTrimRight($reccode, 1) Else Beep(100, 100) EndIf EndIf EndIf If $g = $open Or $g = $playbutton Then If $g <> $playbutton Then $openf = FileOpenDialog("Sounddatei öffnen", @WorkingDir, "TXT (*.txt)") If $g = $playbutton Or FileExists($openf) Then If $g = $playbutton Then $play = $reccode Else $play = FileRead($openf) EndIf $play = StringSplit($play, ",") $dur = Round(InputBox("Coderz-Beeper-Piano", "Gib die Länge eines Tones in Millisekunden an:", $dur, "", 250, 150)) If $dur <> "" Then If $dur < 50 Then $dur = 50 If $dur > 1000 Then $dur = 1000 Global $cancel = 0 GUICtrlSetState($stopmusicbutton, 64) For $i = 1 To UBound($play) - 1 $g = GUIGetMsg() If $g = $stopmusicbutton Then ExitLoop If $play[$i] > 0 Then $id = 0 For $i2 = 1 To $weiss + 12 If $play[$i] = $k[$i2] Then $id = $i2 ExitLoop EndIf Next If $i2 > 0 Then If $tasten_farbe[$i2] <> "0" Then GUICtrlSetBkColor($tasten_farbe[$i2], 0xff0000) Else GUICtrlSetBkColor($tasten[$i2], 0xff0000) EndIf EndIf If $play[$i] > 1 Then Beep($play[$i], $dur) Else GUICtrlSetBkColor($pausebutton, 0xFF0000) Sleep($dur) GUICtrlSetBkColor($pausebutton, 0xFFFFFF) EndIf If $i2 > 0 Then If $tasten_farbe[$i2] <> "0" Then GUICtrlSetBkColor($tasten_farbe[$i2], 0xffffff) Else GUICtrlSetBkColor($tasten[$i2], 0x000000) EndIf EndIf EndIf Next GUICtrlSetState($stopmusicbutton, 128) $g = "" EndIf EndIf EndIf If $g = $save Then $saving = 1 $saveas = FileSaveDialog("Speichern unter", @WorkingDir, "TXT (*.txt)") If $saveas = "" Then $saving = 0 Else If StringRight(StringLower($saveas), 4) <> ".txt" Then $saveas &= ".txt" If FileExists($saveas) Then If MsgBox(308, "Datei existiert bereits", "Die angegebene Datei existiert bereits. Soll sie überschrieben werden?") = 6 Then $saving = 1 FileDelete($saveas) Else $saving = 0 EndIf EndIf If $saving Then FileWrite($saveas, $reccode) EndIf EndIf EndIf If StringLen($reccode) > 0 And $savebutton == 0 Then $savebutton = 1 GUICtrlSetColor($save, 0x00cc00) ElseIf $savebutton = 1 And StringLen($reccode) = 0 Then $savebutton = 0 GUICtrlSetColor($save, 0xcccccc) EndIf If $g = $rec Then If $recording Then GUICtrlSetColor($rec, 0x000000) $recording = 0 GUICtrlSetState($playbutton, 128) GUICtrlSetState($pausebutton, 128) GUICtrlSetState($dellastbutton, 128) Else GUICtrlSetColor($rec, 0xff0000) $reccode = "" $recording = 1 GUICtrlSetState($playbutton, 64) GUICtrlSetState($pausebutton, 64) GUICtrlSetState($dellastbutton, 64) EndIf EndIf WEnd Func taste($x, $y, $t = 0) $keynr += 1 If $t = 1 Then $w = 16 $h = 40 $objw[$keynr] = 16 $objh[$keynr] = 40 Else $w = 30 $h = 80 $objw[$keynr] = 30 $objh[$keynr] = 80 EndIf $tasten[$keynr] = GUICtrlCreateLabel("", $x - 1, $y - 1, $w + 2, $h + 2) GUICtrlSetBkColor(-1, 0x000000) $xpos[$keynr] = $x $ypos[$keynr] = $y If $t = 0 Then $tasten_farbe[$keynr] = GUICtrlCreateLabel("", $x, $y, $w, $h) GUICtrlSetBkColor(-1, 0xffffff) Else $tasten_farbe[$keynr] = "0" EndIf EndFunc ;==>taste
Dauerhaft angemeldet bleiben?