Fixed floating point resolution in saved state issue. Fixed OS X vector max routine to do the proper thing. Reduced the block size of temporary buffers during track export and normalization, which fixes some stack overflow problems on OS X.

git-svn-id: svn://localhost/ardour2/trunk@742 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Jesse Chappell 2006-08-01 22:11:04 +00:00
parent 0851f88d9d
commit e0eac487a5
5 changed files with 16 additions and 14 deletions

View file

@ -644,7 +644,7 @@ AudioRegion::state (bool full)
snprintf (buf, sizeof (buf), "0x%x", (int) _flags);
node.add_property ("flags", buf);
snprintf (buf, sizeof(buf), "%f", _scale_amplitude);
snprintf (buf, sizeof(buf), "%.12g", _scale_amplitude);
node.add_property ("scale-gain", buf);
for (uint32_t n=0; n < sources.size(); ++n) {
@ -1258,7 +1258,7 @@ AudioRegion::set_scale_amplitude (gain_t g)
void
AudioRegion::normalize_to (float target_dB)
{
const jack_nframes_t blocksize = 256 * 1048;
const jack_nframes_t blocksize = 64 * 1024;
Sample buf[blocksize];
char workbuf[blocksize * 4];
jack_nframes_t fpos;

View file

@ -1211,7 +1211,7 @@ AutomationList::store_state (XMLNode& node) const
snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*i)->when));
pointnode->add_property ("x", buf);
snprintf (buf, sizeof (buf), "%f", (*i)->value);
snprintf (buf, sizeof (buf), "%.12g", (*i)->value);
pointnode->add_property ("y", buf);
node.add_child_nocopy (*pointnode);

View file

@ -702,7 +702,7 @@ Crossfade::get_state ()
snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*ii)->when));
pnode->add_property ("x", buf);
snprintf (buf, sizeof (buf), "%f", (*ii)->value);
snprintf (buf, sizeof (buf), "%.12g", (*ii)->value);
pnode->add_property ("y", buf);
child->add_child_nocopy (*pnode);
}
@ -716,7 +716,7 @@ Crossfade::get_state ()
snprintf (buf, sizeof (buf), "%" PRIu32, (jack_nframes_t) floor ((*ii)->when));
pnode->add_property ("x", buf);
snprintf (buf, sizeof (buf), "%f", (*ii)->value);
snprintf (buf, sizeof (buf), "%.12g", (*ii)->value);
pnode->add_property ("y", buf);
child->add_child_nocopy (*pnode);
}

View file

@ -22,6 +22,7 @@
#include <ardour/types.h>
#include <ardour/utils.h>
#include <ardour/mix.h>
#include <stdint.h>
#if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS)
@ -119,8 +120,9 @@ mix_buffers_no_gain (ARDOUR::Sample *dst, ARDOUR::Sample *src, jack_nframes_t nf
float
veclib_compute_peak (ARDOUR::Sample *buf, jack_nframes_t nsamples, float current)
{
vDSP_maxv(buf, 1, &current, nsamples);
return current;
float tmpmax = 0.0f;
vDSP_maxmgv(buf, 1, &tmpmax, nsamples);
return f_max(current, tmpmax);
}
void

View file

@ -529,7 +529,7 @@ EqualPowerStereoPanner::state (bool full_state)
char buf[64];
LocaleGuard lg (X_("POSIX"));
snprintf (buf, sizeof (buf), "%f", x);
snprintf (buf, sizeof (buf), "%.12g", x);
root->add_property (X_("x"), buf);
root->add_property (X_("type"), EqualPowerStereoPanner::name);
if (full_state) {
@ -763,9 +763,9 @@ Multi2dPanner::state (bool full_state)
char buf[64];
LocaleGuard lg (X_("POSIX"));
snprintf (buf, sizeof (buf), "%f", x);
snprintf (buf, sizeof (buf), "%.12g", x);
root->add_property (X_("x"), buf);
snprintf (buf, sizeof (buf), "%f", y);
snprintf (buf, sizeof (buf), "%.12g", y);
root->add_property (X_("y"), buf);
root->add_property (X_("type"), Multi2dPanner::name);
@ -1207,9 +1207,9 @@ Panner::state (bool full)
for (vector<Panner::Output>::iterator o = outputs.begin(); o != outputs.end(); ++o) {
XMLNode* onode = new XMLNode (X_("Output"));
snprintf (buf, sizeof (buf), "%f", (*o).x);
snprintf (buf, sizeof (buf), "%.12g", (*o).x);
onode->add_property (X_("x"), buf);
snprintf (buf, sizeof (buf), "%f", (*o).y);
snprintf (buf, sizeof (buf), "%.12g", (*o).y);
onode->add_property (X_("y"), buf);
root->add_child_nocopy (*onode);
}
@ -1258,10 +1258,10 @@ Panner::set_state (const XMLNode& node)
float x, y;
prop = (*niter)->property (X_("x"));
sscanf (prop->value().c_str(), "%f", &x);
sscanf (prop->value().c_str(), "%.12g", &x);
prop = (*niter)->property (X_("y"));
sscanf (prop->value().c_str(), "%f", &y);
sscanf (prop->value().c_str(), "%.12g", &y);
outputs.push_back (Output (x, y));
}