mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-07 22:25:46 +01:00
add an explicit close function to sndfile
NB. if someday we want to switch back to upstream SndfileHandle, we need to subclass wrap it. (not sure what else is different, anyway)
This commit is contained in:
parent
9a30bfd0c6
commit
a5eb3bae87
1 changed files with 14 additions and 0 deletions
|
|
@ -87,6 +87,8 @@ class SndfileHandle
|
|||
SndfileHandle (const SndfileHandle &orig) ;
|
||||
SndfileHandle & operator = (const SndfileHandle &rhs) ;
|
||||
|
||||
void close (void) ;
|
||||
|
||||
/* Mainly for debugging/testing. */
|
||||
int refCount (void) const { return (p == NULL) ? 0 : p->ref ; }
|
||||
|
||||
|
|
@ -152,6 +154,18 @@ inline
|
|||
SndfileHandle::SNDFILE_ref::~SNDFILE_ref (void)
|
||||
{ if (sf != NULL) { sf_close (sf) ; } }
|
||||
|
||||
|
||||
void
|
||||
SndfileHandle::close (void)
|
||||
{
|
||||
if (p != NULL && --p->ref == 0)
|
||||
{
|
||||
delete p ;
|
||||
p = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, int srate)
|
||||
: p (NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue