source:
tests/src/io/test-source_apple_audio_file.c
@
2fcb973
Last change on this file since 2fcb973 was 248da64, checked in by , 12 years ago | |
---|---|
|
|
File size: 1015 bytes |
Rev | Line | |
---|---|---|
[301b807] | 1 | #include <aubio.h> |
[248da64] | 2 | #include "utils_tests.h" |
[301b807] | 3 | |
[248da64] | 4 | int main (int argc, char **argv) |
5 | { | |
6 | uint_t err = 0; | |
7 | if (argc < 2) { | |
8 | err = 2; | |
9 | PRINT_ERR("not enough arguments\n"); | |
10 | PRINT_MSG("usage: %s <source_path> [samplerate]\n", argv[0]); | |
11 | return err; | |
12 | } | |
[301b807] | 13 | |
[248da64] | 14 | #if __APPLE__ |
[301b807] | 15 | uint_t samplerate = 32000; |
[248da64] | 16 | uint_t hop_size = 256; |
17 | uint_t n_frames = 0, read = 0; | |
18 | if ( argc == 3 ) samplerate = atoi(argv[2]); | |
19 | ||
20 | char_t *source_path = argv[1]; | |
21 | ||
[301b807] | 22 | fvec_t *vec = new_fvec(hop_size); |
[248da64] | 23 | aubio_source_apple_audio_t * s = new_aubio_source_apple_audio(source_path, samplerate, hop_size); |
24 | if (samplerate == 0 ) samplerate = aubio_source_apple_audio_get_samplerate(s); | |
[301b807] | 25 | |
[248da64] | 26 | if (!s) { err = 1; goto beach; } |
[301b807] | 27 | |
[248da64] | 28 | do { |
[301b807] | 29 | aubio_source_apple_audio_do(s, vec, &read); |
[248da64] | 30 | // fvec_print (vec); |
31 | n_frames += read; | |
32 | } while ( read == hop_size ); | |
[301b807] | 33 | |
[248da64] | 34 | beach: |
35 | del_aubio_source_apple_audio (s); | |
36 | del_fvec (vec); | |
[4722e63] | 37 | #else |
[248da64] | 38 | err = 3; |
39 | PRINT_ERR("aubio was not compiled with aubio_source_apple_audio\n"); | |
[4722e63] | 40 | #endif /* __APPLE__ */ |
[301b807] | 41 | return 0; |
42 | } |
Note: See TracBrowser
for help on using the repository browser.