You've already forked lazarus-ccr
Save small change
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2331 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -38,6 +38,7 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*)
|
||||
|
||||
//The original file name is openal.pas
|
||||
unit OpenAL_NT;
|
||||
|
||||
{$IFDEF FPC}
|
||||
@ -2341,7 +2342,6 @@ begin
|
||||
stream.Position := stream.Position + readint;
|
||||
end;
|
||||
until stream.Position >= stream.size;
|
||||
|
||||
end;
|
||||
|
||||
procedure alutLoadWAVFile(fname: string; var format: TALenum; var data: TALvoid;
|
||||
|
@ -79,12 +79,12 @@ type
|
||||
|
||||
TSoundDocument = class
|
||||
private
|
||||
AStream: TMemoryStream;
|
||||
FPlayer: TSoundPlayer;
|
||||
FPlayerKind: TSoundPlayerKind;
|
||||
FCurElementIndex: Integer;
|
||||
FSoundData: TFPList; // of TSoundElement
|
||||
public
|
||||
SoundDocStream: TMemoryStream;
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
// Document read/save methods
|
||||
@ -104,7 +104,6 @@ type
|
||||
procedure Stop;
|
||||
procedure Seek(ANewPos: Double);
|
||||
procedure SetSoundPlayer(AKind: TSoundPlayerKind);
|
||||
function GetSoundDocStream: TStream;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -170,13 +169,13 @@ begin
|
||||
inherited Create;
|
||||
|
||||
FSoundData := TFPList.Create;
|
||||
aStream := TMemoryStream.Create;
|
||||
SoundDocStream := TMemoryStream.Create;
|
||||
end;
|
||||
|
||||
destructor TSoundDocument.Destroy;
|
||||
begin
|
||||
FSoundData.Free;
|
||||
aStream.Free;
|
||||
SoundDocStream.Free;
|
||||
if FPlayer <> nil then FPlayer.Finalize;
|
||||
inherited Destroy;
|
||||
end;
|
||||
@ -200,8 +199,8 @@ begin
|
||||
Clear();
|
||||
lReader.ReadFromStream(lStream, Self);
|
||||
lStream.Position := 0;
|
||||
aStream.Clear;
|
||||
aStream.LoadFromStream(lStream);
|
||||
SoundDocStream.Clear;
|
||||
SoundDocStream.LoadFromStream(lStream);
|
||||
finally
|
||||
lStream.Free;
|
||||
end;
|
||||
@ -291,14 +290,6 @@ begin
|
||||
FPlayer := GSoundPlayers[AKind];
|
||||
end;
|
||||
|
||||
function TSoundDocument.GetSoundDocStream: TStream;
|
||||
begin
|
||||
{aStream.Position := 0;
|
||||
getmem(Result, aStream.Size);
|
||||
aStream.Read(Result^, aStream.Size); }
|
||||
Result := aStream;
|
||||
end;
|
||||
|
||||
var
|
||||
lReaderIndex: TSoundFormat;
|
||||
lPlayerIndex: TSoundPlayerKind;
|
||||
|
@ -28,7 +28,7 @@ type
|
||||
codec_bs: longword;
|
||||
al_source: TALuint;
|
||||
al_format: integer;
|
||||
al_buffers: array[0..0] of TALuint;
|
||||
al_buffers: TALuint;
|
||||
al_bufsize: longword;
|
||||
al_readbuf: Pointer;
|
||||
al_rate: longword;
|
||||
@ -99,7 +99,7 @@ var
|
||||
lReadCount: integer = 0;
|
||||
lBufferBytePtr: PByte;
|
||||
lBufferWordPtr: PWord;
|
||||
loop: TALInt;
|
||||
loop: TALInt; aaa: TStringList;
|
||||
begin
|
||||
GetMem(al_readbuf, al_bufsize);
|
||||
Result := 0;
|
||||
@ -129,7 +129,11 @@ begin
|
||||
end;
|
||||
//AlutLoadWavFile('T:\fpsound\testsounds\test.wav', al_format, al_readbuf, al_bufsize, al_rate, loop);
|
||||
//alutLoadWAVMemory(ASound.GetSoundDocPtr, al_format, al_readbuf, al_bufsize, al_rate, loop);
|
||||
LoadWavStream(ASound.GetSoundDocStream, al_format, al_readbuf, al_bufsize, al_rate, loop);
|
||||
LoadWavStream(ASound.SoundDocStream, al_format, al_readbuf, al_bufsize, al_rate, loop);
|
||||
|
||||
aaa := TStringList.Create;
|
||||
aaa.Add(IntToStr(ASound.SoundDocStream.Size));
|
||||
aaa.SaveToFile(IntToStr(ASound.SoundDocStream.Size) + '.txt');
|
||||
end;
|
||||
|
||||
procedure TOpenALPlayer.Initialize;
|
||||
@ -201,8 +205,8 @@ begin
|
||||
|
||||
// Fill the buffer
|
||||
alFillBuffer(ASound, lKeyElement);
|
||||
alBufferData(al_buffers[0], al_format, al_readbuf, al_bufsize, al_rate);
|
||||
alSourceQueueBuffers(al_source, 1, @al_buffers[0]);
|
||||
alBufferData(al_buffers, al_format, al_readbuf, al_bufsize, al_rate);
|
||||
alSourceQueueBuffers(al_source, 1, @al_buffers);
|
||||
|
||||
// Play the sound
|
||||
alSourcePlay(al_source);
|
||||
|
Reference in New Issue
Block a user