summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Chappell <jesse@essej.net>2006-08-01 22:11:04 +0000
committerJesse Chappell <jesse@essej.net>2006-08-01 22:11:04 +0000
commite0eac487a562aa93631a27f34cc0df1a1edfe048 (patch)
treea6943e34160b6a3852d2ca795dd0beef7b004258
parent0851f88d9d17f9e23c4c87e61c179f0b05a87b44 (diff)
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
-rw-r--r--libs/ardour/audioregion.cc4
-rw-r--r--libs/ardour/automation_event.cc2
-rw-r--r--libs/ardour/crossfade.cc4
-rw-r--r--libs/ardour/mix.cc6
-rw-r--r--libs/ardour/panner.cc14
5 files changed, 16 insertions, 14 deletions
diff --git a/libs/ardour/audioregion.cc b/libs/ardour/audioregion.cc
index fff1c99598..51c7612137 100644
--- a/libs/ardour/audioregion.cc
+++ b/libs/ardour/audioregion.cc
@@ -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;
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index 3df7dd94f7..63492b375b 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -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);
diff --git a/libs/ardour/crossfade.cc b/libs/ardour/crossfade.cc
index bbe0c63b0a..dc4c074844 100644
--- a/libs/ardour/crossfade.cc
+++ b/libs/ardour/crossfade.cc
@@ -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);
}
diff --git a/libs/ardour/mix.cc b/libs/ardour/mix.cc
index ab0d1dde59..c6e234d87b 100644
--- a/libs/ardour/mix.cc
+++ b/libs/ardour/mix.cc
@@ -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
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 4984e13fa9..8336c4697c 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -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));
}