Ring Daemon 16.0.0
Loading...
Searching...
No Matches
audiofile.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * Inspired by tonegenerator of
5 * Laurielle Lea <laurielle.lea@savoirfairelinux.com> (2004)
6 * Inspired by ringbuffer of Audacity Project
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21#pragma once
22
23#include <stdexcept>
24#include "audio/audioloop.h"
25
26namespace jami {
27
28class AudioFileException : public std::runtime_error
29{
30public:
31 AudioFileException(const std::string& str)
32 : std::runtime_error("AudioFile: AudioFileException occurred: " + str)
33 {}
34};
35
39class AudioFile : public AudioLoop
40{
41public:
42 AudioFile(const std::string& filepath, unsigned int sampleRate, AVSampleFormat sampleFormat);
43
44 std::string getFilePath() const { return filepath_; }
45
46protected:
48 std::string filepath_;
49
50private:
51 // override
52 void onBufferFinish();
53 unsigned updatePlaybackScale_;
54};
55
56} // namespace jami
Loop on a sound file.
AudioFileException(const std::string &str)
Definition audiofile.h:31
Abstract interface for file readers.
Definition audiofile.h:40
std::string filepath_
The absolute path to the sound file.
Definition audiofile.h:48
std::string getFilePath() const
Definition audiofile.h:44
void emitSignal(Args... args)
Definition ring_signal.h:64