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
25 #include "DirectSound.h"
\r
26 #include "SoundBufferDescription.h"
\r
27 #include "BufferCapabilities.h"
\r
28 #include "NotificationPosition.h"
\r
32 ref class DataStream;
\r
34 namespace DirectSound
\r
37 /// The SoundBuffer object is used to manage sound buffers.
\r
39 /// <unmanaged>IDirectSoundBuffer</unmanaged>
\r
40 public ref class SoundBuffer abstract : public ComObject
\r
42 COMOBJECT_BASE(IDirectSoundBuffer);
\r
45 bool notVirtualized;
\r
50 DataStream^ Lock( int offset, int sizeBytes, LockFlags flags, [Out] DataStream^% secondPart );
\r
51 Result Unlock( DataStream^ firstPart, DataStream^ secondPart );
\r
55 /// Restores the memory allocation for a lost sound buffer.
\r
60 /// Causes the sound buffer to play, starting at the play cursor.
\r
62 Result Play( int priority, PlayFlags flags );
\r
65 /// Causes the sound buffer to stop playing.
\r
70 /// Writes data to the buffer.
\r
72 /// <returns></returns>
\r
73 generic<typename T> where T : value class
\r
74 Result Write( array<T>^ data, int startIndex, int count, int bufferOffset, LockFlags flags );
\r
77 /// Writes data to the buffer.
\r
79 /// <returns></returns>
\r
80 generic<typename T> where T : value class
\r
81 Result Write( array<T>^ data, int bufferOffset, LockFlags flags );
\r
83 Result SetNotificationPositions( array<NotificationPosition>^ positions );
\r
85 property SlimDX::Multimedia::WaveFormat^ Format
\r
87 SlimDX::Multimedia::WaveFormat^ get();
\r
88 void set( SlimDX::Multimedia::WaveFormat^ value );
\r
92 /// Retrieves the position of the write cursor in the sound buffer.
\r
94 property int CurrentWritePosition
\r
100 /// Retrieves or sets the position of the play cursor.
\r
102 property int CurrentPlayPosition
\r
105 void set( int value );
\r
109 /// Retrieves or sets the frequency, in samples per second, at which the buffer is playing.
\r
111 property int Frequency
\r
114 void set( int value );
\r
118 /// Retrieves or sets the attenuation of the sound.
\r
120 property int Volume
\r
123 void set( int value );
\r
127 /// Retrieves or sets the relative volume of the left and right audio channels.
\r
132 void set( int value );
\r
136 /// Retrieves the status of the sound buffer.
\r
138 property BufferStatus Status
\r
140 BufferStatus get();
\r
144 /// True if a requested 3D algorithm was not available and stereo panning was substituted.
\r
146 property bool NoVirtualization
\r
148 bool get() { return notVirtualized; }
\r
150 void set( bool value ) { notVirtualized = value; }
\r
154 /// Retrieves the capabilities of the buffer object.
\r
156 property BufferCapabilities Capabilities
\r
158 BufferCapabilities get();
\r