ref: 28afc79c7604cac61eca7d621579d19e4fd27e1a
parent: c3b66186656de44da18b7058aec099dbe782dd0b
author: Erik de Castro Lopo <[email protected]>
date: Sun Apr 7 17:37:00 EDT 2013
Add public function sf_get_channels(). Suggested by Max Flax.
--- a/src/samplerate.c
+++ b/src/samplerate.c
@@ -1,5 +1,5 @@
/*
-** Copyright (C) 2002-2012 Erik de Castro Lopo <[email protected]>
+** Copyright (C) 2002-2013 Erik de Castro Lopo <[email protected]>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -288,6 +288,20 @@
return SRC_ERR_NO_ERROR ;
} /* src_set_ratio */
+
+int
+src_get_channels (SRC_STATE *state)
+{ SRC_PRIVATE *psrc ;
+
+ psrc = (SRC_PRIVATE*) state ;
+
+ if (psrc == NULL)
+ return SRC_ERR_BAD_STATE ;
+ if (psrc->vari_process == NULL || psrc->const_process == NULL)
+ return SRC_ERR_BAD_PROC_PTR ;
+
+ return psrc->channels ;
+} /* src_get_channels */
int
src_reset (SRC_STATE *state)
--- a/src/samplerate.h
+++ b/src/samplerate.h
@@ -132,6 +132,13 @@
int src_set_ratio (SRC_STATE *state, double new_ratio) ;
/*
+** Get the current channel count.
+** Returns negative on error, positive channel count otherwise
+*/
+
+int src_get_channels (SRC_STATE *state) ;
+
+/*
** Reset the internal SRC state.
** Does not modify the quality settings.
** Does not free any memory allocations.