myevan / nebula3

Automatically exported from code.google.com/p/nebula3
0 stars 0 forks source link

There may be a delay on 3D Cue's transform information to take place #10

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. build a cue which has a distance attenuation with XACT(DXSDK's Tool)
2. Setup the N3's Audio System
3. Play that cue at a distance(the sound volume should be lower)

What is the expected output? What do you see instead?
at the start of playing, the sound effect has no distance attenuation, but 
after about 0.1 second, this attenuation takes place.

What version of the product are you using? On what operating system?
Nebula3 SDK (Sep 2008), Microsoft DirectX SDK (March 2008)

Please provide any additional information below.
the 3d effect won't take place before xactEngine->DoWork(), so you should 
update the engine when the cue starts playing:

Ptr<Cue>
AudioDeviceBase::PlayCue(const CueId& cueId, bool play, bool enable3D, 
const Math::matrix44& transform, const Math::vector& velocity)
{
    n_assert(this->IsOpen());
    Ptr<SoundBank> soundBank;
    IndexT cueIndex = this->FindCue(cueId, soundBank);
    if (InvalidIndex != cueIndex)
    {
        // create and setup a new cue instance
        Ptr<Cue> newCue = Cue::Create();
        newCue->Setup(soundBank, cueIndex, play, enable3D);
        this->activeCues.Append(newCue);
        if (enable3D)
        {
            newCue->SetTransform(transform);
            newCue->SetVelocity(velocity);
            this->OnFrame();
        }
        return newCue;
    }
    else
    {
        n_error("PlayCue(): cue '%s' not found in any loaded sound bank!", 
cueId.Value().AsCharPtr());
        return Ptr<Cue>();
    }
}

Original issue reported on code.google.com by xoyoj...@gmail.com on 29 Nov 2008 at 6:25