aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-11 13:42:57 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-11 13:42:57 +0000
commit4e4e55b6e62a225d7f70a8aa9342e91881decbc8 (patch)
treeb1f817f132b9011d7e01e50438df11e8b703d4eb
parentbc01e7c70cf07c9758e09b07af5f788a45297eee (diff)
downloadusdx-4e4e55b6e62a225d7f70a8aa9342e91881decbc8.tar.gz
usdx-4e4e55b6e62a225d7f70a8aa9342e91881decbc8.tar.xz
usdx-4e4e55b6e62a225d7f70a8aa9342e91881decbc8.zip
Updated to the new audio-interface
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@785 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UAudioPlayback_Bass.pas86
1 files changed, 70 insertions, 16 deletions
diff --git a/Game/Code/Classes/UAudioPlayback_Bass.pas b/Game/Code/Classes/UAudioPlayback_Bass.pas
index ee6b1ef9..87ff183d 100644
--- a/Game/Code/Classes/UAudioPlayback_Bass.pas
+++ b/Game/Code/Classes/UAudioPlayback_Bass.pas
@@ -31,18 +31,21 @@ uses
UThemes;
type
- TMPModes = (mpNotReady, mpStopped, mpPlaying, mpRecording, mpSeeking,
- mpPaused, mpOpen);
-
-const
- ModeStr: array[TMPModes] of string = ('Not ready', 'Stopped', 'Playing', 'Recording', 'Seeking', 'Paused', 'Open');
-
-type
- TBassOutputStream = class(TAudioOutputStream)
- Handle: HSTREAM;
-
- constructor Create(); overload;
- constructor Create(stream: HSTREAM); overload;
+ TBassOutputStream = class(TAudioPlaybackStream)
+ private
+ Handle: HSTREAM;
+ public
+ constructor Create(); overload;
+ constructor Create(stream: HSTREAM); overload;
+
+ procedure Play(); override;
+ procedure Pause(); override;
+ procedure Stop(); override;
+ procedure Close(); override;
+ function GetLoop(): boolean; override;
+ procedure SetLoop(Enabled: boolean); override;
+ function GetLength(): real; override;
+ function GetStatus(): TStreamStatus; override;
end;
type
@@ -128,6 +131,61 @@ begin
Handle := stream;
end;
+procedure TBassOutputStream.Play();
+begin
+ BASS_ChannelPlay(Handle, True);
+end;
+
+procedure TBassOutputStream.Pause();
+begin
+ //if (Loaded) then
+ BASS_ChannelPause(Handle);
+end;
+
+procedure TBassOutputStream.Stop();
+begin
+ BASS_ChannelStop(Handle);
+end;
+
+procedure TBassOutputStream.Close();
+begin
+ Bass_StreamFree(Handle);
+end;
+
+function TBassOutputStream.GetLoop(): boolean;
+begin
+ // TODO
+ result := false;
+end;
+
+procedure TBassOutputStream.SetLoop(Enabled: boolean);
+begin
+ // TODO
+end;
+
+function TBassOutputStream.GetLength(): real;
+var
+ bytes: integer;
+begin
+ bytes := BASS_ChannelGetLength(Handle);
+ Result := BASS_ChannelBytes2Seconds(Handle, bytes);
+end;
+
+function TBassOutputStream.GetStatus(): TStreamStatus;
+var
+ state: DWORD;
+begin
+ state := BASS_ChannelIsActive(Handle);
+ case state of
+ BASS_ACTIVE_PLAYING:
+ result := sPlaying;
+ BASS_ACTIVE_PAUSED:
+ result := sPaused;
+ else
+ result := sStopped;
+ end;
+end;
+
function TAudioPlayback_Bass.GetName: String;
begin
@@ -267,8 +325,6 @@ function TAudioPlayback_Bass.Length: real;
var
bytes: integer;
begin
- Result := 60;
-
bytes := BASS_ChannelGetLength(MusicStream);
Result := BASS_ChannelBytes2Seconds(MusicStream, bytes);
end;
@@ -277,8 +333,6 @@ function TAudioPlayback_Bass.getPosition: real;
var
bytes: integer;
begin
- Result := 0;
-
bytes := BASS_ChannelGetPosition(MusicStream);
Result := BASS_ChannelBytes2Seconds(MusicStream, bytes);
end;