Changeset 276032d for tests/src/io
- Timestamp:
- Dec 16, 2018, 7:19:58 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- 4ca4a4a
- Parents:
- dea8506
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/src/io/base-sink_custom.h
rdea8506 r276032d 64 64 int test_wrong_params(void) 65 65 { 66 fvec_t *vec; 67 fmat_t *mat; 66 68 aubio_sink_custom_t *s; 67 69 char_t sink_path[PATH_MAX] = "tmp_aubio_XXXXXX"; 68 70 uint_t samplerate = 44100; 71 uint_t hop_size = 256; 72 uint_t oversized_hop_size = 4097; 73 uint_t oversized_samplerate = 192000 * 8 + 1; 74 uint_t channels = 3; 75 uint_t oversized_channels = 1025; 69 76 // create temp file 70 77 int fd = create_temp_sink(sink_path); … … 78 85 s = new_aubio_sink_custom(sink_path, 0); 79 86 87 // check setting wrong parameters fails 88 if (!aubio_sink_custom_preset_samplerate(s, oversized_samplerate)) return 1; 89 if (!aubio_sink_custom_preset_channels(s, oversized_channels)) return 1; 90 if (!aubio_sink_custom_preset_channels(s, -1)) return 1; 91 92 // check setting valid parameters passes 80 93 if (aubio_sink_custom_preset_samplerate(s, samplerate)) return 1; 81 94 if (aubio_sink_custom_preset_channels(s, 1)) return 1; 95 96 // check writing a vector with valid length 97 vec = new_fvec(hop_size); 98 aubio_sink_custom_do(s, vec, hop_size); 99 // check writing more than in the input 100 aubio_sink_custom_do(s, vec, hop_size+1); 101 // check write 0 frames 102 aubio_sink_custom_do(s, vec, 0); 103 del_fvec(vec); 104 105 // check writing an oversized vector 106 vec = new_fvec(oversized_hop_size); 107 aubio_sink_custom_do(s, vec, oversized_hop_size); 108 del_fvec(vec); 82 109 83 110 // test delete without closing … … 86 113 s = new_aubio_sink_custom(sink_path, 0); 87 114 115 // preset channels first 116 if (aubio_sink_custom_preset_channels(s, channels)) return 1; 88 117 if (aubio_sink_custom_preset_samplerate(s, samplerate)) return 1; 89 if (aubio_sink_custom_preset_channels(s, 3)) return 1; 118 119 mat = new_fmat(channels, hop_size); 120 // check writing a vector with valid length 121 aubio_sink_custom_do_multi(s, mat, hop_size); 122 // check writing more than in the input 123 aubio_sink_custom_do_multi(s, mat, hop_size+1); 124 del_fmat(mat); 125 126 // check writing oversized input 127 mat = new_fmat(channels, oversized_hop_size); 128 aubio_sink_custom_do_multi(s, mat, oversized_hop_size); 129 del_fmat(mat); 130 131 // check writing undersized input 132 mat = new_fmat(channels - 1, hop_size); 133 aubio_sink_custom_do_multi(s, mat, hop_size); 134 del_fmat(mat); 90 135 91 136 aubio_sink_custom_close(s);
Note: See TracChangeset
for help on using the changeset viewer.