Autor Beitrag
Killmag10
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: Sa 01.11.03 19:34 
Hi

ich will mit

playsound aus einer RESOURCE sound ausgeben ! das funktioniert aber nicht !

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:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, mmSystem,
  StdCtrls, MPlayer;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
{$R Sounds.RES}

procedure TForm1.Button1Click(Sender: TObject);
begin
mmSystem.PlaySound('1',hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);
end;

end.


.rc Datei :

ausblenden Quelltext
1:
1 RCDATA 1.wav					



was mach ich falsch ?

der sound wird auch in die exe eingebunden, aber er spield es nicht ab !

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: Sa 01.11.03 23:22 
Hallo,

du hast den Sound in der Ressoruce nicht mit 'nem String deklariert (Strings dürfen nicht mit 'ner Ziffer anfangen), sondern mit 'ner Zahl (1). Du musst ihn so aufrufen:
ausblenden Delphi-Quelltext
1:
mmSystem.PlaySound(PChar(1),hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);					


Wenn's jetzt ein String wäre ('Wave1 RCDATA 1.wav'), wäre es natürlich so:
ausblenden Delphi-Quelltext
1:
mmSystem.PlaySound(PChar('1'),hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);					


Untersch8ied: Anführungszeichen in PChar()...

_________________
Life is a bad adventure, but the graphic is really good!
Killmag10 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: So 02.11.03 01:12 
Andreas Pfau hat folgendes geschrieben:
Hallo,

du hast den Sound in der Ressoruce nicht mit 'nem String deklariert (Strings dürfen nicht mit 'ner Ziffer anfangen), sondern mit 'ner Zahl (1). Du musst ihn so aufrufen:
ausblenden Delphi-Quelltext
1:
mmSystem.PlaySound(PChar(1),hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);					


Wenn's jetzt ein String wäre ('Wave1 RCDATA 1.wav'), wäre es natürlich so:
ausblenden Delphi-Quelltext
1:
mmSystem.PlaySound(PChar('1'),hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);					


Untersch8ied: Anführungszeichen in PChar()...



hab's jetzt so gemacht !

geht aber immer noch nich ! :(

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: So 02.11.03 01:50 
Hallo,

oops.... du musst die Ressource als WAVE deklarieren, nicht als RCDATA - das macht einen Unterschied!

_________________
Life is a bad adventure, but the graphic is really good!
Killmag10 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: So 02.11.03 02:03 
geht immer noch nicht !


jetzige .rc Datei:

ausblenden Quelltext
1:
1 RCWAVE 1.wav					

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Phantom1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 390



BeitragVerfasst: So 02.11.03 09:52 
@Killmag10:

so muss deine .rc datei aussehen:

ausblenden Quelltext
1:
SND1 WAVE "1.wav"					


und so wird die datei abgespielt:

ausblenden Delphi-Quelltext
1:
mmSystem.PlaySound('SND1',hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);					
Killmag10 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: So 02.11.03 14:13 
Phantom1 hat folgendes geschrieben:
@Killmag10:

so muss deine .rc datei aussehen:

ausblenden Quelltext
1:
SND1 WAVE "1.wav"					


und so wird die datei abgespielt:

ausblenden Delphi-Quelltext
1:
mmSystem.PlaySound('SND1',hInstance,SND_ASYNC or SND_NODEFAULT or SND_RESOURCE);					


Yes ! Yes ! Yes ! :D

Es geht ! Danke !


achso wie ist das eigendlich mit MP3's ? mit was bindest man die ein ? einfach mit DATA ?

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: So 02.11.03 14:19 
Hallo,

du hast da echt was falsch verstanden - RCDATA ist ein eigenständiger Typ, und das "RC" hat nix mit WAVE zu tun - warum RCDATA so heißt und nicht "rawdata" oder so, weiß ich nicht, aber es gibt mal folgende Typen:
RCDATA (-> Rohdaten)
WAVE
ICON
CURSOR
BITMAP
AVI
Weiterhin existieren:
STRINGTABLE
VERSION
DIALOG
Aber die funzen anders - da kann man nicht einfahc 'ne Datei zuweisen.

Und das mit deinen Namen: Der Name MUSS UNBEDINGT mit einem Buchstaben uder _ anfangen.

_________________
Life is a bad adventure, but the graphic is really good!
Killmag10 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 297

Suse Linux / DOS / Windows All In One ;)
D4 / D2005
BeitragVerfasst: So 02.11.03 14:32 
gut mit den namen das hab ich jetzt auch gerafft !

aber mal ne frage ? warum hat er das dann überhaupt umgewandelt ?

weil RCWAVE ist ja falsch !

_________________
Mega-inkompetente Computer-ruinierende Organisation spioniert ohne funktionierende Technik
Andreas Pfau
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 997



BeitragVerfasst: So 02.11.03 19:33 
Hallo,

du meinst, warum hat Brcc32 das Schlüsselwort "RCWAVE" akzeptiert, obwohl es falsch ist? Ich benutze das Ding auch öfters, und mir ist im Laufe der Zeit eines klar geworden: Egal, was da steht, die Datei wird einfach gelinkt. Der Unterschied ist nur, dass wenn du ein Wave öffnen willst, du nur Zugriff kriegst, wenn WAVe davorsteht. Genauso mit AVI: AVI existiert nicht, aber wenn du ein AVI als RCDATA linkst, bekommst du keinen Zugriff. Irgendwie schwachsinnig, aber man muss sich wohl damit abfinden. Oder mal denen von Borland auf's Dach steigen, was das soll :wink: - schließlich ist in der Onlinehilfe davon nix erwähnt...

_________________
Life is a bad adventure, but the graphic is really good!