Exemplo n.º 1
0
        void Initialize()
        {
            if (_decoderProcess != null)
            {
                return;
            }
            _decoderProcess = new Process();
            _decoderProcess.StartInfo.FileName               = _decoder;
            _decoderProcess.StartInfo.Arguments              = _decoderParams.Replace("%I", "\"" + _path + "\"");
            _decoderProcess.StartInfo.CreateNoWindow         = true;
            _decoderProcess.StartInfo.RedirectStandardOutput = true;
            _decoderProcess.StartInfo.UseShellExecute        = false;
            bool      started = false;
            Exception ex      = null;

            try
            {
                started = _decoderProcess.Start();
                if (started)
                {
                    _decoderProcess.PriorityClass = Process.GetCurrentProcess().PriorityClass;
                }
            }
            catch (Exception _ex)
            {
                ex = _ex;
            }
            if (!started)
            {
                _decoderProcess = null;
                throw new Exception(_decoder + ": " + (ex == null ? "please check the path" : ex.Message));
            }
            rdr = new WAVReader(_path, _decoderProcess.StandardOutput.BaseStream);
        }
Exemplo n.º 2
0
 public UserDefinedReader(string path, Stream IO, string decoder, string decoderParams)
 {
     _path           = path;
     _decoder        = decoder;
     _decoderParams  = decoderParams;
     _decoderProcess = null;
     rdr             = null;
 }
Exemplo n.º 3
0
        public static AudioBuffer ReadAllSamples(string path, Stream IO)
        {
            WAVReader   reader = new WAVReader(path, IO);
            AudioBuffer buff   = new AudioBuffer(reader, (int)reader.Length);

            reader.Read(buff, -1);
            if (reader.Remaining != 0)
            {
                throw new Exception("couldn't read the whole file");
            }
            reader.Close();
            return(buff);
        }