Autor Beitrag
moonwalker
Hält's aus hier
Beiträge: 6


D3 Pro
BeitragVerfasst: Mo 21.02.05 21:52 
Wie der Titel schon sagt, möchte ich ein Soundboard schreiben!
Was muss ich machen, damit bei Button OnClick ein Sound- file einmal abgespielt wird?

Vielen Dank für jede Antwort!
AXMD
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 4006
Erhaltene Danke: 7

Windows 10 64 bit
C# (Visual Studio 2019 Express)
BeitragVerfasst: Mo 21.02.05 21:57 
Harry Hunt
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 50



BeitragVerfasst: Di 22.02.05 15:34 
Wenn du ein MP3 abspielen möchtest, kannst du dazu entweder die ActiveX version des Windows Media Players verwenden, oder DirectShow oder eine der unzähligen Sound-Libraries (FMod - www.fmod.org, BASS - www.un4seen.com, etc.).
PlaySound/SndPlaySound/TMediaPlayer spielt meines erachtens nur WAV.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: Di 22.02.05 15:54 
tmediaplayer spielt auch mp3s und mid
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 23.02.05 08:19 
Titel: Mediaplayer
Du brauchst einen Mediaplayer-Komponente, einen opendialog.

Klicke doppelrt auf den Button und schreibe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
if opendialog1.execute then
begin
mediaplayer.filename:=opendialog1.filename;
mediaplayer1.open;
mediaplayer1.play;
end;


wenn du die wiedergabe stoppen willste schreibe:

ausblenden Delphi-Quelltext
1:
mediaplayer1.close;					


um zu pauseiren beziehungsweis weiter zu machen:
ausblenden Delphi-Quelltext
1:
mediaplayer1.pause;					


im Opendialog musste du den "Filter" auf "*.mp3" (ohne anführungszeichen) stellen, um sicherzugehen, dass nur mp3's ausgewählt werden

Wenn du den Komponenten andere Namen gibst, musst du natürlich opendialog1 und mediaplayer1 entsprechend abändern!

mfg Koller

Moderiert von user profile iconAXMD: Delphi-Tags hinzugefügt.