Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
Loading...
Searching...
No Matches
sox_backend.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Roc authors
3 *
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 */
8
9//! @file roc_sndio/target_sox/roc_sndio/sox_backend.h
10//! @brief SoX backend.
11
12#ifndef ROC_SNDIO_SOX_BACKEND_H_
13#define ROC_SNDIO_SOX_BACKEND_H_
14
15#include <sox.h>
16
17#include "roc_core/mutex.h"
19#include "roc_core/singleton.h"
20#include "roc_sndio/ibackend.h"
21
22namespace roc {
23namespace sndio {
24
25//! SoX backend.
27public:
28 //! Get instance.
29 static SoxBackend& instance() {
31 }
32
33 //! Set internal SoX frame size.
34 //! @remarks
35 //! Number of samples for all channels.
36 void set_frame_size(size_t size);
37
38 //! Check whether the backend can handle given input or output.
39 virtual bool probe(const char* driver, const char* inout, int flags);
40
41 //! Create and open a sink.
42 virtual ISink* open_sink(core::IAllocator& allocator,
43 const char* driver,
44 const char* output,
45 const Config& config);
46
47 //! Create and open a source.
49 const char* driver,
50 const char* input,
51 const Config& config);
52
53 //! Append supported dirvers to the list.
54 virtual bool get_drivers(core::Array<DriverInfo>& arr, int filter_flags);
55
56private:
57 friend class core::Singleton<SoxBackend>;
58
59 SoxBackend();
60
61 core::Mutex mutex_;
62
63 bool first_created_;
64};
65
66} // namespace sndio
67} // namespace roc
68
69#endif // ROC_SNDIO_SOX_BACKEND_H_
Dynamic array.
Definition: array.h:25
Memory allocator interface.
Definition: iallocator.h:23
Mutex.
Definition: mutex.h:27
Base class for non-copyable objects.
Definition: noncopyable.h:23
static T & instance()
Get singleton instance.
Definition: singleton.h:29
Backend interface.
Definition: ibackend.h:27
Sink interface.
Definition: isink.h:21
Source interface.
Definition: isource.h:21
virtual bool probe(const char *driver, const char *inout, int flags)
Check whether the backend can handle given input or output.
virtual bool get_drivers(core::Array< DriverInfo > &arr, int filter_flags)
Append supported dirvers to the list.
static SoxBackend & instance()
Get instance.
Definition: sox_backend.h:29
void set_frame_size(size_t size)
Set internal SoX frame size.
virtual ISource * open_source(core::IAllocator &allocator, const char *driver, const char *input, const Config &config)
Create and open a source.
virtual ISink * open_sink(core::IAllocator &allocator, const char *driver, const char *output, const Config &config)
Create and open a sink.
Backend interface.
Mutex.
Root namespace.
Non-copyable object.
Singleton.
Sink and source config.
Definition: config.h:22