Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# IGSoundEffectsSubsystem.NormalSoundEffectSpecification

00001 00002 00003 00004 00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094

    class NormalSoundEffectSpecification extends SoundEffectSpecification
        within SoundEffectsSubsystem
        PerObjectConfig;

    // ============================================================================
    // NormalSoundEffectSpecification
    //
    // A NormalSoundEffectSpecification is an SoundEffectSpecification that handles creation
    // of normal unreal USound objects, and the data the sound designer needs to edit for their creation.
    //
    // ============================================================================

    // FlaggedSound is a struct that encapsulates a USound with a flag the sound plays for.  The flag is
    // set to the sound designer's preference to match the flag that a material would have.  When a sound
    // is requested to be played based on a material, the FlaggedSound with the matching flag will play.
    // If set to 0, the sound will play if no other flagged sound matches material wise, or if no flag for
    // the material will play.
    struct FlaggedSound
    {
        var config Sound SoundToPlay;
        var config int   Flag;
    };
    // As will all SoundEffectSpecifications, the sound is picked randomly from this list.
    var config array<FlaggedSound> FlaggedSounds;

    // This overriden hook function sets up the flags to be used for the engine call to PlaySound
    simulated protected event SetNativeFlagsHook()
    {
        local int i;
        if (IsSeamlessLoop)
        {
            NativeFlags += SF_Looping;

    //        if (Outer.bDebugSounds)
    //			Log("[SeamlessLoop] "$Self);
            // Set native looping on all samples
            for (i = 0; i < FlaggedSounds.Length; i++)
            {
                //Log(" - [SeamlessLoop] "$FlaggedSounds[i].SoundToPlay);
                if (FlaggedSounds[i].SoundToPlay != None)
                    class'SoundEffectsSubsystem'.static.SetNativeLooping (XLevel, FlaggedSounds[i].SoundToPlay);
            }
        }
    }

    // Initialize hook...
    simulated protected event InitHook()
    {
        // Sanity checks
        if ((NoRepeat || NeverRepeat) && !(FlaggedSounds.Length > 1))
        {
          Log ("[SOUND] WARNING!: Schema <"$":"$name$"> has NoRepeat/NeverRepeat but only has 1 sound!");
            NoRepeat = false;
            NeverRepeat = false;
        }
    }

    // Add all the flagged sounds to the soundsets array from a normal SoundEffectSpecification.  Note, sounds are added
    // to a soundset based on their flag, which is also their index into the soundsets array.
    simulated protected event PopulateSoundsHook()
    {
        local int i;
        local int iSetToInsert;
        local NormalSoundRef newNormalRef;

        if (FlaggedSounds.Length == 0)
        {
            assertWithDescription(false, "NormalSoundEffectSpecification "$Name$" has no FlaggedSounds specified. This will cause a crash if ignored.");
            assert(false);
        }

        for (i = 0; i < FlaggedSounds.Length; i++)
        {
            // glenn: commented out because it spams too much

            //assertWithDescription(FlaggedSounds[i].SoundToPlay != None, "The sound at index "$i$" in SoundEffectSpecification '"$name$"' was not found.");

            iSetToInsert = FlaggedSounds[i].Flag;

            // Make sure the SoundSets array is long enough to at least hold the sounds for this flag
            if ( SoundSets.Length <= iSetToInsert )
                SoundSets.Length = iSetToInsert + 1;

            // Create a new sound ref if necessary
            if ( SoundSets[iSetToInsert] == None )
                SoundSets[iSetToInsert] = new class'SoundSet';

            newNormalRef = new class'NormalSoundRef';
            newNormalRef.Sound = FlaggedSounds[i].SoundToPlay;

            SoundSets[iSetToInsert].AddSoundRef (newNormalRef);
        }
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 16:02:12.000 - Creation time: st 23.5.2018 00:10:46.103 - Created with UnCodeX