Amend f322c4ded7, clean up includes, fix visibility

This commit is contained in:
Robin Gareus 2022-01-28 02:14:54 +01:00
parent b7bbb27c7c
commit 2c9c80ae62
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 39 additions and 43 deletions

View File

@ -52,22 +52,16 @@
#ifndef SNDFILE_HH
#define SNDFILE_HH
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>
#include "pbd/gstdio_compat.h"
#include "audiographer/visibility.h"
#include <sndfile.h>
#include <string>
#include <new> // for std::nothrow
// Prevent conflicts
namespace AudioGrapher {
class SndfileHandle
class LIBAUDIOGRAPHER_API SndfileHandle
{ private :
struct SNDFILE_ref
{ SNDFILE_ref (void) ;

View File

@ -39,6 +39,15 @@
** license, but the LGPL still holds for the libsndfile library itself.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <glib.h>
#include "pbd/gstdio_compat.h"
#include <new> // for std::nothrow
#include "private/sndfile.hh"
namespace AudioGrapher {
@ -47,12 +56,10 @@ namespace AudioGrapher {
** Nothing but implementation below.
*/
inline
SndfileHandle::SNDFILE_ref::SNDFILE_ref (void)
: ref (1)
{}
inline
SndfileHandle::SNDFILE_ref::~SNDFILE_ref (void)
{ if (sf != NULL) { sf_close (sf) ; } }
@ -68,7 +75,6 @@ SndfileHandle::close (void)
}
inline
SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, int srate)
: p (NULL)
{
@ -103,7 +109,6 @@ SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, in
return ;
} /* SndfileHandle const char * constructor */
inline
SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int chans, int srate)
: p (NULL)
{
@ -138,7 +143,6 @@ SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int c
return ;
} /* SndfileHandle std::string constructor */
inline
SndfileHandle::SndfileHandle (int fd, bool close_desc, int mode, int fmt, int chans, int srate)
: p (NULL)
{
@ -163,21 +167,20 @@ SndfileHandle::SndfileHandle (int fd, bool close_desc, int mode, int fmt, int ch
return ;
} /* SndfileHandle fd constructor */
inline
SndfileHandle::~SndfileHandle (void)
{ if (p != NULL && --p->ref == 0)
delete p ;
} /* SndfileHandle destructor */
inline
SndfileHandle::SndfileHandle (const SndfileHandle &orig)
: p (orig.p)
{ if (p != NULL)
++p->ref ;
} /* SndfileHandle copy constructor */
inline SndfileHandle &
SndfileHandle &
SndfileHandle::operator = (const SndfileHandle &rhs)
{
if (&rhs == this)
@ -192,35 +195,35 @@ SndfileHandle::operator = (const SndfileHandle &rhs)
return *this ;
} /* SndfileHandle assignment operator */
inline int
int
SndfileHandle::error (void) const
{ return sf_error (p->sf) ; }
inline const char *
const char *
SndfileHandle::strError (void) const
{ return sf_strerror (p->sf) ; }
inline int
int
SndfileHandle::command (int cmd, void *data, int datasize)
{ return sf_command (p->sf, cmd, data, datasize) ; }
inline sf_count_t
sf_count_t
SndfileHandle::seek (sf_count_t frame_count, int whence)
{ return sf_seek (p->sf, frame_count, whence) ; }
inline void
void
SndfileHandle::writeSync (void)
{ sf_write_sync (p->sf) ; }
inline int
int
SndfileHandle::setString (int str_type, const char* str)
{ return sf_set_string (p->sf, str_type, str) ; }
inline const char*
const char*
SndfileHandle::getString (int str_type) const
{ return sf_get_string (p->sf, str_type) ; }
inline int
int
SndfileHandle::formatCheck(int fmt, int chans, int srate)
{
SF_INFO sfinfo ;
@ -237,82 +240,81 @@ SndfileHandle::formatCheck(int fmt, int chans, int srate)
/*---------------------------------------------------------------------*/
inline sf_count_t
sf_count_t
SndfileHandle::read (short *ptr, sf_count_t items)
{ return sf_read_short (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::read (int *ptr, sf_count_t items)
{ return sf_read_int (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::read (float *ptr, sf_count_t items)
{ return sf_read_float (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::read (double *ptr, sf_count_t items)
{ return sf_read_double (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::write (const short *ptr, sf_count_t items)
{ return sf_write_short (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::write (const int *ptr, sf_count_t items)
{ return sf_write_int (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::write (const float *ptr, sf_count_t items)
{ return sf_write_float (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::write (const double *ptr, sf_count_t items)
{ return sf_write_double (p->sf, ptr, items) ; }
inline sf_count_t
sf_count_t
SndfileHandle::readf (short *ptr, sf_count_t frame_count)
{ return sf_readf_short (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::readf (int *ptr, sf_count_t frame_count)
{ return sf_readf_int (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::readf (float *ptr, sf_count_t frame_count)
{ return sf_readf_float (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::readf (double *ptr, sf_count_t frame_count)
{ return sf_readf_double (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::writef (const short *ptr, sf_count_t frame_count)
{ return sf_writef_short (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::writef (const int *ptr, sf_count_t frame_count)
{ return sf_writef_int (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::writef (const float *ptr, sf_count_t frame_count)
{ return sf_writef_float (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::writef (const double *ptr, sf_count_t frame_count)
{ return sf_writef_double (p->sf, ptr, frame_count) ; }
inline sf_count_t
sf_count_t
SndfileHandle::readRaw (void *ptr, sf_count_t bytes)
{ return sf_read_raw (p->sf, ptr, bytes) ; }
inline sf_count_t
sf_count_t
SndfileHandle::writeRaw (const void *ptr, sf_count_t bytes)
{ return sf_write_raw (p->sf, ptr, bytes) ; }
#ifdef ENABLE_SNDFILE_WINDOWS_PROTOTYPES
inline
SndfileHandle::SndfileHandle (LPCWSTR wpath, int mode, int fmt, int chans, int srate)
: p (NULL)
{