LCOV - code coverage report
Current view: top level - IO/libsndfile - sndfile_traits.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 2 2 100.0 %
Date: 2021-02-18 20:07:22 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /**
       2             :  * \file OutSndFileFilter.h
       3             :  */
       4             : 
       5             : #ifndef ATK_IO_SNDFILETRAITS_H
       6             : #define ATK_IO_SNDFILETRAITS_H
       7             : 
       8             : #include <cstdint>
       9             : #include <sndfile.h>
      10             : 
      11             : namespace ATK
      12             : {
      13             :   /// Empty traits
      14             :   template<typename DataType>
      15             :   class SndfileTraits
      16             :   {
      17             :   };
      18             : 
      19             :   /// Traits for integer 16bits
      20             :   template<>
      21             :   class SndfileTraits<std::int16_t>
      22             :   {
      23             :   public:
      24             :     static int get_type()
      25             :     {
      26             :       return SF_FORMAT_PCM_16;
      27             :     }
      28             :   };
      29             :   
      30             :   /// Traits for integer 32bits
      31             :   template<>
      32             :   class SndfileTraits<std::int32_t>
      33             :   {
      34             :   public:
      35             :     static int get_type()
      36             :     {
      37             :       return SF_FORMAT_PCM_32;
      38             :     }
      39             :   };
      40             :   
      41             :   /// Traits for float 32bits
      42             :   template<>
      43             :   class SndfileTraits<float>
      44             :   {
      45             :   public:
      46           2 :     static int get_type()
      47             :     {
      48           2 :       return SF_FORMAT_FLOAT;
      49             :     }
      50             :   };
      51             : 
      52             :   /// Traits for float 64bits
      53             :   template<>
      54             :   class SndfileTraits<double>
      55             :   {
      56             :   public:
      57             :     static int get_type()
      58             :     {
      59             :       return SF_FORMAT_DOUBLE;
      60             :     }
      61             :   };
      62             : }
      63             : 
      64             : #endif

Generated by: LCOV version TK-3.3.0-4-gdba42eea