OSDN Git Service

Merge branch 'feature/#36529_SlimDXからSharpDXへの移行' into develop
[dtxmania/dtxmania.git] / SlimDXc_Jun2010(VC++2008) / source / xaudio2 / Voice.cpp
diff --git a/SlimDXc_Jun2010(VC++2008)/source/xaudio2/Voice.cpp b/SlimDXc_Jun2010(VC++2008)/source/xaudio2/Voice.cpp
deleted file mode 100644 (file)
index 4015a9d..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-#include "stdafx.h"\r
-/*\r
-* Copyright (c) 2007-2010 SlimDX Group\r
-* \r
-* Permission is hereby granted, free of charge, to any person obtaining a copy\r
-* of this software and associated documentation files (the "Software"), to deal\r
-* in the Software without restriction, including without limitation the rights\r
-* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r
-* copies of the Software, and to permit persons to whom the Software is\r
-* furnished to do so, subject to the following conditions:\r
-* \r
-* The above copyright notice and this permission notice shall be included in\r
-* all copies or substantial portions of the Software.\r
-* \r
-* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
-* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
-* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r
-* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r
-* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r
-* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r
-* THE SOFTWARE.\r
-*/\r
-\r
-#include <xaudio2.h>\r
-\r
-#include "../stack_array.h"\r
-\r
-#include "XAudio2Exception.h"\r
-#include "Voice.h"\r
-\r
-using namespace System;\r
-using namespace System::Runtime::InteropServices;\r
-\r
-namespace SlimDX\r
-{\r
-namespace XAudio2\r
-{\r
-       Result Voice::DisableEffect( int effectIndex )\r
-       {\r
-               HRESULT hr = InternalPointer->DisableEffect( effectIndex );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::DisableEffect( int effectIndex, int operationSet )\r
-       {\r
-               HRESULT hr = InternalPointer->DisableEffect( effectIndex, operationSet );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::EnableEffect( int effectIndex )\r
-       {\r
-               HRESULT hr = InternalPointer->EnableEffect( effectIndex );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::EnableEffect( int effectIndex, int operationSet )\r
-       {\r
-               HRESULT hr = InternalPointer->EnableEffect( effectIndex, operationSet );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       array<float>^ Voice::GetChannelVolumes( int channels )\r
-       {\r
-               array<float>^ results = gcnew array<float>( channels );\r
-               pin_ptr<float> pinResults = &results[0];\r
-\r
-               InternalPointer->GetChannelVolumes( channels, reinterpret_cast<float*>( pinResults ) );\r
-\r
-               return results;\r
-       }\r
-\r
-       Result Voice::SetChannelVolumes( int channels, array<float>^ volumes )\r
-       {\r
-               pin_ptr<float> pinVolumes = &volumes[0];\r
-\r
-               HRESULT hr = InternalPointer->SetChannelVolumes( channels, reinterpret_cast<const float*>( pinVolumes ) );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::SetChannelVolumes( int channels, array<float>^ volumes, int operationSet )\r
-       {\r
-               pin_ptr<float> pinVolumes = &volumes[0];\r
-\r
-               HRESULT hr = InternalPointer->SetChannelVolumes( channels, reinterpret_cast<const float*>( pinVolumes ), operationSet );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::GetEffectParameters( int effectIndex, array<Byte>^ parameters )\r
-       {\r
-               pin_ptr<Byte> pinParams = &parameters[0];\r
-\r
-               HRESULT hr = InternalPointer->GetEffectParameters( effectIndex, pinParams, parameters->Length );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       generic<typename T>\r
-       T Voice::GetEffectParameters( int effectIndex )\r
-       {\r
-               T results;\r
-               HRESULT hr = InternalPointer->GetEffectParameters( effectIndex, &results, Marshal::SizeOf( T::typeid ) );\r
-               RECORD_XAUDIO2( hr );\r
-\r
-               return results;\r
-       }\r
-\r
-       Result Voice::SetEffectParameters( int effectIndex, array<Byte>^ parameters )\r
-       {\r
-               pin_ptr<Byte> pinParams = &parameters[0];\r
-\r
-               HRESULT hr = InternalPointer->SetEffectParameters( effectIndex, pinParams, parameters->Length );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::SetEffectParameters( int effectIndex, array<Byte>^ parameters, int operationSet )\r
-       {\r
-               pin_ptr<Byte> pinParams = &parameters[0];\r
-\r
-               HRESULT hr = InternalPointer->SetEffectParameters( effectIndex, pinParams, parameters->Length, operationSet );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       generic<typename T>\r
-       Result Voice::SetEffectParameters( int effectIndex, T parameters )\r
-       {\r
-               HRESULT hr = InternalPointer->SetEffectParameters( effectIndex, &parameters, Marshal::SizeOf( T::typeid ) );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       generic<typename T>\r
-       Result Voice::SetEffectParameters( int effectIndex, T parameters, int operationSet )\r
-       {\r
-               HRESULT hr = InternalPointer->SetEffectParameters( effectIndex, &parameters, Marshal::SizeOf( T::typeid ), operationSet );\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       bool Voice::IsEffectEnabled( int effectIndex )\r
-       {\r
-               BOOL result = FALSE;\r
-\r
-               InternalPointer->GetEffectState( effectIndex, &result );\r
-\r
-               return result > 0;\r
-       }\r
-\r
-       array<float>^ Voice::GetOutputMatrix( int sourceChannels, int destinationChannels )\r
-       {\r
-               return GetOutputMatrix( nullptr, sourceChannels, destinationChannels );\r
-       }\r
-\r
-       array<float>^ Voice::GetOutputMatrix( Voice^ destinationVoice, int sourceChannels, int destinationChannels )\r
-       {\r
-               array<float>^ results = gcnew array<float>( sourceChannels * destinationChannels );\r
-               pin_ptr<float> pinResults = &results[0];\r
-\r
-               IXAudio2Voice *voice = destinationVoice == nullptr ? NULL : destinationVoice->InternalPointer;\r
-\r
-               InternalPointer->GetOutputMatrix( voice, sourceChannels,\r
-                       destinationChannels, reinterpret_cast<float*>( pinResults ) );\r
-\r
-               return results;\r
-       }\r
-\r
-       Result Voice::SetEffectChain( array<EffectDescriptor>^ effects )\r
-       {\r
-               stack_array<XAUDIO2_EFFECT_DESCRIPTOR> descriptors = stackalloc(XAUDIO2_EFFECT_DESCRIPTOR, effects->Length);\r
-               for (int i = 0; i < effects->Length; i++)\r
-                       descriptors[i] = effects[i].ToUnmanaged();\r
-\r
-               XAUDIO2_EFFECT_CHAIN chain;\r
-               chain.EffectCount = effects->Length;\r
-               chain.pEffectDescriptors = &descriptors[0];\r
-\r
-               HRESULT hr = InternalPointer->SetEffectChain( &chain );\r
-               \r
-               for (int i = 0; i < effects->Length; i++)\r
-                       effects[i].Free();\r
-\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::SetOutputMatrix( int sourceChannels, int destinationChannels, array<float>^ matrix )\r
-       {\r
-               return SetOutputMatrix( nullptr, sourceChannels, destinationChannels, matrix );\r
-       }\r
-\r
-       Result Voice::SetOutputMatrix( Voice^ destinationVoice, int sourceChannels, int destinationChannels, array<float>^ matrix )\r
-       {\r
-               pin_ptr<float> pinMatrix = &matrix[0];\r
-\r
-               IXAudio2Voice *voice = destinationVoice == nullptr ? NULL : destinationVoice->InternalPointer;\r
-\r
-               HRESULT hr = InternalPointer->SetOutputMatrix( voice, sourceChannels,\r
-                       destinationChannels, reinterpret_cast<const float*>( pinMatrix ) );\r
-\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       Result Voice::SetOutputMatrix( int sourceChannels, int destinationChannels, array<float>^ matrix, int operationSet )\r
-       {\r
-               return SetOutputMatrix( nullptr, sourceChannels, destinationChannels, matrix, operationSet );\r
-       }\r
-\r
-       Result Voice::SetOutputMatrix( Voice^ destinationVoice, int sourceChannels, int destinationChannels, array<float>^ matrix, int operationSet )\r
-       {\r
-               pin_ptr<float> pinMatrix = &matrix[0];\r
-\r
-               IXAudio2Voice *voice = destinationVoice == nullptr ? NULL : destinationVoice->InternalPointer;\r
-\r
-               HRESULT hr = InternalPointer->SetOutputMatrix( voice, sourceChannels,\r
-                       destinationChannels, reinterpret_cast<const float*>( pinMatrix ), operationSet );\r
-\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-#if SLIMDX_XAUDIO2_VERSION < 24\r
-       Result Voice::SetOutputVoices( array<Voice^>^ outputVoices )\r
-#else\r
-       Result Voice::SetOutputVoices( array<VoiceSendDescriptor>^ outputVoices )\r
-#endif\r
-       {\r
-               HRESULT hr;\r
-\r
-               if( outputVoices == nullptr || outputVoices->Length == 0 )\r
-                       hr = InternalPointer->SetOutputVoices( NULL );\r
-               else\r
-               {\r
-#if SLIMDX_XAUDIO2_VERSION < 24\r
-                       stack_array<IXAudio2Voice*> voices = stackalloc( IXAudio2Voice*, outputVoices->Length );\r
-                       for( int i = 0; i < outputVoices->Length; i++ )\r
-                               voices[i] = outputVoices[i]->InternalPointer;\r
-\r
-                       XAUDIO2_VOICE_SENDS sendList;\r
-                       sendList.OutputCount = outputVoices->Length;\r
-                       sendList.pOutputVoices = &voices[0];\r
-#else\r
-                       stack_array<XAUDIO2_SEND_DESCRIPTOR> voices = stackalloc( XAUDIO2_SEND_DESCRIPTOR, outputVoices->Length );\r
-                       for( int i = 0; i < outputVoices->Length; i++ )\r
-                               voices[i] = outputVoices[i].CreateNativeVersion();\r
-\r
-                       XAUDIO2_VOICE_SENDS sendList;\r
-                       sendList.SendCount = outputVoices->Length;\r
-                       sendList.pSends = &voices[0];\r
-#endif\r
-\r
-                       hr = InternalPointer->SetOutputVoices( &sendList );\r
-               }\r
-\r
-               return RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       SlimDX::XAudio2::FilterParameters Voice::FilterParameters::get()\r
-       {\r
-               XAUDIO2_FILTER_PARAMETERS parameters;\r
-\r
-               InternalPointer->GetFilterParameters( &parameters );\r
-\r
-               SlimDX::XAudio2::FilterParameters result;\r
-               result.Frequency = parameters.Frequency;\r
-               result.OneOverQ = parameters.OneOverQ;\r
-               result.Type = static_cast<FilterType>( parameters.Type );\r
-\r
-               return result;\r
-       }\r
-\r
-       void Voice::FilterParameters::set( SlimDX::XAudio2::FilterParameters value )\r
-       {\r
-               pin_ptr<SlimDX::XAudio2::FilterParameters> pinValue = &value;\r
-\r
-               HRESULT hr = InternalPointer->SetFilterParameters( reinterpret_cast<const XAUDIO2_FILTER_PARAMETERS*>( pinValue ) );\r
-               RECORD_XAUDIO2( hr );\r
-       }\r
-\r
-       SlimDX::XAudio2::VoiceDetails Voice::VoiceDetails::get()\r
-       {\r
-               XAUDIO2_VOICE_DETAILS details;\r
-\r
-               InternalPointer->GetVoiceDetails( &details );\r
-\r
-               SlimDX::XAudio2::VoiceDetails result;\r
-               result.CreationFlags = static_cast<VoiceFlags>( details.CreationFlags );\r
-               result.InputChannels = details.InputChannels;\r
-               result.InputSampleRate = details.InputSampleRate;\r
-\r
-               return result;\r
-       }\r
-\r
-       float Voice::Volume::get()\r
-       {\r
-               float result;\r
-               InternalPointer->GetVolume( &result );\r
-\r
-               return result;\r
-       }\r
-\r
-       void Voice::Volume::set( float value )\r
-       {\r
-               HRESULT hr = InternalPointer->SetVolume( value );\r
-               RECORD_XAUDIO2( hr );\r
-       }\r
-}\r
-}
\ No newline at end of file