GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
wavfile_source.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2008,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_SOURCE_H
12 #define INCLUDED_GR_WAVFILE_SOURCE_H
13 
14 #include <gnuradio/blocks/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace blocks {
19 
20 /*!
21  * \brief Read stream from a Microsoft PCM (.wav) file, output floats
22  * \ingroup audio_blk
23  *
24  * \details
25  * Unless otherwise called, values are within [-1;1].
26  * Check gr_make_wavfile_source() for extra info.
27  */
28 class BLOCKS_API wavfile_source : virtual public sync_block
29 {
30 public:
31  // gr::blocks::wavfile_source::sptr
32  typedef std::shared_ptr<wavfile_source> sptr;
33 
34  static sptr make(const char* filename, bool repeat = false);
35 
36  /*!
37  * \brief Read the sample rate as specified in the wav file header
38  */
39  virtual unsigned int sample_rate() const = 0;
40 
41  /*!
42  * \brief Return the number of bits per sample as specified in
43  * the wav file header. Only 8 or 16 bit are supported here.
44  */
45  virtual int bits_per_sample() const = 0;
46 
47  /*!
48  * \brief Return the number of channels in the wav file as
49  * specified in the wav file header. This is also the max number
50  * of outputs you can have.
51  */
52  virtual int channels() const = 0;
53 };
54 
55 } /* namespace blocks */
56 } /* namespace gr */
57 
58 #endif /* INCLUDED_GR_WAVFILE_SOURCE_H */
repeat each input repeat times
Definition: repeat.h:30
Read stream from a Microsoft PCM (.wav) file, output floats.
Definition: wavfile_source.h:29
static sptr make(const char *filename, bool repeat=false)
virtual int channels() const =0
Return the number of channels in the wav file as specified in the wav file header....
virtual unsigned int sample_rate() const =0
Read the sample rate as specified in the wav file header.
virtual int bits_per_sample() const =0
Return the number of bits per sample as specified in the wav file header. Only 8 or 16 bit are suppor...
std::shared_ptr< wavfile_source > sptr
Definition: wavfile_source.h:32
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define BLOCKS_API
Definition: gr-blocks/include/gnuradio/blocks/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29