M fpsound.pas

AM   OpenAL_NT.pas
M    fpsound_openal.pas


git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2275 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
yangjixian
2012-02-01 01:46:41 +00:00
parent 9f861a7b4c
commit 00857e5d2c
4 changed files with 2402 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
object Form1: TForm1
Left = 323
Left = 200
Height = 240
Top = 171
Top = 166
Width = 320
Caption = 'Form1'
ClientHeight = 240
@ -19,7 +19,7 @@ object Form1: TForm1
end
object pathEdit: TFileNameEdit
Left = 8
Height = 25
Height = 27
Top = 13
Width = 268
FileName = '/home/felipe/Programas/lazarus-ccr/components/fpsound/testsounds/test.wav'

View File

@ -104,6 +104,7 @@ type
procedure Stop;
procedure Seek(ANewPos: Double);
procedure SetSoundPlayer(AKind: TSoundPlayerKind);
function GetSoundDocPtr: Pointer;
end;
var
@ -285,6 +286,13 @@ begin
FPlayer := GSoundPlayers[AKind];
end;
function TSoundDocument.GetSoundDocPtr: Pointer;
begin
aStream.Position := 0;
getmem(Result, aStream.Size);
aStream.Read(Result^, aStream.Size);
end;
var
lReaderIndex: TSoundFormat;
lPlayerIndex: TSoundPlayerKind;

View File

@ -15,7 +15,7 @@ unit fpsound_openal;
interface
uses
Classes, SysUtils, openal, fpsound;
Classes, SysUtils, OpenAL_NT, fpsound;
type
@ -26,9 +26,9 @@ type
al_device: PALCdevice;
al_context: PALCcontext;
codec_bs : Longword;
al_source : ALuint;
al_source : TALuint;
al_format : Integer;
al_buffers : array[0..0] of ALuint;
al_buffers : array[0..0] of TALuint;
al_bufsize : Longword;
al_readbuf : Pointer;
al_rate : Longword;
@ -107,15 +107,24 @@ begin
Inc(lBufferWordPtr, 2);
end;
end;
al_readbuf := ASound.GetSoundDocPtr;
end;
procedure TOpenALPlayer.Initialize;
var argv: array of PALbyte;
begin
if FInitialized then Exit;
al_device := alcOpenDevice(nil);
IsMultiThread := False;
if not InitOpenAL then
Exception.Create('Initialize OpenAL failed');
{ al_device := alcOpenDevice(nil);
al_context := alcCreateContext(al_device, nil);
alcMakeContextCurrent(al_context);
alcMakeContextCurrent(al_context); }
alutInit(nil, argv);
al_bufcount := 1;
alGenBuffers(al_bufcount, @al_buffers);
alListener3f(AL_POSITION, 0, 0, 0);
alListener3f(AL_VELOCITY, 0, 0, 0);
@ -130,8 +139,6 @@ begin
alSourcei(al_source, AL_LOOPING, AL_FALSE);
// alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
al_bufcount := 1;
alGenBuffers(al_bufcount, @al_buffers);
FInitialized := True;
end;