Wayverb
output.h
1 #pragma once
2 
3 #include "combined/model/member.h"
4 
5 #include "audio_file/audio_file.h"
6 
7 #include <string>
8 
9 namespace wayverb {
10 namespace combined {
11 namespace model {
12 
13 class persistent;
14 class source;
15 class receiver;
16 class capsule;
17 
18 class output final : public basic_member<output> {
19 public:
20  enum class sample_rate {
21  sr44_1KHz = 1,
22  sr48KHz,
23  sr88_2KHz,
24  sr96KHz,
25  sr192KHz
26  };
27 
28  void set_bit_depth(audio_file::bit_depth bit_depth);
29  audio_file::bit_depth get_bit_depth() const;
30 
31  void set_format(audio_file::format format);
32  audio_file::format get_format() const;
33 
34  void set_sample_rate(sample_rate sample_rate);
35  sample_rate get_sample_rate() const;
36 
37  void set_output_directory(std::string path);
38  std::string get_output_directory() const;
39 
40  void set_unique_id(std::string unique);
41  std::string get_unique_id() const;
42 
43  NOTIFYING_COPY_ASSIGN_DECLARATION(output)
44 private:
45  inline void swap(output& other) noexcept {
46  using std::swap;
47  swap(bit_depth_, other.bit_depth_);
48  swap(format_, other.format_);
49  swap(sample_rate_, other.sample_rate_);
50  swap(output_directory_, other.output_directory_);
51  swap(unique_id_, other.unique_id_);
52  };
53 
54  audio_file::bit_depth bit_depth_ = audio_file::bit_depth::pcm24;
55  audio_file::format format_ = audio_file::format::wav;
56  sample_rate sample_rate_ = sample_rate::sr44_1KHz;
57 
58  std::string output_directory_ = "";
59  std::string unique_id_ = "";
60 };
61 
62 constexpr auto get_sample_rate(output::sample_rate sr) {
63  switch (sr) {
64  case output::sample_rate::sr44_1KHz: return 44100.0;
65  case output::sample_rate::sr48KHz: return 48000.0;
66  case output::sample_rate::sr88_2KHz: return 88200.0;
67  case output::sample_rate::sr96KHz: return 96000.0;
68  case output::sample_rate::sr192KHz: return 192000.0;
69  }
70 }
71 
73 
74 std::string compute_output_path(const source& source,
75  const receiver& receiver,
76  const capsule& capsule,
77  const output& output);
78 
79 std::vector<std::string> compute_all_file_names(const persistent& persistent,
80  const output& output);
81 
82 } // namespace model
83 } // namespace combined
84 } // namespace wayverb
Definition: receiver.h:13
Definition: capsule.h:13
Definition: persistent.h:17
Definition: output.h:18
Definition: capsule_base.h:9
Definition: source.h:16