summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-22 21:54:20 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-22 21:54:20 +0100
commit4c5fd68b06ae45ef89c8d66297f09f0781c778b9 (patch)
tree893bbc5028434755e5d329d9f174221f38e14b22
parenta3b16b779ccac616fc32638f0642d797fddc13e3 (diff)
reset DSP plugins on seeks/restarts/trackchanges
-rw-r--r--deadbeef.h1
-rw-r--r--plugins/supereq/supereq.c8
-rw-r--r--streamer.c10
3 files changed, 18 insertions, 1 deletions
diff --git a/deadbeef.h b/deadbeef.h
index a977904e..f52a6326 100644
--- a/deadbeef.h
+++ b/deadbeef.h
@@ -552,6 +552,7 @@ typedef struct DB_dsp_s {
// stereo samples are stored in interleaved format
// stereo sample is counted as 1 sample
int (*process_int16) (int16_t *samples, int nsamples, int nch, int bps, int srate);
+ void (*reset) (void);
} DB_dsp_t;
// misc plugin
diff --git a/plugins/supereq/supereq.c b/plugins/supereq/supereq.c
index 2e1a1ae1..368bcda3 100644
--- a/plugins/supereq/supereq.c
+++ b/plugins/supereq/supereq.c
@@ -137,6 +137,13 @@ supereq_set_band (int band, float value) {
deadbeef->conf_set_float (key, value);
}
+void
+supereq_reset (void) {
+ deadbeef->mutex_lock (mutex);
+ equ_clearbuf(last_bps,last_srate);
+ deadbeef->mutex_unlock (mutex);
+}
+
static DB_supereq_dsp_t plugin = {
.dsp.plugin.api_vmajor = DB_API_VERSION_MAJOR,
.dsp.plugin.api_vminor = DB_API_VERSION_MINOR,
@@ -151,6 +158,7 @@ static DB_supereq_dsp_t plugin = {
.dsp.plugin.stop = supereq_plugin_stop,
// .dsp.plugin.configdialog = settings_dlg,
.dsp.process_int16 = supereq_process_int16,
+ .dsp.reset = supereq_reset,
.get_band = supereq_get_band,
.set_band = supereq_set_band,
};
diff --git a/streamer.c b/streamer.c
index 24386b70..777d7ee6 100644
--- a/streamer.c
+++ b/streamer.c
@@ -813,9 +813,12 @@ streamer_thread (void *ctx) {
}
if (fileinfo && playing_track && playing_track->_duration > 0) {
streamer_lock ();
+ streamer_reset (1);
+#if 0
streambuffer_fill = 0;
streambuffer_pos = 0;
src_remaining = 0;
+#endif
if (fileinfo->plugin->seek (fileinfo, pos) >= 0) {
playpos = fileinfo->readpos;
}
@@ -936,9 +939,14 @@ streamer_reset (int full) { // must be called when current song changes by exter
streambuffer_pos = 0;
streambuffer_fill = 0;
}
-// trace ("\033[0;31msrc_reset\033[37;0m\n");
src_remaining = 0;
src_reset (src);
+ // reset dsp
+ DB_dsp_t **dsp = deadbeef->plug_get_dsp_list ();
+ int srate = p_get_rate ();
+ for (int i = 0; dsp[i]; i++) {
+ dsp[i]->reset ();
+ }
src_unlock ();
}