2 * Copyright (c) 2007-2010 SlimDX Group
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 #include "XACT3Exception.h"
28 using namespace System;
34 Cue::Cue( IXACT3Cue *cue )
36 InternalPointer = cue;
41 HRESULT hr = InternalPointer->Destroy();
42 return RECORD_XACT3(hr);
45 float Cue::GetVariable(int index)
47 XACTVARIABLEVALUE value;
49 HRESULT hr = InternalPointer->GetVariable(static_cast<XACTVARIABLEINDEX>(index), &value);
55 int Cue::GetVariableIndex(String^ friendlyName)
57 array<unsigned char>^ friendlyNameBytes = System::Text::ASCIIEncoding::ASCII->GetBytes(friendlyName);
58 pin_ptr<unsigned char> pinnedFriendlyName = &friendlyNameBytes[0];
60 XACTVARIABLEINDEX result = InternalPointer->GetVariableIndex(reinterpret_cast<PCSTR>(pinnedFriendlyName));
61 return result == XACTVARIABLEINDEX_INVALID ? -1 : result;
64 Result Cue::Pause(bool pause)
66 HRESULT hr = InternalPointer->Pause(pause);
67 return RECORD_XACT3(hr);
72 HRESULT hr = InternalPointer->Play();
73 return RECORD_XACT3(hr);
76 Result Cue::SetMatrixCoefficients(int srcChannelCount, int dstChannelCount, array<float>^ matrixCoefficients)
78 pin_ptr<float> pinnedMatrix = &matrixCoefficients[0];
80 HRESULT hr = InternalPointer->SetMatrixCoefficients(srcChannelCount, dstChannelCount, pinnedMatrix);
81 return RECORD_XACT3(hr);
84 Result Cue::SetVariable(int index, float value)
86 HRESULT hr = InternalPointer->SetVariable(static_cast<XACTVARIABLEINDEX>(index), value);
87 return RECORD_XACT3(hr);
90 Result Cue::Stop(StopFlags flags)
92 HRESULT hr = InternalPointer->Stop(static_cast<DWORD>(flags));
93 return RECORD_XACT3(hr);
96 CueInstanceProperties Cue::Properties::get()
98 LPXACT_CUE_INSTANCE_PROPERTIES resultPointer = NULL;
100 HRESULT hr = InternalPointer->GetProperties(&resultPointer);
103 CueInstanceProperties result = CueInstanceProperties(*resultPointer);
104 CoTaskMemFree(resultPointer);
109 CueState Cue::State::get()
113 HRESULT hr = InternalPointer->GetState(&result);
116 return static_cast<CueState>(result);