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