[25a19c2] | 1 | |
---|
| 2 | |
---|
| 3 | #include "config.h" |
---|
| 4 | #include "aubio_priv.h" |
---|
| 5 | |
---|
| 6 | #ifdef HAVE_RUBBERBAND |
---|
| 7 | |
---|
| 8 | #include "rubberband/rubberband-c.h" |
---|
| 9 | |
---|
| 10 | // check rubberband is 1.8.1, warn if 1.3 |
---|
| 11 | #if !((RUBBERBAND_API_MAJOR_VERSION >= 2) && \ |
---|
| 12 | (RUBBERBAND_API_MINOR_VERSION >= 5)) |
---|
| 13 | #warning RubberBandOptionDetectorSoft not available, \ |
---|
| 14 | please upgrade rubberband to version 1.8.1 or higher |
---|
| 15 | #define RubberBandOptionDetectorSoft 0x00000000 |
---|
| 16 | #endif |
---|
| 17 | |
---|
| 18 | RubberBandOptions aubio_get_rubberband_opts(const char_t *mode) |
---|
| 19 | { |
---|
| 20 | RubberBandOptions rboptions = RubberBandOptionProcessRealTime; |
---|
| 21 | |
---|
| 22 | if ( strcmp(mode,"crispness:0") == 0 ) { |
---|
| 23 | rboptions |= RubberBandOptionTransientsSmooth; |
---|
| 24 | rboptions |= RubberBandOptionWindowLong; |
---|
| 25 | rboptions |= RubberBandOptionPhaseIndependent; |
---|
| 26 | } else if ( strcmp(mode, "crispness:1") == 0 ) { |
---|
| 27 | rboptions |= RubberBandOptionDetectorSoft; |
---|
| 28 | rboptions |= RubberBandOptionTransientsSmooth; |
---|
| 29 | rboptions |= RubberBandOptionWindowLong; |
---|
| 30 | rboptions |= RubberBandOptionPhaseIndependent; |
---|
| 31 | } else if ( strcmp(mode, "crispness:2") == 0 ) { |
---|
| 32 | rboptions |= RubberBandOptionTransientsSmooth; |
---|
| 33 | rboptions |= RubberBandOptionPhaseIndependent; |
---|
| 34 | } else if ( strcmp(mode, "crispness:3") == 0 ) { |
---|
| 35 | rboptions |= RubberBandOptionTransientsSmooth; |
---|
| 36 | } else if ( strcmp(mode, "crispness:4") == 0 ) { |
---|
| 37 | // same as "default" |
---|
| 38 | } else if ( strcmp(mode, "crispness:5") == 0 ) { |
---|
| 39 | rboptions |= RubberBandOptionTransientsCrisp; |
---|
| 40 | } else if ( strcmp(mode, "crispness:6") == 0 ) { |
---|
| 41 | rboptions |= RubberBandOptionTransientsCrisp; |
---|
| 42 | rboptions |= RubberBandOptionWindowShort; |
---|
| 43 | rboptions |= RubberBandOptionPhaseIndependent; |
---|
| 44 | } else if ( strcmp(mode, "default") == 0 ) { |
---|
| 45 | // nothing to do |
---|
| 46 | } else { |
---|
| 47 | // failed parsing option string |
---|
| 48 | return -1; |
---|
| 49 | } |
---|
| 50 | // other options to include |
---|
| 51 | //p->rboptions |= RubberBandOptionWindowStandard; |
---|
| 52 | //p->rboptions |= RubberBandOptionSmoothingOff; |
---|
| 53 | //p->rboptions |= RubberBandOptionFormantShifted; |
---|
| 54 | //p->rboptions |= RubberBandOptionPitchHighConsistency; |
---|
| 55 | return rboptions; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | #endif |
---|