Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

GUI2K4.UT2K4Tab_AudioSettings


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
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478
00479
00480
00481
00482
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551
00552
00553
00554
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611
00612
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623
00624
00625
00626
00627
00628
00629
00630
00631
00632
00633
00634
00635
00636
00637
00638
00639
00640
00641
00642
00643
00644
00645
00646
00647
00648
00649
00650
00651
00652
00653
00654
00655
00656
00657
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688
00689
00690
00691
00692
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
//==============================================================================
//	Description
//
//	Created by Ron Prestenback
//	© 2003, Epic Games, Inc.  All Rights Reserved
//==============================================================================
class UT2K4Tab_AudioSettings extends Settings_Tabs;

#exec OBJ LOAD FILE=PickupSounds.uax
#exec OBJ LOAD FILE=AnnouncerMale2K4.uax

var array<CacheManager.AnnouncerRecord> Announcers;

var string StatusPreviewSound, RewardPreviewSound;

var localized string    AudioModes[4],
                        VoiceModes[4],
                        AnnounceModes[3];


var automated GUISectionBackground  i_BG1, i_BG2, i_BG3;
var automated moSlider      sl_MusicVol, sl_EffectsVol, sl_VoiceVol, sl_TTS;
var automated moComboBox    co_Mode, co_Voices, co_Announce, co_RewardAnnouncer, co_StatusAnnouncer;
var automated moCheckbox    ch_ReverseStereo, ch_MessageBeep, ch_AutoTaunt, ch_TTSIRC, ch_OnlyTeamTTS,
                            ch_MatureTaunts, ch_LowDetail, ch_Default, ch_TTS, ch_VoiceChat;
var automated moButton      b_VoiceChat;

var float   fMusic, fEffects, fTTS;
var int     iVoice, iMode, iVoiceMode, iAnnounce;
var string  sStatAnnouncer, sRewAnnouncer;
var bool    bRev, bBeep, bAuto, bMature, bLow, bCompat, b3DSound, bEAX, bDefault, bTTS, bTTSIRC, bOnlyTeamTTS, bVoiceChat;

function InitComponent(GUIController MyController, GUIComponent MyOwner)
{
    local int i;
    local bool bIsWin32;

    bIsWin32 = ( ( PlatformIsWindows() ) && ( !PlatformIs64Bit() ) );

    Super.InitComponent(MyController, MyOwner);

    if ( bIsWin32 )
    {
        for(i = 0;i < ArrayCount(AudioModes);i++)
            co_Mode.AddItem(AudioModes[i]);
    }
    else
    {
        co_Mode.AddItem("OpenAL");
    }

    for(i = 0;i < ArrayCount(VoiceModes);i++)
        co_Voices.AddItem(VoiceModes[i]);

    for(i = 0;i < ArrayCount(AnnounceModes);i++)
        co_Announce.AddItem(AnnounceModes[i]);

    i_BG2.WinWidth=0.503398;
    i_BG2.WinHeight=0.453045;
    i_BG2.WinLeft=0.004063;
    i_BG2.WinTop=0.540831;

    i_BG3.WinWidth=0.475078;
    i_BG3.WinHeight=0.453045;
    i_BG3.WinLeft=0.518712;
    i_BG3.WinTop=0.540831;

    i_BG1.ManageComponent(sl_MusicVol);
    i_BG1.ManageComponent(sl_EffectsVol);
    i_BG1.ManageComponent(co_Mode);
    i_BG1.ManageComponent(ch_LowDetail);
    i_BG1.ManageComponent(ch_Default);
    i_BG1.ManageComponent(ch_reverseStereo);
    i_BG1.ManageComponent(co_Voices);
    i_BG1.ManageComponent(ch_MatureTaunts);
    i_BG1.ManageComponent(ch_AutoTaunt);
    i_BG1.ManageComponent(ch_MessageBeep);

    i_BG2.ManageComponent(sl_VoiceVol);
    i_BG2.ManageComponent(co_Announce);

//	i_BG3.ManageComponent(sl_TTS);
    i_BG3.ManageComponent(ch_TTS);
    i_BG3.ManageComponent(ch_TTSIRC);
    i_BG3.ManageComponent(ch_OnlyTeamTTS);
    i_BG3.ManageComponent(ch_VoiceChat);
    i_BG3.ManageComponent(b_VoiceChat);

    i_BG2.ManageComponent(co_StatusAnnouncer);
    i_BG2.ManageComponent(co_RewardAnnouncer);

    class'CacheManager'.static.GetAnnouncerList( Announcers );
    for ( i = 0; i < Announcers.Length; i++ )
    {
        if ( Announcers[i].FriendlyName != "" )
        {
            co_StatusAnnouncer.AddItem( Announcers[i].FriendlyName,,string(i) );
            co_RewardAnnouncer.AddItem( Announcers[i].FriendlyName,,string(i) );
        }
    }

    // !!! FIXME: Might use a preinstalled system OpenAL in the future on
    // !!! FIXME:  Mac or Unix, but for now, we don't...  --ryan.
    if ( !PlatformIsWindows() )
        ch_Default.DisableMe();
}

