/// <summary> /// AIFFファイルのヘッダ部分を読み込む。 /// </summary> /// <returns>読めたらtrue</returns> private bool ReadAiffFileHeader(string path) { bool result = false; var ar = new AiffReader(); using (BinaryReader br = new BinaryReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))) { PcmDataLib.PcmData pd; var aiffResult = ar.ReadHeader(br, out pd); if (aiffResult == AiffReader.ResultType.Success) { if (CheckAddPcmData(path, pd, true)) { result = true; } } else { LoadErrorMessageAdd(string.Format(CultureInfo.InvariantCulture, Properties.Resources.ReadFileFailed + " {1}: {2}{3}", "AIFF", aiffResult, path, Environment.NewLine)); } } return(result); }
/// <summary> /// 読み込み処理を終了する。 /// </summary> /// <returns>Error code</returns> public int StreamEnd() { int rv = 0; mMD5SumInMetadata = null; mMD5SumOfPcm = null; switch (m_format) { case Format.FLAC: rv = mFlacR.ReadEnd(); mMD5SumInMetadata = mFlacR.MD5SumInMetadata; mMD5SumOfPcm = mFlacR.MD5SumOfPcm; break; case Format.AIFF: mAiffR.ReadStreamEnd(); break; case Format.WAVE: mWaveR.ReadStreamEnd(); break; case Format.DSF: mDsfR.ReadStreamEnd(); break; case Format.DSDIFF: mDsdiffR.ReadStreamEnd(); break; case Format.MP3: mMp3Reader.ReadStreamEnd(); break; default: System.Diagnostics.Debug.Assert(false); break; } if (null != mBr) { mBr.Close(); mBr = null; } mPcmData = null; mFlacR = null; mAiffR = null; mWaveR = null; mDsfR = null; return(rv); }
private int StreamBeginAiff(string path, long startFrame) { int ercd = -1; mAiffR = new AiffReader(); mBr = new BinaryReader( File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)); AiffReader.ResultType result = mAiffR.ReadStreamBegin(mBr, out mPcmData); if (result == AiffReader.ResultType.Success) { NumFrames = mAiffR.NumFrames; mAiffR.ReadStreamSkip(mBr, startFrame); ercd = 0; } return(ercd); }
public void StreamAbort() { switch (m_format) { case Format.FLAC: mFlacR.ReadStreamAbort(); break; case Format.AIFF: mAiffR.ReadStreamEnd(); break; case Format.WAVE: mWaveR.ReadStreamEnd(); break; case Format.DSF: mDsfR.ReadStreamEnd(); break; case Format.DSDIFF: mDsdiffR.ReadStreamEnd(); break; default: System.Diagnostics.Debug.Assert(false); break; } if (null != mBr) { mBr.Close(); mBr = null; } mPcmData = null; mFlacR = null; mAiffR = null; mWaveR = null; mDsfR = null; }
private int StreamBeginAiff(string path, long startFrame) { int ercd = -1; mAiffR = new AiffReader(); mBr = new BinaryReader( File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read)); AiffReader.ResultType result = mAiffR.ReadStreamBegin(mBr, out mPcmData); if (result == AiffReader.ResultType.Success) { NumFrames = mAiffR.NumFrames; mAiffR.ReadStreamSkip(mBr, startFrame); ercd = 0; } return ercd; }
/// <summary> /// 読み込み処理を通常終了する。 /// </summary> /// <returns>Error code</returns> public int StreamEnd() { int rv = 0; mMD5SumInMetadata = null; mMD5SumOfPcm = null; switch (m_format) { case Format.FLAC: rv = mFlacR.ReadStreamEnd(); mMD5SumInMetadata = mFlacR.MD5SumInMetadata; mMD5SumOfPcm = mFlacR.MD5SumOfPcm; break; case Format.AIFF: mAiffR.ReadStreamEnd(); break; case Format.WAVE: mWaveR.ReadStreamEnd(); break; case Format.DSF: mDsfR.ReadStreamEnd(); break; case Format.DSDIFF: mDsdiffR.ReadStreamEnd(); break; default: System.Diagnostics.Debug.Assert(false); break; } if (null != mBr) { mBr.Close(); mBr = null; } mPcmData = null; mFlacR = null; mAiffR = null; mWaveR = null; mDsfR = null; return rv; }
/// <summary> /// AIFFファイルのヘッダ部分を読み込む。 /// </summary> /// <returns>読めたらtrue</returns> private bool ReadAiffFileHeader(string path) { bool result = false; var ar = new AiffReader(); using (BinaryReader br = new BinaryReader(File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))) { PcmDataLib.PcmData pd; var aiffResult = ar.ReadHeader(br, out pd); if (aiffResult == AiffReader.ResultType.Success) { if (CheckAddPcmData(path, pd, true)) { result = true; } } else { LoadErrorMessageAdd(string.Format(CultureInfo.InvariantCulture, Properties.Resources.ReadFileFailed + " {1}: {2}{3}", "AIFF", aiffResult, path, Environment.NewLine)); } } return result; }