~ubuntu-branches/ubuntu/wily/soundscaperenderer/wily

« back to all changes in this revision

Viewing changes to src/publisher.h

  • Committer: Package Import Robot
  • Author(s): IOhannes m zmölnig (Debian/GNU)
  • Date: 2014-05-08 16:58:09 UTC
  • Revision ID: package-import@ubuntu.com-20140508165809-7tz9dhu5pvo5wy25
Tags: upstream-0.4.1~dfsg
Import upstream version 0.4.1~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
 * Copyright © 2012-2014 Institut für Nachrichtentechnik, Universität Rostock *
 
3
 * Copyright © 2006-2012 Quality & Usability Lab,                             *
 
4
 *                       Telekom Innovation Laboratories, TU Berlin           *
 
5
 *                                                                            *
 
6
 * This file is part of the SoundScape Renderer (SSR).                        *
 
7
 *                                                                            *
 
8
 * The SSR is free software:  you can redistribute it and/or modify it  under *
 
9
 * the terms of the  GNU  General  Public  License  as published by the  Free *
 
10
 * Software Foundation, either version 3 of the License,  or (at your option) *
 
11
 * any later version.                                                         *
 
12
 *                                                                            *
 
13
 * The SSR is distributed in the hope that it will be useful, but WITHOUT ANY *
 
14
 * WARRANTY;  without even the implied warranty of MERCHANTABILITY or FITNESS *
 
15
 * FOR A PARTICULAR PURPOSE.                                                  *
 
16
 * See the GNU General Public License for more details.                       *
 
17
 *                                                                            *
 
18
 * You should  have received a copy  of the GNU General Public License  along *
 
19
 * with this program.  If not, see <http://www.gnu.org/licenses/>.            *
 
20
 *                                                                            *
 
21
 * The SSR is a tool  for  real-time  spatial audio reproduction  providing a *
 
22
 * variety of rendering algorithms.                                           *
 
23
 *                                                                            *
 
24
 * http://spatialaudio.net/ssr                           ssr@spatialaudio.net *
 
25
 ******************************************************************************/
 
26
 
 
27
/// @file
 
28
/// Abstract %Publisher (definition).
 
29
 
 
30
// TODO: use a less general name?
 
31
#ifndef SSR_PUBLISHER_H
 
32
#define SSR_PUBLISHER_H
 
33
 
 
34
#include <inttypes.h>  // for uint32_t
 
35
 
 
36
#include "source.h"
 
37
#include "ssr_global.h"
 
38
 
 
39
using jack_nframes_t = uint32_t; // from <jack/types.h>
 
40
 
 
41
namespace ssr
 
