summaryrefslogtreecommitdiff
path: root/snd-mix.c
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@umlautQ.umlaeute.mur.at>2017-09-19 14:13:01 +0200
committerIOhannes m zmölnig <zmoelnig@umlautQ.umlaeute.mur.at>2017-09-19 14:13:01 +0200
commita34abe0c374d2a9ec1bb5b1825bc0f88eaa7166c (patch)
tree947aa68818ffb3a0c7123ef11567cb80aaaa7537 /snd-mix.c
parent75bedf4141806f1b12c07964ae633c6893a2efa6 (diff)
New upstream version 17.7
Diffstat (limited to 'snd-mix.c')
-rw-r--r--snd-mix.c63
1 files changed, 45 insertions, 18 deletions
diff --git a/snd-mix.c b/snd-mix.c
index 4955895..501052f 100644
--- a/snd-mix.c
+++ b/snd-mix.c
@@ -111,8 +111,26 @@ static bool mix_file_untagged(const char *filename, int in_chan, chan_info *cp,
if (kdur > size) kdur = size;
if (sf->runf == next_sample_value_unscaled)
{
+#if (!WITH_VECTORIZE)
for (j = 0; j < kdur; j++)
chandata[j] += (sf->loc > sf->last) ? next_sound(sf) : sf->data[sf->loc++];
+#else
+ for (j = 0; j < kdur; )
+ {
+ mus_long_t ksize;
+ ksize = sf->last - sf->loc + 1;
+ if (ksize == 1)
+ chandata[j++] = next_sound(sf);
+ else
+ {
+ if (j + ksize > kdur) ksize = kdur - j;
+ mus_copy_floats((mus_float_t *)(chandata + j), (mus_float_t *)(sf->data + sf->loc), ksize);
+ j += ksize;
+ if (j < kdur)
+ chandata[j++] = next_sound(sf);
+ }
+ }
+#endif
}
else
{
@@ -274,13 +292,13 @@ static const char *b2s(bool val)
static char *tagged_mix_to_string(const char *mixinfile, mus_long_t beg, int file_channel, bool delete_file)
{
#if HAVE_FORTH
- return(mus_format("\"%s\" %lld %d snd chn %s %s %s to -mix-%d", mixinfile, beg, file_channel, b2s(true), b2s(delete_file), S_mix, mix_infos_ctr));
+ return(mus_format("\"%s\" %" PRId64 " %d snd chn %s %s %s to -mix-%d", mixinfile, beg, file_channel, b2s(true), b2s(delete_file), S_mix, mix_infos_ctr));
#endif
#if HAVE_SCHEME
- return(mus_format("(varlet -env- '-mix-%d (%s \"%s\" %lld %d snd chn %s %s))", mix_infos_ctr, S_mix, mixinfile, beg, file_channel, b2s(true), b2s(delete_file)));
+ return(mus_format("(varlet -env- '-mix-%d (%s \"%s\" %" PRId64 " %d snd chn %s %s))", mix_infos_ctr, S_mix, mixinfile, beg, file_channel, b2s(true), b2s(delete_file)));
#endif
#if HAVE_RUBY
- return(mus_format("_mix_%d = %s(\"%s\", %lld, %d, snd, chn, %s, %s)", mix_infos_ctr, to_proc_name(S_mix), mixinfile, beg, file_channel, b2s(true), b2s(delete_file)));
+ return(mus_format("_mix_%d = %s(\"%s\", %" PRId64 ", %d, snd, chn, %s, %s)", mix_infos_ctr, to_proc_name(S_mix), mixinfile, beg, file_channel, b2s(true), b2s(delete_file)));
#endif
#if (!HAVE_EXTENSION_LANGUAGE)
return(NULL);
@@ -291,13 +309,13 @@ static char *tagged_mix_to_string(const char *mixinfile, mus_long_t beg, int fil
static char *untagged_mix_to_string(const char *mixinfile, mus_long_t beg, int file_channel, bool delete_file)
{
#if HAVE_FORTH
- return(mus_format("\"%s\" %lld %d snd chn %s %s %s", mixinfile, beg, file_channel, b2s(false), b2s(delete_file), S_mix));
+ return(mus_format("\"%s\" %" PRId64 " %d snd chn %s %s %s", mixinfile, beg, file_channel, b2s(false), b2s(delete_file), S_mix));
#endif
#if HAVE_SCHEME
- return(mus_format("(%s \"%s\" %lld %d snd chn %s %s)", S_mix, mixinfile, beg, file_channel, b2s(false), b2s(delete_file)));
+ return(mus_format("(%s \"%s\" %" PRId64 " %d snd chn %s %s)", S_mix, mixinfile, beg, file_channel, b2s(false), b2s(delete_file)));
#endif
#if HAVE_RUBY
- return(mus_format("%s(\"%s\", %lld, %d, snd, chn, %s, %s)", to_proc_name(S_mix), mixinfile, beg, file_channel, b2s(false), b2s(delete_file)));
+ return(mus_format("%s(\"%s\", %" PRId64 ", %d, snd, chn, %s, %s)", to_proc_name(S_mix), mixinfile, beg, file_channel, b2s(false), b2s(delete_file)));
#endif
#if (!HAVE_EXTENSION_LANGUAGE)
return(NULL);
@@ -1498,13 +1516,13 @@ bool mix_set_position_edit(int id, mus_long_t pos)
{
char *origin = NULL;
#if HAVE_FORTH
- origin = mus_format("-mix-%d %lld set-mix-position", id, pos);
+ origin = mus_format("-mix-%d %" PRId64 " set-mix-position", id, pos);
#endif
#if HAVE_SCHEME
- origin = mus_format("(set! (mix-position (car -mix-%d)) %lld)", id, pos);
+ origin = mus_format("(set! (mix-position (car -mix-%d)) %" PRId64 ")", id, pos);
#endif
#if HAVE_RUBY
- origin = mus_format("set_mix_position(_mix_%d, %lld)", id, pos);
+ origin = mus_format("set_mix_position(_mix_%d, %" PRId64 ")", id, pos);
#endif
edited = begin_mix_op(md->cp, old_ms->beg, old_ms->len, pos, old_ms->len, md->cp->edit_ctr, origin); /* this does not change beg or len */
@@ -2787,7 +2805,7 @@ Xen new_xen_mix(int n)
{
s7_pointer m;
m = Xen_make_object(xen_mix_tag, mx, 0, free_xen_mix);
- s7_object_set_let(m, g_mix_methods);
+ s7_c_object_set_let(m, g_mix_methods);
return(m);
}
#else
@@ -2824,7 +2842,12 @@ static void init_xen_mix(void)
#if HAVE_SCHEME
g_mix_methods = s7_openlet(s7, s7_inlet(s7, s7_list(s7, 2, s7_make_symbol(s7, "object->let"), mix_to_let_func)));
s7_gc_protect(s7, g_mix_methods);
- xen_mix_tag = s7_new_type_x(s7, "<mix>", print_xen_mix, free_xen_mix, s7_xen_mix_equalp, NULL, NULL, NULL, s7_xen_mix_length, s7_xen_mix_copy, NULL, NULL);
+ xen_mix_tag = s7_make_c_type(s7, "<mix>");
+ s7_c_type_set_print(s7, xen_mix_tag, print_xen_mix);
+ s7_c_type_set_free(s7, xen_mix_tag, free_xen_mix);
+ s7_c_type_set_equal(s7, xen_mix_tag, s7_xen_mix_equalp);
+ s7_c_type_set_length(s7, xen_mix_tag, s7_xen_mix_length);
+ s7_c_type_set_copy(s7, xen_mix_tag, s7_xen_mix_copy);
#else
#if HAVE_RUBY
xen_mix_tag = Xen_make_object_type("XenMix", sizeof(xen_mix));
@@ -3438,19 +3461,19 @@ mix data (a " S_vct ") into snd's channel chn starting at beg; return the new mi
name++;
else
name = S_mix_vct;
- new_origin = mus_format("%.*s %lld snd chn %s to -mix-%d",
+ new_origin = mus_format("%.*s %" PRId64 " snd chn %s to -mix-%d",
(int)(strlen(edname) - strlen(name) - 1), edname,
bg, name, mix_infos_ctr);
}
- else new_origin = mus_format("vct( 0 ) %lld snd chn %s to -mix-%d", bg, S_mix_vct, mix_infos_ctr);
+ else new_origin = mus_format("vct( 0 ) %" PRId64 " snd chn %s to -mix-%d", bg, S_mix_vct, mix_infos_ctr);
}
#endif
#if HAVE_SCHEME
- new_origin = mus_format("(varlet -env- '-mix-%d (%s %lld snd chn))", mix_infos_ctr, edname, bg);
+ new_origin = mus_format("(varlet -env- '-mix-%d (%s %" PRId64 " snd chn))", mix_infos_ctr, edname, bg);
#endif
#if HAVE_RUBY
/* mix_vct(vct(0.1, 0.2, 0.3), 100, snd, chn, true, "mix_vct(vct(0.1, 0.2, 0.3)") */
- new_origin = mus_format("_mix_%d = %s, %lld, snd, chn)", mix_infos_ctr, edname, bg);
+ new_origin = mus_format("_mix_%d = %s, %" PRId64 ", snd, chn)", mix_infos_ctr, edname, bg);
#endif
mix_id = mix_buffer_with_tag(cp, data, bg, len, new_origin);
@@ -3683,7 +3706,7 @@ static char *mix_sampler_to_string(mix_fd *fd)
{
mix_info *md;
md = fd->md;
- snprintf(desc, PRINT_BUFFER_SIZE, "#<mix-sampler mix %d, (from %lld, at %lld%s): %s>",
+ snprintf(desc, PRINT_BUFFER_SIZE, "#<mix-sampler mix %d, (from %" PRId64 ", at %" PRId64 "%s): %s>",
md->id,
fd->sf->initial_samp,
fd->sf->loc,
@@ -3750,7 +3773,7 @@ Xen g_make_mix_sampler(Xen mix_id, Xen ubeg)
{
s7_pointer m;
m = Xen_make_object(mf_tag, mf, 0, free_mf);
- s7_object_set_let(m, g_mix_sampler_methods);
+ s7_c_object_set_let(m, g_mix_sampler_methods);
return(m);
}
#else
@@ -4215,7 +4238,11 @@ void g_init_mix(void)
#if HAVE_SCHEME
g_mix_sampler_methods = s7_openlet(s7, s7_inlet(s7, s7_list(s7, 2, s7_make_symbol(s7, "object->let"), mix_sampler_to_let_func)));
s7_gc_protect(s7, g_mix_sampler_methods);
- mf_tag = s7_new_type_x(s7, "<mix-sampler>", print_mf, free_mf, s7_equalp_mf, NULL, s7_read_mix_sample, NULL, NULL, NULL, NULL, NULL);
+ mf_tag = s7_make_c_type(s7, "<mix-sampler>");
+ s7_c_type_set_print(s7, mf_tag, print_mf);
+ s7_c_type_set_free(s7, mf_tag, free_mf);
+ s7_c_type_set_equal(s7, mf_tag, s7_equalp_mf);
+ s7_c_type_set_apply(s7, mf_tag, s7_read_mix_sample);
#else
mf_tag = Xen_make_object_type("MixSampler", sizeof(mix_fd));
#endif