function ResetClicked()
{
    local class<AudioSubSystem> A;
    local class UnrealPlayerClass;
    local PlayerController PC;
    local int i;

    Super.ResetClicked();

    PC = PlayerOwner();

    A = class<AudioSubSystem>(DynamicLoadObject(GetNativeClassName("Engine.Engine.AudioDevice"), Class'Class'));
    A.static.ResetConfig();

    class'Hud'.static.ResetConfig("bMessageBeep");
    class'LevelInfo'.static.ResetConfig("bLowSoundDetail");

    class'PlayerController'.static.ResetConfig("bAutoTaunt");
    class'PlayerController'.static.ResetConfig("bNoMatureLanguage");
    class'PlayerController'.static.ResetConfig("bNoAutoTaunts");
    class'PlayerController'.static.ResetConfig("bNoVoiceTaunts");
    class'PlayerController'.static.ResetConfig("bNoVoiceMessages");
    class'PlayerController'.static.ResetConfig("AnnouncerLevel");
    class'PlayerController'.static.ResetConfig("bNoTextToSpeechVoiceMessages");
//	class'PlayerController'.static.ResetConfig("TextToSpeechVoiceVolume");
    class'PlayerController'.static.ResetConfig("bOnlySpeakTeamText");
    class'UT2K4IRC_Page'.static.ResetConfig("bIRCTextToSpeechEnabled");

    UnrealPlayerClass = class(DynamicLoadObject("UnrealGame.UnrealPlayer",class'Class'));
    if ( UnrealPlayerClass != None )
    {
        UnrealPlayerClass.static.ResetConfig("CustomRewardAnnouncerPack");
        UnrealPlayerClass.static.ResetConfig("CustomStatusAnnouncerPack");
    }

    for (i = 0; i < Components.Length; i++)
        Components[i].LoadINI();
}

