Autor Beitrag
Roy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Do 12.04.07 16:55 
Hallo Proggis,
ich möchte in meinem Player einzelne MP3 Dateien über den Eject Button laden so das sie im Player abspielen. Wie bekomme ich das hin?
patrick dee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Fr 13.04.07 11:22 
Hei

wie meinst du das ? den Button drücken um den Ordner zu öffnen wo die mp3's drinnen sind oder wie ?

Gruß

Patrick

_________________
Glauben heißt nichts wissen ...
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 13.04.07 11:37 
OpenDialog?

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
patrick dee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Fr 13.04.07 11:47 
NACHTRAG :

So würde es gehen um den Ordner zu öffnen :


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
begin
If OpenDialog1.Execute then
   DeinPlayer.FileName := Opendialog1.FileName;
   Label1.Caption :=DeinPalyer.FileName; // siehst welches File geladen ist
   end;


ciao

Patrick

_________________
Glauben heißt nichts wissen ...
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Fr 13.04.07 11:50 
Vielen Dank für eure Antworten, werde die Sachen mal durchgehen!
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Fr 13.04.07 12:13 
Ist die MP3 Datei damit in meinem Player geladen? Bekomme beim Play die Antwort:

EMCIDeviceError kein MCI Gerät geöffnet!

wo liegt der Fehler
patrick dee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Fr 13.04.07 12:27 
Hei

was ist den dein Player ? mediaplayer ?

schau mal ob du das in der usses hast

mmsystem

ciao patrick

_________________
Glauben heißt nichts wissen ...
freak4fun
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 604
Erhaltene Danke: 4

Win 7 Pro
VS 2013 Express, Delphi, C#, PHP, Java
BeitragVerfasst: Fr 13.04.07 12:49 
Über OpenDialog bekommst du den Dateinamen, den musst du deinem Player noch übergeben. ;)

_________________
"Ich werde auf GAR KEINEN Fall…!" - "Keks?" - "Okay, ich tu's."
i++; // zaehler i um 1 erhoehen
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 13.04.07 12:50 
MediaPlayer1.Open muss noch davor.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
patrick dee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 311

Win 98SE, WinXP
D3,D6
BeitragVerfasst: Fr 13.04.07 12:52 
wenn es mediaplayer ist dann so :


PLAY :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
usses 

 mmsystem

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
 with MediaPlayer1 do begin
      MediaPlayer1.FileName := Label1.Caption;
      MediaPlayer1.Open;
      MediaPlayer1.Play;
  end;
end;


ciao Patrick

_________________
Glauben heißt nichts wissen ...
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Fr 13.04.07 13:06 
Oder einfach im Objektinspektor AutoOpen auf true, dann kann das Mediaplayer1.Open auch weg. :wink:

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 13.04.07 13:13 
user profile iconpatrick dee hat folgendes geschrieben:
wenn es mediaplayer ist dann so :


PLAY :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
usses 

 mmsystem

procedure TForm1.BitBtn2Click(Sender: TObject);
begin
 with MediaPlayer1 do begin
      MediaPlayer1.FileName := Label1.Caption;
      MediaPlayer1.Open;
      MediaPlayer1.Play;
  end;
end;


ciao Patrick


mmsystem braucht man nicht.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);
begin
if Opendialog1.Execute then
  begin
    with MediaPlayer1 do begin
    FileName := OpenDialog1.FileName;
    Open;
    Play;
  end;
end;
end;

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Fr 13.04.07 13:14 
nein das habe ich schon probiert, auch wenn er auf AutoOpen steht passiert es. Werde die anderen Varianten probieren.

Danke
alias5000
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2145

WinXP Prof SP2, Ubuntu 9.04
C/C++(Code::Blocks, VS.NET),A51(Keil),Object Pascal(D2005PE, Turbo Delphi Explorer) C# (VS 2008 Express)
BeitragVerfasst: Fr 13.04.07 13:16 
Dann wärs vllcht schlau, wenn du uns deinen Quellcde zeigen würdest
Gruß
alias5000

_________________
Programmers never die, they just GOSUB without RETURN
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Fr 13.04.07 13:20 
So funktioniert es.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TForm1.Button1Click(Sender: TObject);  
begin  
if Opendialog1.Execute then  
  begin  
    with MediaPlayer1 do begin  
    FileName := OpenDialog1.FileName;  
    Open;  
    Play;  
  end;  
end;  
end;
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Fr 13.04.07 16:30 
So, bin nun an dem Punkt angekommen mehrere Lieder in den Player zu laden. Ist es möglich mit dem Vorausgegangenen Code mehrere Lieder in meinem Player einzubinden und abzuspielen?

Danke
Xadron
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 102

XP
C++, D7, HTML
BeitragVerfasst: Fr 13.04.07 17:03 
Vieleicht mit einer Stringlist?!

ausblenden volle Höhe Delphi-Quelltext
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:
deklarien:

aStringlist: TStringlist;
  lied: integer = 0;







für ein Button:

rocedure TForm1.Button1Click(Sender: TObject);
begin
aStringlist := TStringlist.Create;
OpenDialog1.Execute;
aStringlist.Add(opendialog1.filename);
OpenDialog2.Execute;
aStringlist.Add(opendialog2.filename);
MediaPlayer1.FileName := aStringlist[lied];
      MediaPlayer1.Open;
      MediaPlayer1.Play;