42
{
 
43
 
 
44
struct Subscriber;
 
45
 
 
46
/** Abstract interface to controller class (and similar classes).
 
47
 * All member functions are public, everyone can call them.
 
48
 * @attention For now, none of the member functions has a return value. That is
 
49
 * because if we are connected via a slow IP interface we do not want to wait
 
50
 * for transferring back the return value.
 
51
 * \par
 
52
 * Anyhow, maybe this is not a good decision. Maybe there should be return
 
53
 * values?
 
54
 **/
 
55
struct Publisher
 
56
{
 
57
  virtual ~Publisher() {} ///< dtor. does nothing
 
58
 
 
59
  /// load scene from XML file.
 
60
  /// @param scene_file_name name of XML file to load.
 
61
  virtual bool load_scene(const std::string& scene_file_name) = 0;
 
62
  virtual bool save_scene_as_XML(const std::string& filename) const = 0;
 
63
 
 
64
  virtual void start_processing() = 0; ///< start processing
 
65
  virtual void stop_processing() = 0;  ///< stop  processing
 
66
 
 
67
  /// create new source.
 
68
  /// @param name name of the new source
 
69
  /// @param model model (=type) of the new source
 
70
  /// @param file_or_port_name name of audio file or JACK port. If a JACK port
 
71
  /// is given, @a channel has to be zero!
 
72
  /// @param channel number of channel in audio file. If zero, a JACK port is
 
73
  /// given instead of an audio file.
 
74
  /// @param position initial position of the new source.
 
75
  /// @param orientation initial orientation of the new source.
 
76
  /// @param gain initial gain of the new source.
 
77
  virtual void new_source(const std::string& name, Source::model_t model,
 
78
      const std::string& file_or_port_name, int channel = 0,
 
79
      const Position& position = Position(), const bool pos_fix = false,
 
80
      const Orientation& orientation = Orientation(), const bool or_fix = false,
 
81
      const float gain = 1.0f, const bool mute_state = false, 
 
82
      const std::string& properties_file = "") = 0;
 
83
 
 
84
  /// delete a source
 
85
  /// @param[in] id id of the source to be deleted
 
86
  virtual void delete_source(id_t id) = 0;
 
87
 
 
88
  /// delete all sources
 
89
  virtual void delete_all_sources() = 0;
 
90
 
 
91
  /// set position of a source
 
92
  /// @param id source id.
 
93
  /// @param position source position.
 
94
  /// @todo include some sort of identification who sent the request.
 
95
  virtual void set_source_position(id_t id, const Position& position) = 0;
 
96
  /// set orientation of a source
 
97
  virtual void set_source_orientation(id_t id,
 
98
      const Orientation& orientation) = 0;
 
99
  /// set gain (=volume) of a source
 
100
  virtual void set_source_gain(id_t id, float gain) = 0;
 
101
  /// mute/unmute source
 
102
  virtual void set_source_mute(id_t id, bool mute) = 0;
 
103
  /// instantaneous level of audio stream
 
104
  virtual void set_source_signal_level(const id_t id,
 
105
      const float level) = 0;
 
106
  /// set name of a source
 
107
  virtual void set_source_name(id_t id, const std::string& name) = 0;
 
108
  virtual void set_source_properties_file(id_t id, const std::string& name) = 0;
 
109
  /// set model (=type) of a source
 
110
  virtual void set_source_model(id_t id, Source::model_t model) = 0;
 
111
  /// set JACK port of a source
 
112
  virtual void
 
113
  set_source_port_name(id_t id, const std::string& port_name) = 0;
 
114
  virtual void
 
115
  set_source_position_fixed(id_t id, const bool fix) = 0;
 
116
 
 
117
  /// set position of the reference
 
118
  /// @param position well, the position
 
119
  virtual void set_reference_position(const Position& position) = 0;
 
120
  /// set orientation of the reference
 
121
  virtual void set_reference_orientation(const Orientation& orientation) = 0;
 
122
  virtual void set_reference_offset_position(const Position& position) = 0;
 
123
  virtual void set_reference_offset_orientation(const Orientation& orientation) = 0;
 
124
 
 
125
  /// set master volume of the whole scene
 
126
  virtual void set_master_volume(float volume) = 0;
 
127
 
 
128
  /// set amplitude reference distance
 
129
  virtual void
 
130
  set_amplitude_reference_distance(float distance) = 0;
 
131
 
 
132
  /// set instantaneous overall audio level (linear scale)
 
133
  virtual void set_master_signal_level(float level) = 0;
 
134
 
 
135
  /// set CPU load in percent as estimated by JACK
 
136
  virtual void set_cpu_load(const float load) = 0;
 
137
 
 
138
  /// sets the sample rate in all subscribers
 
139
  virtual void publish_sample_rate(const int sample_rate) = 0;
 
140
 
 
141
  /// returns what type the current renderer actually is
 
142
  virtual std::string get_renderer_name() const = 0;
 
143
 
 
144
  /// show head in GUI?
 
145
  virtual bool show_head() const = 0;
 
146
 
 
147
  virtual void transport_start() = 0; ///< start JACK transport
 
148
 
 
149
  virtual void transport_stop() = 0;  ///< stop  JACK transport
 
150
  /// set JACK transport location
 
151
  virtual bool transport_locate(float time_in_sec) = 0;
 
152
  /// This is temporarily used to calibrate the tracker
 
153
  virtual void calibrate_client() = 0;
 
154
 
 
155
  virtual void set_processing_state(bool state) = 0;
 
156
 
 
157
  virtual void subscribe(Subscriber* subscriber) = 0;
 
158
  virtual void unsubscribe(Subscriber* subscriber) = 0;
 
159
  virtual std::string get_scene_as_XML() const = 0;
 
160
};
 
161
 
 
162
}  // namespace ssr
 
163
 
 
164
#endif
 
165
 
 
166
// Settings for Vim (http://www.vim.org/), please do not remove:
 
167
// vim:softtabstop=2:shiftwidth=2:expandtab:textwidth=80:cindent
 
168
// vim:fdm=expr:foldexpr=getline(v\:lnum)=~'/\\*\\*'&&getline(v\:lnum)!~'\\*\\*/'?'a1'\:getline(v\:lnum)=~'\\*\\*/'&&getline(v\:lnum)!~'/\\*\\*'?'s1'\:'='