Sound appears again but cannot change sound file.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2279 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
yangjixian
2012-02-09 16:09:35 +00:00
parent a6547fdc14
commit 821628fbbe
3 changed files with 21 additions and 2 deletions

View File

@@ -52,7 +52,7 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Version Value="10"/>
<Target>
<Filename Value="soundtest"/>
</Target>
@@ -61,6 +61,10 @@
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<GenerateDebugInfo Value="True"/>
<DebugInfoType Value="dsAuto"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>

View File

@@ -200,6 +200,7 @@ begin
Clear();
lReader.ReadFromStream(lStream, Self);
lStream.Position := 0;
aStream.Clear;
aStream.LoadFromStream(lStream);
finally
lStream.Free;

View File

@@ -39,6 +39,8 @@ type
procedure Initialize; override;
procedure Finalize; override;
procedure Play(ASound: TSoundDocument); override;
procedure Pause(ASound: TSoundDocument); override;
procedure Stop(ASound: TSoundDocument); override;
procedure AdjustToKeyElement(ASound: TSoundDocument; AKeyElement: TSoundKeyElement);
procedure alStop;
//function alProcess(ASound: TSoundDocument; AKeyElement: TSoundKeyElement): Boolean;
@@ -193,7 +195,9 @@ begin
// Now clean up the source
alSourceStop(al_source);
alSourceRewind(al_source);
alSourcei(al_source, AL_BUFFER, 0);
// alSourcei(al_source, AL_BUFFER, 0);
if al_readbuf <> nil then
FreeMem(al_readbuf);
// Fill the buffer
alFillBuffer(ASound, lKeyElement);
@@ -204,6 +208,16 @@ begin
alSourcePlay(al_source);
end;
procedure TOpenALPlayer.Stop(ASound: TSoundDocument);
begin
alSourceStop(al_source);
end;
procedure TOpenALPlayer.Pause(ASound: TSoundDocument);
begin
alSourcePause(al_source);
end;
procedure TOpenALPlayer.AdjustToKeyElement(ASound: TSoundDocument;
AKeyElement: TSoundKeyElement);
begin