/// <summary>
        /// Converts a BNS audio file to Wave format.
        /// </summary>
        /// <param name="inputFile"></param>
        /// <param name="outputFile"></param>
        /// <returns></returns>
        public static Wave BnsToWave(Stream inputFile)
        {
            BNS b = new BNS();

            byte[] samples = b.Read(inputFile);

            Wave wave = new Wave(b.bnsInfo.ChannelCount, 16, b.bnsInfo.SampleRate, samples);

            if (b.bnsInfo.HasLoop == 1)
            {
                wave.AddLoop((int)b.bnsInfo.LoopStart);
            }
            return(wave);
        }
        public static Wave BnsToWave(byte[] bnsFile)
        {
            BNS b = new BNS();

            byte[] samples;

            using (MemoryStream ms = new MemoryStream(bnsFile))
                samples = b.Read(ms);

            Wave wave = new Wave(b.bnsInfo.ChannelCount, 16, b.bnsInfo.SampleRate, samples);

            if (b.bnsInfo.HasLoop == 1)
            {
                wave.AddLoop((int)b.bnsInfo.LoopStart);
            }
            return(wave);
        }
        public static Wave BnsToWave(string pathToFile)
        {
            BNS b = new BNS();

            byte[] samples;

            using (FileStream fs = new FileStream(pathToFile, FileMode.Open))
                samples = b.Read(fs);

            Wave wave = new Wave(b.bnsInfo.ChannelCount, 16, b.bnsInfo.SampleRate, samples);

            if (b.bnsInfo.HasLoop == 1)
            {
                wave.AddLoop((int)b.bnsInfo.LoopStart);
            }
            return(wave);
        }
Пример #4
0
        public static Wave BnsToWave(byte[] bnsFile)
        {
            BNS b = new BNS();
            byte[] samples;

            using (MemoryStream ms = new MemoryStream(bnsFile))
                samples = b.Read(ms);

            Wave wave = new Wave(b.bnsInfo.ChannelCount, 16, b.bnsInfo.SampleRate, samples);
            if (b.bnsInfo.HasLoop == 1) wave.AddLoop((int)b.bnsInfo.LoopStart);
            return wave;
        }
Пример #5
0
        public static Wave BnsToWave(string pathToFile)
        {
            BNS b = new BNS();
            byte[] samples;

            using (FileStream fs = new FileStream(pathToFile, FileMode.Open))
                samples = b.Read(fs);

            Wave wave = new Wave(b.bnsInfo.ChannelCount, 16, b.bnsInfo.SampleRate, samples);
            if (b.bnsInfo.HasLoop == 1) wave.AddLoop((int)b.bnsInfo.LoopStart);
            return wave;
        }
Пример #6
0
        /// <summary>
        /// Converts a BNS audio file to Wave format.
        /// </summary>
        /// <param name="inputFile"></param>
        /// <param name="outputFile"></param>
        /// <returns></returns>
        public static Wave BnsToWave(Stream inputFile)
        {
            BNS b = new BNS();
            byte[] samples = b.Read(inputFile);

            Wave wave = new Wave(b.bnsInfo.ChannelCount, 16, b.bnsInfo.SampleRate, samples);
            if (b.bnsInfo.HasLoop == 1) wave.AddLoop((int)b.bnsInfo.LoopStart);
            return wave;
        }