Gorilla.Audio.FMOD.Sound
Unit Gorilla.Audio.FMOD.Sound.pasClasses
- TGorillaFMODSound = class ( TGorillaFMODObject , IGorillaFMODSound )
Constants
- const GORILLA_AUDIO_FMOD_STREAM_MODE_MEMORY : Integer = $880;
TGorillaFMODSound
Wrapper record structure for sound instances.
Ancestors
Implements Interfaces
- IGorillaFMODSound
Members
Methods
- public destructor Destroy
(
)
;
Frees a sound object.
- protected function GetSystemObject ( ) : Pointer ; override;
- protected function GetParent ( ) : IGorillaFMODSound ;
- protected function GetLength ( AIndex : Cardinal ) : Cardinal ;
- protected function GetName ( ) : string ;
- protected function GetMode ( ) : Cardinal ;
- protected procedure SetMode ( const AValue : Cardinal ) ;
- protected function GetDefaults ( ) : TGorillaFMODSoundDefaults ;
- protected procedure SetDefaults ( const AValue : TGorillaFMODSoundDefaults ) ;
- protected function Get3DMinMaxDistance ( ) : TGorillaFMOD3DMinMaxDistance ;
- protected procedure Set3DMinMaxDistance ( const AValue : TGorillaFMOD3DMinMaxDistance ) ;
- protected function Get3DConeSettings ( ) : TGorillaFMOD3DConeSettings ;
- protected procedure Set3DConeSettings ( const AValue : TGorillaFMOD3DConeSettings ) ;
- protected function Get3DCustomRolloff ( ) : TGorillaFMOD3DCustomRolloff ;
- protected procedure Set3DCustomRolloff ( const AValue : TGorillaFMOD3DCustomRolloff ) ;
- protected function GetFormat ( ) : TGorillaFMODSoundFormat ;
- protected function GetNumSubSounds ( ) : Integer ;
- protected function GetNumTags ( ) : TGorillaFMODSoundNumTags ;
- protected function GetOpenState ( ) : TGorillaFMODOpenState ;
- protected function GetNumSyncPoints ( ) : Integer ;
- protected function GetLoopCount ( ) : Integer ;
- protected procedure SetLoopCount ( const AValue : Integer ) ;
- protected function GetMusicNumChannels ( ) : Integer ;
- protected procedure SetMusicSpeed ( const AValue : Single ) ;
- protected function GetMusicSpeed ( ) : Single ;
- protected procedure SetUserData ( const AValue : Pointer ) ;
- protected function GetUserData ( ) : Pointer ;
- public function CreateFromFile
(
ASystem :
IGorillaFMODSystem; AFileName :
string; AMode :
Cardinal
=
$0
; AExInfo :
PFMOD_CreateSoundExInfo
=
nil
)
: IGorillaFMODSound
;
class;
Loads a sound into memory, or opens it for streaming.
- public function CreateFromStream
(
ASystem :
IGorillaFMODSystem; AData :
Pointer; ALength :
Cardinal; AMode :
Cardinal
=
$880
; AExInfo :
PFMOD_CreateSoundExInfo
=
nil
)
: IGorillaFMODSound
;
class overload;
Opens a sound for streaming. This function is a helper function that is the same as System::createSound but has the FMOD_CREATESTREAM flag added internally.
- public function CreateFromStream
(
ASystem :
IGorillaFMODSystem; AStream :
TMemoryStream; AMode :
Cardinal
=
$880
; AExInfo :
PFMOD_CreateSoundExInfo
=
nil
)
: IGorillaFMODSound
;
class overload;
Wrapper constructor to supply a TMemoryStream as source stream. The method will use the "Memory" pointer as data pointer and Stream.Size as length within CreateFromStream() routine.
- public function CreateFromStream
(
ASystem :
IGorillaFMODSystem; AStream :
TStream; AMode :
Cardinal
=
$880
; AExInfo :
PFMOD_CreateSoundExInfo
=
nil
)
: IGorillaFMODSound
;
class overload;
Wrapper constructor to supply a TStream as source stream. Comparable to CreateFromStream() by TMemoryStream, but instead it will load the complete stream to memory instead of constant streaming.
- public function GetSubSound
(
const
AIndex :
Integer
)
: IGorillaFMODSound
;
Retrieves a handle to a Sound object that is contained within the parent sound.
Parameters
- const AIndex : Integer - Index of the subsound to retrieve within this sound.
- public procedure Play
(
AChannelGroup :
IGorillaFMODChannelGroup
=
nil
; APaused :
LongBool
=
False
)
;
Plays a sound object on a particular channel and ChannelGroup if desired.
- public function PlayWithChannel
(
AChannelGroup :
IGorillaFMODChannelGroup
=
nil
; APaused :
LongBool
=
False
)
: IGorillaFMODChannel
;
Plays a sound object on a particular channel and ChannelGroup if desired.
- public procedure Lock
(
AOffset :
Cardinal; ALength :
Cardinal; APtr1 :
PPointer; APtr2 :
PPointer; out
ALen1 :
Cardinal; out
ALen2 :
Cardinal
)
;
Returns a pointer to the beginning of the sample data for a sound.
Parameters
- AOffset : Cardinal - Offset in bytes to the position you want to lock in the sample buffer. Number of bytes you want to lock in the sample buffer. Address of a pointer that will point to the first part of the locked data. Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer. Length of data in bytes that was locked for APtr1. Length of data in bytes that was locked for APtr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- ALength : Cardinal - Offset in bytes to the position you want to lock in the sample buffer. Number of bytes you want to lock in the sample buffer. Address of a pointer that will point to the first part of the locked data. Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer. Length of data in bytes that was locked for APtr1. Length of data in bytes that was locked for APtr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- APtr1 : PPointer - Offset in bytes to the position you want to lock in the sample buffer. Number of bytes you want to lock in the sample buffer. Address of a pointer that will point to the first part of the locked data. Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer. Length of data in bytes that was locked for APtr1. Length of data in bytes that was locked for APtr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- APtr2 : PPointer - Offset in bytes to the position you want to lock in the sample buffer. Number of bytes you want to lock in the sample buffer. Address of a pointer that will point to the first part of the locked data. Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer. Length of data in bytes that was locked for APtr1. Length of data in bytes that was locked for APtr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- out ALen1 : Cardinal - Offset in bytes to the position you want to lock in the sample buffer. Number of bytes you want to lock in the sample buffer. Address of a pointer that will point to the first part of the locked data. Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer. Length of data in bytes that was locked for APtr1. Length of data in bytes that was locked for APtr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- out ALen2 : Cardinal - Offset in bytes to the position you want to lock in the sample buffer. Number of bytes you want to lock in the sample buffer. Address of a pointer that will point to the first part of the locked data. Address of a pointer that will point to the second part of the locked data. This will be null if the data locked hasn't wrapped at the end of the buffer. Length of data in bytes that was locked for APtr1. Length of data in bytes that was locked for APtr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- public procedure Unlock
(
APtr1 :
Pointer; APtr2 :
Pointer; ALen1 :
Cardinal; ALen2 :
Cardinal
)
;
Releases previous sample data lock from Sound::lock.
Parameters
- APtr1 : Pointer - Pointer to the 1st locked portion of sample data, from Sound::lock. Pointer to the 2nd locked portion of sample data, from Sound::lock. Length of data in bytes that was locked for ptr1. Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- APtr2 : Pointer - Pointer to the 1st locked portion of sample data, from Sound::lock. Pointer to the 2nd locked portion of sample data, from Sound::lock. Length of data in bytes that was locked for ptr1. Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- ALen1 : Cardinal - Pointer to the 1st locked portion of sample data, from Sound::lock. Pointer to the 2nd locked portion of sample data, from Sound::lock. Length of data in bytes that was locked for ptr1. Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- ALen2 : Cardinal - Pointer to the 1st locked portion of sample data, from Sound::lock. Pointer to the 2nd locked portion of sample data, from Sound::lock. Length of data in bytes that was locked for ptr1. Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.
- public procedure GetTag
(
const
AName :
string; AIndex :
Integer; ATag :
PFMOD_Tag
)
;
Retrieves a descriptive tag stored by the sound, to describe things like the song name, author etc.
Parameters
- const AName : string - Optional. Name of a tag to retrieve. Used to specify a particular tag if the user requires it. To get all types of tags leave this parameter as 0 or NULL. Index into the tag list. If the name parameter is null, then the index is the index into all tags present, from 0 up to but not including the numtags value returned by Sound::getNumTags. If name is not null, then index is the index from 0 up to the number of tags with the same name. For example if there were 2 tags with the name "TITLE" then you could use 0 and 1 to reference them. Specifying an index of -1 returns new or updated tags. This can be used to pull tags out as they are added or updated. Pointer to a tag structure. This will receive all the details regarding the tag specified by name / index.
- AIndex : Integer - Optional. Name of a tag to retrieve. Used to specify a particular tag if the user requires it. To get all types of tags leave this parameter as 0 or NULL. Index into the tag list. If the name parameter is null, then the index is the index into all tags present, from 0 up to but not including the numtags value returned by Sound::getNumTags. If name is not null, then index is the index from 0 up to the number of tags with the same name. For example if there were 2 tags with the name "TITLE" then you could use 0 and 1 to reference them. Specifying an index of -1 returns new or updated tags. This can be used to pull tags out as they are added or updated. Pointer to a tag structure. This will receive all the details regarding the tag specified by name / index.
- ATag : PFMOD_Tag - Optional. Name of a tag to retrieve. Used to specify a particular tag if the user requires it. To get all types of tags leave this parameter as 0 or NULL. Index into the tag list. If the name parameter is null, then the index is the index into all tags present, from 0 up to but not including the numtags value returned by Sound::getNumTags. If name is not null, then index is the index from 0 up to the number of tags with the same name. For example if there were 2 tags with the name "TITLE" then you could use 0 and 1 to reference them. Specifying an index of -1 returns new or updated tags. This can be used to pull tags out as they are added or updated. Pointer to a tag structure. This will receive all the details regarding the tag specified by name / index.
- public function GetAllTagsAsList
(
)
: TGorillaFMODTagList
;
Helper function to get all tags in a list. The method will implicitly call GetTag to retrieve all embedded tags.
- public function ReadData
(
ABuffer :
Pointer; ALength :
Cardinal
)
: Cardinal
;
Reads data from an opened sound to a specified pointer, using the FMOD codec created internally.
Parameters
- ABuffer : Pointer - A buffer that receives the decoded data from the sound. Number of bytes to read into the buffer.
- ALength : Cardinal - A buffer that receives the decoded data from the sound. Number of bytes to read into the buffer.
- public procedure SeekData
(
APCM :
Cardinal
)
;
Seeks a sound for use with data reading. This is not a function to 'seek a sound' for normal use. This is for use in conjunction with Sound::readData.
Parameters
- APCM : Cardinal - Offset to seek to in PCM samples.
- public procedure SetSoundGroup
(
ASoundGroup :
IGorillaFMODSoundGroup
)
;
Moves the sound from its existing SoundGroup to the specified sound group.
- public function GetSoundGroup
(
)
: IGorillaFMODSoundGroup
;
Retrieves the sound's current soundgroup.
- public function GetSyncPoint
(
AIndex :
Integer
)
: PFMOD_SyncPoint
;
Retrieve a handle to a sync point. These points can be user generated or can come from a wav file with embedded markers.
- public function GetSyncPointInfo
(
AName :
string; AOffsetType :
Cardinal
)
: TGorillaFMODSyncPointInfo
;
Retrieves information on an embedded sync point. These points can be user generated or can come from a wav file with embedded markers.
Parameters
- AName : string - the name of the syncpoint. Optional. Specify 0 or NULL to ignore. A timeunit parameter to determine a desired format for the offset parameter. For example the offset can be specified as pcm samples, or milliseconds.
- AOffsetType : Cardinal - the name of the syncpoint. Optional. Specify 0 or NULL to ignore. A timeunit parameter to determine a desired format for the offset parameter. For example the offset can be specified as pcm samples, or milliseconds.
- public function AddSyncPoint
(
AOffset :
Cardinal; AOffsetType :
Cardinal; const
AName :
string
)
: PFMOD_SyncPoint
;
Adds a sync point at a specific time within the sound. These points can be user generated or can come from a wav file with embedded markers.
Parameters
- AOffset : Cardinal - Offset in units specified by offsettype to add the callback syncpoint for a sound. Offset type to describe the offset provided. Could be PCM samples or milliseconds for example. A name character string to be stored with the sync point. This will be provided via the sync point callback.
- AOffsetType : Cardinal - Offset in units specified by offsettype to add the callback syncpoint for a sound. Offset type to describe the offset provided. Could be PCM samples or milliseconds for example. A name character string to be stored with the sync point. This will be provided via the sync point callback.
- const AName : string - Offset in units specified by offsettype to add the callback syncpoint for a sound. Offset type to describe the offset provided. Could be PCM samples or milliseconds for example. A name character string to be stored with the sync point. This will be provided via the sync point callback.
- public procedure DeleteSyncPoint
(
APoint :
PFMOD_SyncPoint
)
;
Deletes a syncpoint within the sound. These points can be user generated or can come from a wav file with embedded markers.
Parameters
- APoint : PFMOD_SyncPoint - Address of an FMOD_SYNCPOINT object.
- public procedure SetLoopPoints
(
ALoopStartType :
Cardinal; ALoopEndType :
Cardinal; AValue :
TGorillaFMODLoopPoints
)
;
Sets the loop points within a sound.
Parameters
- ALoopStartType :
Cardinal
-
The time format used for the loop start point. See FMOD_TIMEUNIT.
The time format used for the loop end point. See FMOD_TIMEUNIT.
LoopStart - The loop start point. This point in time is played, so it is inclusive.
LoopEnd - The loop end point. This point in time is played, so it is inclusive.
- ALoopEndType :
Cardinal
-
The time format used for the loop start point. See FMOD_TIMEUNIT.
The time format used for the loop end point. See FMOD_TIMEUNIT.
LoopStart - The loop start point. This point in time is played, so it is inclusive.
LoopEnd - The loop end point. This point in time is played, so it is inclusive.
- AValue :
TGorillaFMODLoopPoints
-
The time format used for the loop start point. See FMOD_TIMEUNIT.
The time format used for the loop end point. See FMOD_TIMEUNIT.
LoopStart - The loop start point. This point in time is played, so it is inclusive.
LoopEnd - The loop end point. This point in time is played, so it is inclusive.
- ALoopStartType :
Cardinal
-
The time format used for the loop start point. See FMOD_TIMEUNIT.
The time format used for the loop end point. See FMOD_TIMEUNIT.
- public function GetLoopPoints
(
ALoopStartType :
Cardinal; ALoopEndType :
Cardinal
)
: TGorillaFMODLoopPoints
;
Retrieves the loop points for a sound.
Parameters
- ALoopStartType : Cardinal - The time format used for the loop start point. See FMOD_TIMEUNIT. The time format used for the loop end point. See FMOD_TIMEUNIT.
- ALoopEndType : Cardinal - The time format used for the loop start point. See FMOD_TIMEUNIT. The time format used for the loop end point. See FMOD_TIMEUNIT.
- public procedure SetMusicChannelVolume
(
AChannel :
Integer; AVolume :
Single
)
;
Sets the volume of a MOD/S3M/XM/IT/MIDI music channel volume.
Parameters
- AChannel : Integer - MOD/S3M/XM/IT/MIDI music subchannel to retrieve the volume for. The volume of the channel from 0.0 to 1.0. Default = 1.0.
- AVolume : Single - MOD/S3M/XM/IT/MIDI music subchannel to retrieve the volume for. The volume of the channel from 0.0 to 1.0. Default = 1.0.
- public function GetMusicChannelVolume
(
AChannel :
Integer
)
: Single
;
Retrieves the volume of a MOD/S3M/XM/IT/MIDI music channel volume.
Parameters
- AChannel : Integer - MOD/S3M/XM/IT/MIDI music subchannel to retrieve the volume for.
Properties
- public Parent : IGorillaFMODSound
- public Length[Index] : Cardinal
- public Name : string
- public Mode : Cardinal
- public Defaults : TGorillaFMODSoundDefaults
Retrieves a sound's default attributes for when it is played on a channel with System::playSound.
read GetDefaults
write SetDefaults - public _3DMinMaxDistance : TGorillaFMOD3DMinMaxDistance
Retrieve the minimum and maximum audible distance for a sound.
read Get3DMinMaxDistance
write Set3DMinMaxDistance - public _3DConeSettings : TGorillaFMOD3DConeSettings
Retrieves the inside and outside angles of the sound projection cone.
read Get3DConeSettings
write Set3DConeSettings - public _3DCustomRolloff : TGorillaFMOD3DCustomRolloff
Retrieves a pointer to the sound's current custom rolloff curve.
read Get3DCustomRolloff
write Set3DCustomRolloff - public Format : TGorillaFMODSoundFormat
- public NumSubSounds : Integer
- public NumTags : TGorillaFMODSoundNumTags
- public OpenState : TGorillaFMODOpenState
Retrieves the state a sound is in after FMOD_NONBLOCKING has been used to open it, or the state of the streaming buffer.
read GetOpenState - public NumSyncPoints : Integer
Retrieves the number of sync points stored within a sound. These points can be user generated or can come from a wav file with embedded markers.
read GetNumSyncPoints - public LoopCount : Integer
- public MusicNumChannels : Integer
- public MusicSpeed : Single
- public UserData : Pointer
A user value that the Sound object will store internally. Can be retrieved with Sound::getUserData.
read GetUserData
write SetUserData