mirror of
https://gitee.com/openharmony/third_party_libsnd
synced 2024-11-23 09:59:54 +00:00
tests/utils.tpl : Add function write_mono_file.
This commit is contained in:
parent
2883d6b4cc
commit
3eb08a6b70
@ -1,3 +1,8 @@
|
||||
2007-06-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* tests/util.tpl
|
||||
Add function write_mono_file.
|
||||
|
||||
2007-06-07 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* doc/FAQ.html
|
||||
|
@ -55,6 +55,8 @@ void print_test_name (const char *test, const char *filename) ;
|
||||
|
||||
void dump_data_to_file (const char *filename, void *data, unsigned int datalen) ;
|
||||
|
||||
void write_mono_file (const char * filename, int srate, float * output, int len) ;
|
||||
|
||||
static inline void
|
||||
exit_if_true (int test, const char *format, ...)
|
||||
{ if (test)
|
||||
@ -691,5 +693,26 @@ check_open_file_count_or_die (int lineno)
|
||||
#endif
|
||||
} /* check_open_file_count_or_die */
|
||||
|
||||
void
|
||||
write_mono_file (const char * filename, int srate, float * output, int len)
|
||||
{ SNDFILE * file ;
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
memset (&sfinfo, 0, sizeof (sfinfo)) ;
|
||||
|
||||
sfinfo.samplerate = srate ;
|
||||
sfinfo.channels = 1 ;
|
||||
sfinfo.format = SF_FORMAT_FLAC | SF_FORMAT_PCM_16 ;
|
||||
|
||||
if ((file = sf_open (filename, SFM_WRITE, &sfinfo)) == NULL)
|
||||
{ printf ("sf_open (%s) : %s\n", filename, sf_strerror (NULL)) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
sf_write_float (file, output, len) ;
|
||||
|
||||
sf_close (file) ;
|
||||
} /* write_mono_file */
|
||||
|
||||
[+ ESAC +]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user