Und das nächste Problem welches ich leider wieder nicht in den Griff bekomme.
Folgendes:
Habe Wave-Dateien im Resource:
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:
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..3] of 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.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?!
