Wayverb
hard_source.h
1 #pragma once
2 
3 #include "core/cl/common.h"
4 
5 namespace wayverb {
6 namespace waveguide {
7 namespace preprocessor {
8 
9 template <typename It>
10 class hard_source final {
11 public:
12  hard_source(size_t node, It begin, It end)
13  : node_{node}
14  , begin_{begin}
15  , end_{end} {}
16 
17  bool operator()(cl::CommandQueue& queue, cl::Buffer& buffer, size_t) {
18  if (begin_ == end_) {
19  return false;
20  }
21  core::write_value(queue, buffer, node_, *begin_++);
22  return true;
23  }
24 
25 private:
26  size_t node_;
27  It begin_;
28  It end_;
29 };
30 
31 template <typename It>
32 auto make_hard_source(size_t node, It begin, It end) {
33  return hard_source<It>{node, begin, end};
34 }
35 
36 } // namespace preprocessor
37 } // namespace waveguide
38 } // namespace wayverb
Definition: capsule_base.h:9