summaryrefslogtreecommitdiff
path: root/plugins/ao
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-04 13:34:34 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-07-04 13:34:34 +0200
commit3ffe80c51c395ce1c19174f39d2089c8c7b7b473 (patch)
tree9389cbfbcb3870ee0493c31029df48a300d3d3a9 /plugins/ao
parenta4a93309971551cab185a7747ee26270046a6b8f (diff)
ao plugin: dsf seeking
Diffstat (limited to 'plugins/ao')
-rw-r--r--plugins/ao/eng_dsf/aica.c6
-rw-r--r--plugins/ao/eng_dsf/aica.h1
-rw-r--r--plugins/ao/eng_dsf/dc_hw.c4
-rw-r--r--plugins/ao/eng_dsf/dc_hw.h1
-rw-r--r--plugins/ao/eng_dsf/eng_dsf.c9
5 files changed, 21 insertions, 0 deletions
diff --git a/plugins/ao/eng_dsf/aica.c b/plugins/ao/eng_dsf/aica.c
index 1878f45b..09855a04 100644
--- a/plugins/ao/eng_dsf/aica.c
+++ b/plugins/ao/eng_dsf/aica.c
@@ -1227,6 +1227,12 @@ void *aica_start(const void *config)
void aica_stop(struct _AICA *AICA)
{
+ if (AICA->buffertmpl) {
+ free (AICA->buffertmpl);
+ }
+ if (AICA->buffertmpr) {
+ free (AICA->buffertmpr);
+ }
free(AICA);
}
diff --git a/plugins/ao/eng_dsf/aica.h b/plugins/ao/eng_dsf/aica.h
index 5a1b52ca..f441064f 100644
--- a/plugins/ao/eng_dsf/aica.h
+++ b/plugins/ao/eng_dsf/aica.h
@@ -46,6 +46,7 @@ WRITE16_HANDLER( AICA_MidiIn );
READ16_HANDLER( AICA_MidiOutR );
void *aica_start(const void *config);
+void aica_stop(struct _AICA *AICA);
void AICA_Update(struct _AICA *AICA, void *param, INT16 **inputs, INT16 **buf, int samples);
#endif
diff --git a/plugins/ao/eng_dsf/dc_hw.c b/plugins/ao/eng_dsf/dc_hw.c
index 6c810b37..769e128a 100644
--- a/plugins/ao/eng_dsf/dc_hw.c
+++ b/plugins/ao/eng_dsf/dc_hw.c
@@ -176,3 +176,7 @@ static struct AICAinterface aica_interface =
cpu->AICA = aica_start(&cpu->aica_interface);
}
+void dc_hw_free (struct sARM7 *cpu) {
+ aica_stop (cpu->AICA);
+ cpu->AICA = NULL;
+}
diff --git a/plugins/ao/eng_dsf/dc_hw.h b/plugins/ao/eng_dsf/dc_hw.h
index 3b467f25..33345efe 100644
--- a/plugins/ao/eng_dsf/dc_hw.h
+++ b/plugins/ao/eng_dsf/dc_hw.h
@@ -4,6 +4,7 @@
#include "arm7i.h"
void dc_hw_init(struct sARM7 *cpu);
+void dc_hw_free (struct sARM7 *cpu);
void dc_write8(struct sARM7 *cpu, int addr, uint8 data);
void dc_write16(struct sARM7 *cpu, int addr, uint16 data);
void dc_write32(struct sARM7 *cpu, int addr, uint32 data);
diff --git a/plugins/ao/eng_dsf/eng_dsf.c b/plugins/ao/eng_dsf/eng_dsf.c
index 18109ba0..b58b6ed4 100644
--- a/plugins/ao/eng_dsf/eng_dsf.c
+++ b/plugins/ao/eng_dsf/eng_dsf.c
@@ -35,6 +35,7 @@ typedef struct {
char psfby[256];
uint32 decaybegin, decayend, total_samples;
struct sARM7 *cpu;
+ uint8 init_dc_ram[8*1024*1024];
} dsf_synth_t;
void *dsf_start(const char *path, uint8 *buffer, uint32 length)
@@ -138,6 +139,8 @@ void *dsf_start(const char *path, uint8 *buffer, uint32 length)
}
#endif
+
+ memcpy (s->init_dc_ram, s->cpu->dc_ram, sizeof (s->init_dc_ram));
#if DK_CORE
ARM7_Init(s->cpu);
#else
@@ -236,9 +239,15 @@ int32 dsf_stop(void *handle)
int32 dsf_command(void *handle, int32 command, int32 parameter)
{
+ dsf_synth_t *s = handle;
switch (command)
{
case COMMAND_RESTART:
+ dc_hw_free (s->cpu);
+ memcpy (s->cpu->dc_ram, s->init_dc_ram, sizeof (s->init_dc_ram));
+ ARM7_Init(s->cpu);
+ dc_hw_init (s->cpu);
+ s->total_samples = 0;
return AO_SUCCESS;
}