mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-08 14:45:43 +01:00
remove a bunch of uses of long (mostly replaced by int32_t)
git-svn-id: svn://localhost/ardour2/branches/3.0@7472 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1c1b359ff2
commit
c11c01ef20
12 changed files with 50 additions and 50 deletions
|
|
@ -91,8 +91,8 @@ class Route : public SessionObject, public Automatable, public RouteGroupMember,
|
|||
|
||||
bool set_name (const std::string& str);
|
||||
|
||||
long order_key (std::string const &) const;
|
||||
void set_order_key (std::string const &, long);
|
||||
int32_t order_key (std::string const &) const;
|
||||
void set_order_key (std::string const &, int32_t);
|
||||
|
||||
bool is_hidden() const { return _flags & Hidden; }
|
||||
bool is_master() const { return _flags & MasterOut; }
|
||||
|
|
|
|||
|
|
@ -868,8 +868,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
|
|||
|
||||
static const int delta_accumulator_size = 25;
|
||||
int delta_accumulator_cnt;
|
||||
long delta_accumulator[delta_accumulator_size];
|
||||
long average_slave_delta;
|
||||
int32_t delta_accumulator[delta_accumulator_size];
|
||||
int32_t average_slave_delta;
|
||||
int average_dir;
|
||||
bool have_first_delta_accumulator;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ struct SessionEvent {
|
|||
|
||||
static const nframes_t Immediate = 0;
|
||||
|
||||
static void create_per_thread_pool (const std::string& n, unsigned long nitems);
|
||||
static void create_per_thread_pool (const std::string& n, uint32_t nitems);
|
||||
static void init_event_pool ();
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ Route::remote_control_id() const
|
|||
return _remote_control_id;
|
||||
}
|
||||
|
||||
long
|
||||
int32_t
|
||||
Route::order_key (std::string const & name) const
|
||||
{
|
||||
OrderKeys::const_iterator i = order_keys.find (name);
|
||||
|
|
@ -225,7 +225,7 @@ Route::order_key (std::string const & name) const
|
|||
}
|
||||
|
||||
void
|
||||
Route::set_order_key (std::string const & name, long n)
|
||||
Route::set_order_key (std::string const & name, int32_t n)
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ Route::sync_order_keys (std::string const & base)
|
|||
}
|
||||
|
||||
OrderKeys::iterator i;
|
||||
uint32_t key;
|
||||
int32_t key;
|
||||
|
||||
if ((i = order_keys.find (base)) == order_keys.end()) {
|
||||
/* key doesn't exist, use the first existing key (during session initialization) */
|
||||
|
|
@ -1890,7 +1890,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
|
|||
|
||||
if ((prop = node.property (X_("order-keys"))) != 0) {
|
||||
|
||||
long n;
|
||||
int32_t n;
|
||||
|
||||
string::size_type colon, equal;
|
||||
string remaining = prop->value();
|
||||
|
|
@ -1901,7 +1901,7 @@ Route::_set_state (const XMLNode& node, int version, bool /*call_base*/)
|
|||
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
|
||||
<< endmsg;
|
||||
} else {
|
||||
if (sscanf (remaining.substr (equal+1).c_str(), "%ld", &n) != 1) {
|
||||
if (sscanf (remaining.substr (equal+1).c_str(), "%d", &n) != 1) {
|
||||
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
|
||||
<< endmsg;
|
||||
} else {
|
||||
|
|
@ -2066,7 +2066,7 @@ Route::_set_state_2X (const XMLNode& node, int version)
|
|||
|
||||
if ((prop = node.property (X_("order-keys"))) != 0) {
|
||||
|
||||
long n;
|
||||
int32_t n;
|
||||
|
||||
string::size_type colon, equal;
|
||||
string remaining = prop->value();
|
||||
|
|
@ -2077,7 +2077,7 @@ Route::_set_state_2X (const XMLNode& node, int version)
|
|||
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
|
||||
<< endmsg;
|
||||
} else {
|
||||
if (sscanf (remaining.substr (equal+1).c_str(), "%ld", &n) != 1) {
|
||||
if (sscanf (remaining.substr (equal+1).c_str(), "%d", &n) != 1) {
|
||||
error << string_compose (_("badly formed order key string in state file! [%1] ... ignored."), remaining)
|
||||
<< endmsg;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1693,11 +1693,11 @@ Session::set_remote_control_ids ()
|
|||
|
||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||
if (MixerOrdered == m) {
|
||||
long order = (*i)->order_key(N_("signal"));
|
||||
int32_t order = (*i)->order_key(N_("signal"));
|
||||
(*i)->set_remote_control_id (order+1, false);
|
||||
emit_signal = true;
|
||||
} else if (EditorOrdered == m) {
|
||||
long order = (*i)->order_key(N_("editor"));
|
||||
int32_t order = (*i)->order_key(N_("editor"));
|
||||
(*i)->set_remote_control_id (order+1, false);
|
||||
emit_signal = true;
|
||||
} else if (UserOrdered == m) {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ SessionEvent::init_event_pool ()
|
|||
}
|
||||
|
||||
void
|
||||
SessionEvent::create_per_thread_pool (const std::string& name, unsigned long nitems)
|
||||
SessionEvent::create_per_thread_pool (const std::string& name, uint32_t nitems)
|
||||
{
|
||||
/* this is a per-thread call that simply creates a thread-private ptr to
|
||||
a CrossThreadPool for use by this thread whenever events are allocated/released
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ Session::send_midi_time_code_for_cycle(nframes_t nframes)
|
|||
assert (next_quarter_frame_to_send <= 7);
|
||||
|
||||
/* Duration of one quarter frame */
|
||||
nframes_t quarter_frame_duration = ((long) _frames_per_timecode_frame) >> 2;
|
||||
nframes_t quarter_frame_duration = ((nframes_t) _frames_per_timecode_frame) >> 2;
|
||||
|
||||
DEBUG_TRACE (DEBUG::MTC, string_compose ("TF %1 SF %2 NQ %3 FD %4\n", _transport_frame, outbound_mtc_timecode_frame,
|
||||
next_quarter_frame_to_send, quarter_frame_duration));
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ Session::process_with_events (nframes_t nframes)
|
|||
nframes_t end_frame;
|
||||
bool session_needs_butler = false;
|
||||
nframes_t stop_limit;
|
||||
long frames_moved;
|
||||
framecnt_t frames_moved;
|
||||
|
||||
/* make sure the auditioner is silent */
|
||||
|
||||
|
|
@ -282,11 +282,11 @@ Session::process_with_events (nframes_t nframes)
|
|||
}
|
||||
|
||||
if (_transport_speed == 1.0) {
|
||||
frames_moved = (long) nframes;
|
||||
frames_moved = (framecnt_t) nframes;
|
||||
} else {
|
||||
interpolation.set_target_speed (fabs(_target_transport_speed));
|
||||
interpolation.set_speed (fabs(_transport_speed));
|
||||
frames_moved = (long) interpolation.interpolate (0, nframes, 0, 0);
|
||||
frames_moved = (framecnt_t) interpolation.interpolate (0, nframes, 0, 0);
|
||||
}
|
||||
|
||||
end_frame = _transport_frame + (nframes_t)frames_moved;
|
||||
|
|
@ -342,12 +342,12 @@ Session::process_with_events (nframes_t nframes)
|
|||
while (nframes) {
|
||||
|
||||
this_nframes = nframes; /* real (jack) time relative */
|
||||
frames_moved = (long) floor (_transport_speed * nframes); /* transport relative */
|
||||
frames_moved = (framecnt_t) floor (_transport_speed * nframes); /* transport relative */
|
||||
|
||||
/* running an event, position transport precisely to its time */
|
||||
if (this_event && this_event->action_frame <= end_frame && this_event->action_frame >= _transport_frame) {
|
||||
/* this isn't quite right for reverse play */
|
||||
frames_moved = (long) (this_event->action_frame - _transport_frame);
|
||||
frames_moved = (framecnt_t) (this_event->action_frame - _transport_frame);
|
||||
this_nframes = (nframes_t) abs( floor(frames_moved / _transport_speed) );
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +570,7 @@ Session::calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta)
|
|||
}
|
||||
|
||||
if (delta_accumulator_cnt != 0 || this_delta < _current_frame_rate) {
|
||||
delta_accumulator[delta_accumulator_cnt++] = long(dir) * long(this_delta);
|
||||
delta_accumulator[delta_accumulator_cnt++] = (nframes_t) dir * (nframes_t) this_delta;
|
||||
}
|
||||
|
||||
if (have_first_delta_accumulator) {
|
||||
|
|
@ -578,7 +578,7 @@ Session::calculate_moving_average_of_slave_delta(int dir, nframes_t this_delta)
|
|||
for (int i = 0; i < delta_accumulator_size; ++i) {
|
||||
average_slave_delta += delta_accumulator[i];
|
||||
}
|
||||
average_slave_delta /= long(delta_accumulator_size);
|
||||
average_slave_delta /= (int32_t) delta_accumulator_size;
|
||||
if (average_slave_delta < 0L) {
|
||||
average_dir = -1;
|
||||
average_slave_delta = abs(average_slave_delta);
|
||||
|
|
@ -667,7 +667,7 @@ Session::track_slave_state (float slave_speed, nframes_t slave_transport_frame,
|
|||
/* XXX what? */
|
||||
}
|
||||
|
||||
memset (delta_accumulator, 0, sizeof (long) * delta_accumulator_size);
|
||||
memset (delta_accumulator, 0, sizeof (int32_t) * delta_accumulator_size);
|
||||
average_slave_delta = 0L;
|
||||
this_delta = 0;
|
||||
}
|
||||
|
|
@ -744,7 +744,7 @@ Session::process_without_events (nframes_t nframes)
|
|||
{
|
||||
bool session_needs_butler = false;
|
||||
nframes_t stop_limit;
|
||||
long frames_moved;
|
||||
framecnt_t frames_moved;
|
||||
|
||||
if (!process_can_proceed()) {
|
||||
_silent = true;
|
||||
|
|
@ -788,11 +788,11 @@ Session::process_without_events (nframes_t nframes)
|
|||
click (_transport_frame, nframes);
|
||||
|
||||
if (_transport_speed == 1.0) {
|
||||
frames_moved = (long) nframes;
|
||||
frames_moved = (framecnt_t) nframes;
|
||||
} else {
|
||||
interpolation.set_target_speed (fabs(_target_transport_speed));
|
||||
interpolation.set_speed (fabs(_transport_speed));
|
||||
frames_moved = (long) interpolation.interpolate (0, nframes, 0, 0);
|
||||
frames_moved = (framecnt_t) interpolation.interpolate (0, nframes, 0, 0);
|
||||
}
|
||||
|
||||
if (process_routes (nframes, session_needs_butler)) {
|
||||
|
|
|
|||
|
|
@ -158,9 +158,9 @@ Session::sync_time_vars ()
|
|||
_current_frame_rate = (nframes_t) round (_base_frame_rate * (1.0 + (config.get_video_pullup()/100.0)));
|
||||
_frames_per_timecode_frame = (double) _current_frame_rate / (double) timecode_frames_per_second();
|
||||
if (timecode_drop_frames()) {
|
||||
_frames_per_hour = (long)(107892 * _frames_per_timecode_frame);
|
||||
_frames_per_hour = (int32_t)(107892 * _frames_per_timecode_frame);
|
||||
} else {
|
||||
_frames_per_hour = (long)(3600 * rint(timecode_frames_per_second()) * _frames_per_timecode_frame);
|
||||
_frames_per_hour = (int32_t)(3600 * rint(timecode_frames_per_second()) * _frames_per_timecode_frame);
|
||||
}
|
||||
_timecode_frames_per_hour = (nframes_t)rint(timecode_frames_per_second() * 3600.0);
|
||||
|
||||
|
|
@ -252,9 +252,9 @@ Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool u
|
|||
nframes_t base_samples = (nframes_t) (((timecode.hours * 107892) + ((timecode.minutes / 10) * 17982)) * _frames_per_timecode_frame);
|
||||
|
||||
// Samples inside time exceeding the nearest 10 minutes (always offset, see above)
|
||||
long exceeding_df_minutes = timecode.minutes % 10;
|
||||
long exceeding_df_seconds = (exceeding_df_minutes * 60) + timecode.seconds;
|
||||
long exceeding_df_frames = (30 * exceeding_df_seconds) + timecode.frames - (2 * exceeding_df_minutes);
|
||||
int32_t exceeding_df_minutes = timecode.minutes % 10;
|
||||
int32_t exceeding_df_seconds = (exceeding_df_minutes * 60) + timecode.seconds;
|
||||
int32_t exceeding_df_frames = (30 * exceeding_df_seconds) + timecode.frames - (2 * exceeding_df_minutes);
|
||||
nframes_t exceeding_samples = (nframes_t) rint(exceeding_df_frames * _frames_per_timecode_frame);
|
||||
sample = base_samples + exceeding_samples;
|
||||
} else {
|
||||
|
|
@ -269,7 +269,7 @@ Session::timecode_to_sample( Timecode::Time& timecode, nframes_t& sample, bool u
|
|||
}
|
||||
|
||||
if (use_subframes) {
|
||||
sample += (long) (((double)timecode.subframes * _frames_per_timecode_frame) / config.get_subframes_per_frame());
|
||||
sample += (int32_t) (((double)timecode.subframes * _frames_per_timecode_frame) / config.get_subframes_per_frame());
|
||||
}
|
||||
|
||||
if (use_offset) {
|
||||
|
|
@ -321,7 +321,7 @@ Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool us
|
|||
|
||||
double timecode_frames_left_exact;
|
||||
double timecode_frames_fraction;
|
||||
unsigned long timecode_frames_left;
|
||||
uint32_t timecode_frames_left;
|
||||
|
||||
// Extract whole hours. Do this to prevent rounding errors with
|
||||
// high sample numbers in the calculations that follow.
|
||||
|
|
@ -331,7 +331,7 @@ Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool us
|
|||
// Calculate exact number of (exceeding) timecode frames and fractional frames
|
||||
timecode_frames_left_exact = (double) offset_sample / _frames_per_timecode_frame;
|
||||
timecode_frames_fraction = timecode_frames_left_exact - floor( timecode_frames_left_exact );
|
||||
timecode.subframes = (long) rint(timecode_frames_fraction * config.get_subframes_per_frame());
|
||||
timecode.subframes = (int32_t) rint(timecode_frames_fraction * config.get_subframes_per_frame());
|
||||
|
||||
// XXX Not sure if this is necessary anymore...
|
||||
if (timecode.subframes == config.get_subframes_per_frame()) {
|
||||
|
|
@ -341,20 +341,20 @@ Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool us
|
|||
}
|
||||
|
||||
// Extract hour-exceeding frames for minute, second and frame calculations
|
||||
timecode_frames_left = ((long) floor( timecode_frames_left_exact ));
|
||||
timecode_frames_left = (uint32_t) floor (timecode_frames_left_exact);
|
||||
|
||||
if (timecode_drop_frames()) {
|
||||
// See long explanation in timecode_to_sample()...
|
||||
// See int32_t explanation in timecode_to_sample()...
|
||||
|
||||
// Number of 10 minute chunks
|
||||
timecode.minutes = (timecode_frames_left / 17982) * 10; // exactly 17982 frames in 10 minutes
|
||||
// frames exceeding the nearest 10 minute barrier
|
||||
long exceeding_df_frames = timecode_frames_left % 17982;
|
||||
int32_t exceeding_df_frames = timecode_frames_left % 17982;
|
||||
|
||||
// Find minutes exceeding the nearest 10 minute barrier
|
||||
if (exceeding_df_frames >= 1800) { // nothing to do if we are inside the first minute (0-1799)
|
||||
exceeding_df_frames -= 1800; // take away first minute (different number of frames than the others)
|
||||
long extra_minutes_minus_1 = exceeding_df_frames / 1798; // how many minutes after the first one
|
||||
int32_t extra_minutes_minus_1 = exceeding_df_frames / 1798; // how many minutes after the first one
|
||||
exceeding_df_frames -= extra_minutes_minus_1 * 1798; // take away the (extra) minutes just found
|
||||
timecode.minutes += extra_minutes_minus_1 + 1; // update with exceeding minutes
|
||||
}
|
||||
|
|
@ -379,10 +379,10 @@ Session::sample_to_timecode( nframes_t sample, Timecode::Time& timecode, bool us
|
|||
}
|
||||
} else {
|
||||
// Non drop is easy
|
||||
timecode.minutes = timecode_frames_left / ((long) rint (timecode_frames_per_second ()) * 60);
|
||||
timecode_frames_left = timecode_frames_left % ((long) rint (timecode_frames_per_second ()) * 60);
|
||||
timecode.seconds = timecode_frames_left / (long) rint(timecode_frames_per_second ());
|
||||
timecode.frames = timecode_frames_left % (long) rint(timecode_frames_per_second ());
|
||||
timecode.minutes = timecode_frames_left / ((int32_t) rint (timecode_frames_per_second ()) * 60);
|
||||
timecode_frames_left = timecode_frames_left % ((int32_t) rint (timecode_frames_per_second ()) * 60);
|
||||
timecode.seconds = timecode_frames_left / (int32_t) rint(timecode_frames_per_second ());
|
||||
timecode.frames = timecode_frames_left % (int32_t) rint(timecode_frames_per_second ());
|
||||
}
|
||||
|
||||
if (!use_subframes) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ x86_sse_find_peaks(const ARDOUR::Sample* buf, ARDOUR::nframes_t nframes, float *
|
|||
current_max = _mm_set1_ps(*max);
|
||||
|
||||
// Work input until "buf" reaches 16 byte alignment
|
||||
while ( ((unsigned long)buf) % 16 != 0 && nframes > 0) {
|
||||
while ( ((intptr_t)buf) % 16 != 0 && nframes > 0) {
|
||||
|
||||
// Load the next float into the work buffer
|
||||
work = _mm_set1_ps(*buf);
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ bump_name_once (const std::string& name, char delimiter)
|
|||
}
|
||||
|
||||
errno = 0;
|
||||
long int version = strtol (name.c_str()+delim+1, (char **)NULL, 10);
|
||||
int32_t version = strtol (name.c_str()+delim+1, (char **)NULL, 10);
|
||||
|
||||
if (isnumber == 0 || errno != 0) {
|
||||
// last_element is not a number, or is too large
|
||||
|
|
@ -106,7 +106,7 @@ bump_name_once (const std::string& name, char delimiter)
|
|||
} else {
|
||||
char buf[32];
|
||||
|
||||
snprintf (buf, sizeof(buf), "%ld", version+1);
|
||||
snprintf (buf, sizeof(buf), "%d", version+1);
|
||||
|
||||
newname = name.substr (0, delim+1);
|
||||
newname += buf;
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ VSTPlugin::get_state()
|
|||
/* fetch the current chunk */
|
||||
|
||||
guchar* data;
|
||||
long data_size;
|
||||
int32_t data_size;
|
||||
|
||||
if ((data_size = _plugin->dispatcher (_plugin, 23 /* effGetChunk */, 0, 0, &data, false)) == 0) {
|
||||
return *root;
|
||||
|
|
@ -179,7 +179,7 @@ VSTPlugin::get_state()
|
|||
|
||||
XMLNode* parameters = new XMLNode ("parameters");
|
||||
|
||||
for (long n = 0; n < _plugin->numParams; ++n) {
|
||||
for (int32_t n = 0; n < _plugin->numParams; ++n) {
|
||||
char index[64];
|
||||
char val[32];
|
||||
snprintf (index, sizeof (index), "param_%ld", n);
|
||||
|
|
@ -233,10 +233,10 @@ VSTPlugin::set_state(const XMLNode& node, int)
|
|||
XMLPropertyList::const_iterator i;
|
||||
|
||||
for (i = child->properties().begin(); i != child->properties().end(); ++i) {
|
||||
long param;
|
||||
int32_t param;
|
||||
float val;
|
||||
|
||||
sscanf ((*i)->name().c_str(), "param_%ld", ¶m);
|
||||
sscanf ((*i)->name().c_str(), "param_%d", ¶m);
|
||||
sscanf ((*i)->value().c_str(), "%f", &val);
|
||||
|
||||
_plugin->setParameter (_plugin, param, val);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue