Twitch SDK (Internal)
changefloatingpointdepthoperator.h
Go to the documentation of this file.
1 /********************************************************************************************
2  * Twitch Broadcasting SDK
3  *
4  * This software is supplied under the terms of a license agreement with Twitch Interactive, Inc. and
5  * may not be copied or used except in accordance with the terms of that agreement
6  * Copyright (c) 2012-2017 Twitch Interactive, Inc.
7  *
8  *********************************************************************************************/
9 
10 #pragma once
11 
13 
14 namespace ttv
15 {
31  template <typename InputSource, typename FloatingPointType, typename ContextType>
33  {
34  public:
35  ChangeFloatingPointDepthOperator(ContextType& context)
36  : mInputSource(context)
37  {
38  }
39 
40  using InputSampleType = typename InputSource::SampleType;
41  static_assert(std::is_floating_point<InputSampleType>::value, "Input sample type must be floating point.");
42 
43  using SampleType = FloatingPointType;
44  static_assert(std::is_floating_point<SampleType>::value, "Output sample type must be floating point.");
45 
46  static constexpr size_t SampleRate = InputSource::SampleRate;
47 
48  InputSource& GetInputSource()
49  {
50  return mInputSource;
51  }
52 
53 
55  {
56  return mInputSource.GetSampleRange();
57  }
58 
59 
60  SampleType operator[](size_t index) const
61  {
62  assert(index >= GetSampleRange().startIndex);
63  assert(index < GetSampleRange().startIndex + GetSampleRange().sampleCount);
64 
65  return static_cast<SampleType>(mInputSource[index]);
66  }
67 
68  private:
69  InputSource mInputSource;
70  };
71 }
SampleType operator[](size_t index) const
Definition: changefloatingpointdepthoperator.h:60
InputSource & GetInputSource()
Definition: changefloatingpointdepthoperator.h:48
static constexpr size_t SampleRate
Definition: changefloatingpointdepthoperator.h:46
InputSource mInputSource
Definition: changefloatingpointdepthoperator.h:69
SampleRange GetSampleRange() const
Definition: changefloatingpointdepthoperator.h:54
JSON (JavaScript Object Notation).
Definition: adsapi.h:16
#define assert(expr)
Definition: assertion.h:47
Definition: dsputilities.h:60
FloatingPointType SampleType
Definition: changefloatingpointdepthoperator.h:43
Definition: changefloatingpointdepthoperator.h:32
typename InputSource::SampleType InputSampleType
Definition: changefloatingpointdepthoperator.h:40
ChangeFloatingPointDepthOperator(ContextType &context)
Definition: changefloatingpointdepthoperator.h:35