function InternalOnLoadINI(GUIComponent Sender, string s)
{
    local int i;
    local PlayerController PC;
    local bool bIsWin32;

    PC = PlayerOwner();

    switch (Sender)
    {
    case sl_VoiceVol:
        iVoice = PC.AnnouncerVolume;
        sl_VoiceVol.SetComponentValue(iVoice,true);
        break;

    case sl_MusicVol:
        fMusic = float(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice MusicVolume"));
        sl_MusicVol.SetComponentValue(fMusic,true);
        break;

    case sl_EffectsVol:
        fEffects = float(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice SoundVolume"));
        sl_EffectsVol.SetComponentValue(fEffects,true);
        break;
/*
    case sl_TTS:
        fTTS = PC.TextToSpeechVoiceVolume;
        sl_TTS.SetComponentValue(fTTS,true);
        break;
*/
    case co_Mode:
        iMode = 1;
        bIsWin32 = ( ( PlatformIsWindows() ) && ( !PlatformIs64Bit() ) );
        if ( !bIsWin32 )
        {
            bCompat = False;
            b3DSound = True;
            iMode = 0;
        }
        else
        {
            if ( bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice CompatibilityMode")) )
            {
                bCompat = True;
                iMode = 0;
            }

            if ( bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice Use3DSound")) )
            {
                b3DSound = True;
                iMode = 2;
            }

            if ( bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice UseEAX" )) )
            {
                bEAX = True;
                iMode = 3;
            }
        }
        co_Mode.SilentSetIndex(iMode);
        break;

    case ch_ReverseStereo:
        bRev = bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice ReverseStereo"));
        ch_ReverseStereo.SetComponentValue(bRev,true);
        break;

    case ch_Default:
        bDefault = bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice UseDefaultDriver"));
        ch_Default.SetComponentValue(bDefault,true);
        break;

    case co_Voices:
        if ( PC.bNoAutoTaunts ) iVoiceMode = 1;
        if ( PC.bNoVoiceTaunts ) iVoiceMode = 2;
        if ( PC.bNoVoiceMessages ) iVoiceMode = 3;
        co_Voices.SilentSetIndex(iVoiceMode);
        break;

    case ch_MessageBeep:
        bBeep = class'HUD'.default.bMessageBeep;
        ch_MessageBeep.SetComponentValue(bBeep,true);
        break;

    case ch_AutoTaunt:
        bAuto = PC.bAutoTaunt;
        ch_AutoTaunt.SetComponentValue(bAuto,true);
        break;

    case ch_TTS:
        bTTS = !PC.bNoTextToSpeechVoiceMessages;
        ch_TTS.SetComponentValue(bTTS,true);
        break;

    case ch_OnlyTeamTTS:
        bOnlyTeamTTS = PC.bOnlySpeakTeamText;
        ch_OnlyTeamTTs.SetComponentValue(bOnlyTeamTTS,True);
        break;

    case ch_MatureTaunts:
        bMature = !PC.bNoMatureLanguage;
        ch_MatureTaunts.SetComponentValue(bMature,true);
        break;

    case ch_LowDetail:
        bLow = PC.Level.bLowSoundDetail;

        // Make sure both are the same - LevelInfo.bLowSoundDetail take priority
        if ( bLow != bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice LowQualitySound" )) )
        {
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice LowQualitySound"@bLow);
            PC.ConsoleCommand("SOUND_REBOOT");

            // Restart music.
            if( PC.Level.Song != "" && PC.Level.Song != "None" )
                PC.ClientSetMusic( PC.Level.Song, MTRAN_Instant );

            else PC.ClientSetMusic( class'UT2K4MainMenu'.default.MenuSong, MTRAN_Instant );
        }

        ch_LowDetail.SetComponentValue(bLow,true);
        break;

    case co_Announce:
        iAnnounce = PC.AnnouncerLevel;
        co_Announce.SilentSetIndex(iAnnounce);
        break;

    case co_RewardAnnouncer:

        if ( PC.IsA('UnrealPlayer') )
        {
            sStatAnnouncer = PC.GetCustomStatusAnnouncerClass();
            sRewAnnouncer = PC.GetCustomRewardAnnouncerClass();
        }
        else
        {
            sStatAnnouncer = class'UnrealPlayer'.default.CustomStatusAnnouncerPack;
            sRewAnnouncer = class'UnrealPlayer'.default.CustomRewardAnnouncerPack;
        }

        i = FindAnnouncerClassIndex(sStatAnnouncer);
        if ( i != -1 )
        {
            i = co_StatusAnnouncer.FindIndex(Announcers[i].FriendlyName);
            if ( i != -1 )
                co_StatusAnnouncer.SilentSetIndex(i);
        }

        i = FindAnnouncerClassIndex(sRewAnnouncer);
        if (i != -1)
        {
            i = co_RewardAnnouncer.FindIndex(Announcers[i].FriendlyName);
            if ( i != -1 )
                co_RewardAnnouncer.SilentSetIndex(i);
        }

        break;

    case ch_TTSIRC:
        bTTSIRC = class'UT2K4IRC_Page'.default.bIRCTextToSpeechEnabled;
        ch_TTSIRC.SetComponentValue(bTTSIRC,true);
        break;

    case ch_VoiceChat:
        bVoiceChat = bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice UseVoIP"));
        ch_VoiceChat.SetComponentValue(bVoiceChat,true);
        break;

    default:
        log(Name@"Unknown component calling LoadINI:"$ GUIMenuOption(Sender).Caption);
        GUIMenuOption(Sender).SetComponentValue(s,true);
    }
}

function InternalOnChange(GUIComponent Sender)
{
    local PlayerController PC;
    local float AnnouncerVol;
    local Sound snd;
    local int AnnouncerIdx;
    local bool bIsWin32;

    bIsWin32 = ( ( PlatformIsWindows() ) && ( !PlatformIs64Bit() ) );

    Super.InternalOnChange(Sender);
    PC = PlayerOwner();

    switch(Sender)
    {
        case sl_VoiceVol:
            iVoice = sl_VoiceVol.GetValue();
            AnnouncerVol = 2.0 * FClamp(0.1 + iVoice*0.225,0.2,1.0);
            if ( co_StatusAnnouncer == None )
                return;

            snd = sound(co_StatusAnnouncer.GetObject());
            if ( snd == None && Announcers.Length > 0 )
            {
                snd = Sound(DynamicLoadObject(Announcers[AnnouncerIdx].PackageName $ "." $ StatusPreviewSound,class'Sound'));
                if ( snd == none )
                    snd = Sound(DynamicLoadObject(Announcers[AnnouncerIdx].FallbackPackage $ "." $ StatusPreviewSound,class'Sound'));

                co_StatusAnnouncer.MyComboBox.List.SetObjectAtIndex(co_StatusAnnouncer.MyComboBox.List.Index,snd);
            }

            if ( snd != None )
                PC.PlaySound(snd,SLOT_Talk,AnnouncerVol);

            break;

        case sl_MusicVol:
            fMusic = sl_MusicVol.GetValue();
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice MusicVolume"@fMusic);
            PC.ConsoleCommand("SetMusicVolume"@fMusic);

            if( PC.Level.Song != "" && PC.Level.Song != "None" )
                PC.ClientSetMusic( PC.Level.Song, MTRAN_Instant );
            else PC.ClientSetMusic( class'UT2K4MainMenu'.default.MenuSong, MTRAN_Instant );
            break;

        case sl_EffectsVol:
            fEffects = sl_EffectsVol.GetValue();
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice SoundVolume"@fEffects);
            PC.ConsoleCommand("stopsounds");
            PC.PlaySound(sound'PickupSounds.AdrenelinPickup');
            break;
/*
        case sl_TTS:
            fTTS = sl_TTS.GetValue();
        // Do not preview TTS voice volume, since there isn't any way to truly represent the way it will sound in-game
//              PC.TextToSpeech( "Fo Shizzle my nizzle", fTTS );
            break;
*/
        case co_Mode:
            if ( !bIsWin32 )  // Simple OpenAL abstraction...  --ryan.
                break;

            iMode = co_Mode.GetIndex();
            if (iMode > 1)
                ShowPerformanceWarning();

            bCompat = iMode < 1;
            b3DSound = iMode > 1;
            bEAX = iMode > 2;
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice CompatibilityMode"@bCompat);
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice Use3DSound"@b3DSound);
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice UseEAX"@bEAX);
            PC.ConsoleCommand("SOUND_REBOOT");

            // Restart music.
            if( PC.Level.Song != "" && PC.Level.Song != "None" )
                PC.ClientSetMusic( PC.Level.Song, MTRAN_Instant );
            else PC.ClientSetMusic( class'UT2K4MainMenu'.default.MenuSong, MTRAN_Instant );
            break;

        case ch_ReverseStereo:
            bRev = ch_ReverseStereo.IsChecked();
            break;

        case ch_MessageBeep:
            bBeep = ch_MessageBeep.IsChecked();
            break;

        case ch_AutoTaunt:
            bAuto = ch_AutoTaunt.IsChecked();
            break;

        case ch_TTS:
            bTTS = ch_TTS.IsChecked();
            break;

        case ch_MatureTaunts:
            bMature = ch_MatureTaunts.IsChecked();
            break;

        case co_Voices:
            iVoiceMode = co_Voices.GetIndex();
            break;

        case ch_Default:
            bDefault = ch_Default.IsChecked();
            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice UseDefaultDriver"@bDefault);
            PC.ConsoleCommand("SOUND_REBOOT");
            break;

        case ch_LowDetail:
            bLow = ch_LowDetail.IsChecked();

            PC.Level.bLowSoundDetail = bLow;
            PC.Level.StaticSaveConfig();

            PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice LowQualitySound"@bLow);
            PC.ConsoleCommand("SOUND_REBOOT");

            // Restart music.
            if( PC.Level.Song != "" && PC.Level.Song != "None" )
                PC.ClientSetMusic( PC.Level.Song, MTRAN_Instant );
            else PC.ClientSetMusic( class'UT2K4MainMenu'.default.MenuSong, MTRAN_Instant );
            break;

        case co_Announce:
            iAnnounce = co_Announce.GetIndex();
            break;

        case co_RewardAnnouncer:
            AnnouncerIdx = int(co_RewardAnnouncer.GetExtra());
            sRewAnnouncer = Announcers[AnnouncerIdx].ClassName;

            AnnouncerVol = 2.0 * FClamp(0.1 + iVoice*0.225,0.2,1.0);
            snd = sound(co_RewardAnnouncer.GetObject());
            if ( snd == None )
            {
                snd = Sound(DynamicLoadObject(Announcers[AnnouncerIdx].PackageName $ "." $ RewardPreviewSound,class'Sound'));
                if ( snd == none )
                    snd = Sound(DynamicLoadObject(Announcers[AnnouncerIdx].FallbackPackage $ "." $ RewardPreviewSound,class'Sound'));

                co_RewardAnnouncer.MyComboBox.List.SetObjectAtIndex(co_RewardAnnouncer.MyComboBox.List.Index,snd);
            }
            PC.PlaySound(snd,SLOT_Talk,AnnouncerVol);
            break;

        case co_StatusAnnouncer:
            AnnouncerIdx = int(co_StatusAnnouncer.GetExtra());
            sStatAnnouncer = Announcers[AnnouncerIdx].ClassName;

            AnnouncerVol = 2.0 * FClamp(0.1 + iVoice*0.225,0.2,1.0);
            snd = sound(co_StatusAnnouncer.GetObject());
            if ( snd == None )
            {
                snd = Sound(DynamicLoadObject(Announcers[AnnouncerIdx].PackageName $ "." $ StatusPreviewSound,class'Sound'));
                if ( snd == none )
                    snd = Sound(DynamicLoadObject(Announcers[AnnouncerIdx].FallbackPackage $ "." $ StatusPreviewSound,class'Sound'));

                co_StatusAnnouncer.MyComboBox.List.SetObjectAtIndex(co_StatusAnnouncer.MyComboBox.List.Index,snd);
            }
            PC.PlaySound(snd,SLOT_Talk,AnnouncerVol);
            break;

        case ch_TTSIRC:
            bTTSIRC = ch_TTSIRC.IsChecked();
            break;

        case ch_VoiceChat:
            bVoiceChat = ch_VoiceChat.IsChecked();
            break;

        case ch_OnlyTeamTTS:
            bOnlyTeamTTS = ch_OnlyTeamTTS.IsChecked();
            break;
    }
}

function SaveSettings()
{
    local PlayerController PC;
    local bool bSave, bReboot;

    Super.SaveSettings();
    PC = PlayerOwner();

    if (PC.AnnouncerLevel != iAnnounce)
    {
        PC.AnnouncerLevel = iAnnounce;
        PC.default.AnnouncerLevel = PC.AnnouncerLevel;
        bSave = True;
    }

    if (PC.AnnouncerVolume != iVoice)
    {
        PC.AnnouncerVolume = iVoice;
        PC.default.AnnouncerVolume = iVoice;
        bSave = True;
    }

/*  if ( PC.TextToSpeechVoiceVolume != fTTS )
    {
        PC.TextToSpeechVoiceVolume = fTTS;
        bSave = True;
    }
*/
    if ( PC.bOnlySpeakTeamText != bOnlyTeamTTS )
    {
        PC.bOnlySpeakTeamText = bOnlyTeamTTS;
        bSave = True;
    }

    if ( PC.bNoTextToSpeechVoiceMessages == bTTS )
    {
        PC.bNoTextToSpeechVoiceMessages = !bTTS;
        bSave = True;
    }

    if ( class'UT2K4IRC_Page'.default.bIRCTextToSpeechEnabled != bTTSIRC )
    {
        class'UT2K4IRC_Page'.default.bIRCTextToSpeechEnabled = bTTSIRC;
        class'UT2K4IRC_Page'.static.StaticSaveConfig();
    }

    if (PC.bNoMatureLanguage == bMature)
    {
        PC.bNoMatureLanguage = !bMature;
        PC.default.bNoMatureLanguage = !bMature;
        bSave = True;
    }

    if (PC.bNoAutoTaunts != iVoiceMode > 0)
    {
        PC.bNoAutoTaunts = iVoiceMode > 0;
        PC.default.bNoAutoTaunts = PC.bNoAutoTaunts;
        bSave = True;
    }

    if (PC.bNoVoiceTaunts != iVoiceMode > 1)
    {
        PC.bNoVoiceTaunts = iVoiceMode > 1;
        PC.default.bNoVoiceTaunts = PC.bNoVoiceTaunts;
        bSave = True;
    }

    if (PC.bNoVoiceMessages != iVoiceMode == 3)
    {
        PC.bNoVoiceMessages = iVoiceMode == 3;
        PC.default.bNoVoiceMessages = PC.bNoVoiceMessages;
        bSave = True;
    }

    if (fMusic != sl_MusicVol.GetValue())
        PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice MusicVolume"@fMusic);

    if (fEffects != sl_EffectsVol.GetValue())
        PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice SoundVolume"@fEffects);

    if (bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice ReverseStereo")) != bRev)
        PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice ReverseStereo"@bRev);

    if (bDefault != bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice UseDefaultDriver")))
    {
        PC.ConsoleCommand("set ini:Engine.Engine.AudioDevice UseDefaultDriver"@bDefault);
        bReboot = True;
    }

    if( PC.MyHud != None )
    {
        if ( PC.myHUD.bMessageBeep != bBeep )
        {
            PC.myHUD.bMessageBeep = bBeep;
            PC.myHUD.SaveConfig();
        }
    }

    else
    {
        if ( class'HUD'.default.bMessageBeep != bBeep )
        {
            class'HUD'.default.bMessageBeep = bBeep;
            class'HUD'.static.StaticSaveConfig();
        }
    }

    if ( !PC.Level.IsDemoBuild() && PC.IsA('UnrealPlayer') )
    {
        if ( PC.GetCustomStatusAnnouncerClass() != sStatAnnouncer )
        {
            PC.SetCustomStatusAnnouncerClass(sStatAnnouncer);
            bSave = True;
        }

        if ( PC.GetCustomRewardAnnouncerClass() != sRewAnnouncer )
        {
            PC.SetCustomRewardAnnouncerClass(sRewAnnouncer);
            bSave = True;
        }
    }

    if (bVoiceChat != bool(PC.ConsoleCommand("get ini:Engine.Engine.AudioDevice UseVoIP")))
    {
        if (bVoiceChat)
            PC.EnableVoiceChat();
        else PC.DisableVoiceChat();

        bReboot = False;
    }

    if (bSave)
        PC.SaveConfig();

    if ( PC.bAutoTaunt != bAuto )
        PC.SetAutoTaunt(bAuto);

    if ( !PC.Level.IsDemoBuild() && !PC.IsA('UnrealPlayer') )
    {
        if ( !(class'UnrealPlayer'.default.CustomStatusAnnouncerPack ~= sStatAnnouncer) ||
             !(class'UnrealPlayer'.default.CustomRewardAnnouncerPack ~= sRewAnnouncer) )
        {
            class'UnrealPlayer'.default.CustomStatusAnnouncerPack = sStatAnnouncer;
            class'UnrealPlayer'.default.CustomRewardAnnouncerPack = sRewAnnouncer;
            class'UnrealPlayer'.static.StaticSaveConfig();
        }
    }

    if (bReboot)
        PC.ConsoleCommand("SOUND_REBOOT");
}

function int FindAnnouncerClassIndex( string AnnouncerClass )
{
    local int i;

    for ( i = 0; i < Announcers.Length; i++ )
        if ( Announcers[i].ClassName ~= AnnouncerClass )
            return i;

    return -1;
}

function string GetAnnouncerClass( int Index )
{
    if ( Index < 0 || Index >= Announcers.Length )
        return "";

    return Announcers[Index].ClassName;
}

function string GetAnnouncerPackage( int Index )
{
    if ( Index < 0 || Index >= Announcers.Length )
        return "";

    return Announcers[Index].PackageName;
}

defaultproperties
{
     StatusPreviewSound="1_minute_remains"
     RewardPreviewSound="unstoppable"
     AudioModes(0)="Safe Mode"
     AudioModes(1)="3D Audio"
     AudioModes(2)="H/W 3D Audio"
     AudioModes(3)="H/W 3D + EAX"
     VoiceModes(0)="All"
     VoiceModes(1)="No auto-taunts"
     VoiceModes(2)="No taunts"
     VoiceModes(3)="None"
     AnnounceModes(0)="None"
     AnnounceModes(1)="Minimal"
     AnnounceModes(2)="All"
     Begin Object Class=GUISectionBackground Name=AudioBK1
         Caption="Sound Effects"
         NumColumns=2
         MaxPerColumn=5
         WinTop=0.017393
         WinLeft=0.004063
         WinWidth=0.987773
         WinHeight=0.502850
         OnPreDraw=AudioBK1.InternalPreDraw
     End Object
     i_BG1=GUISectionBackground'GUI2K4.UT2K4Tab_AudioSettings.AudioBK1'

     Begin Object Class=GUISectionBackground Name=AudioBK2
         Caption="Announcer"
         WinTop=0.004372
         WinLeft=0.004063
         WinWidth=0.987773
         WinHeight=0.517498
         OnPreDraw=AudioBK2.InternalPreDraw
     End Object
     i_BG2=GUISectionBackground'GUI2K4.UT2K4Tab_AudioSettings.AudioBK2'

     Begin Object Class=GUISectionBackground Name=AudioBK3
         Caption="Text To Speech"
         WinTop=0.004372
         WinLeft=0.004063
         WinWidth=0.987773
         WinHeight=0.517498
         OnPreDraw=AudioBK3.InternalPreDraw
     End Object
     i_BG3=GUISectionBackground'GUI2K4.UT2K4Tab_AudioSettings.AudioBK3'

     Begin Object Class=moSlider Name=AudioMusicVolume
         MaxValue=1.000000
         Caption="Music Volume"
         OnCreateComponent=AudioMusicVolume.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="0.5"
         Hint="Adjusts the volume of the background music."
         WinTop=0.070522
         WinLeft=0.018164
         WinWidth=0.450000
         TabOrder=0
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     sl_MusicVol=moSlider'GUI2K4.UT2K4Tab_AudioSettings.AudioMusicVolume'

     Begin Object Class=moSlider Name=AudioEffectsVolumeSlider
         MaxValue=1.000000
         Caption="Effects Volume"
         OnCreateComponent=AudioEffectsVolumeSlider.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="0.9"
         Hint="Adjusts the volume of all in game sound effects."
         WinTop=0.070522
         WinLeft=0.524024
         WinWidth=0.450000
         TabOrder=5
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     sl_EffectsVol=moSlider'GUI2K4.UT2K4Tab_AudioSettings.AudioEffectsVolumeSlider'

     Begin Object Class=moSlider Name=AudioAnnouncerVolume
         MaxValue=4.000000
         MinValue=1.000000
         bIntSlider=True
         CaptionWidth=0.650000
         Caption="Volume"
         OnCreateComponent=AudioAnnouncerVolume.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="Adjusts the volume of all in game voice messages."
         WinTop=0.597866
         WinLeft=0.011329
         WinWidth=0.470703
         TabOrder=10
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     sl_VoiceVol=moSlider'GUI2K4.UT2K4Tab_AudioSettings.AudioAnnouncerVolume'

     Begin Object Class=moComboBox Name=AudioMode
         bReadOnly=True
         Caption="Audio Mode"
         OnCreateComponent=AudioMode.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="Software 3D Audio"
         Hint="Changes the audio system mode."
         WinTop=0.149739
         WinLeft=0.018164
         WinWidth=0.450000
         TabOrder=1
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     co_Mode=moComboBox'GUI2K4.UT2K4Tab_AudioSettings.AudioMode'

     Begin Object Class=moComboBox Name=AudioPlayVoices
         bReadOnly=True
         Caption="Play Voices"
         OnCreateComponent=AudioPlayVoices.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="All"
         Hint="Defines the types of voice messages to play."
         WinTop=0.149739
         WinLeft=0.524024
         WinWidth=0.450000
         TabOrder=6
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     co_Voices=moComboBox'GUI2K4.UT2K4Tab_AudioSettings.AudioPlayVoices'

     Begin Object Class=moComboBox Name=AudioAnnounce
         bReadOnly=True
         CaptionWidth=0.650000
         Caption="Announcements"
         OnCreateComponent=AudioAnnounce.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="All"
         Hint="Adjusts the amount of in-game announcements."
         WinTop=0.711079
         WinLeft=0.011329
         WinWidth=0.470703
         TabOrder=11
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     co_Announce=moComboBox'GUI2K4.UT2K4Tab_AudioSettings.AudioAnnounce'

     Begin Object Class=moComboBox Name=AudioRewardAnnouncer
         bReadOnly=True
         CaptionWidth=0.650000
         Caption="Reward Announcer"
         OnCreateComponent=AudioRewardAnnouncer.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="Each tournament player is linked to a Reward announcer that informs you when you've demonstrated exceptional combat skills."
         WinTop=0.890991
         WinLeft=0.011329
         WinWidth=0.470703
         TabOrder=13
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     co_RewardAnnouncer=moComboBox'GUI2K4.UT2K4Tab_AudioSettings.AudioRewardAnnouncer'

     Begin Object Class=moComboBox Name=AudioStatusAnnouncer
         bReadOnly=True
         CaptionWidth=0.650000
         Caption="Status Announcer"
         OnCreateComponent=AudioStatusAnnouncer.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="The Status announcer relays important information about the game to tournament players and spectators."
         WinTop=0.801035
         WinLeft=0.011329
         WinWidth=0.470703
         TabOrder=12
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
     End Object
     co_StatusAnnouncer=moComboBox'GUI2K4.UT2K4Tab_AudioSettings.AudioStatusAnnouncer'

     Begin Object Class=moCheckBox Name=AudioReverseStereo
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Reverse Stereo"
         OnCreateComponent=AudioReverseStereo.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="False"
         Hint="Reverses the left and right audio channels."
         WinTop=0.405678
         WinLeft=0.018164
         WinWidth=0.450000
         TabOrder=4
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_ReverseStereo=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioReverseStereo'

     Begin Object Class=moCheckBox Name=AudioMessageBeep
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Message Beep"
         OnCreateComponent=AudioMessageBeep.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="True"
         Hint="Enables a beep when receiving a text message from other players."
         WinTop=0.405678
         WinLeft=0.524024
         WinWidth=0.450000
         TabOrder=9
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_MessageBeep=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioMessageBeep'

     Begin Object Class=moCheckBox Name=AudioAutoTaunt
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Auto-Taunt"
         OnCreateComponent=AudioAutoTaunt.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="True"
         Hint="Enables your in-game player to automatically taunt opponents."
         WinTop=0.320365
         WinLeft=0.524024
         WinWidth=0.450000
         TabOrder=8
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_AutoTaunt=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioAutoTaunt'

     Begin Object Class=moCheckBox Name=IRCTextToSpeech
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Enable on IRC"
         OnCreateComponent=IRCTextToSpeech.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="Enables Text-To-Speech processing in the IRC client (only messages from active tab is processed)"
         WinTop=0.755462
         WinLeft=0.527734
         WinWidth=0.461134
         TabOrder=16
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_TTSIRC=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.IRCTextToSpeech'

     Begin Object Class=moCheckBox Name=OnlyTeamTTSCheck
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Team Messages Only"
         OnCreateComponent=OnlyTeamTTSCheck.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="If enabled, only team messages will be spoken in team games, unless the match or round is over."
         WinTop=0.755462
         WinLeft=0.527734
         WinWidth=0.461134
         TabOrder=17
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_OnlyTeamTTS=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.OnlyTeamTTSCheck'

     Begin Object Class=moCheckBox Name=AudioMatureTaunts
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Mature Taunts"
         OnCreateComponent=AudioMatureTaunts.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="True"
         Hint="Enables off-color commentary."
         WinTop=0.235052
         WinLeft=0.524024
         WinWidth=0.450000
         TabOrder=7
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_MatureTaunts=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioMatureTaunts'

     Begin Object Class=moCheckBox Name=AudioLowDetail
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Low Sound Detail"
         OnCreateComponent=AudioLowDetail.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="False"
         Hint="Lowers quality of sound."
         WinTop=0.235052
         WinLeft=0.018164
         WinWidth=0.450000
         TabOrder=2
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_LowDetail=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioLowDetail'

     Begin Object Class=moCheckBox Name=AudioDefaultDriver
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="System Driver"
         OnCreateComponent=AudioDefaultDriver.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="False"
         Hint="Use system installed OpenAL driver"
         WinTop=0.320365
         WinLeft=0.018164
         WinWidth=0.450000
         TabOrder=3
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_Default=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioDefaultDriver'

     Begin Object Class=moCheckBox Name=AudioEnableTTS
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Enable In Game"
         OnCreateComponent=AudioEnableTTS.InternalOnCreateComponent
         IniOption="@Internal"
         IniDefault="False"
         Hint="Enables Text-To-Speech message processing"
         WinTop=0.685037
         WinLeft=0.527734
         WinWidth=0.461134
         TabOrder=15
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_TTS=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.AudioEnableTTS'

     Begin Object Class=moCheckBox Name=EnableVoiceChat
         ComponentJustification=TXTA_Left
         CaptionWidth=0.940000
         Caption="Voice Chat"
         OnCreateComponent=EnableVoiceChat.InternalOnCreateComponent
         IniOption="@Internal"
         Hint="Enables the voice chat system during online matches."
         WinTop=0.834777
         WinLeft=0.527734
         WinWidth=0.461134
         TabOrder=18
         OnChange=UT2K4Tab_AudioSettings.InternalOnChange
         OnLoadINI=UT2K4Tab_AudioSettings.InternalOnLoadINI
     End Object
     ch_VoiceChat=moCheckBox'GUI2K4.UT2K4Tab_AudioSettings.EnableVoiceChat'

     Begin Object Class=moButton Name=VoiceOptions
         ButtonCaption="Configure"
         MenuTitle="Voice Chat Options"
         MenuClass="GUI2K4.VoiceChatConfig"
         CaptionWidth=0.500000
         Caption="Voice Options"
         OnCreateComponent=VoiceOptions.InternalOnCreateComponent
         WinTop=0.909065
         WinLeft=0.527734
         WinWidth=0.461134
         WinHeight=0.050000
         TabOrder=19
     End Object
     b_VoiceChat=moButton'GUI2K4.UT2K4Tab_AudioSettings.VoiceOptions'

     PanelCaption="Audio"
     WinTop=0.150000
     WinHeight=0.740000
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 17:13:12.000 - Creation time: Wed 7/2/2007 19:16:57.359 - Created with UnCodeX