- Timestamp:
- Aug 9, 2005, 7:56:21 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- a29ad46
- Parents:
- 28d8c4a
- Location:
- ext
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ext/sndfileio.c
r28d8c4a r5e9c68a 30 30 #define MAX_SIZE 4096 31 31 32 struct _aubio_ file_t {32 struct _aubio_sndfile_t { 33 33 SNDFILE *handle; 34 34 int samplerate; … … 39 39 }; 40 40 41 aubio_ file_t * new_file_ro(const char* outputname) {42 aubio_ file_t * f = AUBIO_NEW(aubio_file_t);41 aubio_sndfile_t * new_aubio_sndfile_ro(const char* outputname) { 42 aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t); 43 43 SF_INFO sfinfo; 44 44 AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo)); … … 65 65 } 66 66 67 int file_open_wo(aubio_file_t * f, const char* inputname) {67 int aubio_sndfile_open_wo(aubio_sndfile_t * f, const char* inputname) { 68 68 SF_INFO sfinfo; 69 69 memset (&sfinfo, 0, sizeof (sfinfo)); … … 90 90 91 91 /* setup file struct from existing one */ 92 aubio_ file_t * new_file_wo(aubio_file_t * fmodel, const char *outputname) {93 aubio_ file_t * f = AUBIO_NEW(aubio_file_t);92 aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * fmodel, const char *outputname) { 93 aubio_sndfile_t * f = AUBIO_NEW(aubio_sndfile_t); 94 94 f->samplerate = fmodel->samplerate; 95 95 f->channels = fmodel->channels; 96 96 f->format = fmodel->format; 97 file_open_wo(f, outputname);97 aubio_sndfile_open_wo(f, outputname); 98 98 return f; 99 99 } … … 101 101 102 102 /* return 0 if properly closed, 1 otherwise */ 103 int del_ file(aubio_file_t * f) {103 int del_aubio_sndfile(aubio_sndfile_t * f) { 104 104 if (sf_close(f->handle)) { 105 105 AUBIO_ERR("Error closing file."); … … 122 122 /* read frames from file in data 123 123 * return the number of frames actually read */ 124 int file_read(aubio_file_t * f, int frames, fvec_t * read) {124 int aubio_sndfile_read(aubio_sndfile_t * f, int frames, fvec_t * read) { 125 125 sf_count_t read_frames; 126 126 int i,j, channels = f->channels; … … 131 131 /* allocate data for de/interleaving reallocated when needed. */ 132 132 if (nsamples >= f->size) { 133 AUBIO_ERR("Maximum file_read buffer size exceeded.");133 AUBIO_ERR("Maximum aubio_sndfile_read buffer size exceeded."); 134 134 return -1; 135 135 /* … … 158 158 * return the number of frames actually written 159 159 */ 160 int file_write(aubio_file_t * f, int frames, fvec_t * write) {160 int aubio_sndfile_write(aubio_sndfile_t * f, int frames, fvec_t * write) { 161 161 sf_count_t written_frames = 0; 162 162 int i, j, channels = f->channels; … … 166 166 /* allocate data for de/interleaving reallocated when needed. */ 167 167 if (nsamples >= f->size) { 168 AUBIO_ERR("Maximum file_write buffer size exceeded.");168 AUBIO_ERR("Maximum aubio_sndfile_write buffer size exceeded."); 169 169 return -1; 170 170 /* … … 192 192 */ 193 193 194 uint_t aubio_ file_channels(aubio_file_t * f) {194 uint_t aubio_sndfile_channels(aubio_sndfile_t * f) { 195 195 return f->channels; 196 196 } 197 197 198 uint_t aubio_ file_samplerate(aubio_file_t * f) {198 uint_t aubio_sndfile_samplerate(aubio_sndfile_t * f) { 199 199 return f->samplerate; 200 200 } 201 201 202 void file_info(aubio_file_t * f) {202 void aubio_sndfile_info(aubio_sndfile_t * f) { 203 203 AUBIO_DBG("srate : %d\n", f->samplerate); 204 204 AUBIO_DBG("channels : %d\n", f->channels); -
ext/sndfileio.h
r28d8c4a r5e9c68a 31 31 * sndfile object 32 32 */ 33 typedef struct _aubio_ file_t aubio_file_t;33 typedef struct _aubio_sndfile_t aubio_sndfile_t; 34 34 /** 35 35 * Open a sound file for reading 36 36 */ 37 aubio_ file_t * new_file_ro (const char * inputfile);37 aubio_sndfile_t * new_aubio_sndfile_ro (const char * inputfile); 38 38 /** 39 39 * Copy file model from previously opened sound file. 40 40 */ 41 aubio_ file_t * new_file_wo(aubio_file_t * existingfile, const char * outputname);41 aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * existingfile, const char * outputname); 42 42 /** 43 43 * Open a sound file for writing 44 44 */ 45 int file_open_wo (aubio_file_t * file, const char * outputname);45 int aubio_sndfile_open_wo (aubio_sndfile_t * file, const char * outputname); 46 46 /** 47 47 * Read frames data from file 48 48 */ 49 int file_read(aubio_file_t * file, int frames, fvec_t * read);49 int aubio_sndfile_read(aubio_sndfile_t * file, int frames, fvec_t * read); 50 50 /** 51 51 * Write data of length frames to file 52 52 */ 53 int file_write(aubio_file_t * file, int frames, fvec_t * write);53 int aubio_sndfile_write(aubio_sndfile_t * file, int frames, fvec_t * write); 54 54 /** 55 55 * Close file and delete file object 56 56 */ 57 int del_ file(aubio_file_t * file);57 int del_aubio_sndfile(aubio_sndfile_t * file); 58 58 /** 59 59 * Return some files facts 60 60 */ 61 void file_info(aubio_file_t * file);61 void aubio_sndfile_info(aubio_sndfile_t * file); 62 62 /** 63 63 * Return number of channel in file 64 64 */ 65 uint_t aubio_ file_channels(aubio_file_t * file);66 uint_t aubio_ file_samplerate(aubio_file_t * file);65 uint_t aubio_sndfile_channels(aubio_sndfile_t * file); 66 uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file); 67 67 68 68 #ifdef __cplusplus
Note: See TracChangeset
for help on using the changeset viewer.