Download Now

    Reference TAudioBank

    Declared in Codebot.Hardware.pas on line 177

    TAudioBank plays one audio source. Banks belong to TAudio.
      TAudioBank = class
      public
        constructor Create(Audio: TAudio);
        destructor Destroy; override;
        { Load a source, which can be nil. The bank is paused and reset. }
        procedure Load(Source: TAudioSource); overload;
        { Load a source by name. The bank is paused and reset. }
        procedure Load(const Name: string); overload;
        { Load a source by id. The bank is paused and reset. }
        procedure Load(Id: Integer); overload;
        { Unload is the same as Load(nil) }
        procedure Unload;
        { Play the bank, raising it from silence to its volume over a number of
          seconds. A paused bank starts from silence where it was paused, and a
          completed bank starts again from the beginning. A bank which is fading out
          turns around from where the fade had reached. }
        procedure FadeIn(Seconds: Single);
        { Lower the bank to silence over a number of seconds and then pause it. Its
          position is kept, so FadeIn or Paused continues from there. }
        procedure FadeOut(Seconds: Single);
        { Pause the bank and set its properties to their defaults. Source, Duration
          and Reserved are not changed. }
        procedure Reset;
        { The source loaded in the bank }
        property Source: TAudioSource read FSource;
        { The duration of the source in seconds }
        property Duration: Single read GetDuration;
        { Completed is True once the bank has played to the end LoopCount times. The
          bank is then paused. }
        property Completed: Boolean read FCompleted;
        { A paused bank is not decoded or mixed. The default is True. A bank without
          a source is always paused. Setting Paused to False plays at the volume of
          the bank at once, ending any fade. }
        property Paused: Boolean read FPaused write SetPaused;
        { The number of times to play before the bank is completed. A value of less
          than 1 plays until it is stopped, and reads back as 0. The default is 1. }
        property LoopCount: Integer read FLoopCount write SetLoopCount;
        { The number of times the bank has played to the end }
        property Loop: Integer read FLoop;
        { A muted bank advances its position but is not heard }
        property Muted: Boolean read FMuted write SetMuted;
        { Pan moves the audio to the left at -1 or to the right at 1. The default is
          0. }
        property Pan: Single read FPan write SetPan;
        { Position is the playback point in seconds. Setting it clears Completed and
          sets Loop to 0. Most formats move the position to the start of the nearest
          block they can decode from, so the value read back can differ from the
          value set. }
        property Position: Single read GetPosition write SetPosition;
        { Volume ranges from 0 for silence to 1. The default is 1. Volume reads as 0
          while the bank is muted. }
        property Volume: Single read GetVolume write SetVolume;
        { A reserved bank is never chosen by TAudio.Play or TAudio.Next and can only
          be loaded directly }
        property Reserved: Boolean read FReserved write FReserved;
      end;

    See also