| Autor |
Beitrag |
Terra
      
Beiträge: 307
Windows 7 Ultimate
Delphi® XE3
|
Verfasst: Mo 28.08.06 11:04
Hallöchen...
ich hätte da mal ein Problem.
Ich habe zumindest schonmal rausgefunden, wie die Funktion GetSongTimeInfo(); von der Komponente BasDllPlayer zugewiesen wird. Jetzt möchte ich die grade gespielte Zeit anzeigen lassen. Also "BassdllPlayer1.GetSongTimeInfo(stUp);". Jetzt habe ich mein Label, wo die Zeit angezeigt werden soll. Wie verbinde ich jetzt also beide Funktionen ???
Label3 := BassdllPlayer1.GetSongTimeInfo(stUp); geht nicht.
Könnt mir da bitte jemand helfen ???
Terra
|
|
Gausi
      
Beiträge: 8554
Erhaltene Danke: 481
Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
|
Verfasst: Mo 28.08.06 11:39
Ich kenne die Komponente nicht, aber ich bezweifle, dass diese Funktion eine Variable vom Typ TLabel zurückliefert. Sinnvoll wäre da z.B. Integer, was man dann der Caption des Labels zuweisen kann:
Delphi-Quelltext 1:
| Label3.Caption := IntToStr(BassdllPlayer1.GetSongTimeInfo(stUp)); |
_________________ We are, we were and will not be.
|
|
Terra 
      
Beiträge: 307
Windows 7 Ultimate
Delphi® XE3
|
Verfasst: Mo 28.08.06 12:08
Hallo Gausi,
hatte mich verschrieben, wollte das label natürlich mit Caption schreiben.
Also: Label3.Caption .....
So wie du es aber geschrieben hast, geht es nicht.
Bekomm die Meldung:
[Pascal Error] Unit1.pas(30):E2250 There is no overload version of 'IntToStr' that can be called with these arguments.
Hier mal die Funktion:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66:
| type TPlayerModus = (moSamples, moMusik, moStream); TBassSongStatusInfo = (stUp, stDown, stLength);
function TBassdllPlayer.GetSongTimeInfo(InfoStatus:TBassSongStatusInfo): TBassSongInfo; var Time: Integer; begin if Status = sndNotLoaded then begin Result.asInteger:=0; Result.asString := '--:--'; end else begin case Modus of moSamples: case InfoStatus of stUp: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetPosition(Channel))); stDown: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetPosition(Channel))) - round(BASS_ChannelBytes2Seconds(Channel, BASS_StreamGetLength(Channel))); stLength: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_StreamGetLength(Channel))); end; moMusik: case InfoStatus of stUp: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetPosition(Channel))); stDown: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_MusicGetLength(Channel, True)) * (SpeedinProzent / 100)) - round( BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetPosition(Channel))); stLength: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_MusicGetLength(Channel, True)) * (SpeedinProzent / 100)); end; moStream: case InfoStatus of stUp: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_ChannelGetPosition(Channel))); stDown: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_StreamGetLength(Channel))) - round(BASS_ChannelBytes2Seconds(Channel, BASS_StreamGetLength(Channel))); stLength: Result.asInteger:= round(BASS_ChannelBytes2Seconds(Channel, BASS_StreamGetLength(Channel))); end; end; if Result.asInteger <> 0 then begin Time := Trunc(Result.asInteger); Result.asString := Format('%.2d:%.2d', [Time div 60, abs(Time mod 60)]); end else Result.asString := '00:00'; end; end; |
Zuletzt bearbeitet von Terra am Mo 28.08.06 12:39, insgesamt 1-mal bearbeitet
|
|
Gausi
      
Beiträge: 8554
Erhaltene Danke: 481
Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
|
Verfasst: Mo 28.08.06 12:18
_________________ We are, we were and will not be.
|
|
Terra 
      
Beiträge: 307
Windows 7 Ultimate
Delphi® XE3
|
Verfasst: Mo 28.08.06 12:38
Vielen Dank Gausi ... ich war schon am verzweifeln.
Wann weis ich eigentlich, wann ich so ein .asString bzw. ein .asInteger einsetzen muss?
Wär da im Leben nie selbst drauf gekommen.
Terra
|
|
Gausi
      
Beiträge: 8554
Erhaltene Danke: 481
Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
|
Verfasst: Mo 28.08.06 12:49
Schau dir doch einfach mal an, was du eben an Quelltext gepostet hast. Da steht sowas von result.asString. Daraus habe ich abgeleitet, dass der Ergebnistyp TBassSongInfo von GetSongTimeInfo eine Eigenschaft asString haben sollte.
Da ich erstmal annehme, dass die Kompo ganz gut ist, und Variablen/Funktionen sinnvoll belegt sind, habe ich die kühne Behauptung gewagt, dass
GetSongTimeInfo().asString eine Angabe über die SongTime liefert, und zwar in Form eines Strings 
_________________ We are, we were and will not be.
|
|
Terra 
      
Beiträge: 307
Windows 7 Ultimate
Delphi® XE3
|
Verfasst: Mo 28.08.06 12:56
Hmm, jetzt wo du das so beschreibst, hört es sich logisch an ^^ muss ich mir echt mal merken solche kleinigkeiten ...
Vielen Dank für deine Mühe.
Bis zur nächsten Frage,
Terra
|
|
|