public WaveInDevice(int liDevice, Win32.WaveFormat loFormat, int liBufferSize) { m_BufferSize = liBufferSize; // CallBack einrichten int liReplyCode = Win32.MM_Win32.waveInOpen(out m_DeviceHandle, liDevice, loFormat, m_BufferProc, 0, Win32.MM_Win32.CALLBACK_FUNCTION); CheckErrorCode(liReplyCode); }
public WaveOutDevice(int liDevice, Win32.WaveFormat loFormat, int liBufferSize) { m_ZeroBase = (loFormat.BitRate == 8 ? (byte)128 : (byte)0); m_BufferSize = liBufferSize; // CallBack einrichten int liReplyCode = Win32.MM_Win32.waveOutOpen(out m_DeviceHandle, liDevice, loFormat, m_BufferProc, 0, Win32.MM_Win32.CALLBACK_FUNCTION); CheckErrorCode(liReplyCode); }
private void ReadHeader() { BinaryReader loReader = new BinaryReader(m_Stream); string lsFormat = ReadChunk(loReader); // Ersten Block lesen if (lsFormat != "RIFF") { throw new Exception("Invalid file format. '" + lsFormat + "' not supported."); } loReader.ReadInt32(); // Länge des Headers lsFormat = ReadChunk(loReader); // Ersten Block lesen if (lsFormat != "WAVE") { throw new Exception("Invalid file format. '" + lsFormat + "' not supported."); } lsFormat = ReadChunk(loReader); // Ersten Block lesen if (lsFormat != "fmt ") { throw new Exception("Invalid file format. '" + lsFormat + "' not supported."); } m_Format = new Win32.WaveFormat(loReader, true); // Mit Daten aus Stream initialisieren // Position in Datei ausrichten while ((m_Stream.Position < m_Stream.Length) && (loReader.ReadByte() != (byte)'d')) { ; } if (m_Stream.Position >= m_Stream.Length) { throw new Exception("Invalid file format. End of file."); } loReader.ReadInt32(); // Länge der Extension m_Length = m_Stream.Length - m_Stream.Position; m_DataPos = m_Stream.Position; // Position der Daten setzen Position = 0; }
private void WriteHeader(Win32.WaveFormat loFormat) { BinaryWriter loWriter = new BinaryWriter(m_Stream); loWriter.Write(System.Text.Encoding.ASCII.GetBytes("RIFF")); loWriter.Write((uint)38); loWriter.Write(System.Text.Encoding.ASCII.GetBytes("WAVE")); loWriter.Write(System.Text.Encoding.ASCII.GetBytes("fmt ")); m_Format = new Win32.WaveFormat(); // Mit Daten aus Stream initialisieren m_Format.WriteFormat(loWriter, true); loWriter.Write(System.Text.Encoding.ASCII.GetBytes("data")); loWriter.Write((uint)0); m_Length = 0; m_DataPos = m_Stream.Position; // Position der Daten setzen Position = 0; }
public WaveStreamWriter(Stream loStream, Win32.WaveFormat loFormat) { m_Stream = loStream; WriteHeader(loFormat); }
public WaveStreamWriter(string lsFile, Win32.WaveFormat loFormat) { m_Stream = (Stream)(new FileStream(lsFile, FileMode.Create, FileAccess.Write, FileShare.Write)); WriteHeader(loFormat); }