end;






und für den lied weiter button:

procedure TForm1.Button2Click(Sender: TObject);
begin

      MediaPlayer1.stop;
lied := +1;
MediaPlayer1.FileName := aStringlist[lied];
      MediaPlayer1.Open;
MediaPlayer1.Play;
end;


Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt

_________________
|x-32:88x+39-3|+3:21=47-4x
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 13.04.07 18:18 
Schau mal hier, ein sehr gutes Tutorial.
Mediaplayer für Dummies

@Xadron
ausblenden Quelltext
1:
[Delpi]//Quelltext[/Delphi]					

ausblenden Delphi-Quelltext
1:
//Quelltext					

oder Quelltext markieren unter Bereich - Delphi wählen und auf das + klicken.

Edit: Der Link scheint nicht richtig zu funzen man klicke hier.
www.krazz.net/retnyg...etnyg/tut/mptut1.htm

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
Roy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 184

Windows7 Ultimate
Delphi 2007, NET, Embarcadero
BeitragVerfasst: Sa 14.04.07 15:29 
wie erstelle ich eine StringList. Nehme ich dazu eine StringValuesList und nenne diese aStringList oder muss ich die List selber erstellen? Und wo kommt der Quellcode rein?

Bin jetzt wie folgt vorgegangen
ausblenden volle Höhe Delphi-Quelltext
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:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
var
  Form1: TForm1;
  aStringlist: TStringlist;
lied: integer = 0;
implementation

{$R *.dfm}


procedure TForm1.Image3Click(Sender: TObject);
begin
MediaPlayer1.Stop;
Image3.Visible:=false;
Image2.Visible:=true
end;

 procedure TForm1.WMNCHitTest (var M: TWMNCHitTest);
begin
  inherited;
  if M.Result = htClient then 
    M.Result := htCaption;
end;

 var
  ID3Tag: TID3Tag;

procedure Lese_ID3Tag(Filename: string);
var
  Buffer: array[1..128] of char;
  F: File;
  mp3hdrread: array[1..4] of byte;
  mp3hdr: longint absolute mp3hdrread;
  tempbyte, bitrateindex, versionindex: byte;
  bitrate, version, layer, groese: longint;
begin
  AssignFile(F, Filename);

  Reset(F,1);
  groese:=filesize(f);
  blockread(f,mp3hdrread,4);
  tempbyte:=mp3hdrread[1];
  mp3hdrread[1]:=mp3hdrread[4];
  mp3hdrread[4]:=tempbyte;
  tempbyte:=mp3hdrread[2];
  mp3hdrread[2]:=mp3hdrread[3];
  mp3hdrread[3]:=tempbyte;

  reset(f,1);
  Seek(F,FileSize(F)-128);
  BlockRead(F, Buffer, SizeOf(Buffer));
  CloseFile(F);
  bitrateindex:=((mp3hdr shr 12) and $F);
  versionindex:=((mp3hdr shr 19) and $3);

  case versionindex of
    0: version:=3;
    1: version:=0; //unbekannt
    2: version:=2;
    3: version:=1;
  end;

  layer:=4-((mp3hdr shr 17) and $3);

  if version<>0 then
    bitrate:=MPEG_BIT_RATES[version][layer][bitrateindex]
  else
    bitrate:=128;

  with ID3Tag do
  begin
    ID:=copy(Buffer,1,3);
    Titel:=copy(Buffer,4,30);
    Artist:=copy(Buffer,34,30);
    Album:=copy(Buffer,64,30);
    Year:=copy(Buffer,94,4);
    Comment:=copy(Buffer,98,30);
    Genre:=ord(Buffer[128]);
    sample:=sample_rates[version][((mp3hdr shr 10) and $3)];
    dauer:=(groese*8) div ((bitrate)*1000);
    bits:=bitrate;
    vers:=version;
    layers:=layer;
  end;
  end;

procedure TForm1.Image5Click(Sender: TObject);
begin
  if OpenDialog1.Execute then
  begin
    Lese_ID3Tag(OpenDialog1.FileName);

    Titel.Caption:=ID3Tag.Titel;
    Artist.Caption:=ID3Tag.Artist;
    Album.Caption:=ID3Tag.Album;
    Year.Caption:=ID3Tag.Year;
    Comment.Caption:=ID3Tag.Comment;
    Genre.Caption:=IntToStr(ID3Tag.Genre);

    Duration.Caption:=IntToStr(id3tag.dauer);
    Samplerate.Caption:=IntToStr(id3tag.sample);
    Bitrate.Caption:=IntToStr(id3tag.bits);
    Layer.caption:=IntToStr(id3tag.layers);
    Yersion.caption:=IntToStr(id3tag.vers);
  end;
    with MediaPlayer1 do begin
    FileName := OpenDialog1.FileName;
    Image2.Visible:=false;
    Image3.Visible:=true;
    Open;
    Play;
end;
end;


jedoch kann ich nur einen Titel laden!

Wer kann mir da Weiterhelfen
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Sa 14.04.07 15:58 
Wie wäre es denn mit lesen ?
www.krazz.net/retnyg...etnyg/tut/mptut1.htm
Also manchmal... :roll:

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)