Audaspace
1.9.0
A high level audio library.
Toggle main menu visibility
Loading...
Searching...
No Matches
libsndfile
SndFileWriter.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
19
#ifdef LIBSNDFILE_PLUGIN
20
#define AUD_BUILD_PLUGIN
21
#endif
22
28
29
#include "
file/IWriter.h
"
30
31
#include <string>
32
#include <sndfile.h>
33
34
AUD_NAMESPACE_BEGIN
35
39
class
AUD_PLUGIN_API
SndFileWriter :
public
IWriter
40
{
41
private
:
45
int
m_position;
46
50
DeviceSpecs
m_specs;
51
55
SNDFILE* m_sndfile;
56
57
// delete copy constructor and operator=
58
SndFileWriter(
const
SndFileWriter&) =
delete
;
59
SndFileWriter& operator=(
const
SndFileWriter&) =
delete
;
60
61
public
:
72
SndFileWriter
(
const
std::string &filename,
DeviceSpecs
specs,
Container
format,
Codec
codec,
unsigned
int
bitrate);
73
77
virtual
~SndFileWriter
();
78
79
virtual
int
getPosition
()
const
;
80
virtual
DeviceSpecs
getSpecs
()
const
;
81
virtual
void
write
(
unsigned
int
length,
sample_t
* buffer);
82
};
83
84
AUD_NAMESPACE_END
AUD_NAMESPACE_END
#define AUD_NAMESPACE_END
Closes the audaspace namespace aud.
Definition
Audaspace.h:119
sample_t
float sample_t
Sample type.(float samples).
Definition
Audaspace.h:126
AUD_NAMESPACE_BEGIN
#define AUD_NAMESPACE_BEGIN
Opens the audaspace namespace aud.
Definition
Audaspace.h:116
AUD_PLUGIN_API
#define AUD_PLUGIN_API
Used for exporting symbols in the shared library.
Definition
Audaspace.h:94
IWriter.h
Defines the IWriter interface as well as Container and Codec types.
Container
Container
Container formats for writers.
Definition
IWriter.h:31
Codec
Codec
Audio codecs for writers.
Definition
IWriter.h:45
IWriter
This class represents a sound sink where audio data can be written to.
Definition
IWriter.h:62
SndFileWriter::SndFileWriter
SndFileWriter(const std::string &filename, DeviceSpecs specs, Container format, Codec codec, unsigned int bitrate)
Creates a new writer.
SndFileWriter::write
virtual void write(unsigned int length, sample_t *buffer)
Request to write the next length samples out into the sink.
SndFileWriter::getSpecs
virtual DeviceSpecs getSpecs() const
Returns the specification of the audio data being written into the sink.
SndFileWriter::getPosition
virtual int getPosition() const
Returns how many samples have been written so far.
SndFileWriter::~SndFileWriter
virtual ~SndFileWriter()
Destroys the writer and closes the file.
DeviceSpecs
Specification of a sound device.
Definition
Specification.h:129
Generated by
1.17.0