コード例 #1
0
        public static QbItemBase GetQbItem(QbItemStruct item, uint[] keys)
        {
            foreach (uint key in keys)
            {
                QbItemBase subitem = item.FindItem(QbKey.Create(key), false);
                if (subitem != null)
                {
                    return(subitem);
                }
            }

            return(null);
        }
コード例 #2
0
        public static AudioFormat GetAudioFormat(FormatData data)
        {
            SongData    song        = data.Song;
            AudioFormat audioformat = new AudioFormat();

            QbItemStruct item = GetSongItem(data);

            if (item == null)
            {
                return(null);
            }
            float bandvolume   = 0;
            float guitarvolume = 0;
            float bassvolume   = 0;
            float drumvolume   = 0;

            QbItemFloat subitem = item.FindItem(QbKey.Create(0xD8F335CF), false) as QbItemFloat;             // GH3: band_playback_volume

            if (subitem != null)
            {
                bandvolume = (subitem as QbItemFloat).Values[0];
                bassvolume = bandvolume;
            }
            subitem = item.FindItem(QbKey.Create(0xA449CAD3), false) as QbItemFloat;             // GH3: guitar_playback_volume
            if (subitem != null)
            {
                guitarvolume = (subitem as QbItemFloat).Values[0];
            }
            subitem = item.FindItem(QbKey.Create(0x46507438), false) as QbItemFloat;             // GH4: overall_song_volume
            if (subitem != null)
            {
                bandvolume   = (subitem as QbItemFloat).Values[0];
                guitarvolume = bandvolume;
                bassvolume   = bandvolume;
                drumvolume   = bandvolume;
            }

            // GH4 engine games that came out after GHWT use a different drum audio scheme; the GH5 engine uses the same as GHWT
            bool gh4v2 = NeversoftMetadata.IsGuitarHero4(song.Game) && song.Game != Game.GuitarHeroWorldTour;
            // GHVH is the only BIK-based GH game with stereo bass
            bool ghvh = song.Game == Game.GuitarHeroVanHalen;

            if (gh4v2)
            {
                // Kick
                audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, -1, Instrument.Drums));
                audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, 1, Instrument.Drums));
                // Snare
                audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, -1, Instrument.Drums));
                audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, 1, Instrument.Drums));
            }
            else
            {
                // Kick
                audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, 0, Instrument.Drums));
                // Snare
                audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, 0, Instrument.Drums));
            }
            // Overhead
            audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, -1, Instrument.Drums));
            audioformat.Mappings.Add(new AudioFormat.Mapping(drumvolume, 1, Instrument.Drums));
            // Guitar
            audioformat.Mappings.Add(new AudioFormat.Mapping(guitarvolume, -1, Instrument.Guitar));
            audioformat.Mappings.Add(new AudioFormat.Mapping(guitarvolume, 1, Instrument.Guitar));
            // Bass
            audioformat.Mappings.Add(new AudioFormat.Mapping(bassvolume, ghvh ? -1 : 0, Instrument.Bass));
            if (ghvh)
            {
                audioformat.Mappings.Add(new AudioFormat.Mapping(bassvolume, 1, Instrument.Bass));
            }
            // Else / Vocals
            audioformat.Mappings.Add(new AudioFormat.Mapping(bandvolume, -1, Instrument.Ambient));
            audioformat.Mappings.Add(new AudioFormat.Mapping(bandvolume, 1, Instrument.Ambient));
            // Preview
            audioformat.Mappings.Add(new AudioFormat.Mapping(bandvolume, -1, Instrument.Preview));
            audioformat.Mappings.Add(new AudioFormat.Mapping(bandvolume, 1, Instrument.Preview));

            return(audioformat);
        }