mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-30 18:37:40 +01:00
Merged with trunk R1283.
NOTE: Compiles, but broken (crash on adding MIDI track). git-svn-id: svn://localhost/ardour2/branches/midi@1292 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
ef6b25432d
commit
532f6aad4a
271 changed files with 12893 additions and 7748 deletions
|
|
@ -40,6 +40,7 @@
|
|||
#include <pbd/error.h>
|
||||
#include <pbd/stacktrace.h>
|
||||
#include <pbd/xml++.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <ardour/utils.h>
|
||||
|
||||
#include "i18n.h"
|
||||
|
|
@ -47,6 +48,7 @@
|
|||
using namespace ARDOUR;
|
||||
using namespace std;
|
||||
using namespace PBD;
|
||||
using Glib::ustring;
|
||||
|
||||
void
|
||||
elapsed_time_to_str (char *buf, uint32_t seconds)
|
||||
|
|
@ -90,6 +92,24 @@ elapsed_time_to_str (char *buf, uint32_t seconds)
|
|||
}
|
||||
}
|
||||
|
||||
ustring
|
||||
legalize_for_path (ustring str)
|
||||
{
|
||||
ustring::size_type pos;
|
||||
ustring legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: ";
|
||||
ustring legal;
|
||||
|
||||
legal = str;
|
||||
pos = 0;
|
||||
|
||||
while ((pos = legal.find_first_not_of (legal_chars, pos)) != string::npos) {
|
||||
legal.replace (pos, 1, "_");
|
||||
pos += 1;
|
||||
}
|
||||
|
||||
return legal;
|
||||
}
|
||||
#if 0
|
||||
string
|
||||
legalize_for_path (string str)
|
||||
{
|
||||
|
|
@ -107,6 +127,7 @@ legalize_for_path (string str)
|
|||
|
||||
return legal;
|
||||
}
|
||||
#endif
|
||||
|
||||
ostream&
|
||||
operator<< (ostream& o, const BBT_Time& bbt)
|
||||
|
|
@ -180,7 +201,7 @@ tokenize_fullpath (string fullpath, string& path, string& name)
|
|||
}
|
||||
|
||||
int
|
||||
touch_file (string path)
|
||||
touch_file (ustring path)
|
||||
{
|
||||
int fd = open (path.c_str(), O_RDWR|O_CREAT, 0660);
|
||||
if (fd >= 0) {
|
||||
|
|
@ -190,22 +211,31 @@ touch_file (string path)
|
|||
return 1;
|
||||
}
|
||||
|
||||
string
|
||||
placement_as_string (Placement p)
|
||||
ustring
|
||||
region_name_from_path (ustring path, bool strip_channels)
|
||||
{
|
||||
switch (p) {
|
||||
case PreFader:
|
||||
return _("pre");
|
||||
default: /* to get g++ to realize we have all the cases covered */
|
||||
case PostFader:
|
||||
return _("post");
|
||||
}
|
||||
}
|
||||
path = PBD::basename_nosuffix (path);
|
||||
|
||||
string
|
||||
region_name_from_path (string path)
|
||||
if (strip_channels) {
|
||||
|
||||
/* remove any "?R", "?L" or "?[a-z]" channel identifier */
|
||||
|
||||
ustring::size_type len = path.length();
|
||||
|
||||
if (len > 3 && (path[len-2] == '%' || path[len-2] == '?' || path[len-2] == '.') &&
|
||||
(path[len-1] == 'R' || path[len-1] == 'L' || (islower (path[len-1])))) {
|
||||
|
||||
path = path.substr (0, path.length() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
bool
|
||||
path_is_paired (ustring path, ustring& pair_base)
|
||||
{
|
||||
string::size_type pos;
|
||||
ustring::size_type pos;
|
||||
|
||||
/* remove any leading path */
|
||||
|
||||
|
|
@ -219,21 +249,23 @@ region_name_from_path (string path)
|
|||
path = path.substr (0, pos);
|
||||
}
|
||||
|
||||
/* remove any "?R", "?L" or "?[a-z]" channel identifier */
|
||||
|
||||
string::size_type len = path.length();
|
||||
ustring::size_type len = path.length();
|
||||
|
||||
if (len > 3 && (path[len-2] == '%' || path[len-2] == '?') &&
|
||||
/* look for possible channel identifier: "?R", "%R", ".L" etc. */
|
||||
|
||||
if (len > 3 && (path[len-2] == '%' || path[len-2] == '?' || path[len-2] == '.') &&
|
||||
(path[len-1] == 'R' || path[len-1] == 'L' || (islower (path[len-1])))) {
|
||||
|
||||
path = path.substr (0, path.length() - 2);
|
||||
}
|
||||
pair_base = path.substr (0, len-2);
|
||||
return true;
|
||||
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
string
|
||||
path_expand (string path)
|
||||
return false;
|
||||
}
|
||||
|
||||
ustring
|
||||
path_expand (ustring path)
|
||||
{
|
||||
#ifdef HAVE_WORDEXP
|
||||
/* Handle tilde and environment variable expansion in session path */
|
||||
|
|
@ -371,25 +403,65 @@ slave_source_to_string (SlaveSource src)
|
|||
}
|
||||
}
|
||||
|
||||
/* I don't really like hard-coding these falloff rates here
|
||||
* Probably should use a map of some kind that could be configured
|
||||
* These rates are db/sec.
|
||||
*/
|
||||
|
||||
#define METER_FALLOFF_OFF 0.0f
|
||||
#define METER_FALLOFF_SLOWEST 6.6f // BBC standard
|
||||
#define METER_FALLOFF_SLOW 8.6f // BBC standard
|
||||
#define METER_FALLOFF_MEDIUM 20.0f
|
||||
#define METER_FALLOFF_FAST 32.0f
|
||||
#define METER_FALLOFF_FASTER 46.0f
|
||||
#define METER_FALLOFF_FASTEST 70.0f
|
||||
|
||||
float
|
||||
meter_falloff_to_float (MeterFalloff falloff)
|
||||
{
|
||||
switch (falloff) {
|
||||
case MeterFalloffOff:
|
||||
return 0.0f;
|
||||
return METER_FALLOFF_OFF;
|
||||
case MeterFalloffSlowest:
|
||||
return 1.0f;
|
||||
return METER_FALLOFF_SLOWEST;
|
||||
case MeterFalloffSlow:
|
||||
return 2.0f;
|
||||
return METER_FALLOFF_SLOW;
|
||||
case MeterFalloffMedium:
|
||||
return 3.0f;
|
||||
return METER_FALLOFF_MEDIUM;
|
||||
case MeterFalloffFast:
|
||||
return 4.0f;
|
||||
return METER_FALLOFF_FAST;
|
||||
case MeterFalloffFaster:
|
||||
return 5.0f;
|
||||
return METER_FALLOFF_FASTER;
|
||||
case MeterFalloffFastest:
|
||||
return METER_FALLOFF_FASTEST;
|
||||
default:
|
||||
return 6.0f;
|
||||
return METER_FALLOFF_FAST;
|
||||
}
|
||||
}
|
||||
|
||||
MeterFalloff
|
||||
meter_falloff_from_float (float val)
|
||||
{
|
||||
if (val == METER_FALLOFF_OFF) {
|
||||
return MeterFalloffOff;
|
||||
}
|
||||
else if (val <= METER_FALLOFF_SLOWEST) {
|
||||
return MeterFalloffSlowest;
|
||||
}
|
||||
else if (val <= METER_FALLOFF_SLOW) {
|
||||
return MeterFalloffSlow;
|
||||
}
|
||||
else if (val <= METER_FALLOFF_MEDIUM) {
|
||||
return MeterFalloffMedium;
|
||||
}
|
||||
else if (val <= METER_FALLOFF_FAST) {
|
||||
return MeterFalloffFast;
|
||||
}
|
||||
else if (val <= METER_FALLOFF_FASTER) {
|
||||
return MeterFalloffFaster;
|
||||
}
|
||||
else {
|
||||
return MeterFalloffFastest;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue