コード例 #1
0
        private bool LoadWavFile(string path)
        {
            using (var br = new BinaryReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))) {
                mPcm = WavRWHelper.ReadWav(br);
            }

            if (mPcm == null)
            {
                MessageBox.Show("Error: Read WAV file failed {0}", path);
                return(false);
            }

            return(true);
        }
コード例 #2
0
        private bool SaveWavFile(string path)
        {
            var wavParamList = new List <WavChunkParams>();

            foreach (var i in listBoxChunkLayout.Items)
            {
                var lbi = i as ListBoxItem;
                var wcp = lbi.Tag as WavChunkParams;
                wavParamList.Add(wcp);
            }

            using (var bw = new BinaryWriter(File.Open(path, FileMode.Create, FileAccess.Write, FileShare.Write))) {
                if (!WavRWHelper.WriteWav(bw, mPcm, wavParamList))
                {
                    return(false);
                }
            }
            return(true);
        }