~ubuntu-branches/ubuntu/vivid/soundscaperenderer/vivid

« back to all changes in this revision

Viewing changes to src/audiorecorder.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
/// Audio recorder using ecasound (definition).
 
29
 
 
30
#ifndef SSR_AUDIORECORDER_H
 
31
#define SSR_AUDIORECORDER_H
 
32
 
 
33
#include <eca-control-interface.h>
 
34
#include <string>
 
35
#include <memory>
 
36
#include <stdexcept> // for std::runtime_error
 
37
 
 
38
/**
 
39
 * Writes a (multichannel) soundfile using ecasound and JACK transport.
 
40
 **/
 
41
class AudioRecorder
 
42
{
 
43
  public:
 
44
    using ptr_t = std::unique_ptr<AudioRecorder>; ///< auto_ptr to AudioRecorder
 
45
 
 
46
    /// exception to be thrown by ctor.
 
47
    struct audiorecorder_error : public std::runtime_error
 
48
    {
 
49
      audiorecorder_error(const std::string& s): std::runtime_error(s) {}
 
50
    };
 
51
 
 
52
    ~AudioRecorder();
 
53
 
 
54
    AudioRecorder(const std::string& audio_file_name,
 
55
        const std::string& format_string, const std::string& record_source,
 
56
        const std::string& client_name = "recorder",
 
57
        const std::string& input_prefix = "channel") throw(audiorecorder_error);
 
58
 
 
59
    bool enable();   ///< enable recording as soon as transport is started
 
60
    bool disable();  ///< disable recording
 
61
 
 
62
    const std::string client_name;   ///< name of JACK client used by ecasound
 
63
    const std::string input_prefix;  ///< prefix used for channels
 
64
 
 
65
  private:
 
66
    ECA_CONTROL_INTERFACE _eca; ///< interface to ecasound
 
67
};
 
68
 
 
69
#endif
 
70
 
 
71
// Settings for Vim (http://www.vim.org/), please do not remove:
 
72
// vim:softtabstop=2:shiftwidth=2:expandtab:textwidth=80:cindent
 
73
// vim:fdm=expr:foldexpr=getline(v\:lnum)=~'/\\*\\*'&&getline(v\:lnum)!~'\\*\\*/'?'a1'\:getline(v\:lnum)=~'\\*\\*/'&&getline(v\:lnum)!~'/\\*\\*'?'s1'\:'='