LCOV - code coverage report
Current view: top level - src/media/audio/sound - audiofile.h (source / functions) Hit Total Coverage
Test: jami-coverage-filtered.info Lines: 3 4 75.0 %
Date: 2024-04-19 19:18:04 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /*
       2             :  *  Copyright (C) 2004-2024 Savoir-faire Linux Inc.
       3             :  *
       4             :  *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
       5             :  *
       6             :  *  Inspired by tonegenerator of
       7             :  *   Laurielle Lea <laurielle.lea@savoirfairelinux.com> (2004)
       8             :  *  Inspired by ringbuffer of Audacity Project
       9             :  *
      10             :  *  This program is free software; you can redistribute it and/or modify
      11             :  *  it under the terms of the GNU General Public License as published by
      12             :  *  the Free Software Foundation; either version 3 of the License, or
      13             :  *  (at your option) any later version.
      14             :  *
      15             :  *  This program is distributed in the hope that it will be useful,
      16             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      17             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      18             :  *  GNU General Public License for more details.
      19             :  *
      20             :  *  You should have received a copy of the GNU General Public License
      21             :  *  along with this program; if not, write to the Free Software
      22             :  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
      23             :  */
      24             : #pragma once
      25             : 
      26             : #include <stdexcept>
      27             : #include "audio/audioloop.h"
      28             : 
      29             : namespace jami {
      30             : 
      31             : class AudioFileException : public std::runtime_error
      32             : {
      33             : public:
      34          58 :     AudioFileException(const std::string& str)
      35          58 :         : std::runtime_error("AudioFile: AudioFileException occurred: " + str)
      36          58 :     {}
      37             : };
      38             : 
      39             : /**
      40             :  * @brief Abstract interface for file readers
      41             :  */
      42             : class AudioFile : public AudioLoop
      43             : {
      44             : public:
      45             :     AudioFile(const std::string& filepath, unsigned int sampleRate, AVSampleFormat sampleFormat);
      46             : 
      47           0 :     std::string getFilePath() const { return filepath_; }
      48             : 
      49             : protected:
      50             :     /** The absolute path to the sound file */
      51             :     std::string filepath_;
      52             : 
      53             : private:
      54             :     // override
      55             :     void onBufferFinish();
      56             :     unsigned updatePlaybackScale_;
      57             : };
      58             : 
      59             : } // namespace jami

Generated by: LCOV version 1.14