Audaspace  1.3.0
A high level audio library.
FileManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright 2009-2016 Jörg Müller
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #pragma once
18 
25 #include "respec/Specification.h"
26 #include "IWriter.h"
27 
28 #include <list>
29 #include <memory>
30 
32 
33 class IFileInput;
34 class IFileOutput;
35 class IReader;
36 class Buffer;
37 
42 {
43 private:
44  static std::list<std::shared_ptr<IFileInput>>& inputs();
45  static std::list<std::shared_ptr<IFileOutput>>& outputs();
46 
47  // delete copy constructor and operator=
48  FileManager(const FileManager&) = delete;
49  FileManager& operator=(const FileManager&) = delete;
50  FileManager() = delete;
51 
52 public:
57  static void registerInput(std::shared_ptr<IFileInput> input);
58 
63  static void registerOutput(std::shared_ptr<IFileOutput> output);
64 
71  static std::shared_ptr<IReader> createReader(std::string filename);
72 
79  static std::shared_ptr<IReader> createReader(std::shared_ptr<Buffer> buffer);
80 
92  static std::shared_ptr<IWriter> createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate);
93 };
94 
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition: Audaspace.h:119
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition: Audaspace.h:116
#define AUD_API
Used for exporting symbols in the shared library.
Definition: Audaspace.h:93
Defines the IWriter interface as well as Container and Codec types.
Container
Container formats for writers.
Definition: IWriter.h:31
Codec
Audio codecs for writers.
Definition: IWriter.h:44
Defines all important macros and basic data structures for stream format descriptions.
This class is a simple buffer in RAM which is 32 Byte aligned and provides resize functionality.
Definition: Buffer.h:34
The FileManager manages all file input and output plugins.
Definition: FileManager.h:42
static void registerInput(std::shared_ptr< IFileInput > input)
Registers a file input used to create an IReader to read from a file.
static std::shared_ptr< IReader > createReader(std::shared_ptr< Buffer > buffer)
Creates a file reader for the given buffer if a registed IFileInput is able to read it.
static std::shared_ptr< IReader > createReader(std::string filename)
Creates a file reader for the given filename if a registed IFileInput is able to read it.
static void registerOutput(std::shared_ptr< IFileOutput > output)
Registers a file output used to create an IWriter to write to a file.
static std::shared_ptr< IWriter > createWriter(std::string filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
Creates a file writer that writes a sound to the given file path.
The IFileInput interface represents a file input plugin that can create file input readers from filen...
Definition: IFileInput.h:41
The IFileOutput interface represents a file output plugin that can write files.
Definition: IFileOutput.h:38
This class represents a sound source as stream or as buffer which can be read for example by another ...
Definition: IReader.h:35
Specification of a sound device.
Definition: Specification.h:120