GNU Radio Manual and C++ API Reference
3.9.1.0
The Free & Open Software Radio Ecosystem
wavfile_sink.h
Go to the documentation of this file.
1
/* -*- c++ -*- */
2
/*
3
* Copyright 2008,2009,2013 Free Software Foundation, Inc.
4
*
5
* This file is part of GNU Radio
6
*
7
* SPDX-License-Identifier: GPL-3.0-or-later
8
*
9
*/
10
11
#ifndef INCLUDED_GR_WAVFILE_SINK_H
12
#define INCLUDED_GR_WAVFILE_SINK_H
13
14
#include <
gnuradio/blocks/api.h
>
15
#include <
gnuradio/blocks/wavfile.h
>
16
#include <
gnuradio/sync_block.h
>
17
18
namespace
gr
{
19
namespace
blocks {
20
21
/*!
22
* \brief Write stream to a Microsoft PCM (.wav) file.
23
* \ingroup audio_blk
24
*
25
* \details
26
* Values must be floats within [-1;1].
27
* Check gr_make_wavfile_sink() for extra info.
28
*/
29
class
BLOCKS_API
wavfile_sink
:
virtual
public
sync_block
30
{
31
public
:
32
// gr::blocks::wavfile_sink::sptr
33
typedef
std::shared_ptr<wavfile_sink>
sptr
;
34
35
/*
36
* \param filename The .wav file to be opened
37
* \param n_channels Number of channels (2 = stereo or I/Q output)
38
* \param sample_rate Sample rate [S/s]
39
* \param format Output format (WAV, FLAC, Ogg Vorbis, RF64)
40
* \param subformat Bits per sample
41
* \param append Append to existing file
42
*/
43
static
sptr
make(
const
char
* filename,
44
int
n_channels,
45
unsigned
int
sample_rate,
46
wavfile_format_t
format,
47
wavfile_subformat_t
subformat,
48
bool
append =
false
);
49
50
/*!
51
* \brief Opens a new file and writes a WAV header. Thread-safe.
52
*/
53
virtual
bool
open(
const
char
* filename) = 0;
54
55
/*!
56
* \brief Closes the currently active file and completes the WAV
57
* header. Thread-safe.
58
*/
59
virtual
void
close() = 0;
60
61
/*!
62
* \brief Set the sample rate. This will not affect the WAV file
63
* currently opened. Any following open() calls will use this new
64
* sample rate.
65
*/
66
virtual
void
set_sample_rate(
unsigned
int
sample_rate) = 0;
67
68
/*!
69
* \brief Set bits per sample. This will not affect the WAV file
70
* currently opened (see set_sample_rate()). If the value is
71
* neither 8 nor 16, the call is ignored and the current value
72
* is kept.
73
*/
74
virtual
void
set_bits_per_sample(
int
bits_per_sample) = 0;
75
76
/*!
77
* \brief Enable appending to an existing file instead of
78
* creating it. This will not affect the WAV file currently
79
* opened (see set_sample_rate()).
80
*/
81
virtual
void
set_append(
bool
append) = 0;
82
};
83
84
}
/* namespace blocks */
85
}
/* namespace gr */
86
87
#endif
/* INCLUDED_GR_WAVFILE_SINK_H */
wavfile.h
api.h
gr::blocks::wavfile_format_t
wavfile_format_t
Definition:
wavfile.h:44
BLOCKS_API
#define BLOCKS_API
Definition:
gr-blocks/include/gnuradio/blocks/api.h:18
gr::blocks::wavfile_sink
Write stream to a Microsoft PCM (.wav) file.
Definition:
wavfile_sink.h:29
gr::sync_block
synchronous 1:1 input to output with history
Definition:
sync_block.h:25
gr::blocks::wavfile_sink::sptr
std::shared_ptr< wavfile_sink > sptr
Definition:
wavfile_sink.h:33
sync_block.h
gr::blocks::wavfile_subformat_t
wavfile_subformat_t
Definition:
wavfile.h:51
gr
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition:
basic_block.h:29
gr-blocks
include
gnuradio
blocks
wavfile_sink.h
Generated by
1.8.17