annotate src/libsndfile-1.0.27/Octave/sndfile_load.m @ 168:ceec0dd9ec9c

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam <cannam@all-day-breakfast.com>
date Fri, 07 Feb 2020 11:51:13 +0000
parents cd6cdf86811e
children
rev   line source
cannam@125 1 ## Copyright (C) 2002-2011 Erik de Castro Lopo
cannam@125 2 ##
cannam@125 3 ## This program is free software; you can redistribute it and/or modify
cannam@125 4 ## it under the terms of the GNU General Public License as published by
cannam@125 5 ## the Free Software Foundation; either version 2, or (at your option)
cannam@125 6 ## any later version.
cannam@125 7 ##
cannam@125 8 ## This program is distributed in the hope that it will be useful, but
cannam@125 9 ## WITHOUT ANY WARRANTY; without even the implied warranty of
cannam@125 10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cannam@125 11 ## General Public License for more details.
cannam@125 12 ##
cannam@125 13 ## You should have received a copy of the GNU General Public License
cannam@125 14 ## along with this file. If not, write to the Free Software Foundation,
cannam@125 15 ## 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cannam@125 16
cannam@125 17 ## -*- texinfo -*-
cannam@125 18 ## @deftypefn {Function File} {} sndfile_load (@var{filename})
cannam@125 19 ## Load data from the file given by @var{filename}.
cannam@125 20 ## @end deftypefn
cannam@125 21
cannam@125 22 ## Author: Erik de Castro Lopo <erikd@mega-nerd.com>
cannam@125 23 ## Description: Load the sound data from the given file name
cannam@125 24
cannam@125 25 function [data fs] = sndfile_load (filename)
cannam@125 26
cannam@125 27 if (nargin != 1),
cannam@125 28 error ("Need an input filename") ;
cannam@125 29 endif
cannam@125 30
cannam@125 31 samplerate = -1 ;
cannam@125 32 samplingrate = -1 ;
cannam@125 33 wavedata = -1 ;
cannam@125 34
cannam@125 35
cannam@125 36 eval (sprintf ('load -f %s', filename)) ;
cannam@125 37
cannam@125 38 if (samplerate > 0),
cannam@125 39 fs = samplerate ;
cannam@125 40 elseif (samplingrate > 0),
cannam@125 41 fs = samplingrate ;
cannam@125 42 else
cannam@125 43 error ("Not able to find sample rate.") ;
cannam@125 44 endif
cannam@125 45
cannam@125 46 if (max (size (wavedata)) > 1),
cannam@125 47 data = wavedata ;
cannam@125 48 else
cannam@125 49 error ("Not able to find waveform data.") ;
cannam@125 50 endif
cannam@125 51
cannam@125 52 endfunction