SQUEEZELITE-1.1-2.10.20130605GITA0A1828

Changes...

Code:
--------------------
    
  * Wed Jun 05 2013 - 1.1-2.10.20130605gita0a1828
  - Updated squeezelite-flags.patch. 
  (flags, precision, passband_end, stopband_start, phase_response)
  
--------------------


Update...

Code:
--------------------
    
  sudo csos-cleanUpdate-testing squeezelite
  
--------------------


If the -u option is given without any args, defaults: precision = 20 bit
(HQ), passband_end = 0.913 (91.3%), stopband_start = 1 (100%), phase =
50 (ie. linear), which would be the equiv. of "-u hL" or "-u
:::20:91.3:100:50" on the command line.


Code:
--------------------
    
  -u 
[<quality>:<flags>:<attenuation>:<precision>:<passband_end>:<stopband_start>:<phase_response>]
 Upsample to max rate for device,
                        quality = (v|h|m|l|q)(|L|I|M)(|s),
                        flags = num in hex,
                        attenuation = attenuation in dB to apply (default is 
-1db if not explicitly set),
                        precision = number of bits precision (NB. HQ = 20. VHQ 
= 28),
                        passband_end = number in percent (0dB pt. bandwidth to 
preserve. nyquist = 100%),
                        stopband_start = number in percent (Aliasing/imaging 
control. > passband_end),
                        phase_response = 0-100 (0 = minimum / 50 = linear / 100 
= maximum)
  
--------------------


squeezelite-flags.patch

Code:
--------------------
    
  diff -u /home/clivem/development/git/squeezelite/main.c ./main.c
  --- /home/clivem/development/git/squeezelite/main.c   2013-06-05 
04:56:42.144063679 +0100
  +++ ./main.c  2013-06-05 13:31:18.860011186 +0100
  @@ -46,7 +46,14 @@
                   "  -p <priority>\t\tSet real time priority of output thread 
(1-99)\n"
  #endif
                   "  -r <rate>\t\tMax sample rate for output device, enables 
output device to be off when squeezelite is started\n"
  -                "  -u [<qual>:<atten>]\tUpsample to max rate for device, 
qual = (v|h|m|l|q)(|L|I|M)(|s), atten = (0|1|2|3|6) dB attenuation\n"
  +                "  -u 
[<quality>:<flags>:<attenuation>:<precision>:<passband_end>:<stopband_start>:<phase_response>]
 Upsample to max rate for device,\n"
  +                "  \t\t\tquality = (v|h|m|l|q)(|L|I|M)(|s),\n"
  +                "  \t\t\tflags = num in hex,\n"
  +                "  \t\t\tattenuation = attenuation in dB to apply (default 
is -1db if not explicitly set),\n"
  +                "  \t\t\tprecision = number of bits precision (NB. HQ = 20. 
VHQ = 28),\n"
  +                "  \t\t\tpassband_end = number in percent (0dB pt. bandwidth 
to preserve. nyquist = 100%),\n"
  +                "  \t\t\tstopband_start = number in percent 
(Aliasing/imaging control. > passband_end),\n"
  +                "  \t\t\tphase_response = 0-100 (0 = minimum / 50 = linear / 
100 = maximum)\n"
  #if LINUX
                   "  -z \t\t\tDaemonize\n"
  #endif
  diff -u /home/clivem/development/git/squeezelite/process.c ./process.c
  --- /home/clivem/development/git/squeezelite/process.c        2013-06-05 
