summaryrefslogtreecommitdiff
path: root/libs/audiographer
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-03-02 23:11:04 +0100
committerRobin Gareus <robin@gareus.org>2015-03-02 23:11:04 +0100
commita5eb3bae87c53cdc66f05fca0dfa412833b12cc2 (patch)
treedfbb997f69aa968bf9c5e6f697e33dbb272a4ac7 /libs/audiographer
parent9a30bfd0c602ee08142374b2a409d28573530fc6 (diff)
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)
Diffstat (limited to 'libs/audiographer')
-rw-r--r--libs/audiographer/private/sndfile.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/audiographer/private/sndfile.hh b/libs/audiographer/private/sndfile.hh
index 1c4ef5ab58..02e8651f60 100644
--- a/libs/audiographer/private/sndfile.hh
+++ b/libs/audiographer/private/sndfile.hh
@@ -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)