Triode wrote:
> Clive - latest squeezelite should take simple options for resampling:
> -u vMs|1 should be your preferred option -v -M -s scale -1 dB
> -u will select the default recipe with no scaling
I have another patch (which I need to test) which allows setting all the
quality options directly. Sooner or later, (even if John doesn't ask for
it), someone will want to set precision, passband, stopband, phase
values directly, rather than using the recipe defines.
SQUEEZELITE-1.1-2.8.20130603GIT0091351
Changes...
Code:
--------------------
* Wed Jun 05 2013 - 1.1-2.9.20130605gita0a1828
- Add squeezelite-flags.patch
- Latest git revision a0a1828.
- Add initial parameter parsing for resampling.
--------------------
Update...
Code:
--------------------
sudo csos-cleanUpdate-testing squeezelite
--------------------
For Triode....
squeezelite-flags.patch
Code:
--------------------
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 06:44:45.306126694 +0100
@@ -21,13 +21,14 @@
// sample processing - currently resampling with libsoxr
#include "squeezelite.h"
-
+#include <math.h>
#include <soxr.h>
struct soxr {
soxr_t resampler;
size_t old_clips;
unsigned long recipe;
+ unsigned long flags;
double scale;
// soxr symbols to be dynamically loaded
soxr_io_spec_t (* soxr_io_spec)(soxr_datatype_t itype, soxr_datatype_t
otype);
@@ -193,7 +194,7 @@
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);
+ soxr_quality_spec_t q_spec = r->soxr_quality_spec(r->recipe,
r->flags);
soxr_error_t error;
io_spec.scale = r->scale;
@@ -255,14 +256,15 @@
return;
}
- char *qual = NULL, *scale = NULL;
+ char *qual = NULL, *atten = NULL;
if (opt) {
qual = next_param(opt, ':');
- scale = next_param(NULL, ':');
+ atten = next_param(NULL, ':');
}
- r->recipe = 0;
- r->scale = 0;
+ r->recipe = SOXR_HQ;
+ r->flags = 0;
+ r->scale = 1.0;
if (qual && qual[0] != '\0') {
if (strchr(qual, 'v')) r->recipe |= SOXR_VHQ;
@@ -274,19 +276,16 @@
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 (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 (atten) {
+ double scale = pow(10, -atof(atten) / 20);
+ if (scale > 0 && scale <= 1.0) {
+ r->scale = scale;
+ }
}
- LOG_INFO("resampling enabled recipe: %02x scale: %03.2f", r->recipe,
r->scale);
+ LOG_INFO("resampling enabled recipe: 0x%02x scale: %03.2f", r->recipe,
r->scale);
LOCK_D;
decode.direct = false;
--------------------
+-------------------------------------------------------------------+
|Filename: squeezelite-flags.patch |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=14892|
+-------------------------------------------------------------------+
------------------------------------------------------------------------
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