Autor Beitrag
Massiv
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 12:41 
Haallo

ich möchte, wenn eine musik abgespielt ist, ein bild anzeigen lassen.
und wenn die musik gestoppt wurde soll das bild verschwinden!
ich habe schon folgenden code versucht aber das geht mit der if schleife nicht was mach ich falsch?
ausblenden Delphi-Quelltext
1:
if bassdllplayer1.play = true then image1.picture.loadfromfile('pfad')					

aber dann steht da inkompatible typen
Sylvus
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 195



BeitragVerfasst: So 29.03.09 13:21 
.play ist meiner Meinung nach eine procedure und hat keinen Rückgabewert!
Mit xxx.play sagst du dem Computer nur, dass er etwas abspielen soll, aber du fragst ihn nicht ob er schon etwas abspielt! Ich kenn jetzt nur den MediaPlayer von Delphi, aber da wäre das ganze so:
if MediaPlayer1.Position>1 then aber das ist auch nur geraten, also probier einfach aus!


Viele Grüße Sylvus
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: So 29.03.09 13:29 
Schau dir mal die Eigenschaften der Komponente an (Status)
den Link kannst du dir auch mal genauer anschauen, dort wirst du schon etwas finden.
www.delphipraxis.net...highlight=bassplayer
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 15:00 
sylvus,
habs so ausprobiert
ausblenden Delphi-Quelltext
1:
If bassdllplayer1.Position>1 then image3.Picture.LoadFromFile('C:\Dokumente und Einstellungen\Besitzer\Desktop\musik0417ss.gif');					

aber dann muss ich den button zweimal klicken damit das bild erscheint, warum?

Moderiert von user profile iconGausi: Delphi-Tags repariert
Sylvus
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 195



BeitragVerfasst: So 29.03.09 15:07 
kenn mich nicht aus, aber probier ">0"
Es kann sein, dass es erst auf 1 springt und dann ist das größer Zeichen falsch, also entweder:
>=1 oder >0 :)
Probiers mal viele Grüße
Sylvus
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 17:23 
das geht auch nicht :(
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 29.03.09 17:40 
Probiers mal mit: if MediaPlayer1.Mode = mpPlaying then
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 17:48 
Ich benutze bassdllplayer
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 29.03.09 17:58 
user profile iconBlackheart666 hat folgendes geschrieben Zum zitierten Posting springen:
Schau dir mal die Eigenschaften der Komponente an (Status)
den Link kannst du dir auch mal genauer anschauen, dort wirst du schon etwas finden.
www.delphipraxis.net...highlight=bassplayer

Probiers mal mit: if MediaPlayer1.Status = sndPLAYING then
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 18:01 
hey danke hat funktioniert!
könntest du mir aber bitte erklären was sndplaying bedutet beziehungsweise was für ne anweisung das ist.
und was muss ich eingeben, das das bild wieder verschwindet wenn keine musik läuft?
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 29.03.09 18:08 
user profile iconMassiv hat folgendes geschrieben Zum zitierten Posting springen:
hey danke hat funktioniert!
könntest du mir aber bitte erklären was sndplaying bedutet beziehungsweise was für ne anweisung das ist.

sndPlaying ist eine Konstante. Du überprüfst halt nur, ob der Status gleich dieser Konstante ist.

user profile iconMassiv hat folgendes geschrieben Zum zitierten Posting springen:
und was muss ich eingeben, das das bild wieder verschwindet wenn keine musik läuft?

Es würde sich z. B. anbieten, da einen Timer zu verwenden, der ständig prüft:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure Timer1.OnTimer(Sender:TObject);
begin
  if MediaPlayer1.Status = sndPLAYING then
    //Bild anzeigen
  else
    //Bild verschwinden lassen;
end;
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 18:22 
Hey danke läuft super ausser da gibts ein kleines problem!
wenn ich zumbeispiel die musik stoppe dauert das so ca.2 sekunden bis das bild weg ist
weisst du woran das liegt. also der timer reagiert nicht sofort!verstehste?
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: So 29.03.09 18:23 
Vielleicht ist das Timerinterval zu klein groß?

Edit: Relative Größenangabe geändert. Danke an user profile iconplatzwart.


Zuletzt bearbeitet von Regan am So 29.03.09 18:31, insgesamt 1-mal bearbeitet
platzwart
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1054
Erhaltene Danke: 78

Win 7, Ubuntu 9.10
Delphi 2007 Pro, C++, Qt
BeitragVerfasst: So 29.03.09 18:25 
Das Timerintverall ist zu groß ;) Stells mal auf 500

_________________
Wissenschaft schafft Wissenschaft, denn Wissenschaft ist Wissenschaft, die mit Wissen und Schaffen Wissen schafft. (myself)
Massiv Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 93



BeitragVerfasst: So 29.03.09 18:26 
jo!klappt thx man :)