Octave/sndfile.cc : Add Octave function sfversion which returns the libsndfile version that the module is linked against.

This commit is contained in:
Erik de Castro Lopo 2008-10-27 21:24:55 +11:00
parent f819b2b55c
commit 0586befa36
3 changed files with 32 additions and 5 deletions

View File

@ -19,6 +19,10 @@
* Octave/*
Reduce 3 C++ files to one, fix build for octave 3.0, fix build.
* Octave/sndfile.cc Octave/PKG_ADD
Add Octave function sfversion which returns the libsndfile version that the
module is linked against.
2008-10-26 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* programs/common.c

View File

@ -1,2 +1,3 @@
autoload ("sfread", "sndfile.oct");
autoload ("sfversion", "sndfile.oct");
autoload ("sfwrite", "sndfile.oct");

View File

@ -28,12 +28,35 @@ static int format_of_str (const std::string & fmt) ;
static void string_of_format (std::string & fmt, int format) ;
DEFUN_DLD (sfversion, args, nargout ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{version} =} sfversion ()\n\
@cindex Reading sound files\n\
Return a string containing the libsndfile version.\n\
@end deftypefn")
{ char buffer [256] ;
octave_value_list retval ;
/* Bail out if the input parameters are bad. */
if (args.length () != 0 || nargout > 1)
{ print_usage () ;
return retval ;
} ;
sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer)) ;
std::string version (buffer) ;
retval.append (version) ;
return retval ;
} /* sfversion */
DEFUN_DLD (sfread, args, nargout ,
"-*- texinfo -*-\n\
@deftypefn {Loadable Function} {@var{I},@var{srate},@var{format} =} sfread (@var{filename})\n\
@deftypefn {Loadable Function} {@var{data},@var{srate},@var{format} =} sfread (@var{filename})\n\
@cindex Reading sound files\n\
Read a sound file from disk using libsndfile.\n\
\n\
@seealso{wavread}\n\
@end deftypefn")
{ SNDFILE * file ;
@ -105,11 +128,10 @@ Read a sound file from disk using libsndfile.\n\
return retval ;
} /* sfread */
DEFUN_DLD (sfwrite, args, nargout , "\
-*- texinfo -*-\n\
DEFUN_DLD (sfwrite, args, nargout ,
"-*- texinfo -*-\n\
@deftypefn {Function File} sfwrite (@var{filename},@var{data},@var{srate},@var{format})\n\
Write a sound file to disk using libsndfile.\n\
\n\
@seealso{wavwrite}\n\
@end deftypefn\n\
")