Autor Beitrag
FSS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Mi 15.03.06 17:28 
Hallo,

ich habe da ein kleines Problem mit dem Befehl "Beep". Ich habe einen Timer, der nach Ablauf der eingestellten Zeit einen Text in ein Label schreiben soll und ein Audiosignal ausgeben soll.
Das mit dem Label klappt so weit, aber ich bekomme keinen Ton hin, hier ist mal der Quelltext:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Interval := 1;
  if ActiveControl <> nil then
    Label1.Caption := ('Die Zeit ist um!');
end;


Wenn ich hier einfach einen "beep"-Befehl einbaue:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Timer1.Interval := 1;
  if ActiveControl <> nil then
    Labelstatus.Caption := ('Die Zeit ist um!');
    beep;
end;


funktioniert es nicht.

Hat jemand eine Idee, wie es gehen könnt und gibt es eine andere Möglichkeit einen Ton (oder sogar eine Wav-Datei) auszugeben?

FSS

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 17:36 
Warum änderst du den Interval im OnTimer Ereignis am Anfang? :gruebel: Machs doch im Objektinspektor!
Probier mal MessageBeep(0) aus.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Marc.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1876
Erhaltene Danke: 129

Win 8.1, Xubuntu 15.10

BeitragVerfasst: Mi 15.03.06 17:37 
schreib mal
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
 if ActiveControl <> nil then 
 begin
 Labelstatus.Caption := ('Die Zeit ist um!');
 beep;
end;


:roll:
edit oh du bekommst keinen ton 0o
na dann habe ich mich wohl vor aluter müdigkeit verlesen -,-
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Mi 15.03.06 17:43 
Das mit dem "MessageBeep(0)" hilft leider auch nichts, es kommt kein Ton!
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 18:49 
Was erwartest du denn für ein Ton? :gruebel:
Klatsch mal nen Button aufs Formular und ins OnClick ereignis fügst du das Beep ein. Was passiert?
Also ich höre etwas (auch bei MessageBeep(0)).

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Mi 15.03.06 18:54 
Mach mal deinen Lautsprecher an :D
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 18:57 
Wenn das nicht hilft, setze entweder die angeschlossenen Kopfhörer auf oder ziehe sie aus der Buchse des Lautsprechers :mrgreen:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Mi 15.03.06 19:19 
Wenn ich das "Beep" direkt einem Button zuweise funktioniert alles.
Außerdem habe ich gerade etwas gemerkt: wenn ich anstatt "Beep" "MessageBeep(0)" verwende, höre ich zwar auch keinen Ton wenn der Timer abgelaufen ist, aber wenn ich das Programm beende (über einen Button) ertönt ein Ton.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 19:22 
Ich hab das ganze mal ausprobiert:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
if ActiveControl <> nil then
    Label1.Caption := ('Die Zeit ist um!');
beep;
end;

Label1 ändert sich nicht, aber ich höre immer etwas...

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Mi 15.03.06 19:26 
Also wenn ich das so schreibe wie du, mit Timer1.Interval:=1
dann Schnarrt mein Lautsprecher wie wild weil das Ding ja alle 1/1000 sec piepen will

erhöhe doch mal dein Invervall
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Mi 15.03.06 19:27 
@Marco D. ...Er hats in nem Timer
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 19:29 
user profile iconder Berliner hat folgendes geschrieben:
@Marco D. ...Er hats in nem Timer

Habe ich was anderes gesagt/behauptet? :gruebel:
Das war mir klar :wink:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Mi 15.03.06 19:31 
Tja..stimmt wohl aber du hast dein Interval auf 1000 gelassen oder ?
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 19:32 
Ist das nicht egal?
Es piept doch trotzdem :zwinker:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Mi 15.03.06 19:34 
@Marco D. -- Setzt mal den Timer auf 1 dann schnarrt das ding nur noch
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 19:38 
user profile iconder Berliner hat folgendes geschrieben:
@Marco D. -- Setzt mal den Timer auf 1 dann schnarrt das ding nur noch

Stimmt :zustimm:
Aber den Fehler habe ich immer noch nicht gefunden :-(

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
der Berliner
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 417

Win Xp Home
delphi 2005
BeitragVerfasst: Mi 15.03.06 19:41 
Ich auch..ob es nu beept oder schnarrt aufjedenfall Hör was.
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Mi 15.03.06 19:43 
Also ich weiß nicht warum, aber auf jeden Fall funktioniert es jetzt.
Ich habe die Stelle im Quelltext gelöscht und alles noch einmal genau so hingeschrieben.
Es funktioniert! Aber woran das liegt? Keine Ahnung? :?:
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mi 15.03.06 19:47 
Da wird wohl der vorherige Quelltext einen Fehler enthalten haben :zwinker:
Ist eine dumme Antwort, klar, aber so ist es doch.

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
FSS Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 83

Win 7 Professional 64Bit
Delphi 7 PE, Delphi 2005 PE, Turbo Delphi Explorer 2006
BeitragVerfasst: Mi 15.03.06 19:55 
Da hast du vermutlich Recht, tut mir leid, dass ich euch so viel Mühe gemacht habe.