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 "../ComObject.h"
\r
25 #include "../multimedia/WaveFormat.h"
\r
26 #include "../multimedia/WaveFormatExtensible.h"
\r
28 #include "DeviceDetails.h"
\r
29 #include "PerformanceData.h"
\r
30 #include "DebugConfiguration.h"
\r
31 #include "ErrorEventArgs.h"
\r
32 #include "EngineCallback.h"
\r
38 public ref class XAudio2 : public ComObject
\r
40 COMOBJECT(IXAudio2, XAudio2);
\r
43 EngineCallbackShim *callback;
\r
46 void InvokeCriticalError( ErrorEventArgs^ e ) { OnCriticalError( e ); }
\r
47 void InvokeProcessingPassEnd() { OnProcessingPassEnd( System::EventArgs::Empty ); }
\r
48 void InvokeProcessingPassStart() { OnProcessingPassStart( System::EventArgs::Empty); }
\r
51 void OnCriticalError( ErrorEventArgs^ e );
\r
52 void OnProcessingPassEnd( System::EventArgs^ e );
\r
53 void OnProcessingPassStart( System::EventArgs^ e );
\r
57 XAudio2( XAudio2Flags flags, ProcessorSpecifier processor );
\r
58 virtual ~XAudio2() { if( callback != NULL ) delete callback; callback = NULL; }
\r
60 static float AmplitudeRatioToDecibels( float volume );
\r
61 static float CutoffFrequencyToRadians( float cutoffFrequency, int sampleRate );
\r
62 static float DecibelsToAmplitudeRatio( float decibels );
\r
63 static float FrequencyRatioToSemitones( float frequencyRatio );
\r
64 static float RadiansToCutoffFrequency( float radians, float sampleRate );
\r
65 static float SemitonesToFrequencyRatio( float semitones );
\r
67 Result StartEngine();
\r
70 Result CommitChanges();
\r
71 Result CommitChanges( int operationSet );
\r
73 DeviceDetails^ GetDeviceDetails( int index );
\r
75 void SetDebugConfiguration( DebugConfiguration configuration );
\r
77 property int DeviceCount
\r
82 property PerformanceData^ PerformanceData
\r
84 SlimDX::XAudio2::PerformanceData^ get();
\r
87 event System::EventHandler<ErrorEventArgs^>^ CriticalError;
\r
88 event System::EventHandler^ ProcessingPassEnd;
\r
89 event System::EventHandler^ ProcessingPassStart;
\r
91 literal int MaximumBufferBytes = XAUDIO2_MAX_BUFFER_BYTES;
\r
92 literal int MaximumQueuedBuffers = XAUDIO2_MAX_QUEUED_BUFFERS;
\r
93 literal int MaximumAudioChannels = XAUDIO2_MAX_AUDIO_CHANNELS;
\r
94 literal int MinimumSampleRate = XAUDIO2_MIN_SAMPLE_RATE;
\r
95 literal int MaximumSampleRate = XAUDIO2_MAX_SAMPLE_RATE;
\r
96 literal float MaximumVolumeLevel = XAUDIO2_MAX_VOLUME_LEVEL;
\r
97 literal float MinimumFrequencyRatio = XAUDIO2_MIN_FREQ_RATIO;
\r
98 literal float MaximumFrequencyRatio = XAUDIO2_MAX_FREQ_RATIO;
\r
99 literal float DefaultFrequencyRatio = XAUDIO2_DEFAULT_FREQ_RATIO;
\r
100 literal float MaximumFilterOneOverQ = XAUDIO2_MAX_FILTER_ONEOVERQ;
\r
101 literal float MaximumFilterFrequency = XAUDIO2_MAX_FILTER_FREQUENCY;
\r
102 literal int MaximumLoopCount = XAUDIO2_MAX_LOOP_COUNT;
\r
104 literal int CommitNow = XAUDIO2_COMMIT_NOW;
\r
105 literal int CommitAll = XAUDIO2_COMMIT_ALL;
\r
106 literal int NoLoopRegion = XAUDIO2_NO_LOOP_REGION;
\r
107 literal int LoopInfinite = XAUDIO2_LOOP_INFINITE;
\r
108 literal int DefaultChannels = XAUDIO2_DEFAULT_CHANNELS;
\r
109 literal int DefaultSampleRate = XAUDIO2_DEFAULT_SAMPLERATE;
\r
111 static property System::Guid FormatSubtypePcm
\r
113 System::Guid get();
\r
116 static property System::Guid FormatSubtypeAdpcm
\r
118 System::Guid get();
\r
121 static property System::Guid FormatSubtypeIeee
\r
123 System::Guid get();
\r