2 * Copyright (c) 2007-2010 SlimDX Group
\r
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
5 * of this software and associated documentation files (the "Software"), to deal
\r
6 * in the Software without restriction, including without limitation the rights
\r
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
8 * copies of the Software, and to permit persons to whom the Software is
\r
9 * furnished to do so, subject to the following conditions:
\r
11 * The above copyright notice and this permission notice shall be included in
\r
12 * all copies or substantial portions of the Software.
\r
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
24 #include "WaveFormat.h"
\r
25 #include "WaveFormatExtensible.h"
\r
29 namespace Multimedia
\r
31 public ref class WaveStream : System::IO::Stream
\r
38 DataStream^ internalMemory;
\r
39 DataStream^ publicMemory;
\r
43 void InitStream( System::IO::Stream^ stream, int length );
\r
46 property DataStream^ InternalMemory
\r
48 DataStream^ get() { return publicMemory; }
\r
52 WaveStream( System::String^ path );
\r
53 WaveStream( System::IO::Stream^ stream );
\r
54 WaveStream( System::IO::Stream^ stream, int length );
\r
59 /// Sets the position within the current stream.
\r
61 /// <exception cref="InvalidOperationException">Attempted to seek outside of the bounds of the stream.</exception>
\r
62 virtual System::Int64 Seek( System::Int64 offset, System::IO::SeekOrigin origin ) override;
\r
67 /// <exception cref="NotSupportedException">Always thrown.</exception>
\r
68 virtual void Write( array<System::Byte>^ buffer, int offset, int count ) override;
\r
71 /// Reads a sequence of bytes from the current stream and advances the position
\r
72 /// within the stream by the number of bytes read.
\r
74 /// <param name="buffer">An array of values to be read from the stream.</param>
\r
75 /// <param name="offset">The zero-based byte offset in buffer at which to begin storing
\r
76 /// the data read from the current stream.</param>
\r
77 /// <param name="count">The maximum number of bytes to be read from the current stream.</param>
\r
78 /// <returns>The number of bytes read from the stream.</returns>
\r
79 /// <exception cref="NotSupportedException">This stream does not support reading.</exception>
\r
80 /// <exception cref="ArgumentNullException"><paramref name="buffer" /> is a null reference.</exception>
\r
81 /// <exception cref="ArgumentOutOfRangeException"><paramref name="offset" /> or <paramref name="count" /> is negative.</exception>
\r
82 /// <exception cref="ArgumentException">The sum of <paramref name="offset" /> and <paramref name="count" /> is greater than the buffer length.</exception>
\r
83 virtual int Read( array<System::Byte>^ buffer, int offset, int count ) override;
\r
88 /// <exception cref="NotSupportedException">Always thrown.</exception>
\r
89 virtual void Flush() override;
\r
94 /// <param name="value">Always ignored.</param>
\r
95 /// <exception cref="NotSupportedException">Always thrown.</exception>
\r
96 virtual void SetLength( System::Int64 value ) override;
\r
99 /// Gets a value indicating whether the current stream supports reading.
\r
101 /// <value>Always <c>true</c>.</value>
\r
102 property bool CanRead
\r
104 virtual bool get() override { return true; }
\r
108 /// Gets a value indicating whether the current stream supports seeking.
\r
110 /// <value>Always <c>true</c>.</value>
\r
111 property bool CanSeek
\r
113 virtual bool get() override { return true; }
\r
117 /// Gets a value indicating whether the current stream supports writing.
\r
119 /// <value>Always <c>false</c>.</value>
\r
120 property bool CanWrite
\r
122 virtual bool get() override { return false; }
\r
126 /// Gets the length in bytes of the stream.
\r
128 /// <value>A long value representing the length of the stream in bytes.</value>
\r
129 property System::Int64 Length
\r
131 virtual System::Int64 get() override;
\r
135 /// Gets or sets the position within the current stream.
\r
137 /// <value>The current position within the stream.</value>
\r
138 /// <seealso cref="Stream">Stream Class</seealso>
\r
139 property System::Int64 Position
\r
141 virtual System::Int64 get() override;
\r
142 virtual void set( System::Int64 ) override;
\r
145 property WaveFormat^ Format
\r
147 WaveFormat^ get() { return format; }
\r