Beispiel #1
0
        public static Stream AddPreviewDecoder(FormatData data, AudioFormat format, ProgressIndicator progress)
        {
            if (data.Song.PreviewTimes != null)
            {
                MultiDecoder multi = new MultiDecoder(RawkAudio.Decoder.BufferSize);
                multi.AddDecoder(format.Decoder);

                Stream previewstream = new TemporaryStream();
                PlatformRB2WiiCustomDLC.TranscodePreview(data.Song.PreviewTimes, format.Mappings, format.Decoder, previewstream, progress);

                previewstream.Position = 0;
                IDecoder previewdecoder = new RawkAudio.Decoder(previewstream, RawkAudio.Decoder.AudioFormat.VorbisOgg);
                multi.AddDecoder(previewdecoder);
                format.Mappings.Add(new AudioFormat.Mapping(0, previewdecoder.Channels == 1 ? 0 : -1, Instrument.Preview));
                if (previewdecoder.Channels == 2)
                {
                    format.Mappings.Add(new AudioFormat.Mapping(0, 1, Instrument.Preview));
                }
                format.Decoder = multi;
                multi.Seek(0);

                return(previewstream);
            }

            return(null);
        }
Beispiel #2
0
        public static void Initialise()
        {
            Formats = new List <IFormat>();

            //PlatformDJHWiiDisc.Initialise();
            PlatformFretsOnFire.Initialise();
            PlatformGH2PS2Disc.Initialise();
            PlatformGH3WiiDisc.Initialise();
            PlatformGH4WiiDLC.Initialise();
            PlatformGH5WiiDisc.Initialise();
            //PlatformGH5WiiDLC.Initialise();
            PlatformLocalStorage.Initialise();
            PlatformRawkFile.Initialise();
            //PlatformRB2360Disc.Initialise();
            //PlatformRB2360DLC.Initialise();
            PlatformRB2360RBN.Initialise();
            PlatformRB2WiiCustomDLC.Initialise();
            PlatformRB2WiiDisc.Initialise();
            //PlatformRB2WiiDLC.Initialise();

            //ChartFormatChart.Initialise();
            //ChartFormatFsgMub.Initialise();
            ChartFormatGH1.Initialise();
            ChartFormatGH2.Initialise();
            ChartFormatGH3.Initialise();
            ChartFormatGH4.Initialise();
            ChartFormatGH5.Initialise();
            ChartFormatRB.Initialise();

            AudioFormatBeatlesBink.Initialise();
            AudioFormatBink.Initialise();
            AudioFormatFFmpeg.Initialise();
            AudioFormatGH3WiiFSB.Initialise();
            AudioFormatMogg.Initialise();
            //AudioFormatMp3.Initialise();
            AudioFormatOgg.Initialise();
            AudioFormatRB2Bink.Initialise();
            AudioFormatRB2Mogg.Initialise();
            AudioFormatVGS.Initialise();

            NeversoftMetadata.Initialise();
        }
        public Stream GetPreviewStream(FormatData data, ProgressIndicator progress)
        {
            if (!data.HasStream(this, PreviewName))
            {
                AudioFormat format = new AudioFormat();

                /* Let it crash if it can't decode it. KIBE biks we don't know about don't belong here.
                 * try { */
                format.Decoder = new RawkAudio.Decoder(GetAudioStream(data), RawkAudio.Decoder.AudioFormat.BinkAudio);

                /*} catch {
                 *      format.Decoder = new ZeroDecoder(1, 28000, 0x7FFFFFFFFFFFFFFF);
                 * }*/
                Stream            previewstream = new TemporaryStream();
                CryptedMoggStream mogg          = new CryptedMoggStream(previewstream);
                mogg.WriteHeader();
                PlatformRB2WiiCustomDLC.TranscodePreview(data.Song.PreviewTimes, null, format.Decoder, mogg, progress);
                previewstream.Position = 0;
                format.Decoder.Dispose();
                return(previewstream);
            }

            return(data.GetStream(this, PreviewName));
        }
Beispiel #4
0
        public override void EncodeAudio(AudioFormat audioformat, FormatData formatdata, ProgressIndicator progress)
        {
            progress.NewTask(20);

            Stream audio = formatdata.AddStream(this, AudioName);

            progress.SetNextWeight(1);
            List <AudioFormat.Mapping> oldmaps = audioformat.Mappings;

            ushort[] masks = PlatformRB2WiiCustomDLC.RemixAudioTracks(formatdata.Song, audioformat);

            progress.SetNextWeight(14);
            long samples           = audioformat.Decoder.Samples;
            CryptedMoggStream mogg = new CryptedMoggStream(audio);

            //mogg.WriteHeader(samples);
            mogg.WriteHeader();
            RawkAudio.Encoder encoder = new RawkAudio.Encoder(mogg, audioformat.Channels, audioformat.Decoder.SampleRate, 28000);
            progress.NewTask("Transcoding Audio", samples);
            JaggedShortArray buffer = new JaggedShortArray(encoder.Channels, audioformat.Decoder.AudioBuffer.Rank2);

            AudioFormat.ProcessOffset(audioformat.Decoder, encoder, audioformat.InitialOffset);
            while (samples > 0)
            {
                //int read = audioformat.Decoder.Read((int)Math.Min(samples, 0x4E20));
                //int read = audioformat.Decoder.Read((int)Math.Min(samples, 0x20));
                int read = audioformat.Decoder.Read((int)Math.Min(samples, buffer.Rank2));
                if (read <= 0)
                {
                    break;
                }

                audioformat.Decoder.AudioBuffer.DownmixTo(buffer, masks, read);

                encoder.Write(buffer, read);
                samples -= read;
                progress.Progress(read);
                //mogg.Update(read);
            }
            progress.EndTask();
            progress.Progress(14);
            encoder.Dispose();
            mogg.WriteEntries();
            formatdata.CloseStream(audio);

            progress.SetNextWeight(6);
            Stream preview = formatdata.AddStream(this, PreviewName);

            mogg = new CryptedMoggStream(preview);
            mogg.WriteHeader();
            PlatformRB2WiiCustomDLC.TranscodePreview(formatdata.Song.PreviewTimes, oldmaps, audioformat.Decoder != null ? audioformat.Decoder : new ZeroDecoder(1, 28000, 0x7FFFFFFFFFFFFFFF), mogg, progress);
            formatdata.CloseStream(preview);

            progress.EndTask();
            progress.Progress(6);

            Stream formatstream = formatdata.AddStream(this, FormatName);

            audioformat.Save(formatstream);
            formatdata.CloseStream(formatstream);
        }
 public static void Initialise()
 {
     Instance = new PlatformRB2WiiCustomDLC();
 }