//
      // UpdateEffect2D
      //
      // Update effect data (TRUE if effect was playing)
      //
      Bool UpdateEffect2D(Effect *e, S32 pan, F32 priority, S32 vol)
      {
        // See if this effect is still being played
        if (Voice *voice = FindVoicePlayingEffect(e))
        {
          AIL_set_sample_pan(voice->handle2D, pan);
          voice->priority = priority;
          AIL_set_sample_volume(voice->handle2D, vol);
          return (TRUE);
        }

        return (FALSE);
      }
      //
      // Play2D
      //
      // Play a record as a 2D sample (TRUE if actually started)
      //
      Bool Play2D
      (
        Effect *e, Record *r, S32 vol, U32 owner, F32 priority, S32 loop, S32 pan
      )
      {
        ASSERT(e);
        ASSERT(r);

        // Request a 2D voice
        Voice *voice = Request(priority, FALSE, e->GetVoiceIndex());

        if (!voice)
        {
          return (FALSE);
        }

        // Request the cache data
        Cache::Item *item = Cache::Request(r);

        if (!item)
        {
          // Unable to load data
          return (FALSE);
        }

        // Stop any sounds from this owner
        if (owner != NO_OWNER) 
        {
          Output::StopByOwner(owner);
        }

        // The current time
        U32 time = AIL_ms_count();

        // Are we under the minimum repeat time
        if ((time - r->lastUse) < MIN_REPEATTIME)
        {
          return (FALSE);
        }

        // Save info about this use
        r->lastUse = time;

        // Initialise the voice
        AIL_init_sample(voice->handle2D);

        // Initialise the sound effect data
        if (!AIL_set_sample_file(voice->handle2D, item->data, 0))
        {
          LOG_WARN(("Ignoring possibly corrupted file '%s'", r->Name()));
          r->valid = FALSE;
          return (FALSE);
        }

        // Setup the voice
        voice->effect = e;
        voice->record = r;
        voice->owner = owner;
        voice->priority = priority;

        // Set the volume
        AIL_set_sample_volume(voice->handle2D, vol);

        // Set the stereo panning
        AIL_set_sample_pan(voice->handle2D, pan);

        // Set the loop count for this voice
        AIL_set_sample_loop_count(voice->handle2D, loop);

        // Start the sample playing
        AIL_start_sample(voice->handle2D);

        return (TRUE);
      }
Beispiel #3
0
void __fastcall TForm_Main::c_TrackBar_PanChange(TObject *Sender)
{
	AIL_set_sample_pan( m_hSample, c_TrackBar_Pan->Position );
}