Autor Beitrag
Pepp3r
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mi 23.03.11 18:02 
Und das nächste Problem welches ich leider wieder nicht in den Griff bekomme.
Folgendes:
Habe Wave-Dateien im Resource:
ausblenden Quelltext
1:
2:
3:
reihe WAVE reihe.wav
drop WAVE drop.wav
levelup WAVE levelup.wav


Ich möchte sie nun in ein Array of Stream laden:
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:
  TTetris = class
  private
    soundFx: Array [1..3of TMemoryStream;
//...
  end;
//...
procedure TTetris.InitData;
var
  i: Byte;
  S:Tresourcestream;
begin
  for i := 1 to 3 do
  begin
    soundFx[i] := TMemoryStream.Create;
    s:=Tresourcestream.create(HInstance,fx[i],'WAVE');
   try
    //s.Seek(i-1, sofrombeginning);
    //soundFx[i].LoadFromStream(s);
    s.SaveToStream(soundFx[i]);
   finally
    s.Free;
   end;
  end;
end;

procedure TTetris.PlayFx(fx: Tfx);
begin
  soundFx[ord(fx)+1].seek(0,sofromBeginning);
  sndPlaySound(PChar(soundFx[ord(fx)+1]), SND_ASYNC);
end;

//...


Bekomme zwar keine exception, aber der gewollte ton wird nich abgespielt, stattdessen nur ein Windows *Ping*-Geräusch.
Ich möchte die Dateien in jedem Fall im Stream speichern. Nicht auf der Festplatte (hat allerdings geklappt).
Hilfe?! :shock: :shock:
Pepp3r Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 82



BeitragVerfasst: Mi 23.03.11 19:36