format.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <string>
9 
10 #ifdef ETK_EXTERN_FRAMEWORK_ROS
11  #include <ros/ros.h>
12  #include "audio_msg/AudioBuffer.h"
13  namespace audio {
14  enum format {
15  format_unknow = audio_msg::AudioBuffer::FORMAT_UNKNOW,
16  format_int8 = audio_msg::AudioBuffer::FORMAT_INT8,
17  format_int8_on_int16 = audio_msg::AudioBuffer::FORMAT_INT8_ON_INT16,
18  format_int16 = audio_msg::AudioBuffer::FORMAT_INT16,
19  format_int16_on_int32 = audio_msg::AudioBuffer::FORMAT_INT16_ON_INT32,
20  format_int24 = audio_msg::AudioBuffer::FORMAT_INT24,
21  format_int24_on_int32 = audio_msg::AudioBuffer::FORMAT_INT24_ON_INT32,
22  format_int32 = audio_msg::AudioBuffer::FORMAT_INT32,
23  format_int32_on_int64 = audio_msg::AudioBuffer::FORMAT_INT32_ON_INT64,
24  format_int64 = audio_msg::AudioBuffer::FORMAT_INT64,
25  format_float = audio_msg::AudioBuffer::FORMAT_FLOAT,
26  format_double = audio_msg::AudioBuffer::FORMAT_DOUBLE
27  };
28  };
29 #else
30  namespace audio {
31  enum format {
32  format_unknow,
44  };
45  };
46 #endif
47 
48 namespace audio {
49  std::string getFormatString(enum audio::format _format);
50  enum audio::format getFormatFromString(const std::string& _value);
51  std::vector<enum audio::format> getListFormatFromString(const std::string& _value);
52  std::ostream& operator <<(std::ostream& _os, enum audio::format _obj);
53  std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::format>& _obj);
54  uint32_t getFormatBytes(enum audio::format _format);
55  // For ROS Interface:
56  std::vector<uint8_t> convertFormat(const std::vector<enum audio::format>& _obj);
57  std::vector<enum audio::format> convertFormat(const std::vector<uint8_t>& _obj);
58  uint8_t convertFormat(enum audio::format _obj);
59  enum audio::format convertFormat(uint8_t _obj);
60 };
61 
Signed 24 bits on 24 bits (lower)
Definition: format.hpp:37
Signed 64 bits.
Definition: format.hpp:41
Signed 32 bits on 64 bits data (32 bit fixpoint value)
Definition: format.hpp:40
format
Definition: format.hpp:31
Signed 32 bits.
Definition: format.hpp:39
Signed 8 bits on 16 bits data (8 bit fixpoint value)
Definition: format.hpp:34
Signed 16 bits on 32 bits data (16 bit fixpoint value)
Definition: format.hpp:36
Signed 24 bits on 32 bits (lower)
Definition: format.hpp:38
Floating point 64 bits (double precision)
Definition: format.hpp:43
Audio library namespace.
Definition: channel.hpp:70
Signed 16 bits.
Definition: format.hpp:35
Signed 8 bits.
Definition: format.hpp:33
Floating point 32 bits (single precision)
Definition: format.hpp:42