Ejemplo n.º 1
0
        public static byte[] ConvertFile(byte[] bytes, FileType encodeType, FileType convertToType, bool loop)
        {
            using (var ms = new MemoryStream(bytes))
            {
                byte[] track = ConvertStream.ConvertFile(new Options(), ms, encodeType, convertToType);

                if (convertToType == FileType.Hca && loop)
                {
                    track = HCA.EncodeLoop(track, loop);
                }

                return(track);
            }
        }
Ejemplo n.º 2
0
        public async Task AsyncSetHcaAudio(byte[] hcaBytes)
        {
            WavStream wav = null;
            await Task.Run(() => wav = HCA.Decode(hcaBytes));

            if (wavePlayer.PlaybackState != PlaybackState.Stopped)
            {
                wavePlayer.Stop();
            }

            if (CurrentWav != null)
            {
                CurrentWav.Dispose();
            }
            CurrentWav = wav;

            //Load wav
            await Task.Run(() => wavePlayer.Init(wav.waveStream));

            wavePlayer.Volume = 1f;
        }