OSDN Git Service

DTXMania089リリースに際してのtag付け。
[dtxmania/dtxmania.git] / 110401(DTXMania089) / SlimDXc_Jun2010(VC++2008) / source / multimedia / WaveStream.h
1 /*\r
2 * Copyright (c) 2007-2010 SlimDX Group\r
3\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
10\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
13\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
20 * THE SOFTWARE.\r
21 */\r
22 #pragma once\r
23 \r
24 #include "WaveFormat.h"\r
25 #include "WaveFormatExtensible.h"\r
26 \r
27 namespace SlimDX\r
28 {\r
29         namespace Multimedia\r
30         {\r
31                 public ref class WaveStream : System::IO::Stream\r
32                 {\r
33                 private:\r
34                         HMMIO handle;\r
35                         int dataOffset;\r
36                         int size;\r
37                         WaveFormat^ format;\r
38                         DataStream^ internalMemory;\r
39                         DataStream^ publicMemory;\r
40 \r
41                         void Destruct();\r
42                         void Init();\r
43                         void InitStream( System::IO::Stream^ stream, int length );\r
44 \r
45                 internal:\r
46                         property DataStream^ InternalMemory\r
47                         {\r
48                                 DataStream^ get() { return publicMemory; }\r
49                         }\r
50 \r
51                 public:\r
52                         WaveStream( System::String^ path );\r
53                         WaveStream( System::IO::Stream^ stream );\r
54                         WaveStream( System::IO::Stream^ stream, int length );\r
55                         ~WaveStream();\r
56                         !WaveStream();\r
57 \r
58                         /// <summary>\r
59                         /// Sets the position within the current stream.\r
60                         /// </summary>\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
63 \r
64                         /// <summary>\r
65                         /// Not supported.\r
66                         /// </summary>\r
67                         /// <exception cref="NotSupportedException">Always thrown.</exception>\r
68                         virtual void Write( array<System::Byte>^ buffer, int offset, int count ) override;\r
69 \r
70                         /// <summary>\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
73                         /// </summary>\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
84 \r
85                         /// <summary>\r
86                         /// Not supported.\r
87                         /// </summary>\r
88                         /// <exception cref="NotSupportedException">Always thrown.</exception>\r
89                         virtual void Flush() override;\r
90 \r
91                         /// <summary>\r
92                         /// Not supported.\r
93                         /// </summary>\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
97 \r
98                         /// <summary>\r
99                         /// Gets a value indicating whether the current stream supports reading.\r
100                         /// </summary>\r
101                         /// <value>Always <c>true</c>.</value>\r
102                         property bool CanRead\r
103                         {\r
104                                 virtual bool get() override { return true; }\r
105                         }\r
106 \r
107                         /// <summary>\r
108                         /// Gets a value indicating whether the current stream supports seeking.\r
109                         /// </summary>\r
110                         /// <value>Always <c>true</c>.</value>\r
111                         property bool CanSeek\r
112                         {\r
113                                 virtual bool get() override { return true; }\r
114                         }\r
115 \r
116                         /// <summary>\r
117                         /// Gets a value indicating whether the current stream supports writing.\r
118                         /// </summary>\r
119                         /// <value>Always <c>false</c>.</value>\r
120                         property bool CanWrite\r
121                         {\r
122                                 virtual bool get() override { return false; }\r
123                         }\r
124 \r
125                         /// <summary>\r
126                         /// Gets the length in bytes of the stream.\r
127                         /// </summary>\r
128                         /// <value>A long value representing the length of the stream in bytes.</value>\r
129                         property System::Int64 Length\r
130                         {\r
131                                 virtual System::Int64 get() override;\r
132                         }\r
133 \r
134                         /// <summary>\r
135                         /// Gets or sets the position within the current stream.\r
136                         /// </summary>\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
140                         {\r
141                                 virtual System::Int64 get() override;\r
142                                 virtual void set( System::Int64 ) override;\r
143                         }\r
144 \r
145                         property WaveFormat^ Format\r
146                         {\r
147                                 WaveFormat^ get() { return format; }\r
148                         }\r
149                 };\r
150         }\r
151 }