@DATABASE Audio V1.00
$VER: PureBasic - Audio library V1.00 (24.08.2000) © Fantaisie Software
@NODE MAIN "Audio"

  @{b}PureBasic - Audio V1.00@{ub}

    The Audio library is a top level library to manage
    all audios access from PureBasic. For now, Sound
    and PTModule libraries use it.

  @{b}Commands summary:@{ub}

    @{" AllocateAudioChannels " LINK AllocateAudioChannels}
    @{" FreeAudioChannels     " LINK FreeAudioChannels}
    @{" InitAudio             " LINK InitAudio}
    @{" UseAsPTModuleChannels " LINK UseAsPTModuleChannels}
    @{" UseAsSoundChannels    " LINK UseAsSoundChannels}

    @{" Audio Demo " LINK PureBasic:Examples/Sources/Audio.pb/Main}
@ENDNODE


@Node AllocateAudioChannels

    @{b}SYNTAX@{ub}
  @{b}Result@{ub}.w = AllocateAudioChannels(@{b}Channels@{ub}.w)

    @{b}FUNCTION@{ub}
  Use this function to allocate one or more audio
  channels.

  Call UseAsSoundChannels() and/or UseAsPTModuleChannels()
  to set up the right channel mask for each Lib.

  @{b}Channels@{ub}
  This mask specify which channel to allocate.

   1 = try to allocate channel 0
   2 = try to allocate channel 1
   4 = try to allocate channel 2
   8 = try to allocate channel 3

  When added together:

   9 = try to allocate channel 0 and 3
  15 = try to allocate all channels

  @{b}Result@{ub}
  If TRUE this show which is the allocated channels.

  If more than one channel is wanted no less is ever
  allocated. Lets say if you want all channels (15),
  the second channel have earlyer been allocated by
  another program, then the result will be FALSE as
  not all of the wanted channels could be allocated.
@EndNode


@Node FreeAudioChannels

    @{b}SYNTAX@{ub}
  @{b}Result@{ub}.w = FreeAudioChannels(@{b}Channels@{ub}.w)

    @{b}FUNCTION@{ub}
  Free one or more channels allocated with
  AllocateAudioChannels().

  Call UseAsSoundChannels() and/or UseAsPTModuleChannels()
  to set up the right channel mask for each Lib.

  @{b}Channels@{ub}
  This mask is the accually channels to free.

   1 = free channel 0
   2 = free channel 1
   4 = free channel 2
   8 = free channel 3

  When added together:

   9 = free channel 0 and 3
  15 = free all channels

  @{b}Result@{ub}
  This show which of the channels are freed.
@EndNode


@Node InitAudio

    @{b}SYNTAX@{ub}
  @{b}Result@{ub}.l = InitAudio()

    @{b}FUNCTION@{ub}
  This is the initroutine that always should be called
  befor any other routines in Audio Lib and even more;
  it MUST be called befor InitSound() and InitPTModule()
  as it is kind of master lib for Sound Lib and PTModule
  Lib.

  @{b}Result@{ub}
  If this is TRUE the Audio environment is correctly
  initialized but if it's instead FALSE no other
  Audio function should be called.
@EndNode


@Node UseAsPTModuleChannels

    @{b}SYNTAX@{ub}
  UseAsPTModuleChannels(@{b}Channels@{ub}.w)

    @{b}STATEMENT@{ub}
  Call this statement to set the channel mask
  for PTModule Lib, that it use when some of
  that nice tunes is to be played.

  @{b}Channels@{ub}
  This is the channel mask and it must never
  specify any channel that aren't properly
  allocated or is the same as for Sound Lib.

   1 = allow PTModule Lib to use channel 0
   2 = allow PTModule Lib to use channel 1
   4 = allow PTModule Lib to use channel 2
   8 = allow PTModule Lib to use channel 3

  When added together:

   9 = allow PTModule Lib to use channel 0 and 3
  15 = allow PTModule Lib to use all channels
@EndNode


@Node UseAsSoundChannels

    @{b}SYNTAX@{ub}
  UseAsSoundChannels(@{b}Channels@{ub}.w)

    @{b}STATEMENT@{ub}
  Call this statement to set the channel mask
  for Sound Lib, that it use when some fancy
  sound should be played.

  @{b}Channels@{ub}
  This is the channel mask and it must never
  specify any channel that aren't properly
  allocated or is the same as for PTModule Lib.

   1 = allow Sound Lib to use channel 0
   2 = allow Sound Lib to use channel 1
   4 = allow Sound Lib to use channel 2
   8 = allow Sound Lib to use channel 3

  When added together:

   9 = allow Sound Lib to use channel 0 and 3
  15 = allow Sound Lib to use all channels
@EndNode