04:56:42.145063648 +0100
  +++ ./process.c       2013-06-05 13:02:49.708586481 +0100
  @@ -22,12 +22,18 @@
  
  #include "squeezelite.h"
  
  +#include <math.h>
  #include <soxr.h>
  
  struct soxr {
        soxr_t resampler;
        size_t old_clips;
  -     unsigned long recipe;
  +     unsigned long q_recipe;
  +     unsigned long q_flags;
  +     double q_precision;         /* Conversion precision (in bits).          
 20    */
  +     double q_phase_response;    /* 0=minimum, ... 50=linear, ... 
100=maximum 50    */
  +     double q_passband_end;      /* 0dB pt. bandwidth to preserve; nyquist=1 
 0.913 */
  +     double q_stopband_begin;    /* Aliasing/imaging control; > passband_end 
  1    */
        double scale;
        // soxr symbols to be dynamically loaded
        soxr_io_spec_t (* soxr_io_spec)(soxr_datatype_t itype, soxr_datatype_t 
otype);
  @@ -44,7 +50,7 @@
  extern log_level loglevel;
  
  extern struct buffer *outputbuf;
  -extern struct outputstate output;
  +//extern struct outputstate output;
  extern struct decodestate decode;
  struct processstate process;
  extern struct codec *codec;
  @@ -193,11 +199,24 @@
        if (process.active) {
  
                soxr_io_spec_t io_spec = r->soxr_io_spec(SOXR_INT32_I, 
SOXR_INT32_I);
  -             soxr_quality_spec_t q_spec = r->soxr_quality_spec(r->recipe, 0);
  +             io_spec.scale = r->scale;
  +
  +             soxr_quality_spec_t q_spec = r->soxr_quality_spec(r->q_recipe, 
r->q_flags);
  +             if (r->q_precision > 0) {
  +                     q_spec.precision = r->q_precision;
  +             }
  +             if (r->q_passband_end > 0) {
  +                     q_spec.passband_end = r->q_passband_end;
  +             }
  +             if (r->q_stopband_begin > 0) {
  +                     q_spec.stopband_begin = r->q_stopband_begin;
  +             }
  +             if (r->q_phase_response > -1) {
  +                     q_spec.phase_response = r->q_phase_response;
  +             }
  +
                soxr_error_t error;
  
  -             io_spec.scale = r->scale;
  -     
                r->resampler = r->soxr_create(raw_sample_rate, outrate, 2, 
&error, &io_spec, &q_spec, NULL);
                if (error) {
                        LOG_INFO("soxr_create error: %s", soxr_strerror(error));
  @@ -255,38 +274,72 @@
                return;
        }
  
  -     char *qual = NULL, *scale = NULL;
  +     char *qual = NULL, *flags = NULL;
  +     char *atten = NULL;
  +     char *precision = NULL, *passband_end = NULL, *stopband_begin = NULL, 
*phase_response = NULL;
  +
        if (opt) {
                qual  = next_param(opt, ':');
  -             scale = next_param(NULL, ':');
  +             flags = next_param(NULL, ':');
  +             atten = next_param(NULL, ':');
  +             precision = next_param(NULL, ':');
  +             passband_end = next_param(NULL, ':');
  +             stopband_begin = next_param(NULL, ':');
  +             phase_response = next_param(NULL, ':');
  +     }
  +
  +     // default to HQ (20 bit) if not user specified
  +     r->q_recipe = SOXR_HQ;
  +     r->q_flags = 0;
  +     // default to 1db of attenuation if not user specified
  +     r->scale = pow(10, -1.0 / 20);
  +     // override recipe derived values with user specified values
  +     r->q_precision = 0;
  +     r->q_passband_end = 0;
  +     r->q_stopband_begin = 0;
  +     r->q_phase_response = -1;
  +
  +     if (qual && qual[0] != '\0') {
  +             if (strchr(qual, 'v')) r->q_recipe |= SOXR_VHQ;
  +             if (strchr(qual, 'h')) r->q_recipe |= SOXR_HQ;
  +             if (strchr(qual, 'm')) r->q_recipe |= SOXR_MQ;
  +             if (strchr(qual, 'l')) r->q_recipe |= SOXR_LQ;
  +             if (strchr(qual, 'q')) r->q_recipe |= SOXR_QQ;
  +             if (strchr(qual, 'L')) r->q_recipe |= SOXR_LINEAR_PHASE;
  +             if (strchr(qual, 'I')) r->q_recipe |= SOXR_INTERMEDIATE_PHASE;
  +             if (strchr(qual, 'M')) r->q_recipe |= SOXR_MINIMUM_PHASE;
  +             if (strchr(qual, 's')) r->q_recipe |= SOXR_STEEP_FILTER;
  +     }
  +
  +     if (flags) {
  +             r->q_flags = strtoul(flags, 0, 16);
  +     }
  +
  +     if (atten) {
  +             double scale = pow(10, -atof(atten) / 20);
  +             if (scale > 0 && scale <= 1.0) {
  +                     r->scale = scale;
  +             }
  +     }
  +
  +     if (precision) {
  +             r->q_precision = atof(precision);
        }
  
  -     r->recipe = 0;
  -     r->scale = 0;
  +     if (passband_end) {
  +             r->q_passband_end = atof(passband_end) / 100;
  +     }
  
  -     if (qual && qual[0] != '\0') {
  -             if (strchr(qual, 'v')) r->recipe |= SOXR_VHQ;
  -             if (strchr(qual, 'h')) r->recipe |= SOXR_HQ;
  -             if (strchr(qual, 'm')) r->recipe |= SOXR_MQ;
  -             if (strchr(qual, 'l')) r->recipe |= SOXR_LQ;
  -             if (strchr(qual, 'q')) r->recipe |= SOXR_QQ;
  -             if (strchr(qual, 'L')) r->recipe |= SOXR_LINEAR_PHASE;
  -             if (strchr(qual, 'I')) r->recipe |= SOXR_INTERMEDIATE_PHASE;
  -             if (strchr(qual, 'M')) r->recipe |= SOXR_MINIMUM_PHASE;
  -             if (strchr(qual, 's')) r->recipe |= SOXR_STEEP_FILTER;
  -     } else {
  -             r->recipe = SOXR_VHQ | SOXR_MINIMUM_PHASE | SOXR_STEEP_FILTER;
  +     if (stopband_begin) {
  +             r->q_stopband_begin = atof(stopband_begin) / 100;
        }
  
  -     if (scale) {
  -             if (!strcmp(scale, "0")) r->scale = 0;
  -             if (!strcmp(scale, "1")) r->scale = 0.89;
  -             if (!strcmp(scale, "2")) r->scale = 0.79;
  -             if (!strcmp(scale, "3")) r->scale = 0.71;
  -             if (!strcmp(scale, "6")) r->scale = 0.50;
  +     if (phase_response) {
  +             r->q_phase_response = atof(phase_response);
        }
  
  -     LOG_INFO("resampling enabled recipe: %02x scale: %03.2f", r->recipe, 
r->scale);
  +     LOG_INFO("resampling enabled recipe: 0x%02x, flags: 0x%02x, scale: 
%03.2f, precision: %03.1f, passband_end: %03.5f, stopband_begin: %03.5f, 
phase_response: %03.1f",
  +                     r->q_recipe, r->q_flags, r->scale, r->q_precision, 
r->q_passband_end, r->q_stopband_begin, r->q_phase_response);
  
        LOCK_D;
        decode.direct = false;
  
--------------------


+-------------------------------------------------------------------+
|Filename: squeezelite-flags.patch                                  |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=14893|
+-------------------------------------------------------------------+

------------------------------------------------------------------------
JackOfAll's Profile: http://forums.slimdevices.com/member.php?userid=3069
View this thread: http://forums.slimdevices.com/showthread.php?t=98544

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to