mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
pulling trunk
git-svn-id: svn://localhost/ardour2/branches/undo@586 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
3038d8ce4a
commit
eb3f77df57
237 changed files with 68673 additions and 4051 deletions
|
|
@ -58,7 +58,6 @@ ladspa_plugin.cc
|
|||
location.cc
|
||||
mtc_slave.cc
|
||||
named_selection.cc
|
||||
osc.cc
|
||||
panner.cc
|
||||
pcm_utils.cc
|
||||
playlist.cc
|
||||
|
|
@ -97,6 +96,7 @@ mix.cc
|
|||
|
||||
arch_specific_objects = [ ]
|
||||
|
||||
osc_files = [ 'osc.cc' ]
|
||||
vst_files = [ 'vst_plugin.cc', 'session_vst.cc' ]
|
||||
coreaudio_files = [ 'coreaudio_source.cc' ]
|
||||
extra_sources = [ ]
|
||||
|
|
@ -104,6 +104,9 @@ extra_sources = [ ]
|
|||
if ardour['VST']:
|
||||
extra_sources += vst_files
|
||||
|
||||
if ardour['LIBLO']:
|
||||
extra_sources += osc_files
|
||||
|
||||
ardour.Append(CCFLAGS="-D_REENTRANT -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE")
|
||||
ardour.Append(CXXFLAGS="-DDATA_DIR=\\\""+final_prefix+"/share\\\"")
|
||||
ardour.Append(CXXFLAGS="-DMODULE_DIR=\\\""+final_prefix+"/lib\\\"")
|
||||
|
|
@ -172,13 +175,16 @@ if conf.CheckCHeader('sys/vfs.h'):
|
|||
if conf.CheckCHeader('/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h'):
|
||||
ardour.Append(LINKFLAGS="-framework CoreMIDI")
|
||||
|
||||
if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h'):
|
||||
if conf.CheckCHeader('/System/Library/Frameworks/AudioToolbox.framework/Headers/ExtendedAudioFile.h') and ardour['COREAUDIO'] == 1:
|
||||
ardour.Append(CXXFLAGS="-DHAVE_COREAUDIO")
|
||||
ardour.Append(LINKFLAGS="-framework AudioToolbox")
|
||||
#
|
||||
|
||||
|
||||
if env['CONFIG_ARCH'] == 'apple':
|
||||
# this next line avoids issues with circular dependencies between libardour and libardour_cp.
|
||||
# it is based on the (entirely reasonable) assumption that a system with CoreAudio is OS X
|
||||
#
|
||||
print 'APPLE CONFIG'
|
||||
ardour.Append(LINKFLAGS='-undefined suppress -flat_namespace')
|
||||
extra_sources += coreaudio_files
|
||||
|
||||
|
|
@ -188,15 +194,19 @@ ardour.Merge ([
|
|||
libraries['core'],
|
||||
libraries['xml'],
|
||||
libraries['sndfile'],
|
||||
libraries['raptor'],
|
||||
libraries['lrdf'],
|
||||
libraries['samplerate'],
|
||||
libraries['sigc2'],
|
||||
libraries['pbd3'],
|
||||
libraries['soundtouch'],
|
||||
libraries['midi++2'],
|
||||
libraries['lo'],
|
||||
libraries['glib2'],
|
||||
libraries['glibmm2']
|
||||
])
|
||||
|
||||
if ardour['LIBLO']:
|
||||
ardour.Merge ([ libraries['lo'] ])
|
||||
|
||||
ardour.VersionBuild(['version.cc', 'ardour/version.h'], 'SConscript')
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,11 @@
|
|||
#include <signal.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <pbd/failed_constructor.h>
|
||||
|
||||
#include <ardour/configuration.h>
|
||||
#include <ardour/types.h>
|
||||
|
||||
using namespace PBD;
|
||||
|
||||
namespace MIDI {
|
||||
class MachineControl;
|
||||
class Port;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@
|
|||
#include <string>
|
||||
|
||||
#include <sigc++/signal.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <jack/jack.h>
|
||||
#include <jack/transport.h>
|
||||
|
|
@ -59,7 +61,7 @@ class AudioEngine : public sigc::trackable
|
|||
int start ();
|
||||
bool running() const { return _running; }
|
||||
|
||||
PBD::NonBlockingLock& process_lock() { return _process_lock; }
|
||||
Glib::Mutex& process_lock() { return _process_lock; }
|
||||
|
||||
jack_nframes_t frame_rate();
|
||||
jack_nframes_t frames_per_cycle();
|
||||
|
|
@ -185,10 +187,10 @@ class AudioEngine : public sigc::trackable
|
|||
ARDOUR::Session *session;
|
||||
jack_client_t *_jack;
|
||||
std::string jack_client_name;
|
||||
PBD::NonBlockingLock port_lock;
|
||||
PBD::NonBlockingLock _process_lock;
|
||||
PBD::Lock session_remove_lock;
|
||||
pthread_cond_t session_removed;
|
||||
Glib::Mutex port_lock;
|
||||
Glib::Mutex _process_lock;
|
||||
Glib::Mutex session_remove_lock;
|
||||
Glib::Cond session_removed;
|
||||
bool session_remove_pending;
|
||||
bool _running;
|
||||
bool _has_run;
|
||||
|
|
@ -202,8 +204,6 @@ class AudioEngine : public sigc::trackable
|
|||
sigc::slot<int,jack_nframes_t> freewheel_action;
|
||||
bool reconnect_on_halt;
|
||||
int _usecs_per_cycle;
|
||||
jack_nframes_t last_meter_point;
|
||||
jack_nframes_t meter_interval;
|
||||
|
||||
typedef std::set<Port*> Ports;
|
||||
Ports ports;
|
||||
|
|
@ -237,10 +237,10 @@ class AudioEngine : public sigc::trackable
|
|||
|
||||
int connect_to_jack (std::string client_name);
|
||||
|
||||
static void* _meter_thread (void* arg);
|
||||
void* meter_thread ();
|
||||
pthread_t meter_thread_id;
|
||||
void maybe_start_metering_thread ();
|
||||
void meter_thread ();
|
||||
void start_metering_thread ();
|
||||
Glib::Thread* m_meter_thread;
|
||||
mutable gint m_meter_exit;
|
||||
};
|
||||
|
||||
}; /* namespace ARDOUR */
|
||||
|
|
|
|||
|
|
@ -22,10 +22,8 @@
|
|||
#define __ardour_auditioner_h__
|
||||
|
||||
#include <string>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <pbd/atomic.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/audio_track.h>
|
||||
|
|
@ -50,16 +48,16 @@ class Auditioner : public AudioTrack
|
|||
int play_audition (jack_nframes_t nframes);
|
||||
|
||||
void cancel_audition () {
|
||||
atomic_set (&_active, 0);
|
||||
g_atomic_int_set (&_active, 0);
|
||||
}
|
||||
|
||||
bool active() const { return atomic_read (&_active); }
|
||||
bool active() const { return g_atomic_int_get (&_active); }
|
||||
|
||||
private:
|
||||
AudioRegion *the_region;
|
||||
jack_nframes_t current_frame;
|
||||
atomic_t _active;
|
||||
PBD::Lock lock;
|
||||
mutable gint _active;
|
||||
Glib::Mutex lock;
|
||||
jack_nframes_t length;
|
||||
|
||||
void drop_ports ();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <cmath>
|
||||
|
||||
#include <sigc++/signal.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/undo.h>
|
||||
#include <pbd/xml++.h>
|
||||
#include <ardour/ardour.h>
|
||||
|
|
@ -144,7 +144,7 @@ class AutomationList : public StateManager
|
|||
std::pair<AutomationList::iterator,AutomationList::iterator> control_points_adjacent (double when);
|
||||
|
||||
template<class T> void apply_to_points (T& obj, void (T::*method)(const AutomationList&)) {
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
(obj.*method)(*this);
|
||||
}
|
||||
|
||||
|
|
@ -157,13 +157,13 @@ class AutomationList : public StateManager
|
|||
double get_max_xval() const { return max_xval; }
|
||||
|
||||
double eval (double where) {
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
return unlocked_eval (where);
|
||||
}
|
||||
|
||||
double rt_safe_eval (double where, bool& ok) {
|
||||
|
||||
TentativeLockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock, Glib::TRY_LOCK);
|
||||
|
||||
if ((ok = lm.locked())) {
|
||||
return unlocked_eval (where);
|
||||
|
|
@ -186,7 +186,7 @@ class AutomationList : public StateManager
|
|||
};
|
||||
|
||||
AutomationEventList events;
|
||||
mutable PBD::NonBlockingLock lock;
|
||||
mutable Glib::Mutex lock;
|
||||
bool _frozen;
|
||||
bool changed_when_thawed;
|
||||
bool _dirty;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
#include <sigc++/signal.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <ardour/stateful.h>
|
||||
|
||||
using std::vector;
|
||||
|
|
@ -67,7 +67,7 @@ class Connection : public Stateful, public sigc::trackable {
|
|||
Connection (const XMLNode&);
|
||||
|
||||
private:
|
||||
mutable PBD::Lock port_lock;
|
||||
mutable Glib::Mutex port_lock;
|
||||
vector<PortList> _ports;
|
||||
string _name;
|
||||
bool _sysdep;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/stateful.h>
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ struct ControlProtocolInfo {
|
|||
static ControlProtocolManager* _instance;
|
||||
|
||||
Session* _session;
|
||||
PBD::Lock protocols_lock;
|
||||
Glib::Mutex protocols_lock;
|
||||
std::list<ControlProtocol*> control_protocols;
|
||||
|
||||
void drop_session ();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class CoreAudioSource : public ExternalSource {
|
|||
|
||||
mutable float *tmpbuf;
|
||||
mutable jack_nframes_t tmpbufsize;
|
||||
mutable PBD::Lock _tmpbuf_lock;
|
||||
mutable Glib::Mutex _tmpbuf_lock;
|
||||
|
||||
void init (const string &str, bool build_peak);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,11 +23,10 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <sigc++/signal.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/undo.h>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#include <pthread.h>
|
||||
#include <ardour/automation_event.h>
|
||||
|
||||
namespace ARDOUR {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <pbd/fastlog.h>
|
||||
#include <pbd/ringbufferNPT.h>
|
||||
#include <pbd/atomic.h>
|
||||
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/configuration.h>
|
||||
|
|
@ -115,7 +115,7 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
}
|
||||
|
||||
void set_record_enabled (bool yn, void *src);
|
||||
bool record_enabled() const { return atomic_read (&_record_enabled); }
|
||||
bool record_enabled() const { return g_atomic_int_get (&_record_enabled); }
|
||||
void punch_in ();
|
||||
void punch_out ();
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
uint32_t _n_channels;
|
||||
id_t _id;
|
||||
|
||||
atomic_t _record_enabled;
|
||||
mutable gint _record_enabled;
|
||||
AudioPlaylist* _playlist;
|
||||
double _visible_speed;
|
||||
double _actual_speed;
|
||||
|
|
@ -365,7 +365,7 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
AlignStyle _persistent_alignment_style;
|
||||
bool first_input_change;
|
||||
|
||||
PBD::NonBlockingLock state_lock;
|
||||
Glib::Mutex state_lock;
|
||||
|
||||
jack_nframes_t scrub_start;
|
||||
jack_nframes_t scrub_buffer_size;
|
||||
|
|
@ -404,7 +404,7 @@ class DiskStream : public Stateful, public sigc::trackable
|
|||
};
|
||||
|
||||
vector<CaptureInfo*> capture_info;
|
||||
PBD::Lock capture_info_lock;
|
||||
Glib::Mutex capture_info_lock;
|
||||
|
||||
void init (Flag);
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,11 @@
|
|||
#include <sigc++/signal.h>
|
||||
#include <jack/jack.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/fastlog.h>
|
||||
#include <pbd/undo.h>
|
||||
#include <pbd/atomic.h>
|
||||
|
||||
#include <midi++/controllable.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
|
|
@ -205,7 +206,15 @@ class IO : public Stateful, public ARDOUR::StateManager
|
|||
}
|
||||
}
|
||||
|
||||
static sigc::signal<void> Meter;
|
||||
static void update_meters();
|
||||
|
||||
private:
|
||||
|
||||
static sigc::signal<void> Meter;
|
||||
static Glib::StaticMutex m_meter_signal_lock;
|
||||
sigc::connection m_meter_connection;
|
||||
|
||||
public:
|
||||
|
||||
/* automation */
|
||||
|
||||
|
|
@ -261,7 +270,7 @@ class IO : public Stateful, public ARDOUR::StateManager
|
|||
int ports_became_legal ();
|
||||
|
||||
private:
|
||||
mutable PBD::Lock io_lock;
|
||||
mutable Glib::Mutex io_lock;
|
||||
|
||||
protected:
|
||||
Session& _session;
|
||||
|
|
@ -269,7 +278,7 @@ class IO : public Stateful, public ARDOUR::StateManager
|
|||
gain_t _gain;
|
||||
gain_t _effective_gain;
|
||||
gain_t _desired_gain;
|
||||
PBD::NonBlockingLock declick_lock;
|
||||
Glib::Mutex declick_lock;
|
||||
vector<Port*> _outputs;
|
||||
vector<Port*> _inputs;
|
||||
vector<float> _peak_power;
|
||||
|
|
@ -322,7 +331,7 @@ class IO : public Stateful, public ARDOUR::StateManager
|
|||
jack_nframes_t last_automation_snapshot;
|
||||
static jack_nframes_t _automation_interval;
|
||||
|
||||
AutoState _gain_automation_state;
|
||||
AutoState _gain_automation_state;
|
||||
AutoStyle _gain_automation_style;
|
||||
|
||||
bool apply_gain_automation;
|
||||
|
|
@ -331,7 +340,7 @@ class IO : public Stateful, public ARDOUR::StateManager
|
|||
int save_automation (const string&);
|
||||
int load_automation (const string&);
|
||||
|
||||
PBD::NonBlockingLock automation_lock;
|
||||
Glib::Mutex automation_lock;
|
||||
|
||||
/* AudioTrack::deprecated_use_diskstream_connections() needs these */
|
||||
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@
|
|||
#include <map>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
#include <sigc++/signal.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/undo.h>
|
||||
|
||||
#include "ardour.h"
|
||||
|
|
@ -168,12 +168,12 @@ class Locations : public Stateful, public StateManager
|
|||
sigc::signal<void,Location*> removed;
|
||||
|
||||
template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
(obj.*method)(locations);
|
||||
}
|
||||
|
||||
template<class T1, class T2> void apply (T1& obj, void (T1::*method)(LocationList&, T2& arg), T2& arg) {
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
(obj.*method)(locations, arg);
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ class Locations : public Stateful, public StateManager
|
|||
|
||||
LocationList locations;
|
||||
Location *current_location;
|
||||
mutable PBD::Lock lock;
|
||||
mutable Glib::Mutex lock;
|
||||
|
||||
int set_current_unlocked (Location *);
|
||||
void location_changed (Location*);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#define __ardour_logcurve_h__
|
||||
|
||||
#include <pbd/fastlog.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class LogCurve {
|
|||
}
|
||||
void set_length (uint32_t len) { l = len; }
|
||||
|
||||
mutable PBD::NonBlockingLock lock;
|
||||
mutable Glib::Mutex lock;
|
||||
|
||||
protected:
|
||||
float a;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,9 @@
|
|||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <sigc++/signal.h>
|
||||
#include <pbd/atomic.h>
|
||||
#include <pbd/undo.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
|
|
@ -169,9 +170,9 @@ class Playlist : public Stateful, public StateManager {
|
|||
RegionList regions;
|
||||
string _name;
|
||||
Session& _session;
|
||||
atomic_t block_notifications;
|
||||
atomic_t ignore_state_changes;
|
||||
mutable PBD::NonBlockingLock region_lock;
|
||||
mutable gint block_notifications;
|
||||
mutable gint ignore_state_changes;
|
||||
mutable Glib::Mutex region_lock;
|
||||
RegionList pending_removals;
|
||||
RegionList pending_adds;
|
||||
RegionList pending_bounds;
|
||||
|
|
@ -197,8 +198,8 @@ class Playlist : public Stateful, public StateManager {
|
|||
void init (bool hide);
|
||||
|
||||
bool holding_state () const {
|
||||
return atomic_read (&block_notifications) != 0 ||
|
||||
atomic_read (&ignore_state_changes) != 0;
|
||||
return g_atomic_int_get (&block_notifications) != 0 ||
|
||||
g_atomic_int_get (&ignore_state_changes) != 0;
|
||||
}
|
||||
|
||||
/* prevent the compiler from ever generating these */
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@
|
|||
#include <map>
|
||||
#include <sigc++/signal.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/undo.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
|
|
@ -131,7 +132,7 @@ class Redirect : public IO
|
|||
map<uint32_t,AutomationList*> parameter_automation;
|
||||
set<uint32_t> visible_parameter_automation;
|
||||
|
||||
mutable PBD::NonBlockingLock _automation_lock;
|
||||
mutable Glib::Mutex _automation_lock;
|
||||
|
||||
void can_automate (uint32_t);
|
||||
set<uint32_t> can_automate_list;
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class Region : public Stateful, public StateManager
|
|||
string _name;
|
||||
mutable RegionEditState _first_edit;
|
||||
int _frozen;
|
||||
PBD::Lock lock;
|
||||
Glib::Mutex lock;
|
||||
ARDOUR::id_t _id;
|
||||
ARDOUR::Playlist* _playlist;
|
||||
mutable uint32_t _read_data_count; // modified in read()
|
||||
|
|
|
|||
|
|
@ -27,11 +27,8 @@
|
|||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <pbd/atomic.h>
|
||||
#include <pbd/fastlog.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/xml++.h>
|
||||
#include <pbd/undo.h>
|
||||
#include <midi++/controllable.h>
|
||||
|
|
@ -142,14 +139,14 @@ class Route : public IO
|
|||
void flush_redirects ();
|
||||
|
||||
template<class T> void foreach_redirect (T *obj, void (T::*func)(Redirect *)) {
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
(obj->*func) (*i);
|
||||
}
|
||||
}
|
||||
|
||||
Redirect *nth_redirect (uint32_t n) {
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
RedirectList::iterator i;
|
||||
for (i = _redirects.begin(); i != _redirects.end() && n; ++i, --n);
|
||||
if (i == _redirects.end()) {
|
||||
|
|
@ -294,9 +291,9 @@ class Route : public IO
|
|||
jack_nframes_t _roll_delay;
|
||||
jack_nframes_t _own_latency;
|
||||
RedirectList _redirects;
|
||||
PBD::NonBlockingRWLock redirect_lock;
|
||||
Glib::RWLock redirect_lock;
|
||||
IO *_control_outs;
|
||||
PBD::NonBlockingLock control_outs_lock;
|
||||
Glib::Mutex control_outs_lock;
|
||||
RouteGroup *_edit_group;
|
||||
RouteGroup *_mix_group;
|
||||
std::string _comment;
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/atomic.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <pbd/undo.h>
|
||||
#include <pbd/pool.h>
|
||||
|
||||
|
|
@ -274,7 +274,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
typedef list<DiskStream *> DiskStreamList;
|
||||
|
||||
Session::DiskStreamList disk_streams() const {
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
return diskstreams; /* XXX yes, force a copy */
|
||||
}
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
typedef list<Route *> RouteList;
|
||||
|
||||
RouteList get_routes() const {
|
||||
RWLockMonitor rlock (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rlock (route_lock);
|
||||
return routes; /* XXX yes, force a copy */
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
}
|
||||
|
||||
RecordState record_status() const {
|
||||
return (RecordState) atomic_read (&_record_status);
|
||||
return (RecordState) g_atomic_int_get (&_record_status);
|
||||
}
|
||||
|
||||
bool actively_recording () {
|
||||
|
|
@ -1004,12 +1004,12 @@ class Session : public sigc::trackable, public Stateful
|
|||
typedef void (Session::*process_function_type)(jack_nframes_t);
|
||||
|
||||
AudioEngine &_engine;
|
||||
atomic_t processing_prohibited;
|
||||
mutable gint processing_prohibited;
|
||||
process_function_type process_function;
|
||||
process_function_type last_process_function;
|
||||
jack_nframes_t _current_frame_rate;
|
||||
int transport_sub_state;
|
||||
atomic_t _record_status;
|
||||
mutable gint _record_status;
|
||||
jack_nframes_t _transport_frame;
|
||||
Location* end_location;
|
||||
Location* start_location;
|
||||
|
|
@ -1166,14 +1166,14 @@ class Session : public sigc::trackable, public Stateful
|
|||
bool pending_abort;
|
||||
bool pending_auto_loop;
|
||||
|
||||
Sample* butler_mixdown_buffer;
|
||||
float* butler_gain_buffer;
|
||||
pthread_t butler_thread;
|
||||
PBD::NonBlockingLock butler_request_lock;
|
||||
pthread_cond_t butler_paused;
|
||||
bool butler_should_run;
|
||||
atomic_t butler_should_do_transport_work;
|
||||
int butler_request_pipe[2];
|
||||
Sample* butler_mixdown_buffer;
|
||||
float* butler_gain_buffer;
|
||||
pthread_t butler_thread;
|
||||
Glib::Mutex butler_request_lock;
|
||||
Glib::Cond butler_paused;
|
||||
bool butler_should_run;
|
||||
mutable gint butler_should_do_transport_work;
|
||||
int butler_request_pipe[2];
|
||||
|
||||
struct ButlerRequest {
|
||||
enum Type {
|
||||
|
|
@ -1417,10 +1417,10 @@ class Session : public sigc::trackable, public Stateful
|
|||
static MultiAllocSingleReleasePool pool;
|
||||
};
|
||||
|
||||
PBD::Lock midi_lock;
|
||||
Glib::Mutex midi_lock;
|
||||
pthread_t midi_thread;
|
||||
int midi_request_pipe[2];
|
||||
atomic_t butler_active;
|
||||
mutable gint butler_active;
|
||||
RingBuffer<MIDIRequest*> midi_requests;
|
||||
|
||||
int start_midi_thread ();
|
||||
|
|
@ -1471,7 +1471,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
/* disk-streams */
|
||||
|
||||
DiskStreamList diskstreams;
|
||||
mutable PBD::NonBlockingRWLock diskstream_lock;
|
||||
mutable Glib::RWLock diskstream_lock;
|
||||
uint32_t dstream_buffer_size;
|
||||
void add_diskstream (DiskStream*);
|
||||
int load_diskstreams (const XMLNode&);
|
||||
|
|
@ -1479,7 +1479,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
/* routes stuff */
|
||||
|
||||
RouteList routes;
|
||||
mutable PBD::NonBlockingRWLock route_lock;
|
||||
mutable Glib::RWLock route_lock;
|
||||
void add_route (Route*);
|
||||
uint32_t destructive_index;
|
||||
|
||||
|
|
@ -1502,7 +1502,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
|
||||
/* REGION MANAGEMENT */
|
||||
|
||||
mutable PBD::Lock region_lock;
|
||||
mutable Glib::Mutex region_lock;
|
||||
typedef map<ARDOUR::id_t,AudioRegion *> AudioRegionList;
|
||||
AudioRegionList audio_regions;
|
||||
|
||||
|
|
@ -1515,7 +1515,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
|
||||
/* SOURCES */
|
||||
|
||||
mutable PBD::Lock source_lock;
|
||||
mutable Glib::Mutex source_lock;
|
||||
typedef std::map<id_t, Source *> SourceList;
|
||||
|
||||
SourceList sources;
|
||||
|
|
@ -1529,7 +1529,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
|
||||
/* PLAYLISTS */
|
||||
|
||||
mutable PBD::Lock playlist_lock;
|
||||
mutable Glib::Mutex playlist_lock;
|
||||
typedef set<Playlist *> PlaylistList;
|
||||
PlaylistList playlists;
|
||||
PlaylistList unused_playlists;
|
||||
|
|
@ -1547,7 +1547,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
|
||||
/* NAMED SELECTIONS */
|
||||
|
||||
mutable PBD::Lock named_selection_lock;
|
||||
mutable Glib::Mutex named_selection_lock;
|
||||
typedef set<NamedSelection *> NamedSelectionList;
|
||||
NamedSelectionList named_selections;
|
||||
|
||||
|
|
@ -1607,7 +1607,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
vector<space_and_path> session_dirs;
|
||||
vector<space_and_path>::iterator last_rr_session_dir;
|
||||
uint32_t _total_free_4k_blocks;
|
||||
PBD::Lock space_lock;
|
||||
Glib::Mutex space_lock;
|
||||
|
||||
static const char* sound_dir_name;
|
||||
static const char* tape_dir_name;
|
||||
|
|
@ -1618,15 +1618,15 @@ class Session : public sigc::trackable, public Stateful
|
|||
int ensure_sound_dir (string, string&);
|
||||
void refresh_disk_space ();
|
||||
|
||||
atomic_t _playback_load;
|
||||
atomic_t _capture_load;
|
||||
atomic_t _playback_load_min;
|
||||
atomic_t _capture_load_min;
|
||||
mutable gint _playback_load;
|
||||
mutable gint _capture_load;
|
||||
mutable gint _playback_load_min;
|
||||
mutable gint _capture_load_min;
|
||||
|
||||
/* I/O Connections */
|
||||
|
||||
typedef list<Connection *> ConnectionList;
|
||||
mutable PBD::Lock connection_lock;
|
||||
mutable Glib::Mutex connection_lock;
|
||||
ConnectionList _connections;
|
||||
int load_connections (const XMLNode&);
|
||||
|
||||
|
|
@ -1685,7 +1685,7 @@ class Session : public sigc::trackable, public Stateful
|
|||
Sample* click_emphasis_data;
|
||||
jack_nframes_t click_length;
|
||||
jack_nframes_t click_emphasis_length;
|
||||
mutable PBD::NonBlockingRWLock click_lock;
|
||||
mutable Glib::RWLock click_lock;
|
||||
|
||||
static const Sample default_click[];
|
||||
static const jack_nframes_t default_click_length;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace ARDOUR {
|
|||
template<class T> void
|
||||
Session::foreach_connection (T *obj, void (T::*func)(Connection *))
|
||||
{
|
||||
LockMonitor lm (connection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (connection_lock);
|
||||
for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); i++) {
|
||||
(obj->*func) (*i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace ARDOUR {
|
|||
template<class T> void
|
||||
Session::foreach_diskstream (T *obj, void (T::*func)(DiskStream&))
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); i++) {
|
||||
if (!(*i)->hidden()) {
|
||||
(obj->*func) (**i);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace ARDOUR {
|
|||
template<class T> void
|
||||
Session::foreach_playlist (T *obj, void (T::*func)(Playlist *))
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); i++) {
|
||||
if (!(*i)->hidden()) {
|
||||
(obj->*func) (*i);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace ARDOUR {
|
|||
|
||||
template<class T> void Session::foreach_audio_region (T *obj, void (T::*func)(AudioRegion *))
|
||||
{
|
||||
LockMonitor lm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
for (AudioRegionList::iterator i = audio_regions.begin(); i != audio_regions.end(); i++) {
|
||||
(obj->*func) ((*i).second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/route.h>
|
||||
|
||||
|
|
@ -35,7 +36,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&))
|
|||
RouteList public_order;
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
public_order = routes;
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +54,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route*))
|
|||
RouteList public_order;
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
public_order = routes;
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +73,7 @@ Session::foreach_route (T *obj, void (T::*func)(Route&, A), A arg1)
|
|||
RouteList public_order;
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
public_order = routes;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ namespace ARDOUR {
|
|||
template<class T> void
|
||||
Session::foreach_named_selection (T& obj, void (T::*func)(NamedSelection&))
|
||||
{
|
||||
LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (named_selection_lock);
|
||||
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); i++) {
|
||||
(obj.*func) (**i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
#include <jack/jack.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <sigc++/signal.h>
|
||||
#include <ardour/ardour.h>
|
||||
#include <midi++/parser.h>
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class SndFileSource : public ExternalSource {
|
|||
|
||||
mutable float *tmpbuf;
|
||||
mutable jack_nframes_t tmpbufsize;
|
||||
mutable PBD::Lock _tmpbuf_lock;
|
||||
mutable Glib::Mutex _tmpbuf_lock;
|
||||
|
||||
void init (const string &str, bool build_peak);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@
|
|||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
|
||||
#include <sigc++/signal.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/stateful.h>
|
||||
#include <pbd/xml++.h>
|
||||
|
|
@ -125,7 +127,7 @@ class Source : public Stateful, public sigc::trackable
|
|||
string _name;
|
||||
uint32_t _use_cnt;
|
||||
bool _peaks_built;
|
||||
mutable PBD::Lock _lock;
|
||||
mutable Glib::Mutex _lock;
|
||||
jack_nframes_t _length;
|
||||
bool next_peak_clear_should_notify;
|
||||
string peakpath;
|
||||
|
|
@ -156,7 +158,7 @@ class Source : public Stateful, public sigc::trackable
|
|||
};
|
||||
|
||||
static vector<Source*> pending_peak_sources;
|
||||
static PBD::Lock pending_peak_sources_lock;
|
||||
static Glib::StaticMutex pending_peak_sources_lock;
|
||||
|
||||
static void queue_for_peaks (Source&);
|
||||
static void clear_queue_for_peaks ();
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <pthread.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/undo.h>
|
||||
#include <sigc++/signal.h>
|
||||
|
||||
|
|
@ -198,7 +197,7 @@ class TempoMap : public Stateful, public StateManager {
|
|||
typedef vector<BBTPoint> BBTPointList;
|
||||
|
||||
template<class T> void apply_with_metrics (T& obj, void (T::*method)(const Metrics&)) {
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
(obj.*method)(*metrics);
|
||||
}
|
||||
|
||||
|
|
@ -285,7 +284,7 @@ class TempoMap : public Stateful, public StateManager {
|
|||
jack_nframes_t last_bbt_when;
|
||||
bool last_bbt_valid;
|
||||
BBT_Time last_bbt;
|
||||
mutable PBD::Lock lock;
|
||||
mutable Glib::Mutex lock;
|
||||
|
||||
void timestamp_metrics ();
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ AudioPlaylist::read (Sample *buf, Sample *mixdown_buffer, float *gain_buffer, ch
|
|||
its OK to block (for short intervals).
|
||||
*/
|
||||
|
||||
LockMonitor rm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock rm (region_lock);
|
||||
|
||||
end = start + cnt - 1;
|
||||
|
||||
|
|
@ -504,7 +504,7 @@ AudioPlaylist::add_crossfade (Crossfade& xfade)
|
|||
|
||||
void AudioPlaylist::notify_crossfade_added (Crossfade *x)
|
||||
{
|
||||
if (atomic_read(&block_notifications)) {
|
||||
if (g_atomic_int_get(&block_notifications)) {
|
||||
_pending_xfade_adds.insert (_pending_xfade_adds.end(), x);
|
||||
} else {
|
||||
NewCrossfade (x); /* EMIT SIGNAL */
|
||||
|
|
|
|||
|
|
@ -625,7 +625,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
|
|||
jack_nframes_t transport_frame;
|
||||
|
||||
{
|
||||
TentativeRWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
|
||||
if (lm.locked()) {
|
||||
// automation snapshot can also be called from the non-rt context
|
||||
// and it uses the redirect list, so we take the lock out here
|
||||
|
|
@ -709,7 +709,7 @@ AudioTrack::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nfram
|
|||
/* don't waste time with automation if we're recording or we've just stopped (yes it can happen) */
|
||||
|
||||
if (!diskstream->record_enabled() && _session.transport_rolling()) {
|
||||
TentativeLockMonitor am (automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock am (automation_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (am.locked() && gain_automation_playback()) {
|
||||
apply_gain_automation = _gain_automation_curve.rt_safe_get_vector (start_frame, end_frame, _session.gain_automation_buffer(), nframes);
|
||||
|
|
@ -789,7 +789,7 @@ AudioTrack::export_stuff (vector<Sample*>& buffers, char * workbuf, uint32_t nbu
|
|||
vector<Sample*>::iterator bi;
|
||||
Sample * b;
|
||||
|
||||
RWLockMonitor rlock (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rlock (redirect_lock);
|
||||
|
||||
if (diskstream->playlist()->read (buffers[0], mix_buffer, gain_buffer, workbuf, start, nframes) != nframes) {
|
||||
return -1;
|
||||
|
|
@ -958,7 +958,7 @@ AudioTrack::freeze (InterThreadInfo& itt)
|
|||
_freeze_record.have_mementos = true;
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
|
||||
for (RedirectList::iterator r = _redirects.begin(); r != _redirects.end(); ++r) {
|
||||
|
||||
|
|
@ -1015,7 +1015,7 @@ AudioTrack::unfreeze ()
|
|||
|
||||
} else {
|
||||
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__); // should this be a write lock? jlc
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock); // should this be a write lock? jlc
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
for (vector<FreezeRecordInsertInfo*>::iterator ii = _freeze_record.insert_info.begin(); ii != _freeze_record.insert_info.end(); ++ii) {
|
||||
if ((*ii)->id == (*i)->id()) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <cerrno>
|
||||
#include <vector>
|
||||
|
||||
#include <glibmm/timer.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
#include <ardour/audioengine.h>
|
||||
|
|
@ -45,7 +46,6 @@ jack_nframes_t Port::long_over_length = 10;
|
|||
|
||||
AudioEngine::AudioEngine (string client_name)
|
||||
{
|
||||
pthread_cond_init (&session_removed, 0);
|
||||
session = 0;
|
||||
session_remove_pending = false;
|
||||
_running = false;
|
||||
|
|
@ -60,10 +60,12 @@ AudioEngine::AudioEngine (string client_name)
|
|||
_buffer_size = 0;
|
||||
_freewheeling = false;
|
||||
_freewheel_thread_registered = false;
|
||||
last_meter_point = 0;
|
||||
meter_interval = 0;
|
||||
meter_thread_id = (pthread_t) 0;
|
||||
|
||||
m_meter_thread = 0;
|
||||
m_meter_exit = false;
|
||||
|
||||
start_metering_thread();
|
||||
|
||||
if (connect_to_jack (client_name)) {
|
||||
throw NoBackendAvailable ();
|
||||
}
|
||||
|
|
@ -76,9 +78,9 @@ AudioEngine::~AudioEngine ()
|
|||
jack_client_close (_jack);
|
||||
}
|
||||
|
||||
if (meter_thread_id != (pthread_t) 0) {
|
||||
pthread_cancel (meter_thread_id);
|
||||
}
|
||||
if(m_meter_thread) {
|
||||
g_atomic_int_inc(&m_meter_exit);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -227,7 +229,7 @@ AudioEngine::_freewheel_callback (int onoff, void *arg)
|
|||
int
|
||||
AudioEngine::process_callback (jack_nframes_t nframes)
|
||||
{
|
||||
TentativeLockMonitor tm (_process_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock tm (_process_lock, Glib::TRY_LOCK);
|
||||
jack_nframes_t next_processed_frames;
|
||||
|
||||
/* handle wrap around of total frames counter */
|
||||
|
|
@ -246,7 +248,7 @@ AudioEngine::process_callback (jack_nframes_t nframes)
|
|||
if (session_remove_pending) {
|
||||
session = 0;
|
||||
session_remove_pending = false;
|
||||
pthread_cond_signal (&session_removed);
|
||||
session_removed.signal();
|
||||
_processed_frames = next_processed_frames;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -269,14 +271,7 @@ AudioEngine::process_callback (jack_nframes_t nframes)
|
|||
_processed_frames = next_processed_frames;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* manage meters */
|
||||
|
||||
if ((meter_interval > _buffer_size) && (last_meter_point + meter_interval < next_processed_frames)) {
|
||||
IO::Meter ();
|
||||
last_meter_point = next_processed_frames;
|
||||
}
|
||||
|
||||
if (last_monitor_check + monitor_check_interval < next_processed_frames) {
|
||||
for (Ports::iterator i = ports.begin(); i != ports.end(); ++i) {
|
||||
|
||||
|
|
@ -315,11 +310,6 @@ AudioEngine::jack_sample_rate_callback (jack_nframes_t nframes)
|
|||
monitor_check_interval = nframes / 10;
|
||||
last_monitor_check = 0;
|
||||
|
||||
meter_interval = nframes / 100;
|
||||
last_meter_point = 0;
|
||||
|
||||
maybe_start_metering_thread ();
|
||||
|
||||
if (session) {
|
||||
session->set_frame_rate (nframes);
|
||||
}
|
||||
|
|
@ -350,48 +340,25 @@ AudioEngine::jack_bufsize_callback (jack_nframes_t nframes)
|
|||
session->set_block_size (_buffer_size);
|
||||
}
|
||||
|
||||
maybe_start_metering_thread ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
AudioEngine::maybe_start_metering_thread ()
|
||||
AudioEngine::start_metering_thread ()
|
||||
{
|
||||
if (meter_interval == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_buffer_size == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (meter_interval < _buffer_size) {
|
||||
if (meter_thread_id != (pthread_t) 0) {
|
||||
pthread_cancel (meter_thread_id);
|
||||
}
|
||||
pthread_create (&meter_thread_id, 0, _meter_thread, this);
|
||||
}
|
||||
if(m_meter_thread == 0) {
|
||||
m_meter_thread = Glib::Thread::create (sigc::mem_fun(this, &AudioEngine::meter_thread), false);
|
||||
}
|
||||
}
|
||||
|
||||
void*
|
||||
AudioEngine::_meter_thread (void *arg)
|
||||
{
|
||||
return static_cast<AudioEngine*>(arg)->meter_thread ();
|
||||
}
|
||||
|
||||
void*
|
||||
void
|
||||
AudioEngine::meter_thread ()
|
||||
{
|
||||
PBD::ThreadCreated (pthread_self(), "Metering");
|
||||
|
||||
while (true) {
|
||||
usleep (10000); /* 1/100th sec interval */
|
||||
pthread_testcancel();
|
||||
IO::Meter ();
|
||||
while (g_atomic_int_get(&m_meter_exit) != true) {
|
||||
Glib::usleep (10000); /* 1/100th sec interval */
|
||||
IO::update_meters ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -405,13 +372,13 @@ AudioEngine::set_session (Session *s)
|
|||
void
|
||||
AudioEngine::remove_session ()
|
||||
{
|
||||
LockMonitor lm (_process_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_process_lock);
|
||||
|
||||
if (_running) {
|
||||
|
||||
if (session) {
|
||||
session_remove_pending = true;
|
||||
pthread_cond_wait (&session_removed, _process_lock.mutex());
|
||||
session_removed.wait(_process_lock);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
@ -448,7 +415,7 @@ AudioEngine::register_audio_input_port (const string& portname)
|
|||
|
||||
} else {
|
||||
|
||||
pthread_mutex_unlock (_process_lock.mutex());
|
||||
_process_lock.unlock();
|
||||
throw PortRegistrationFailure();
|
||||
}
|
||||
|
||||
|
|
@ -476,7 +443,7 @@ AudioEngine::register_audio_output_port (const string& portname)
|
|||
|
||||
} else {
|
||||
|
||||
pthread_mutex_unlock (_process_lock.mutex());
|
||||
_process_lock.unlock();
|
||||
throw PortRegistrationFailure ();
|
||||
}
|
||||
|
||||
|
|
@ -633,7 +600,7 @@ AudioEngine::frames_per_cycle ()
|
|||
Port *
|
||||
AudioEngine::get_port_by_name (const string& portname, bool keep)
|
||||
{
|
||||
LockMonitor lm (_process_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_process_lock);
|
||||
|
||||
if (!_running) {
|
||||
if (!_has_run) {
|
||||
|
|
@ -966,7 +933,7 @@ AudioEngine::reconnect_to_jack ()
|
|||
if (_jack) {
|
||||
disconnect_from_jack ();
|
||||
/* XXX give jackd a chance */
|
||||
usleep (250000);
|
||||
Glib::usleep (250000);
|
||||
}
|
||||
|
||||
if (connect_to_jack (jack_client_name)) {
|
||||
|
|
|
|||
|
|
@ -27,8 +27,9 @@
|
|||
#include <sigc++/bind.h>
|
||||
#include <sigc++/class_slot.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <pbd/xml++.h>
|
||||
|
||||
#include <ardour/audioregion.h>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/diskstream.h>
|
||||
#include <ardour/audioregion.h>
|
||||
|
|
@ -57,7 +57,7 @@ Auditioner::Auditioner (Session& s)
|
|||
IO::output_changed.connect (mem_fun (*this, &Auditioner::output_changed));
|
||||
|
||||
the_region = 0;
|
||||
atomic_set (&_active, 0);
|
||||
g_atomic_int_set (&_active, 0);
|
||||
}
|
||||
|
||||
Auditioner::~Auditioner ()
|
||||
|
|
@ -74,14 +74,14 @@ Auditioner::prepare_playlist ()
|
|||
void
|
||||
Auditioner::audition_current_playlist ()
|
||||
{
|
||||
if (atomic_read (&_active)) {
|
||||
if (g_atomic_int_get (&_active)) {
|
||||
/* don't go via session for this, because we are going
|
||||
to remain active.
|
||||
*/
|
||||
cancel_audition ();
|
||||
}
|
||||
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
diskstream->seek (0);
|
||||
length = diskstream->playlist()->get_maximum_extent();
|
||||
current_frame = 0;
|
||||
|
|
@ -90,20 +90,20 @@ Auditioner::audition_current_playlist ()
|
|||
|
||||
_panner->reset (n_outputs(), diskstream->n_channels());
|
||||
|
||||
atomic_set (&_active, 1);
|
||||
g_atomic_int_set (&_active, 1);
|
||||
}
|
||||
|
||||
void
|
||||
Auditioner::audition_region (AudioRegion& region)
|
||||
{
|
||||
if (atomic_read (&_active)) {
|
||||
if (g_atomic_int_get (&_active)) {
|
||||
/* don't go via session for this, because we are going
|
||||
to remain active.
|
||||
*/
|
||||
cancel_audition ();
|
||||
}
|
||||
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
the_region = new AudioRegion (region);
|
||||
the_region->set_position (0, this);
|
||||
|
|
@ -126,7 +126,7 @@ Auditioner::audition_region (AudioRegion& region)
|
|||
length = the_region->length();
|
||||
diskstream->seek (0);
|
||||
current_frame = 0;
|
||||
atomic_set (&_active, 1);
|
||||
g_atomic_int_set (&_active, 1);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -136,7 +136,7 @@ Auditioner::play_audition (jack_nframes_t nframes)
|
|||
jack_nframes_t this_nframes;
|
||||
int ret;
|
||||
|
||||
if (atomic_read (&_active) == 0) {
|
||||
if (g_atomic_int_get (&_active) == 0) {
|
||||
silence (nframes, 0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ void
|
|||
AutomationList::clear ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
events.clear ();
|
||||
if (!no_state) {
|
||||
save_state (_("cleared"));
|
||||
|
|
@ -239,14 +239,14 @@ AutomationList::clear ()
|
|||
void
|
||||
AutomationList::x_scale (double factor)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
_x_scale (factor);
|
||||
}
|
||||
|
||||
bool
|
||||
AutomationList::extend_to (double when)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
if (events.empty() || events.back()->when == when) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -285,7 +285,7 @@ AutomationList::rt_add (double when, double value)
|
|||
// cerr << "RT: alist @ " << this << " add " << value << " @ " << when << endl;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
iterator where;
|
||||
TimeComparator cmp;
|
||||
|
|
@ -369,7 +369,7 @@ AutomationList::add (double when, double value, bool for_loading)
|
|||
/* this is for graphical editing and loading data from storage */
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
TimeComparator cmp;
|
||||
ControlEvent cp (when, 0.0f);
|
||||
bool insert = true;
|
||||
|
|
@ -413,7 +413,7 @@ void
|
|||
AutomationList::erase (AutomationList::iterator i)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
events.erase (i);
|
||||
reposition_for_rt_add (0);
|
||||
if (!no_state) {
|
||||
|
|
@ -428,7 +428,7 @@ void
|
|||
AutomationList::erase (AutomationList::iterator start, AutomationList::iterator end)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
events.erase (start, end);
|
||||
reposition_for_rt_add (0);
|
||||
if (!no_state) {
|
||||
|
|
@ -445,7 +445,7 @@ AutomationList::reset_range (double start, double endt)
|
|||
bool reset = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
TimeComparator cmp;
|
||||
ControlEvent cp (start, 0.0f);
|
||||
iterator s;
|
||||
|
|
@ -481,7 +481,7 @@ AutomationList::erase_range (double start, double endt)
|
|||
bool erased = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
TimeComparator cmp;
|
||||
ControlEvent cp (start, 0.0f);
|
||||
iterator s;
|
||||
|
|
@ -515,7 +515,7 @@ AutomationList::move_range (iterator start, iterator end, double xdelta, double
|
|||
*/
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
while (start != end) {
|
||||
(*start)->when += xdelta;
|
||||
|
|
@ -542,7 +542,7 @@ AutomationList::modify (iterator iter, double when, double val)
|
|||
*/
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
(*iter)->when = when;
|
||||
(*iter)->value = val;
|
||||
if (!no_state) {
|
||||
|
|
@ -558,7 +558,7 @@ AutomationList::modify (iterator iter, double when, double val)
|
|||
std::pair<AutomationList::iterator,AutomationList::iterator>
|
||||
AutomationList::control_points_adjacent (double xval)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
iterator i;
|
||||
TimeComparator cmp;
|
||||
ControlEvent cp (xval, 0.0f);
|
||||
|
|
@ -620,7 +620,7 @@ Change
|
|||
AutomationList::restore_state (StateManager::State& state)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
State* lstate = dynamic_cast<State*> (&state);
|
||||
|
||||
events.clear ();
|
||||
|
|
@ -655,7 +655,7 @@ void
|
|||
AutomationList::truncate_end (double last_coordinate)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
ControlEvent cp (last_coordinate, 0);
|
||||
list<ControlEvent*>::reverse_iterator i;
|
||||
double last_val;
|
||||
|
|
@ -760,7 +760,7 @@ void
|
|||
AutomationList::truncate_start (double overall_length)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
AutomationList::iterator i;
|
||||
double first_legal_value;
|
||||
double first_legal_coordinate;
|
||||
|
|
@ -998,7 +998,7 @@ AutomationList::cut (iterator start, iterator end)
|
|||
AutomationList* nal = new AutomationList (default_value);
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
for (iterator x = start; x != end; ) {
|
||||
iterator tmp;
|
||||
|
|
@ -1032,7 +1032,7 @@ AutomationList::cut_copy_clear (double start, double end, int op)
|
|||
bool changed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
if ((s = lower_bound (events.begin(), events.end(), &cp, cmp)) == events.end()) {
|
||||
return nal;
|
||||
|
|
@ -1094,7 +1094,7 @@ AutomationList::copy (iterator start, iterator end)
|
|||
AutomationList* nal = new AutomationList (default_value);
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
for (iterator x = start; x != end; ) {
|
||||
iterator tmp;
|
||||
|
|
@ -1141,7 +1141,7 @@ AutomationList::paste (AutomationList& alist, double pos, float times)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
iterator where;
|
||||
iterator prev;
|
||||
double end = 0;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include "i18n.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
|
||||
Connection::Connection (const XMLNode& node)
|
||||
{
|
||||
|
|
@ -58,7 +57,7 @@ void
|
|||
Connection::add_connection (int port, string portname)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (port_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (port_lock);
|
||||
_ports[port].push_back (portname);
|
||||
}
|
||||
ConnectionsChanged (port); /* EMIT SIGNAL */
|
||||
|
|
@ -70,7 +69,7 @@ Connection::remove_connection (int port, string portname)
|
|||
bool changed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (port_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (port_lock);
|
||||
PortList& pl = _ports[port];
|
||||
PortList::iterator i = find (pl.begin(), pl.end(), portname);
|
||||
|
||||
|
|
@ -88,7 +87,7 @@ Connection::remove_connection (int port, string portname)
|
|||
const Connection::PortList&
|
||||
Connection::port_connections (int port) const
|
||||
{
|
||||
LockMonitor lm (port_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (port_lock);
|
||||
return _ports[port];
|
||||
}
|
||||
|
||||
|
|
@ -102,7 +101,7 @@ void
|
|||
Connection::add_port ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (port_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (port_lock);
|
||||
_ports.push_back (PortList());
|
||||
}
|
||||
ConfigurationChanged(); /* EMIT SIGNAL */
|
||||
|
|
@ -114,7 +113,7 @@ Connection::remove_port (int which_port)
|
|||
bool changed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (port_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (port_lock);
|
||||
vector<PortList>::iterator i;
|
||||
int n;
|
||||
|
||||
|
|
@ -135,7 +134,7 @@ void
|
|||
Connection::clear ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (port_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (port_lock);
|
||||
_ports.clear ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using namespace std;
|
||||
|
||||
#include "i18n.h"
|
||||
|
|
@ -32,7 +31,7 @@ ControlProtocolManager::ControlProtocolManager ()
|
|||
|
||||
ControlProtocolManager::~ControlProtocolManager()
|
||||
{
|
||||
LockMonitor lm (protocols_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (protocols_lock);
|
||||
|
||||
for (list<ControlProtocol*>::iterator i = control_protocols.begin(); i != control_protocols.end(); ++i) {
|
||||
delete (*i);
|
||||
|
|
@ -62,7 +61,7 @@ ControlProtocolManager::drop_session ()
|
|||
_session = 0;
|
||||
|
||||
{
|
||||
LockMonitor lm (protocols_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (protocols_lock);
|
||||
for (list<ControlProtocol*>::iterator p = control_protocols.begin(); p != control_protocols.end(); ++p) {
|
||||
delete *p;
|
||||
}
|
||||
|
|
@ -89,7 +88,7 @@ ControlProtocolManager::instantiate (ControlProtocolInfo& cpi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
LockMonitor lm (protocols_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (protocols_lock);
|
||||
control_protocols.push_back (cpi.protocol);
|
||||
|
||||
return cpi.protocol;
|
||||
|
|
@ -113,7 +112,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
|
|||
cpi.descriptor->destroy (cpi.descriptor, cpi.protocol);
|
||||
|
||||
{
|
||||
LockMonitor lm (protocols_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (protocols_lock);
|
||||
list<ControlProtocol*>::iterator p = find (control_protocols.begin(), control_protocols.end(), cpi.protocol);
|
||||
if (p != control_protocols.end()) {
|
||||
control_protocols.erase (p);
|
||||
|
|
@ -281,7 +280,7 @@ XMLNode&
|
|||
ControlProtocolManager::get_state (void)
|
||||
{
|
||||
XMLNode* root = new XMLNode (state_node_name);
|
||||
LockMonitor lm (protocols_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (protocols_lock);
|
||||
|
||||
for (list<ControlProtocolInfo*>::iterator i = control_protocol_info.begin(); i != control_protocol_info.end(); ++i) {
|
||||
XMLNode* child = new XMLNode (X_("Protocol"));
|
||||
|
|
|
|||
|
|
@ -66,29 +66,34 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
|
|||
}
|
||||
|
||||
/* note that we temporarily truncated _id at the colon */
|
||||
FSRef ref;
|
||||
err = FSPathMakeRef ((UInt8*)file.c_str(), &ref, 0);
|
||||
FSRef fsr;
|
||||
err = FSPathMakeRef ((UInt8*)file.c_str(), &fsr, 0);
|
||||
if (err != noErr) {
|
||||
cerr << "FSPathMakeRef " << err << endl;
|
||||
throw failed_constructor();
|
||||
}
|
||||
|
||||
err = ExtAudioFileOpen (&ref, &af);
|
||||
err = ExtAudioFileOpen (&fsr, &af);
|
||||
if (err != noErr) {
|
||||
cerr << "ExtAudioFileOpen " << err << endl;
|
||||
ExtAudioFileDispose (af);
|
||||
throw failed_constructor();
|
||||
}
|
||||
|
||||
AudioStreamBasicDescription file_asbd;
|
||||
memset(&file_asbd, 0, sizeof(file_asbd));
|
||||
size_t asbd_size = sizeof(file_asbd);
|
||||
memset(&file_asbd, 0, sizeof(AudioStreamBasicDescription));
|
||||
size_t asbd_size = sizeof(AudioStreamBasicDescription);
|
||||
err = ExtAudioFileGetProperty(af,
|
||||
kExtAudioFileProperty_FileDataFormat, &asbd_size, &file_asbd);
|
||||
if (err != noErr) {
|
||||
cerr << "ExtAudioFileGetProperty1 " << err << endl;
|
||||
ExtAudioFileDispose (af);
|
||||
throw failed_constructor();
|
||||
}
|
||||
n_channels = file_asbd.mChannelsPerFrame;
|
||||
|
||||
cerr << "number of channels: " << n_channels << endl;
|
||||
|
||||
if (channel >= n_channels) {
|
||||
error << string_compose(_("CoreAudioSource: file only contains %1 channels; %2 is invalid as a channel number"), n_channels, channel) << endmsg;
|
||||
ExtAudioFileDispose (af);
|
||||
|
|
@ -96,17 +101,36 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
|
|||
}
|
||||
|
||||
int64_t ca_frames;
|
||||
size_t prop_size = sizeof(ca_frames);
|
||||
size_t prop_size = sizeof(int64_t);
|
||||
|
||||
err = ExtAudioFileGetProperty(af, kExtAudioFileProperty_FileLengthFrames, &prop_size, &ca_frames);
|
||||
if (err != noErr) {
|
||||
cerr << "ExtAudioFileGetProperty2 " << err << endl;
|
||||
ExtAudioFileDispose (af);
|
||||
throw failed_constructor();
|
||||
}
|
||||
_length = ca_frames;
|
||||
|
||||
_length = ca_frames;
|
||||
_path = file;
|
||||
|
||||
AudioStreamBasicDescription client_asbd;
|
||||
memset(&client_asbd, 0, sizeof(AudioStreamBasicDescription));
|
||||
client_asbd.mSampleRate = file_asbd.mSampleRate;
|
||||
client_asbd.mFormatID = kAudioFormatLinearPCM;
|
||||
client_asbd.mFormatFlags = kLinearPCMFormatFlagIsFloat;
|
||||
client_asbd.mBytesPerPacket = file_asbd.mChannelsPerFrame * 4;
|
||||
client_asbd.mFramesPerPacket = 1;
|
||||
client_asbd.mBytesPerFrame = client_asbd.mBytesPerPacket;
|
||||
client_asbd.mChannelsPerFrame = file_asbd.mChannelsPerFrame;
|
||||
client_asbd.mBitsPerChannel = 32;
|
||||
|
||||
err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd);
|
||||
if (err != noErr) {
|
||||
cerr << "ExtAudioFileSetProperty3 " << err << endl;
|
||||
ExtAudioFileDispose (af);
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
if (build_peak) {
|
||||
if (initialize_peakfile (false, file)) {
|
||||
error << "initialize peakfile failed" << endmsg;
|
||||
|
|
@ -114,24 +138,6 @@ CoreAudioSource::init (const string& idstr, bool build_peak)
|
|||
throw failed_constructor ();
|
||||
}
|
||||
}
|
||||
|
||||
AudioStreamBasicDescription client_asbd;
|
||||
memset(&client_asbd, 0, sizeof(client_asbd));
|
||||
client_asbd.mFormatID = kAudioFormatLinearPCM;
|
||||
client_asbd.mFormatFlags = kLinearPCMFormatFlagIsFloat;
|
||||
client_asbd.mSampleRate = file_asbd.mSampleRate;
|
||||
|
||||
err = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &asbd_size, &client_asbd);
|
||||
if (err != noErr) {
|
||||
ExtAudioFileDispose (af);
|
||||
throw failed_constructor ();
|
||||
}
|
||||
|
||||
err = ExtAudioFileSetProperty (af, kExtAudioFileProperty_ClientDataFormat, asbd_size, &client_asbd);
|
||||
if (err != noErr) {
|
||||
ExtAudioFileDispose (af);
|
||||
throw failed_constructor ();
|
||||
}
|
||||
}
|
||||
|
||||
CoreAudioSource::~CoreAudioSource ()
|
||||
|
|
@ -173,7 +179,7 @@ CoreAudioSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, ch
|
|||
uint32_t real_cnt = cnt * n_channels;
|
||||
|
||||
{
|
||||
LockMonitor lm (_tmpbuf_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_tmpbuf_lock);
|
||||
|
||||
if (tmpbufsize < real_cnt) {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include <cfloat>
|
||||
#include <cmath>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#include "ardour/curve.h"
|
||||
|
|
@ -37,7 +37,6 @@
|
|||
|
||||
using namespace std;
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
using namespace sigc;
|
||||
|
||||
Curve::Curve (double minv, double maxv, double canv, bool nostate)
|
||||
|
|
@ -204,7 +203,7 @@ Curve::solve ()
|
|||
bool
|
||||
Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
||||
{
|
||||
TentativeLockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock, Glib::TRY_LOCK);
|
||||
|
||||
if (!lm.locked()) {
|
||||
return false;
|
||||
|
|
@ -217,7 +216,7 @@ Curve::rt_safe_get_vector (double x0, double x1, float *vec, int32_t veclen)
|
|||
void
|
||||
Curve::get_vector (double x0, double x1, float *vec, int32_t veclen)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
_get_vector (x0, x1, vec, veclen);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@ jack_nframes_t
|
|||
DestructiveFileSource::write (Sample* data, jack_nframes_t cnt, char * workbuf)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
jack_nframes_t old_file_pos;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/xml++.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
|
|
@ -139,7 +139,7 @@ DiskStream::init (Flag f)
|
|||
first_input_change = true;
|
||||
_playlist = 0;
|
||||
i_am_the_modifier = 0;
|
||||
atomic_set (&_record_enabled, 0);
|
||||
g_atomic_int_set (&_record_enabled, 0);
|
||||
was_recording = false;
|
||||
capture_start_frame = 0;
|
||||
capture_captured = 0;
|
||||
|
|
@ -213,7 +213,7 @@ DiskStream::destroy_channel (ChannelInfo &chan)
|
|||
|
||||
DiskStream::~DiskStream ()
|
||||
{
|
||||
LockMonitor lm (state_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (state_lock);
|
||||
|
||||
if (_playlist) {
|
||||
_playlist->unref ();
|
||||
|
|
@ -229,7 +229,7 @@ DiskStream::~DiskStream ()
|
|||
void
|
||||
DiskStream::handle_input_change (IOChange change, void *src)
|
||||
{
|
||||
LockMonitor lm (state_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (state_lock);
|
||||
|
||||
if (!(input_change_pending & change)) {
|
||||
input_change_pending = IOChange (input_change_pending|change);
|
||||
|
|
@ -241,7 +241,7 @@ void
|
|||
DiskStream::non_realtime_input_change ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (state_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (state_lock);
|
||||
|
||||
if (input_change_pending == NoChange) {
|
||||
return;
|
||||
|
|
@ -349,7 +349,7 @@ int
|
|||
DiskStream::use_playlist (AudioPlaylist* playlist)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (state_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (state_lock);
|
||||
|
||||
if (playlist == _playlist) {
|
||||
return 0;
|
||||
|
|
@ -565,7 +565,7 @@ DiskStream::non_realtime_set_speed ()
|
|||
{
|
||||
if (_buffer_reallocation_required)
|
||||
{
|
||||
LockMonitor lm (state_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (state_lock);
|
||||
allocate_temporary_buffers ();
|
||||
|
||||
_buffer_reallocation_required = false;
|
||||
|
|
@ -753,7 +753,8 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
|
|||
returns a non-zero value, in which case, ::commit should not be called.
|
||||
*/
|
||||
|
||||
if (pthread_mutex_trylock (state_lock.mutex())) {
|
||||
// If we can't take the state lock return.
|
||||
if (!state_lock.trylock()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1002,7 +1003,7 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
|
|||
be called. unlock the state lock.
|
||||
*/
|
||||
|
||||
pthread_mutex_unlock (state_lock.mutex());
|
||||
state_lock.unlock();
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
@ -1011,7 +1012,7 @@ DiskStream::process (jack_nframes_t transport_frame, jack_nframes_t nframes, jac
|
|||
void
|
||||
DiskStream::recover ()
|
||||
{
|
||||
pthread_mutex_unlock (state_lock.mutex());
|
||||
state_lock.unlock();
|
||||
_processed = false;
|
||||
}
|
||||
|
||||
|
|
@ -1047,7 +1048,7 @@ DiskStream::commit (jack_nframes_t nframes)
|
|||
|| channels[0].capture_buf->read_space() >= disk_io_chunk_frames;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock (state_lock.mutex());
|
||||
state_lock.unlock();
|
||||
|
||||
_processed = false;
|
||||
|
||||
|
|
@ -1140,7 +1141,7 @@ DiskStream::overwrite_existing_buffers ()
|
|||
int
|
||||
DiskStream::seek (jack_nframes_t frame, bool complete_refill)
|
||||
{
|
||||
LockMonitor lm (state_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (state_lock);
|
||||
uint32_t n;
|
||||
int ret;
|
||||
ChannelList::iterator chan;
|
||||
|
|
@ -1702,7 +1703,7 @@ DiskStream::transport_stopped (struct tm& when, time_t twhen, bool abort_capture
|
|||
}
|
||||
|
||||
/* XXX is there anything we can do if err != 0 ? */
|
||||
LockMonitor lm (capture_info_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (capture_info_lock);
|
||||
|
||||
if (capture_info.empty()) {
|
||||
return;
|
||||
|
|
@ -1925,7 +1926,7 @@ DiskStream::set_record_enabled (bool yn, void* src)
|
|||
|
||||
if (record_enabled() != yn) {
|
||||
if (yn) {
|
||||
atomic_set (&_record_enabled, 1);
|
||||
g_atomic_int_set (&_record_enabled, 1);
|
||||
capturing_sources.clear ();
|
||||
if (Config->get_use_hardware_monitoring()) {
|
||||
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
|
||||
|
|
@ -1941,7 +1942,7 @@ DiskStream::set_record_enabled (bool yn, void* src)
|
|||
}
|
||||
|
||||
} else {
|
||||
atomic_set (&_record_enabled, 0);
|
||||
g_atomic_int_set (&_record_enabled, 0);
|
||||
if (Config->get_use_hardware_monitoring()) {
|
||||
for (ChannelList::iterator chan = channels.begin(); chan != channels.end(); ++chan) {
|
||||
if ((*chan).source) {
|
||||
|
|
@ -2415,7 +2416,7 @@ DiskStream::set_loop (Location *location)
|
|||
jack_nframes_t
|
||||
DiskStream::get_capture_start_frame (uint32_t n)
|
||||
{
|
||||
LockMonitor lm (capture_info_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (capture_info_lock);
|
||||
|
||||
if (capture_info.size() > n) {
|
||||
return capture_info[n]->start;
|
||||
|
|
@ -2428,7 +2429,7 @@ DiskStream::get_capture_start_frame (uint32_t n)
|
|||
jack_nframes_t
|
||||
DiskStream::get_captured_frames (uint32_t n)
|
||||
{
|
||||
LockMonitor lm (capture_info_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (capture_info_lock);
|
||||
|
||||
if (capture_info.size() > n) {
|
||||
return capture_info[n]->frames;
|
||||
|
|
|
|||
|
|
@ -53,10 +53,11 @@
|
|||
#include <vector>
|
||||
#include <cstdio> /* for rename(2) */
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <pbd/stl_delete.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/dirname.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/pathscanner.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
|
|
@ -351,7 +352,7 @@ FileSource::set_allow_remove_if_empty (bool yn)
|
|||
int
|
||||
FileSource::set_name (string newname, bool destructive)
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
string oldpath = _path;
|
||||
string newpath = Session::change_audio_path_by_name (oldpath, _name, newname, destructive);
|
||||
|
||||
|
|
@ -365,7 +366,7 @@ FileSource::set_name (string newname, bool destructive)
|
|||
return -1;
|
||||
}
|
||||
|
||||
_name = basename (newpath);
|
||||
_name = Glib::path_get_basename (newpath);
|
||||
_path = newpath;
|
||||
|
||||
return rename_peakfile (peak_path (_path));
|
||||
|
|
@ -680,7 +681,7 @@ FileSource::compute_header_size ()
|
|||
int
|
||||
FileSource::update_header (jack_nframes_t when, struct tm& now, time_t tnow)
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
if (is_bwf) {
|
||||
/* random code is 9 digits */
|
||||
|
|
@ -1009,7 +1010,7 @@ FileSource::mark_for_remove ()
|
|||
jack_nframes_t
|
||||
FileSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char * workbuf) const
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
return read_unlocked (dst, start, cnt, workbuf);
|
||||
}
|
||||
|
||||
|
|
@ -1055,7 +1056,7 @@ jack_nframes_t
|
|||
FileSource::write (Sample *data, jack_nframes_t cnt, char * workbuf)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
jack_nframes_t oldlen;
|
||||
int32_t frame_pos = _length;
|
||||
|
|
@ -1287,7 +1288,7 @@ FileSource::is_empty (string path)
|
|||
void
|
||||
FileSource::mark_streaming_write_completed ()
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
next_peak_clear_should_notify = true;
|
||||
|
||||
|
|
@ -1313,13 +1314,15 @@ FileSource::move_to_trash (const string trash_dir_name)
|
|||
on whichever filesystem it was already on.
|
||||
*/
|
||||
|
||||
newpath = PBD::dirname (_path);
|
||||
newpath = PBD::dirname (newpath);
|
||||
// XXX Portability
|
||||
|
||||
newpath = Glib::path_get_dirname (_path);
|
||||
newpath = Glib::path_get_dirname (newpath);
|
||||
|
||||
newpath += '/';
|
||||
newpath += trash_dir_name;
|
||||
newpath += '/';
|
||||
newpath += PBD::basename (_path);
|
||||
newpath += Glib::path_get_basename (_path);
|
||||
|
||||
if (access (newpath.c_str(), F_OK) == 0) {
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ inline static void gdither_innner_loop(const GDitherType dt,
|
|||
const int clamp_l)
|
||||
{
|
||||
uint32_t pos, i;
|
||||
u_int8_t *o8 = (u_int8_t*) y;
|
||||
uint8_t *o8 = (uint8_t*) y;
|
||||
int16_t *o16 = (int16_t*) y;
|
||||
int32_t *o32 = (int32_t*) y;
|
||||
float tmp, r, ideal;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,10 @@
|
|||
#include <ardour/utils.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/control_protocol_manager.h>
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
#include <ardour/osc.h>
|
||||
#endif
|
||||
|
||||
#include <ardour/mix.h>
|
||||
|
||||
|
|
@ -59,7 +62,10 @@
|
|||
|
||||
ARDOUR::Configuration* ARDOUR::Config = 0;
|
||||
ARDOUR::AudioLibrary* ARDOUR::Library = 0;
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
ARDOUR::OSC* ARDOUR::osc = 0;
|
||||
#endif
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace std;
|
||||
|
|
@ -74,6 +80,7 @@ Change ARDOUR::PositionChanged = ARDOUR::new_change ();
|
|||
Change ARDOUR::NameChanged = ARDOUR::new_change ();
|
||||
Change ARDOUR::BoundsChanged = Change (0); // see init(), below
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
static int
|
||||
setup_osc ()
|
||||
{
|
||||
|
|
@ -89,6 +96,7 @@ setup_osc ()
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
setup_midi ()
|
||||
|
|
@ -197,10 +205,12 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization, void (*s
|
|||
if (setup_midi ()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
if (setup_osc ()) {
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VST_SUPPORT
|
||||
if (Config->get_use_vst() && fst_init (sighandler)) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,10 @@
|
|||
#include <sndfile.h>
|
||||
#include <samplerate.h>
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <pbd/basename.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/diskstream.h>
|
||||
|
|
@ -212,7 +215,7 @@ Session::import_audiofile (import_status& status)
|
|||
sources.push_back(newfiles[n]);
|
||||
}
|
||||
|
||||
AudioRegion *r = new AudioRegion (sources, 0, newfiles[0]->length(), region_name_from_path (PBD::basename(basepath)),
|
||||
AudioRegion *r = new AudioRegion (sources, 0, newfiles[0]->length(), region_name_from_path (Glib::path_get_basename (basepath)),
|
||||
0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile));
|
||||
|
||||
status.new_regions.push_back (r);
|
||||
|
|
@ -228,7 +231,7 @@ Session::import_audiofile (import_status& status)
|
|||
did not bother to create whole-file AudioRegions for them. Do it now.
|
||||
*/
|
||||
|
||||
AudioRegion *r = new AudioRegion (*newfiles[n], 0, newfiles[n]->length(), region_name_from_path (PBD::basename (newfiles[n]->name())),
|
||||
AudioRegion *r = new AudioRegion (*newfiles[n], 0, newfiles[n]->length(), region_name_from_path (Glib::path_get_basename (newfiles[n]->name())),
|
||||
0, AudioRegion::Flag (AudioRegion::DefaultFlags | AudioRegion::WholeFile | AudioRegion::Import));
|
||||
|
||||
status.new_regions.push_back (r);
|
||||
|
|
@ -285,7 +288,7 @@ Session::import_audiofile (import_status& status)
|
|||
string
|
||||
Session::build_tmp_convert_name(string infile)
|
||||
{
|
||||
string tmp_name(_path + "/." + PBD::basename (infile.c_str()) + "XXXXXX");
|
||||
string tmp_name(_path + "/." + Glib::path_get_basename (infile.c_str()) + "XXXXXX");
|
||||
char* tmp = new char[tmp_name.length() + 1];
|
||||
tmp_name.copy(tmp, string::npos);
|
||||
tmp[tmp_name.length()] = 0;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ PluginInsert::PluginInsert (Session& s, Plugin& plug, Placement placement)
|
|||
save_state (_("initial state"));
|
||||
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
IO::MoreOutputs (output_streams ());
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ PluginInsert::PluginInsert (Session& s, const XMLNode& node)
|
|||
_plugins[0]->ParameterChanged.connect (mem_fun (*this, &PluginInsert::parameter_changed));
|
||||
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
IO::MoreOutputs (output_streams());
|
||||
}
|
||||
}
|
||||
|
|
@ -410,7 +410,7 @@ PluginInsert::automation_run (vector<Sample *>& bufs, uint32_t nbufs, jack_nfram
|
|||
jack_nframes_t now = _session.transport_frame ();
|
||||
jack_nframes_t end = now + nframes;
|
||||
|
||||
TentativeLockMonitor lm (_automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_automation_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (!lm.locked()) {
|
||||
connect_and_run (bufs, nbufs, nframes, offset, false);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@
|
|||
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/xml++.h>
|
||||
|
||||
#include <ardour/audioengine.h>
|
||||
|
|
@ -70,6 +71,8 @@ sigc::signal<int> IO::PannersLegal;
|
|||
sigc::signal<void,uint32_t> IO::MoreOutputs;
|
||||
sigc::signal<int> IO::PortsCreated;
|
||||
|
||||
Glib::StaticMutex IO::m_meter_signal_lock = GLIBMM_STATIC_MUTEX_INIT;
|
||||
|
||||
/* this is a default mapper of MIDI control values to a gain coefficient.
|
||||
others can be imagined. see IO::set_midi_to_gain_function().
|
||||
*/
|
||||
|
|
@ -126,13 +129,20 @@ IO::IO (Session& s, string name,
|
|||
|
||||
_gain_automation_state = Off;
|
||||
_gain_automation_style = Absolute;
|
||||
|
||||
Meter.connect (mem_fun (*this, &IO::meter));
|
||||
|
||||
{
|
||||
// IO::Meter is emitted from another thread so the
|
||||
// Meter signal must be protected.
|
||||
Glib::Mutex::Lock guard (m_meter_signal_lock);
|
||||
m_meter_connection = Meter.connect (mem_fun (*this, &IO::meter));
|
||||
}
|
||||
}
|
||||
|
||||
IO::~IO ()
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
|
||||
Glib::Mutex::Lock guard (m_meter_signal_lock);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
vector<Port *>::iterator i;
|
||||
|
||||
for (i = _inputs.begin(); i != _inputs.end(); ++i) {
|
||||
|
|
@ -142,6 +152,8 @@ IO::~IO ()
|
|||
for (i = _outputs.begin(); i != _outputs.end(); ++i) {
|
||||
_session.engine().unregister_port (*i);
|
||||
}
|
||||
|
||||
m_meter_connection.disconnect();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -380,7 +392,7 @@ IO::deliver_output (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_t nfram
|
|||
gain_t pangain = _gain;
|
||||
|
||||
{
|
||||
TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (dm.locked()) {
|
||||
dg = _desired_gain;
|
||||
|
|
@ -427,7 +439,7 @@ IO::deliver_output_no_pan (vector<Sample *>& bufs, uint32_t nbufs, jack_nframes_
|
|||
|
||||
} else {
|
||||
|
||||
TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (dm.locked()) {
|
||||
dg = _desired_gain;
|
||||
|
|
@ -568,10 +580,10 @@ IO::disconnect_input (Port* our_port, string other_port, void* src)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
/* check that our_port is really one of ours */
|
||||
|
||||
|
|
@ -604,10 +616,10 @@ IO::connect_input (Port* our_port, string other_port, void* src)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em(_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
/* check that our_port is really one of ours */
|
||||
|
||||
|
|
@ -638,10 +650,10 @@ IO::disconnect_output (Port* our_port, string other_port, void* src)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em(_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
if (find (_outputs.begin(), _outputs.end(), our_port) == _outputs.end()) {
|
||||
return -1;
|
||||
|
|
@ -671,10 +683,10 @@ IO::connect_output (Port* our_port, string other_port, void* src)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em(_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
/* check that our_port is really one of ours */
|
||||
|
||||
|
|
@ -730,10 +742,10 @@ IO::remove_output_port (Port* port, void* src)
|
|||
IOChange change (NoChange);
|
||||
|
||||
{
|
||||
LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em(_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
if (_noutputs - 1 == (uint32_t) _output_minimum) {
|
||||
/* sorry, you can't do this */
|
||||
|
|
@ -779,10 +791,10 @@ IO::add_output_port (string destination, void* src)
|
|||
char buf[64];
|
||||
|
||||
{
|
||||
LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em(_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
if (_output_maximum >= 0 && (int) _noutputs == _output_maximum) {
|
||||
return -1;
|
||||
|
|
@ -830,10 +842,10 @@ IO::remove_input_port (Port* port, void* src)
|
|||
IOChange change (NoChange);
|
||||
|
||||
{
|
||||
LockMonitor em(_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em(_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
if (((int)_ninputs - 1) < _input_minimum) {
|
||||
/* sorry, you can't do this */
|
||||
|
|
@ -880,10 +892,10 @@ IO::add_input_port (string source, void* src)
|
|||
char buf[64];
|
||||
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
if (_input_maximum >= 0 && (int) _ninputs == _input_maximum) {
|
||||
return -1;
|
||||
|
|
@ -931,10 +943,10 @@ int
|
|||
IO::disconnect_inputs (void* src)
|
||||
{
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
for (vector<Port *>::iterator i = _inputs.begin(); i != _inputs.end(); ++i) {
|
||||
_session.engine().disconnect (*i);
|
||||
|
|
@ -951,10 +963,10 @@ int
|
|||
IO::disconnect_outputs (void* src)
|
||||
{
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
for (vector<Port *>::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
|
||||
_session.engine().disconnect (*i);
|
||||
|
|
@ -1063,8 +1075,8 @@ IO::ensure_io (uint32_t nin, uint32_t nout, bool clear, void* src)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
Port* port;
|
||||
|
||||
|
|
@ -1212,8 +1224,8 @@ IO::ensure_inputs (uint32_t n, bool clear, bool lockit, void* src)
|
|||
}
|
||||
|
||||
if (lockit) {
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
LockMonitor im (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
Glib::Mutex::Lock im (io_lock);
|
||||
changed = ensure_inputs_locked (n, clear, src);
|
||||
} else {
|
||||
changed = ensure_inputs_locked (n, clear, src);
|
||||
|
|
@ -1314,8 +1326,8 @@ IO::ensure_outputs (uint32_t n, bool clear, bool lockit, void* src)
|
|||
/* XXX caller should hold io_lock, but generally doesn't */
|
||||
|
||||
if (lockit) {
|
||||
LockMonitor em (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
LockMonitor im (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock em (_session.engine().process_lock());
|
||||
Glib::Mutex::Lock im (io_lock);
|
||||
changed = ensure_outputs_locked (n, clear, src);
|
||||
} else {
|
||||
changed = ensure_outputs_locked (n, clear, src);
|
||||
|
|
@ -1389,7 +1401,7 @@ IO::state (bool full_state)
|
|||
bool need_ins = true;
|
||||
bool need_outs = true;
|
||||
LocaleGuard lg (X_("POSIX"));
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
node->add_property("name", _name);
|
||||
snprintf (buf, sizeof(buf), "%" PRIu64, id());
|
||||
|
|
@ -2058,7 +2070,7 @@ IO::set_output_maximum (int n)
|
|||
void
|
||||
IO::set_port_latency (jack_nframes_t nframes)
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock);
|
||||
|
||||
for (vector<Port *>::iterator i = _outputs.begin(); i != _outputs.end(); ++i) {
|
||||
(*i)->set_latency (nframes);
|
||||
|
|
@ -2109,8 +2121,8 @@ IO::use_input_connection (Connection& c, void* src)
|
|||
uint32_t limit;
|
||||
|
||||
{
|
||||
LockMonitor lm (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
LockMonitor lm2 (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_session.engine().process_lock());
|
||||
Glib::Mutex::Lock lm2 (io_lock);
|
||||
|
||||
limit = c.nports();
|
||||
|
||||
|
|
@ -2187,8 +2199,8 @@ IO::use_output_connection (Connection& c, void* src)
|
|||
uint32_t limit;
|
||||
|
||||
{
|
||||
LockMonitor lm (_session.engine().process_lock(), __LINE__, __FILE__);
|
||||
LockMonitor lm2 (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_session.engine().process_lock());
|
||||
Glib::Mutex::Lock lm2 (io_lock);
|
||||
|
||||
limit = c.nports();
|
||||
|
||||
|
|
@ -2437,10 +2449,26 @@ IO::send_state_changed ()
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
Update the peak meters.
|
||||
|
||||
The meter signal lock is taken to prevent modification of the
|
||||
Meter signal while updating the meters, taking the meter signal
|
||||
lock prior to taking the io_lock ensures that all IO will remain
|
||||
valid while metering.
|
||||
*/
|
||||
void
|
||||
IO::update_meters()
|
||||
{
|
||||
Glib::Mutex::Lock guard (m_meter_signal_lock);
|
||||
|
||||
Meter();
|
||||
}
|
||||
|
||||
void
|
||||
IO::meter ()
|
||||
{
|
||||
LockMonitor lm (io_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (io_lock); // READER: meter thread.
|
||||
uint32_t limit = max (_ninputs, _noutputs);
|
||||
|
||||
for (uint32_t n = 0; n < limit; ++n) {
|
||||
|
|
@ -2602,7 +2630,7 @@ IO::load_automation (const string& path)
|
|||
void
|
||||
IO::clear_automation ()
|
||||
{
|
||||
LockMonitor lm (automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (automation_lock);
|
||||
_gain_automation_curve.clear ();
|
||||
_panner->clear_automation ();
|
||||
}
|
||||
|
|
@ -2613,7 +2641,7 @@ IO::set_gain_automation_state (AutoState state)
|
|||
bool changed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (automation_lock);
|
||||
|
||||
if (state != _gain_automation_curve.automation_state()) {
|
||||
changed = true;
|
||||
|
|
@ -2638,7 +2666,7 @@ IO::set_gain_automation_style (AutoStyle style)
|
|||
bool changed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (automation_lock);
|
||||
|
||||
if (style != _gain_automation_curve.automation_style()) {
|
||||
changed = true;
|
||||
|
|
@ -2666,7 +2694,7 @@ IO::set_gain (gain_t val, void *src)
|
|||
if (val>1.99526231f) val=1.99526231f;
|
||||
|
||||
{
|
||||
LockMonitor dm (declick_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock dm (declick_lock);
|
||||
_desired_gain = val;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -371,7 +371,7 @@ Locations::set_current (Location *loc, bool want_lock)
|
|||
int ret;
|
||||
|
||||
if (want_lock) {
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
ret = set_current_unlocked (loc);
|
||||
} else {
|
||||
ret = set_current_unlocked (loc);
|
||||
|
|
@ -399,7 +399,7 @@ void
|
|||
Locations::clear ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
LocationList::iterator tmp;
|
||||
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
|
||||
tmp = i;
|
||||
|
|
@ -424,7 +424,7 @@ void
|
|||
Locations::clear_markers ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
LocationList::iterator tmp;
|
||||
|
||||
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
|
||||
|
|
@ -448,7 +448,7 @@ void
|
|||
Locations::clear_ranges ()
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
LocationList::iterator tmp;
|
||||
|
||||
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
|
||||
|
|
@ -477,7 +477,7 @@ void
|
|||
Locations::add (Location *loc, bool make_current)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
locations.push_back (loc);
|
||||
|
||||
if (make_current) {
|
||||
|
|
@ -507,7 +507,7 @@ Locations::remove (Location *loc)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
for (i = locations.begin(); i != locations.end(); ++i) {
|
||||
if ((*i) == loc) {
|
||||
|
|
@ -547,7 +547,7 @@ Locations::get_state ()
|
|||
{
|
||||
XMLNode *node = new XMLNode ("Locations");
|
||||
LocationList::iterator iter;
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
for (iter = locations.begin(); iter != locations.end(); ++iter) {
|
||||
node->add_child_nocopy ((*iter)->get_state ());
|
||||
|
|
@ -570,7 +570,7 @@ Locations::set_state (const XMLNode& node)
|
|||
nlist = node.children();
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
Location *loc = new Location;
|
||||
|
|
@ -614,7 +614,7 @@ Locations::first_location_before (jack_nframes_t frame)
|
|||
LocationList locs;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
locs = locations;
|
||||
}
|
||||
|
||||
|
|
@ -638,7 +638,7 @@ Locations::first_location_after (jack_nframes_t frame)
|
|||
LocationList locs;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
locs = locations;
|
||||
}
|
||||
|
||||
|
|
@ -662,7 +662,7 @@ Locations::first_mark_before (jack_nframes_t frame)
|
|||
LocationList locs;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
locs = locations;
|
||||
}
|
||||
|
||||
|
|
@ -699,7 +699,7 @@ Locations::first_mark_after (jack_nframes_t frame)
|
|||
LocationList locs;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
locs = locations;
|
||||
}
|
||||
|
||||
|
|
@ -792,7 +792,7 @@ Change
|
|||
Locations::restore_state (StateManager::State& state)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
State* lstate = dynamic_cast<State*> (&state);
|
||||
|
||||
locations = lstate->locations;
|
||||
|
|
@ -817,7 +817,7 @@ uint32_t
|
|||
Locations::num_range_markers () const
|
||||
{
|
||||
uint32_t cnt = 0;
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
|
||||
if ((*i)->is_range_marker()) {
|
||||
++cnt;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@
|
|||
#include <unistd.h>
|
||||
#include <float.h>
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/failed_constructor.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/xml++.h>
|
||||
|
||||
#include <ardour/session.h>
|
||||
|
|
@ -1369,7 +1370,7 @@ Panner::state (bool full)
|
|||
|
||||
if (full) {
|
||||
if (save () == 0) {
|
||||
root->add_property (X_("automation"), PBD::basename (automation_path));
|
||||
root->add_property (X_("automation"), Glib::path_get_basename (automation_path));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,8 +225,8 @@ Playlist::copy_regions (RegionList& newlist) const
|
|||
void
|
||||
Playlist::init (bool hide)
|
||||
{
|
||||
atomic_set (&block_notifications, 0);
|
||||
atomic_set (&ignore_state_changes, 0);
|
||||
g_atomic_int_set (&block_notifications, 0);
|
||||
g_atomic_int_set (&ignore_state_changes, 0);
|
||||
pending_modified = false;
|
||||
pending_length = false;
|
||||
_refcnt = 0;
|
||||
|
|
@ -292,13 +292,13 @@ void
|
|||
Playlist::freeze ()
|
||||
{
|
||||
delay_notifications ();
|
||||
atomic_inc (&ignore_state_changes);
|
||||
g_atomic_int_inc (&ignore_state_changes);
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::thaw ()
|
||||
{
|
||||
atomic_dec (&ignore_state_changes);
|
||||
g_atomic_int_dec_and_test (&ignore_state_changes);
|
||||
release_notifications ();
|
||||
}
|
||||
|
||||
|
|
@ -306,14 +306,14 @@ Playlist::thaw ()
|
|||
void
|
||||
Playlist::delay_notifications ()
|
||||
{
|
||||
atomic_inc (&block_notifications);
|
||||
g_atomic_int_inc (&block_notifications);
|
||||
freeze_length = _get_maximum_extent();
|
||||
}
|
||||
|
||||
void
|
||||
Playlist::release_notifications ()
|
||||
{
|
||||
if (atomic_dec_and_test(&block_notifications)) {
|
||||
if (g_atomic_int_dec_and_test (&block_notifications)) {
|
||||
flush_notifications ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ Redirect::load_automation (string path)
|
|||
return 1;
|
||||
}
|
||||
|
||||
LockMonitor lm (_automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_automation_lock);
|
||||
set<uint32_t> tosave;
|
||||
parameter_automation.clear ();
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ Redirect::load_automation (string path)
|
|||
int
|
||||
Redirect::save_automation (string path)
|
||||
{
|
||||
LockMonitor lm (_automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_automation_lock);
|
||||
string fullpath;
|
||||
|
||||
if (parameter_automation.empty()) {
|
||||
|
|
@ -268,7 +268,7 @@ Redirect::state (bool full_state)
|
|||
void
|
||||
Redirect::what_has_automation (set<uint32_t>& s) const
|
||||
{
|
||||
LockMonitor lm (_automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_automation_lock);
|
||||
map<uint32_t,AutomationList*>::const_iterator li;
|
||||
|
||||
for (li = parameter_automation.begin(); li != parameter_automation.end(); ++li) {
|
||||
|
|
@ -279,7 +279,7 @@ Redirect::what_has_automation (set<uint32_t>& s) const
|
|||
void
|
||||
Redirect::what_has_visible_automation (set<uint32_t>& s) const
|
||||
{
|
||||
LockMonitor lm (_automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_automation_lock);
|
||||
set<uint32_t>::const_iterator li;
|
||||
|
||||
for (li = visible_parameter_automation.begin(); li != visible_parameter_automation.end(); ++li) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <sigc++/bind.h>
|
||||
#include <sigc++/class_slot.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/xml++.h>
|
||||
|
||||
#include <ardour/region.h>
|
||||
|
|
@ -178,7 +178,7 @@ Region::restore_and_return_flags (RegionState& state)
|
|||
Change what_changed = Change (0);
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
if (_start != state._start) {
|
||||
what_changed = Change (what_changed|StartChanged);
|
||||
|
|
@ -947,7 +947,7 @@ Region::thaw (const string& why)
|
|||
Change what_changed = Change (0);
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
if (_frozen && --_frozen > 0) {
|
||||
return;
|
||||
|
|
@ -978,7 +978,7 @@ void
|
|||
Region::send_change (Change what_changed)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
if (_frozen) {
|
||||
pending_changed = Change (pending_changed|what_changed);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
|
|||
declick = _pending_declick;
|
||||
|
||||
{
|
||||
TentativeLockMonitor cm (control_outs_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock cm (control_outs_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (cm.locked()) {
|
||||
co = _control_outs;
|
||||
|
|
@ -245,7 +245,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
|
|||
}
|
||||
|
||||
{
|
||||
TentativeLockMonitor dm (declick_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock dm (declick_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (dm.locked()) {
|
||||
dmg = desired_mute_gain;
|
||||
|
|
@ -330,7 +330,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
|
|||
-------------------------------------------------------------------------------------------------- */
|
||||
|
||||
if (with_redirects) {
|
||||
TentativeRWLockMonitor rm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rm (redirect_lock, Glib::TRY_LOCK);
|
||||
if (rm.locked()) {
|
||||
if (mute_gain > 0 || !_mute_affects_pre_fader) {
|
||||
for (i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
|
|
@ -499,7 +499,7 @@ Route::process_output_buffers (vector<Sample*>& bufs, uint32_t nbufs,
|
|||
|
||||
if (post_fader_work) {
|
||||
|
||||
TentativeRWLockMonitor rm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rm (redirect_lock, Glib::TRY_LOCK);
|
||||
if (rm.locked()) {
|
||||
if (mute_gain > 0 || !_mute_affects_post_fader) {
|
||||
for (i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
|
|
@ -723,7 +723,7 @@ Route::set_solo (bool yn, void *src)
|
|||
void
|
||||
Route::set_solo_mute (bool yn)
|
||||
{
|
||||
LockMonitor lm (declick_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (declick_lock);
|
||||
|
||||
/* Called by Session in response to another Route being soloed.
|
||||
*/
|
||||
|
|
@ -757,7 +757,7 @@ Route::set_mute (bool yn, void *src)
|
|||
_midi_mute_control.send_feedback (_muted);
|
||||
}
|
||||
|
||||
LockMonitor lm (declick_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (declick_lock);
|
||||
desired_mute_gain = (yn?0.0f:1.0f);
|
||||
}
|
||||
}
|
||||
|
|
@ -772,7 +772,7 @@ Route::add_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
|
|||
}
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
|
||||
PluginInsert* pi;
|
||||
PortInsert* porti;
|
||||
|
|
@ -845,7 +845,7 @@ Route::add_redirects (const RedirectList& others, void *src, uint32_t* err_strea
|
|||
}
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
|
||||
RedirectList::iterator existing_end = _redirects.end();
|
||||
--existing_end;
|
||||
|
|
@ -904,7 +904,7 @@ Route::clear_redirects (void *src)
|
|||
}
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
delete *i;
|
||||
|
|
@ -934,7 +934,7 @@ Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
|
|||
redirect_max_outs = 0;
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
RedirectList::iterator i;
|
||||
bool removed = false;
|
||||
|
||||
|
|
@ -1013,7 +1013,7 @@ Route::remove_redirect (Redirect *redirect, void *src, uint32_t* err_streams)
|
|||
int
|
||||
Route::reset_plugin_counts (uint32_t* lpc)
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
return _reset_plugin_counts (lpc);
|
||||
}
|
||||
|
||||
|
|
@ -1183,7 +1183,7 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st
|
|||
RedirectList to_be_deleted;
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
RedirectList::iterator tmp;
|
||||
RedirectList the_copy;
|
||||
|
||||
|
|
@ -1262,7 +1262,7 @@ Route::copy_redirects (const Route& other, Placement placement, uint32_t* err_st
|
|||
void
|
||||
Route::all_redirects_flip ()
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
|
||||
if (_redirects.empty()) {
|
||||
return;
|
||||
|
|
@ -1278,7 +1278,7 @@ Route::all_redirects_flip ()
|
|||
void
|
||||
Route::all_redirects_active (bool state)
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
|
||||
if (_redirects.empty()) {
|
||||
return;
|
||||
|
|
@ -1300,7 +1300,7 @@ Route::sort_redirects (uint32_t* err_streams)
|
|||
{
|
||||
{
|
||||
RedirectSorter comparator;
|
||||
RWLockMonitor lm (redirect_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (redirect_lock);
|
||||
uint32_t old_rmo = redirect_max_outs;
|
||||
|
||||
/* the sweet power of C++ ... */
|
||||
|
|
@ -1779,7 +1779,7 @@ Route::silence (jack_nframes_t nframes, jack_nframes_t offset)
|
|||
}
|
||||
|
||||
{
|
||||
TentativeRWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (lm.locked()) {
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
|
|
@ -1804,7 +1804,7 @@ Route::silence (jack_nframes_t nframes, jack_nframes_t offset)
|
|||
int
|
||||
Route::set_control_outs (const vector<string>& ports)
|
||||
{
|
||||
LockMonitor lm (control_outs_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (control_outs_lock);
|
||||
vector<string>::const_iterator i;
|
||||
|
||||
if (_control_outs) {
|
||||
|
|
@ -2007,7 +2007,7 @@ Route::transport_stopped (bool abort_ignored, bool did_locate, bool can_flush_re
|
|||
jack_nframes_t now = _session.transport_frame();
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
|
||||
if (!did_locate) {
|
||||
automation_snapshot (now);
|
||||
|
|
@ -2126,7 +2126,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t
|
|||
bool can_record, bool rec_monitors_input)
|
||||
{
|
||||
{
|
||||
TentativeRWLockMonitor lm(redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock, Glib::TRY_LOCK);
|
||||
if (lm.locked()) {
|
||||
// automation snapshot can also be called from the non-rt context
|
||||
// and it uses the redirect list, so we take the lock out here
|
||||
|
|
@ -2150,7 +2150,7 @@ Route::roll (jack_nframes_t nframes, jack_nframes_t start_frame, jack_nframes_t
|
|||
apply_gain_automation = false;
|
||||
|
||||
{
|
||||
TentativeLockMonitor am (automation_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock am (automation_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (am.locked() && _session.transport_rolling()) {
|
||||
|
||||
|
|
@ -2242,7 +2242,7 @@ Route::send_all_midi_feedback ()
|
|||
if (_session.get_midi_feedback()) {
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
(*i)->send_all_midi_feedback ();
|
||||
}
|
||||
|
|
@ -2262,7 +2262,7 @@ Route::write_midi_feedback (MIDI::byte* buf, int32_t& bufsize)
|
|||
buf = _midi_mute_control.write_feedback (buf, bufsize, _muted);
|
||||
|
||||
{
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
buf = (*i)->write_midi_feedback (buf, bufsize);
|
||||
}
|
||||
|
|
@ -2278,7 +2278,7 @@ Route::flush_redirects ()
|
|||
this is called from the RT audio thread.
|
||||
*/
|
||||
|
||||
RWLockMonitor lm (redirect_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (redirect_lock);
|
||||
|
||||
for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
|
||||
(*i)->deactivate ();
|
||||
|
|
|
|||
|
|
@ -32,12 +32,13 @@
|
|||
#include <sigc++/bind.h>
|
||||
#include <sigc++/retype.h>
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/pathscanner.h>
|
||||
#include <pbd/stl_delete.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/dirname.h>
|
||||
|
||||
#include <ardour/audioengine.h>
|
||||
#include <ardour/configuration.h>
|
||||
|
|
@ -64,7 +65,10 @@
|
|||
#include <ardour/crossfade.h>
|
||||
#include <ardour/playlist.h>
|
||||
#include <ardour/click.h>
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
#include <ardour/osc.h>
|
||||
#endif
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -550,7 +554,7 @@ Session::set_worst_io_latencies (bool take_lock)
|
|||
}
|
||||
|
||||
if (take_lock) {
|
||||
route_lock.read_lock ();
|
||||
route_lock.reader_lock ();
|
||||
}
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
|
|
@ -559,7 +563,7 @@ Session::set_worst_io_latencies (bool take_lock)
|
|||
}
|
||||
|
||||
if (take_lock) {
|
||||
route_lock.unlock ();
|
||||
route_lock.reader_unlock ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -794,10 +798,12 @@ Session::when_engine_running ()
|
|||
|
||||
_engine.set_session (this);
|
||||
|
||||
#ifdef HAVE_LIBLO
|
||||
/* and to OSC */
|
||||
|
||||
osc->set_session (*this);
|
||||
|
||||
#endif
|
||||
|
||||
_state_of_the_state = Clean;
|
||||
|
||||
DirtyChanged (); /* EMIT SIGNAL */
|
||||
|
|
@ -954,7 +960,7 @@ Session::set_auto_input (bool yn)
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -972,7 +978,7 @@ void
|
|||
Session::reset_input_monitor_state ()
|
||||
{
|
||||
if (transport_rolling()) {
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -980,7 +986,7 @@ Session::reset_input_monitor_state ()
|
|||
}
|
||||
}
|
||||
} else {
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
//cerr << "switching to input = " << !auto_input << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -1247,8 +1253,8 @@ void
|
|||
Session::enable_record ()
|
||||
{
|
||||
/* XXX really atomic compare+swap here */
|
||||
if (atomic_read (&_record_status) != Recording) {
|
||||
atomic_set (&_record_status, Recording);
|
||||
if (g_atomic_int_get (&_record_status) != Recording) {
|
||||
g_atomic_int_set (&_record_status, Recording);
|
||||
_last_record_location = _transport_frame;
|
||||
send_mmc_in_another_thread (MIDI::MachineControl::cmdRecordStrobe);
|
||||
|
||||
|
|
@ -1257,7 +1263,7 @@ Session::enable_record ()
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
|
|
@ -1275,13 +1281,13 @@ Session::disable_record (bool rt_context, bool force)
|
|||
{
|
||||
RecordState rs;
|
||||
|
||||
if ((rs = (RecordState) atomic_read (&_record_status)) != Disabled) {
|
||||
if ((rs = (RecordState) g_atomic_int_get (&_record_status)) != Disabled) {
|
||||
|
||||
if (!Config->get_latched_record_enable () || force) {
|
||||
atomic_set (&_record_status, Disabled);
|
||||
g_atomic_int_set (&_record_status, Disabled);
|
||||
} else {
|
||||
if (rs == Recording) {
|
||||
atomic_set (&_record_status, Enabled);
|
||||
g_atomic_int_set (&_record_status, Enabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1292,7 +1298,7 @@ Session::disable_record (bool rt_context, bool force)
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
|
|
@ -1312,14 +1318,14 @@ Session::disable_record (bool rt_context, bool force)
|
|||
void
|
||||
Session::step_back_from_record ()
|
||||
{
|
||||
atomic_set (&_record_status, Enabled);
|
||||
g_atomic_int_set (&_record_status, Enabled);
|
||||
|
||||
if (Config->get_use_hardware_monitoring()) {
|
||||
/* Even though this can be called from RT context we are using
|
||||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if (auto_input && (*i)->record_enabled ()) {
|
||||
|
|
@ -1333,7 +1339,7 @@ Session::step_back_from_record ()
|
|||
void
|
||||
Session::maybe_enable_record ()
|
||||
{
|
||||
atomic_set (&_record_status, Enabled);
|
||||
g_atomic_int_set (&_record_status, Enabled);
|
||||
|
||||
/* XXX this save should really happen in another thread. its needed so that
|
||||
pending capture state can be recovered if we crash.
|
||||
|
|
@ -1441,8 +1447,8 @@ Session::set_block_size (jack_nframes_t nframes)
|
|||
*/
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
vector<Sample*>::iterator i;
|
||||
uint32_t np;
|
||||
|
||||
|
|
@ -1519,7 +1525,7 @@ Session::set_default_fade (float steepness, float fade_msecs)
|
|||
|
||||
{
|
||||
// jlc, WTF is this!
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
AudioRegion::set_default_fade (steepness, fade_frames);
|
||||
}
|
||||
|
||||
|
|
@ -1670,7 +1676,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod
|
|||
/* count existing audio tracks */
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (dynamic_cast<AudioTrack*>(*i) != 0) {
|
||||
if (!(*i)->hidden()) {
|
||||
|
|
@ -1786,7 +1792,7 @@ Session::new_audio_route (int input_channels, int output_channels)
|
|||
/* count existing audio busses */
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (dynamic_cast<AudioTrack*>(*i) == 0) {
|
||||
if (!(*i)->hidden()) {
|
||||
|
|
@ -1869,7 +1875,7 @@ void
|
|||
Session::add_route (Route* route)
|
||||
{
|
||||
{
|
||||
RWLockMonitor lm (route_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (route_lock);
|
||||
routes.push_front (route);
|
||||
resort_routes(0);
|
||||
}
|
||||
|
|
@ -1900,7 +1906,7 @@ Session::add_diskstream (DiskStream* dstream)
|
|||
dstream->do_refill(0, 0, 0);
|
||||
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (diskstream_lock);
|
||||
diskstreams.push_back (dstream);
|
||||
}
|
||||
|
||||
|
|
@ -1928,7 +1934,7 @@ void
|
|||
Session::remove_route (Route& route)
|
||||
{
|
||||
{
|
||||
RWLockMonitor lm (route_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (route_lock);
|
||||
routes.remove (&route);
|
||||
|
||||
/* deleting the master out seems like a dumb
|
||||
|
|
@ -1956,7 +1962,7 @@ Session::remove_route (Route& route)
|
|||
}
|
||||
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (diskstream_lock);
|
||||
|
||||
AudioTrack* at;
|
||||
|
||||
|
|
@ -1992,7 +1998,7 @@ Session::route_solo_changed (void* src, Route* route)
|
|||
return;
|
||||
}
|
||||
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
bool is_track;
|
||||
|
||||
is_track = (dynamic_cast<AudioTrack*>(route) != 0);
|
||||
|
|
@ -2191,14 +2197,14 @@ Session::catch_up_on_solo ()
|
|||
basis, but needs the global overview that only the session
|
||||
has.
|
||||
*/
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
update_route_solo_state();
|
||||
}
|
||||
|
||||
Route *
|
||||
Session::route_by_name (string name)
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if ((*i)->name() == name) {
|
||||
|
|
@ -2212,7 +2218,7 @@ Session::route_by_name (string name)
|
|||
Route *
|
||||
Session::route_by_remote_id (uint32_t id)
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if ((*i)->remote_control_id() == id) {
|
||||
|
|
@ -2262,7 +2268,7 @@ Session::get_maximum_extent () const
|
|||
DiskStream *
|
||||
Session::diskstream_by_name (string name)
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->name() == name) {
|
||||
|
|
@ -2276,7 +2282,7 @@ Session::diskstream_by_name (string name)
|
|||
DiskStream *
|
||||
Session::diskstream_by_id (id_t id)
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->id() == id) {
|
||||
|
|
@ -2348,7 +2354,7 @@ Session::region_name (string& result, string base, bool newlevel) const
|
|||
|
||||
if (base == "") {
|
||||
|
||||
LockMonitor lm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
|
||||
snprintf (buf, sizeof (buf), "%d", (int)audio_regions.size() + 1);
|
||||
|
||||
|
|
@ -2376,7 +2382,7 @@ Session::region_name (string& result, string base, bool newlevel) const
|
|||
bool name_taken = true;
|
||||
|
||||
{
|
||||
LockMonitor lm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
|
||||
for (int n = 1; n < 5000; ++n) {
|
||||
|
||||
|
|
@ -2415,7 +2421,7 @@ Session::add_region (Region* region)
|
|||
bool added = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
|
||||
if ((ar = dynamic_cast<AudioRegion*> (region)) != 0) {
|
||||
|
||||
|
|
@ -2492,7 +2498,7 @@ Session::remove_region (Region* region)
|
|||
bool removed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
|
||||
if ((ar = dynamic_cast<AudioRegion*> (region)) != 0) {
|
||||
if ((i = audio_regions.find (region->id())) != audio_regions.end()) {
|
||||
|
|
@ -2523,7 +2529,7 @@ Session::find_whole_file_parent (AudioRegion& child)
|
|||
{
|
||||
AudioRegionList::iterator i;
|
||||
AudioRegion* region;
|
||||
LockMonitor lm (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (region_lock);
|
||||
|
||||
for (i = audio_regions.begin(); i != audio_regions.end(); ++i) {
|
||||
|
||||
|
|
@ -2599,7 +2605,7 @@ Session::remove_last_capture ()
|
|||
{
|
||||
list<Region*> r;
|
||||
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
list<Region*>& l = (*i)->last_capture_regions();
|
||||
|
|
@ -2629,7 +2635,7 @@ Session::add_source (Source* source)
|
|||
pair<SourceList::key_type, SourceList::mapped_type> entry;
|
||||
|
||||
{
|
||||
LockMonitor lm (source_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (source_lock);
|
||||
entry.first = source->id();
|
||||
entry.second = source;
|
||||
sources.insert (entry);
|
||||
|
|
@ -2647,7 +2653,7 @@ Session::remove_source (Source* source)
|
|||
SourceList::iterator i;
|
||||
|
||||
{
|
||||
LockMonitor lm (source_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (source_lock);
|
||||
|
||||
if ((i = sources.find (source->id())) != sources.end()) {
|
||||
sources.erase (i);
|
||||
|
|
@ -2669,7 +2675,7 @@ Session::remove_source (Source* source)
|
|||
Source *
|
||||
Session::get_source (ARDOUR::id_t id)
|
||||
{
|
||||
LockMonitor lm (source_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (source_lock);
|
||||
SourceList::iterator i;
|
||||
Source* source = 0;
|
||||
|
||||
|
|
@ -2687,8 +2693,8 @@ Session::peak_path_from_audio_path (string audio_path)
|
|||
|
||||
string res;
|
||||
|
||||
res = PBD::dirname (audio_path);
|
||||
res = PBD::dirname (res);
|
||||
res = Glib::path_get_dirname (audio_path);
|
||||
res = Glib::path_get_dirname (res);
|
||||
res += '/';
|
||||
res += peak_dir_name;
|
||||
res += '/';
|
||||
|
|
@ -2702,7 +2708,7 @@ string
|
|||
Session::change_audio_path_by_name (string path, string oldname, string newname, bool destructive)
|
||||
{
|
||||
string look_for;
|
||||
string old_basename = basename_nosuffix (oldname);
|
||||
string old_basename = PBD::basename_nosuffix (oldname);
|
||||
string new_legalized = legalize_for_path (newname);
|
||||
|
||||
/* note: we know (or assume) the old path is already valid */
|
||||
|
|
@ -2915,7 +2921,7 @@ Session::get_playlist (string name)
|
|||
Playlist *
|
||||
Session::playlist_by_name (string name)
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||
if ((*i)->name() == name) {
|
||||
return* i;
|
||||
|
|
@ -2937,7 +2943,7 @@ Session::add_playlist (Playlist* playlist)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
if (find (playlists.begin(), playlists.end(), playlist) == playlists.end()) {
|
||||
playlists.insert (playlists.begin(), playlist);
|
||||
// playlist->ref();
|
||||
|
|
@ -2957,7 +2963,7 @@ Session::track_playlist (Playlist* pl, bool inuse)
|
|||
PlaylistList::iterator x;
|
||||
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
|
||||
if (!inuse) {
|
||||
//cerr << "shifting playlist to unused: " << pl->name() << endl;
|
||||
|
|
@ -2989,7 +2995,7 @@ Session::remove_playlist (Playlist* playlist)
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
// cerr << "removing playlist: " << playlist->name() << endl;
|
||||
|
||||
PlaylistList::iterator i;
|
||||
|
|
@ -3105,7 +3111,7 @@ void
|
|||
Session::set_all_solo (bool yn)
|
||||
{
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (!(*i)->hidden()) {
|
||||
|
|
@ -3121,7 +3127,7 @@ void
|
|||
Session::set_all_mute (bool yn)
|
||||
{
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (!(*i)->hidden()) {
|
||||
|
|
@ -3136,7 +3142,7 @@ Session::set_all_mute (bool yn)
|
|||
uint32_t
|
||||
Session::n_diskstreams () const
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
uint32_t n = 0;
|
||||
|
||||
for (DiskStreamList::const_iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
|
|
@ -3150,7 +3156,7 @@ Session::n_diskstreams () const
|
|||
void
|
||||
Session::foreach_diskstream (void (DiskStream::*func)(void))
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if (!(*i)->hidden()) {
|
||||
((*i)->*func)();
|
||||
|
|
@ -3169,8 +3175,8 @@ Session::graph_reordered ()
|
|||
return;
|
||||
}
|
||||
|
||||
RWLockMonitor lm1 (route_lock, true, __LINE__, __FILE__);
|
||||
RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm1 (route_lock);
|
||||
Glib::RWLock::ReaderLock lm2 (diskstream_lock);
|
||||
|
||||
resort_routes (0);
|
||||
|
||||
|
|
@ -3198,7 +3204,7 @@ Session::record_enable_all ()
|
|||
void
|
||||
Session::record_enable_change_all (bool yn)
|
||||
{
|
||||
RWLockMonitor lm1 (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm1 (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
AudioTrack* at;
|
||||
|
|
@ -3283,7 +3289,7 @@ void
|
|||
Session::add_connection (ARDOUR::Connection* connection)
|
||||
{
|
||||
{
|
||||
LockMonitor (connection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock guard (connection_lock);
|
||||
_connections.push_back (connection);
|
||||
}
|
||||
|
||||
|
|
@ -3298,7 +3304,7 @@ Session::remove_connection (ARDOUR::Connection* connection)
|
|||
bool removed = false;
|
||||
|
||||
{
|
||||
LockMonitor (connection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock guard (connection_lock);
|
||||
ConnectionList::iterator i = find (_connections.begin(), _connections.end(), connection);
|
||||
|
||||
if (i != _connections.end()) {
|
||||
|
|
@ -3317,7 +3323,7 @@ Session::remove_connection (ARDOUR::Connection* connection)
|
|||
ARDOUR::Connection *
|
||||
Session::connection_by_name (string name) const
|
||||
{
|
||||
LockMonitor lm (connection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (connection_lock);
|
||||
|
||||
for (ConnectionList::const_iterator i = _connections.begin(); i != _connections.end(); ++i) {
|
||||
if ((*i)->name() == name) {
|
||||
|
|
@ -3334,7 +3340,7 @@ Session::set_edit_mode (EditMode mode)
|
|||
_edit_mode = mode;
|
||||
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
|
||||
for (PlaylistList::iterator i = playlists.begin(); i != playlists.end(); ++i) {
|
||||
(*i)->set_edit_mode (mode);
|
||||
|
|
@ -3409,7 +3415,7 @@ Session::next_insert_name ()
|
|||
NamedSelection *
|
||||
Session::named_selection_by_name (string name)
|
||||
{
|
||||
LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (named_selection_lock);
|
||||
for (NamedSelectionList::iterator i = named_selections.begin(); i != named_selections.end(); ++i) {
|
||||
if ((*i)->name == name) {
|
||||
return* i;
|
||||
|
|
@ -3422,7 +3428,7 @@ void
|
|||
Session::add_named_selection (NamedSelection* named_selection)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (named_selection_lock);
|
||||
named_selections.insert (named_selections.begin(), named_selection);
|
||||
}
|
||||
|
||||
|
|
@ -3437,7 +3443,7 @@ Session::remove_named_selection (NamedSelection* named_selection)
|
|||
bool removed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (named_selection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (named_selection_lock);
|
||||
|
||||
NamedSelectionList::iterator i = find (named_selections.begin(), named_selections.end(), named_selection);
|
||||
|
||||
|
|
@ -3459,7 +3465,7 @@ Session::reset_native_file_format ()
|
|||
{
|
||||
// jlc - WHY take routelock?
|
||||
//RWLockMonitor lm1 (route_lock, true, __LINE__, __FILE__);
|
||||
RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm2 (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
(*i)->reset_write_sources (false);
|
||||
|
|
@ -3469,7 +3475,7 @@ Session::reset_native_file_format ()
|
|||
bool
|
||||
Session::route_name_unique (string n) const
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if ((*i)->name() == n) {
|
||||
|
|
@ -3489,7 +3495,7 @@ Session::remove_file_source (FileSource& fs)
|
|||
uint32_t
|
||||
Session::n_playlists () const
|
||||
{
|
||||
LockMonitor lm (playlist_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (playlist_lock);
|
||||
return playlists.size();
|
||||
}
|
||||
|
||||
|
|
@ -3538,7 +3544,7 @@ Session::add_instant_xml (XMLNode& node, const std::string& dir)
|
|||
int
|
||||
Session::freeze (InterThreadInfo& itt)
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
|
||||
|
|
@ -3573,7 +3579,7 @@ Session::write_one_track (AudioTrack& track, jack_nframes_t start, jack_nframes_
|
|||
char * workbuf = 0;
|
||||
const jack_nframes_t chunk_size = (256 * 1024)/4;
|
||||
|
||||
atomic_set (&processing_prohibited, 1);
|
||||
g_atomic_int_set (&processing_prohibited, 1);
|
||||
|
||||
/* call tree *MUST* hold route_lock */
|
||||
|
||||
|
|
@ -3694,7 +3700,7 @@ Session::write_one_track (AudioTrack& track, jack_nframes_t start, jack_nframes_
|
|||
delete [] workbuf;
|
||||
}
|
||||
|
||||
atomic_set (&processing_prohibited, 0);
|
||||
g_atomic_int_set (&processing_prohibited, 0);
|
||||
|
||||
itt.done = true;
|
||||
|
||||
|
|
@ -3714,7 +3720,7 @@ uint32_t
|
|||
Session::ntracks () const
|
||||
{
|
||||
uint32_t n = 0;
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (dynamic_cast<AudioTrack*> (*i)) {
|
||||
|
|
@ -3729,7 +3735,7 @@ uint32_t
|
|||
Session::nbusses () const
|
||||
{
|
||||
uint32_t n = 0;
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::const_iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (dynamic_cast<AudioTrack*> (*i) == 0) {
|
||||
|
|
|
|||
|
|
@ -26,8 +26,9 @@
|
|||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
#include <ardour/configuration.h>
|
||||
|
|
@ -73,8 +74,6 @@ Session::start_butler_thread ()
|
|||
|
||||
Crossfade::set_buffer_size (dstream_buffer_size);
|
||||
|
||||
pthread_cond_init (&butler_paused, 0);
|
||||
|
||||
butler_should_run = false;
|
||||
|
||||
if (pipe (butler_request_pipe)) {
|
||||
|
|
@ -114,7 +113,7 @@ Session::terminate_butler_thread ()
|
|||
void
|
||||
Session::schedule_butler_transport_work ()
|
||||
{
|
||||
atomic_inc (&butler_should_do_transport_work);
|
||||
g_atomic_int_inc (&butler_should_do_transport_work);
|
||||
summon_butler ();
|
||||
}
|
||||
|
||||
|
|
@ -135,19 +134,19 @@ Session::summon_butler ()
|
|||
void
|
||||
Session::stop_butler ()
|
||||
{
|
||||
LockMonitor lm (butler_request_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (butler_request_lock);
|
||||
char c = ButlerRequest::Pause;
|
||||
::write (butler_request_pipe[1], &c, 1);
|
||||
pthread_cond_wait (&butler_paused, butler_request_lock.mutex());
|
||||
butler_paused.wait(butler_request_lock);
|
||||
}
|
||||
|
||||
void
|
||||
Session::wait_till_butler_finished ()
|
||||
{
|
||||
LockMonitor lm (butler_request_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (butler_request_lock);
|
||||
char c = ButlerRequest::Wake;
|
||||
::write (butler_request_pipe[1], &c, 1);
|
||||
pthread_cond_wait (&butler_paused, butler_request_lock.mutex());
|
||||
butler_paused.wait(butler_request_lock);
|
||||
}
|
||||
|
||||
void *
|
||||
|
|
@ -158,7 +157,7 @@ Session::_butler_thread_work (void* arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define transport_work_requested() atomic_read(&butler_should_do_transport_work)
|
||||
#define transport_work_requested() g_atomic_int_get(&butler_should_do_transport_work)
|
||||
|
||||
void *
|
||||
Session::butler_thread_work ()
|
||||
|
|
@ -256,7 +255,7 @@ Session::butler_thread_work ()
|
|||
|
||||
gettimeofday (&begin, 0);
|
||||
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
|
||||
for (i = diskstreams.begin(); !transport_work_requested() && butler_should_run && i != diskstreams.end(); ++i) {
|
||||
|
||||
|
|
@ -355,7 +354,7 @@ Session::butler_thread_work ()
|
|||
|
||||
|
||||
{
|
||||
LockMonitor lm (butler_request_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (butler_request_lock);
|
||||
|
||||
if (butler_should_run && (disk_work_outstanding || transport_work_requested())) {
|
||||
// for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
|
|
@ -365,7 +364,7 @@ Session::butler_thread_work ()
|
|||
continue;
|
||||
}
|
||||
|
||||
pthread_cond_signal (&butler_paused);
|
||||
butler_paused.signal();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -398,7 +397,7 @@ Session::overwrite_some_buffers (DiskStream* ds)
|
|||
|
||||
} else {
|
||||
|
||||
RWLockMonitor dm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
(*i)->set_pending_overwrite (true);
|
||||
}
|
||||
|
|
@ -429,36 +428,36 @@ Session::write_data_rate () const
|
|||
uint32_t
|
||||
Session::playback_load ()
|
||||
{
|
||||
return (uint32_t) atomic_read (&_playback_load);
|
||||
return (uint32_t) g_atomic_int_get (&_playback_load);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Session::capture_load ()
|
||||
{
|
||||
return (uint32_t) atomic_read (&_capture_load);
|
||||
return (uint32_t) g_atomic_int_get (&_capture_load);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Session::playback_load_min ()
|
||||
{
|
||||
return (uint32_t) atomic_read (&_playback_load_min);
|
||||
return (uint32_t) g_atomic_int_get (&_playback_load_min);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
Session::capture_load_min ()
|
||||
{
|
||||
return (uint32_t) atomic_read (&_capture_load_min);
|
||||
return (uint32_t) g_atomic_int_get (&_capture_load_min);
|
||||
}
|
||||
|
||||
void
|
||||
Session::reset_capture_load_min ()
|
||||
{
|
||||
atomic_set (&_capture_load_min, 100);
|
||||
g_atomic_int_set (&_capture_load_min, 100);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Session::reset_playback_load_min ()
|
||||
{
|
||||
atomic_set (&_playback_load_min, 100);
|
||||
g_atomic_int_set (&_playback_load_min, 100);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Session::click (jack_nframes_t start, jack_nframes_t nframes, jack_nframes_t off
|
|||
return;
|
||||
}
|
||||
|
||||
TentativeRWLockMonitor clickm (click_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (!clickm.locked() || _transport_speed != 1.0 || !_clicking || click_data == 0) {
|
||||
_click_io->silence (nframes, offset);
|
||||
|
|
@ -209,7 +209,7 @@ Session::setup_click_sounds (int which)
|
|||
void
|
||||
Session::clear_clicks ()
|
||||
{
|
||||
RWLockMonitor lm (click_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (click_lock);
|
||||
|
||||
for (Clicks::iterator i = clicks.begin(); i != clicks.end(); ++i) {
|
||||
delete *i;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include <ardour/timestamps.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/session.h>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include <sigc++/bind.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/gdither.h>
|
||||
#include <ardour/timestamps.h>
|
||||
|
|
@ -485,7 +485,7 @@ Session::prepare_to_export (AudioExportSpecification& spec)
|
|||
/* take everyone out of awrite to avoid disasters */
|
||||
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
(*i)->protect_automation ();
|
||||
}
|
||||
|
|
@ -494,7 +494,7 @@ Session::prepare_to_export (AudioExportSpecification& spec)
|
|||
/* get everyone to the right position */
|
||||
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)-> seek (spec.start_frame, true)) {
|
||||
error << string_compose (_("%1: cannot seek to %2 for export"),
|
||||
|
|
@ -524,7 +524,7 @@ Session::prepare_to_export (AudioExportSpecification& spec)
|
|||
|
||||
set_transport_speed (1.0, false);
|
||||
butler_transport_work ();
|
||||
atomic_set (&butler_should_do_transport_work, 0);
|
||||
g_atomic_int_set (&butler_should_do_transport_work, 0);
|
||||
post_transport ();
|
||||
|
||||
/* we are ready to go ... */
|
||||
|
|
|
|||
|
|
@ -28,8 +28,10 @@
|
|||
#include <midi++/types.h>
|
||||
#include <midi++/port.h>
|
||||
#include <midi++/manager.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
#include <ardour/configuration.h>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <midi++/port.h>
|
||||
#include <midi++/manager.h>
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
#include <ardour/configuration.h>
|
||||
|
|
@ -110,7 +110,7 @@ Session::set_midi_control (bool yn)
|
|||
poke_midi_thread ();
|
||||
|
||||
if (_midi_port) {
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock guard (route_lock);
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
(*i)->reset_midi_control (_midi_port, midi_control);
|
||||
}
|
||||
|
|
@ -601,7 +601,7 @@ Session::mmc_record_strobe (MIDI::MachineControl &mmc)
|
|||
*/
|
||||
|
||||
save_state ("", true);
|
||||
atomic_set (&_record_status, Enabled);
|
||||
g_atomic_int_set (&_record_status, Enabled);
|
||||
RecordStateChanged (); /* EMIT SIGNAL */
|
||||
|
||||
request_transport_speed (1.0);
|
||||
|
|
@ -783,7 +783,7 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
|
|||
if (mmc_control) {
|
||||
|
||||
RouteList::iterator i;
|
||||
RWLockMonitor (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock guard (route_lock);
|
||||
|
||||
for (i = routes.begin(); i != routes.end(); ++i) {
|
||||
AudioTrack *at;
|
||||
|
|
@ -908,7 +908,7 @@ Session::send_full_time_code ()
|
|||
msg[8] = smpte.frames;
|
||||
|
||||
{
|
||||
LockMonitor lm (midi_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (midi_lock);
|
||||
|
||||
if (_mtc_port->midimsg (msg, sizeof (msg))) {
|
||||
error << _("Session: could not send full MIDI time code") << endmsg;
|
||||
|
|
@ -940,7 +940,7 @@ Session::send_midi_time_code ()
|
|||
|
||||
// Send quarter frames up to current time
|
||||
{
|
||||
LockMonitor lm (midi_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (midi_lock);
|
||||
|
||||
switch(next_quarter_frame_to_send) {
|
||||
case 0:
|
||||
|
|
@ -1075,7 +1075,7 @@ Session::deliver_mmc (MIDI::MachineControl::Command cmd, jack_nframes_t where)
|
|||
|
||||
mmc_buffer[nbytes++] = 0xf7; // terminate SysEx/MMC message
|
||||
|
||||
LockMonitor lm (midi_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (midi_lock);
|
||||
|
||||
if (_mmc_port->write (mmc_buffer, nbytes) != nbytes) {
|
||||
error << string_compose(_("MMC: cannot send command %1%2%3"), &hex, cmd, &dec) << endmsg;
|
||||
|
|
|
|||
|
|
@ -23,14 +23,13 @@
|
|||
#include <algorithm>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <ardour/timestamps.h>
|
||||
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/atomic.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <ardour/session.h>
|
||||
#include <ardour/timestamps.h>
|
||||
#include <ardour/diskstream.h>
|
||||
#include <ardour/audioengine.h>
|
||||
#include <ardour/slave.h>
|
||||
|
|
@ -54,7 +53,7 @@ Session::process (jack_nframes_t nframes)
|
|||
}
|
||||
|
||||
if (non_realtime_work_pending()) {
|
||||
if (atomic_read (&butler_should_do_transport_work) == 0) {
|
||||
if (g_atomic_int_get (&butler_should_do_transport_work) == 0) {
|
||||
post_transport ();
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +84,7 @@ Session::no_roll (jack_nframes_t nframes, jack_nframes_t offset)
|
|||
this is really bad ...
|
||||
*/
|
||||
|
||||
if (atomic_read (&processing_prohibited)) {
|
||||
if (g_atomic_int_get (&processing_prohibited)) {
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
(*i)->silence (nframes, offset);
|
||||
}
|
||||
|
|
@ -222,15 +221,15 @@ Session::commit_diskstreams (jack_nframes_t nframes, bool &needs_butler)
|
|||
cworst = min (cworst, (*i)->capture_buffer_load());
|
||||
}
|
||||
|
||||
uint32_t pmin = atomic_read (&_playback_load);
|
||||
uint32_t pminold = atomic_read (&_playback_load_min);
|
||||
uint32_t cmin = atomic_read (&_capture_load);
|
||||
uint32_t cminold = atomic_read (&_capture_load_min);
|
||||
uint32_t pmin = g_atomic_int_get (&_playback_load);
|
||||
uint32_t pminold = g_atomic_int_get (&_playback_load_min);
|
||||
uint32_t cmin = g_atomic_int_get (&_capture_load);
|
||||
uint32_t cminold = g_atomic_int_get (&_capture_load_min);
|
||||
|
||||
atomic_set (&_playback_load, (uint32_t) floor (pworst * 100.0f));
|
||||
atomic_set (&_capture_load, (uint32_t) floor (cworst * 100.0f));
|
||||
atomic_set (&_playback_load_min, min (pmin, pminold));
|
||||
atomic_set (&_capture_load_min, min (cmin, cminold));
|
||||
g_atomic_int_set (&_playback_load, (uint32_t) floor (pworst * 100.0f));
|
||||
g_atomic_int_set (&_capture_load, (uint32_t) floor (cworst * 100.0f));
|
||||
g_atomic_int_set (&_playback_load_min, min (pmin, pminold));
|
||||
g_atomic_int_set (&_capture_load_min, min (cmin, cminold));
|
||||
|
||||
if (actively_recording()) {
|
||||
set_dirty();
|
||||
|
|
@ -280,8 +279,8 @@ Session::process_with_events (jack_nframes_t nframes)
|
|||
end_frame = _transport_frame + nframes;
|
||||
|
||||
{
|
||||
TentativeRWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
|
||||
TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
|
||||
|
||||
Event* this_event;
|
||||
Events::iterator the_next_one;
|
||||
|
|
@ -557,7 +556,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
|
|||
if (slave_state == Waiting) {
|
||||
|
||||
// cerr << "waiting at " << slave_transport_frame << endl;
|
||||
TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (dsm.locked() && slave_transport_frame >= slave_wait_end) {
|
||||
// cerr << "\tstart at " << _transport_frame << endl;
|
||||
|
|
@ -679,7 +678,7 @@ Session::follow_slave (jack_nframes_t nframes, jack_nframes_t offset)
|
|||
|
||||
bool need_butler;
|
||||
|
||||
TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
|
||||
if (!dsm.locked()) {
|
||||
goto noroll;
|
||||
}
|
||||
|
|
@ -730,8 +729,8 @@ Session::process_without_events (jack_nframes_t nframes)
|
|||
long frames_moved;
|
||||
|
||||
{
|
||||
TentativeRWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
|
||||
TentativeRWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (!rm.locked() || !dsm.locked() || (post_transport_work & (PostTransportLocate|PostTransportStop))) {
|
||||
no_roll (nframes, 0);
|
||||
|
|
@ -802,7 +801,7 @@ Session::process_without_events (jack_nframes_t nframes)
|
|||
void
|
||||
Session::process_audition (jack_nframes_t nframes)
|
||||
{
|
||||
TentativeRWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rm (route_lock, Glib::TRY_LOCK);
|
||||
Event* ev;
|
||||
|
||||
if (rm.locked()) {
|
||||
|
|
|
|||
|
|
@ -44,14 +44,15 @@
|
|||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <glibmm.h>
|
||||
|
||||
#include <midi++/mmc.h>
|
||||
#include <midi++/port.h>
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/dirname.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/pathscanner.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
#include <pbd/basename.h>
|
||||
#include <pbd/strsplit.h>
|
||||
|
||||
#include <ardour/audioengine.h>
|
||||
|
|
@ -118,7 +119,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
|||
_tempo_map = new TempoMap (_current_frame_rate);
|
||||
_tempo_map->StateChanged.connect (mem_fun (*this, &Session::tempo_map_changed));
|
||||
|
||||
atomic_set (&processing_prohibited, 0);
|
||||
g_atomic_int_set (&processing_prohibited, 0);
|
||||
send_cnt = 0;
|
||||
insert_cnt = 0;
|
||||
_transport_speed = 0;
|
||||
|
|
@ -129,7 +130,7 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
|||
end_location = new Location (0, 0, _("end"), Location::Flags ((Location::IsMark|Location::IsEnd)));
|
||||
start_location = new Location (0, 0, _("start"), Location::Flags ((Location::IsMark|Location::IsStart)));
|
||||
_end_location_is_free = true;
|
||||
atomic_set (&_record_status, Disabled);
|
||||
g_atomic_int_set (&_record_status, Disabled);
|
||||
auto_play = false;
|
||||
punch_in = false;
|
||||
punch_out = false;
|
||||
|
|
@ -170,12 +171,12 @@ Session::first_stage_init (string fullpath, string snapshot_name)
|
|||
midi_control = true;
|
||||
mmc = 0;
|
||||
post_transport_work = PostTransportWork (0);
|
||||
atomic_set (&butler_should_do_transport_work, 0);
|
||||
atomic_set (&butler_active, 0);
|
||||
atomic_set (&_playback_load, 100);
|
||||
atomic_set (&_capture_load, 100);
|
||||
atomic_set (&_playback_load_min, 100);
|
||||
atomic_set (&_capture_load_min, 100);
|
||||
g_atomic_int_set (&butler_should_do_transport_work, 0);
|
||||
g_atomic_int_set (&butler_active, 0);
|
||||
g_atomic_int_set (&_playback_load, 100);
|
||||
g_atomic_int_set (&_capture_load, 100);
|
||||
g_atomic_int_set (&_playback_load_min, 100);
|
||||
g_atomic_int_set (&_capture_load_min, 100);
|
||||
pending_audition_region = 0;
|
||||
_edit_mode = Slide;
|
||||
pending_edit_mode = _edit_mode;
|
||||
|
|
@ -1334,7 +1335,7 @@ Session::state(bool full_state)
|
|||
child = node->add_child ("Sources");
|
||||
|
||||
if (full_state) {
|
||||
LockMonitor sl (source_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock sl (source_lock);
|
||||
|
||||
for (SourceList::iterator siter = sources.begin(); siter != sources.end(); ++siter) {
|
||||
|
||||
|
|
@ -1363,7 +1364,7 @@ Session::state(bool full_state)
|
|||
child = node->add_child ("Regions");
|
||||
|
||||
if (full_state) {
|
||||
LockMonitor rl (region_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock rl (region_lock);
|
||||
|
||||
for (AudioRegionList::const_iterator i = audio_regions.begin(); i != audio_regions.end(); ++i) {
|
||||
|
||||
|
|
@ -1378,7 +1379,7 @@ Session::state(bool full_state)
|
|||
child = node->add_child ("DiskStreams");
|
||||
|
||||
{
|
||||
RWLockMonitor dl (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dl (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if (!(*i)->hidden()) {
|
||||
child->add_child_nocopy ((*i)->get_state());
|
||||
|
|
@ -1390,7 +1391,7 @@ Session::state(bool full_state)
|
|||
|
||||
child = node->add_child ("Connections");
|
||||
{
|
||||
LockMonitor lm (connection_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (connection_lock);
|
||||
for (ConnectionList::iterator i = _connections.begin(); i != _connections.end(); ++i) {
|
||||
if (!(*i)->system_dependent()) {
|
||||
child->add_child_nocopy ((*i)->get_state());
|
||||
|
|
@ -1400,7 +1401,7 @@ Session::state(bool full_state)
|
|||
|
||||
child = node->add_child ("Routes");
|
||||
{
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
RoutePublicOrderSorter cmp;
|
||||
RouteList public_order(routes);
|
||||
|
|
@ -1803,7 +1804,7 @@ Session::get_sources_as_xml ()
|
|||
|
||||
{
|
||||
XMLNode* node = new XMLNode (X_("Sources"));
|
||||
LockMonitor lm (source_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (source_lock);
|
||||
|
||||
for (SourceList::iterator i = sources.begin(); i != sources.end(); ++i) {
|
||||
node->add_child_nocopy ((*i).second->get_state());
|
||||
|
|
@ -1958,7 +1959,7 @@ Session::refresh_disk_space ()
|
|||
#if HAVE_SYS_VFS_H
|
||||
struct statfs statfsbuf;
|
||||
vector<space_and_path>::iterator i;
|
||||
LockMonitor lm (space_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (space_lock);
|
||||
double scale;
|
||||
|
||||
/* get freespace on every FS that is part of the session path */
|
||||
|
|
@ -2399,7 +2400,7 @@ Session::load_route_groups (const XMLNode& node, bool edit)
|
|||
void
|
||||
Session::swap_configuration(Configuration** new_config)
|
||||
{
|
||||
RWLockMonitor lm (route_lock, true, __LINE__, __FILE__); // jlc - WHY?
|
||||
Glib::RWLock::WriterLock lm (route_lock); // jlc - WHY?
|
||||
Configuration* tmp = *new_config;
|
||||
*new_config = Config;
|
||||
Config = tmp;
|
||||
|
|
@ -2409,7 +2410,7 @@ Session::swap_configuration(Configuration** new_config)
|
|||
void
|
||||
Session::copy_configuration(Configuration* new_config)
|
||||
{
|
||||
RWLockMonitor lm (route_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock lm (route_lock);
|
||||
new_config = new Configuration(*Config);
|
||||
}
|
||||
|
||||
|
|
@ -2588,7 +2589,7 @@ Session::GlobalRouteBooleanState
|
|||
Session::get_global_route_boolean (bool (Route::*method)(void) const)
|
||||
{
|
||||
GlobalRouteBooleanState s;
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (!(*i)->hidden()) {
|
||||
|
|
@ -2608,7 +2609,7 @@ Session::GlobalRouteMeterState
|
|||
Session::get_global_route_metering ()
|
||||
{
|
||||
GlobalRouteMeterState s;
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
if (!(*i)->hidden()) {
|
||||
|
|
@ -3065,13 +3066,13 @@ Session::cleanup_sources (Session::cleanup_report& rep)
|
|||
on whichever filesystem it was already on.
|
||||
*/
|
||||
|
||||
newpath = PBD::dirname (*x);
|
||||
newpath = PBD::dirname (newpath);
|
||||
newpath = Glib::path_get_dirname (*x);
|
||||
newpath = Glib::path_get_dirname (newpath);
|
||||
|
||||
newpath += '/';
|
||||
newpath += dead_sound_dir_name;
|
||||
newpath += '/';
|
||||
newpath += PBD::basename ((*x));
|
||||
newpath += Glib::path_get_basename ((*x));
|
||||
|
||||
if (access (newpath.c_str(), F_OK) == 0) {
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include <pbd/undo.h>
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
#include <midi++/mmc.h>
|
||||
|
|
@ -190,8 +190,8 @@ Session::realtime_stop (bool abort)
|
|||
void
|
||||
Session::butler_transport_work ()
|
||||
{
|
||||
RWLockMonitor rm (route_lock, false, __LINE__, __FILE__);
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock rm (route_lock);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
|
||||
if (post_transport_work & PostTransportCurveRealloc) {
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
|
|
@ -240,13 +240,13 @@ Session::butler_transport_work ()
|
|||
non_realtime_set_audition ();
|
||||
}
|
||||
|
||||
atomic_dec (&butler_should_do_transport_work);
|
||||
g_atomic_int_dec_and_test (&butler_should_do_transport_work);
|
||||
}
|
||||
|
||||
void
|
||||
Session::non_realtime_set_speed ()
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
(*i)->non_realtime_set_speed ();
|
||||
|
|
@ -256,7 +256,7 @@ Session::non_realtime_set_speed ()
|
|||
void
|
||||
Session::non_realtime_overwrite ()
|
||||
{
|
||||
RWLockMonitor lm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (diskstream_lock);
|
||||
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->pending_overwrite) {
|
||||
|
|
@ -395,9 +395,9 @@ Session::non_realtime_stop (bool abort)
|
|||
*/
|
||||
|
||||
if (!Config->get_latched_record_enable()) {
|
||||
atomic_set (&_record_status, Disabled);
|
||||
g_atomic_int_set (&_record_status, Disabled);
|
||||
} else {
|
||||
atomic_set (&_record_status, Enabled);
|
||||
g_atomic_int_set (&_record_status, Enabled);
|
||||
}
|
||||
RecordStateChanged (); /* emit signal */
|
||||
}
|
||||
|
|
@ -625,7 +625,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
|
|||
|
||||
/* this is functionally what clear_clicks() does but with a tentative lock */
|
||||
|
||||
TentativeRWLockMonitor clickm (click_lock, true, __LINE__, __FILE__);
|
||||
Glib::RWLock::WriterLock clickm (click_lock, Glib::TRY_LOCK);
|
||||
|
||||
if (clickm.locked()) {
|
||||
|
||||
|
|
@ -644,7 +644,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -659,7 +659,7 @@ Session::locate (jack_nframes_t target_frame, bool with_roll, bool with_flush, b
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
//cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -703,7 +703,7 @@ Session::set_transport_speed (float speed, bool abort)
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if ((*i)->record_enabled ()) {
|
||||
//cerr << "switching to input" << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -729,7 +729,7 @@ Session::set_transport_speed (float speed, bool abort)
|
|||
a non-tentative rwlock here, because the action must occur.
|
||||
The rarity and short potential lock duration makes this "OK"
|
||||
*/
|
||||
RWLockMonitor dsm (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock dsm (diskstream_lock);
|
||||
for (DiskStreamList::iterator i = diskstreams.begin(); i != diskstreams.end(); ++i) {
|
||||
if (auto_input && (*i)->record_enabled ()) {
|
||||
//cerr << "switching from input" << __FILE__ << __LINE__ << endl << endl;
|
||||
|
|
@ -1156,7 +1156,7 @@ Session::engine_halted ()
|
|||
the picture.
|
||||
*/
|
||||
|
||||
atomic_set (&butler_should_do_transport_work, 0);
|
||||
g_atomic_int_set (&butler_should_do_transport_work, 0);
|
||||
post_transport_work = PostTransportWork (0);
|
||||
stop_butler ();
|
||||
|
||||
|
|
@ -1192,8 +1192,8 @@ Session::update_latency_compensation (bool with_stop, bool abort)
|
|||
return;
|
||||
}
|
||||
|
||||
RWLockMonitor lm (route_lock, false, __LINE__, __FILE__);
|
||||
RWLockMonitor lm2 (diskstream_lock, false, __LINE__, __FILE__);
|
||||
Glib::RWLock::ReaderLock lm (route_lock);
|
||||
Glib::RWLock::ReaderLock lm2 (diskstream_lock);
|
||||
_worst_track_latency = 0;
|
||||
|
||||
for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) {
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ SndFileSource::read (Sample *dst, jack_nframes_t start, jack_nframes_t cnt, char
|
|||
real_cnt = cnt * _info.channels;
|
||||
|
||||
{
|
||||
LockMonitor lm (_tmpbuf_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_tmpbuf_lock);
|
||||
|
||||
if (tmpbufsize < real_cnt) {
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include <iomanip>
|
||||
#include <algorithm>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/xml++.h>
|
||||
#include <pbd/pthread_utils.h>
|
||||
|
||||
|
|
@ -41,13 +41,12 @@ using std::min;
|
|||
using std::max;
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace PBD;
|
||||
|
||||
sigc::signal<void,Source *> Source::SourceCreated;
|
||||
sigc::signal<void,Source *> Source::SourceCreated;
|
||||
pthread_t Source::peak_thread;
|
||||
bool Source::have_peak_thread = false;
|
||||
vector<Source*> Source::pending_peak_sources;
|
||||
PBD::Lock Source::pending_peak_sources_lock;
|
||||
Glib::StaticMutex Source::pending_peak_sources_lock = GLIBMM_STATIC_MUTEX_INIT;
|
||||
int Source::peak_request_pipe[2];
|
||||
|
||||
bool Source::_build_missing_peakfiles = false;
|
||||
|
|
@ -142,19 +141,19 @@ Source::peak_thread_work (void* arg)
|
|||
PBD::ThreadCreated (pthread_self(), X_("Peak"));
|
||||
struct pollfd pfd[1];
|
||||
|
||||
LockMonitor lm (pending_peak_sources_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (pending_peak_sources_lock);
|
||||
|
||||
while (true) {
|
||||
|
||||
pfd[0].fd = peak_request_pipe[0];
|
||||
pfd[0].events = POLLIN|POLLERR|POLLHUP;
|
||||
|
||||
pthread_mutex_unlock (pending_peak_sources_lock.mutex());
|
||||
pending_peak_sources_lock.unlock();
|
||||
|
||||
if (poll (pfd, 1, -1) < 0) {
|
||||
|
||||
if (errno == EINTR) {
|
||||
pthread_mutex_lock (pending_peak_sources_lock.mutex());
|
||||
pending_peak_sources_lock.lock();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -204,16 +203,16 @@ Source::peak_thread_work (void* arg)
|
|||
}
|
||||
}
|
||||
|
||||
pthread_mutex_lock (pending_peak_sources_lock.mutex());
|
||||
pending_peak_sources_lock.lock();
|
||||
|
||||
while (!pending_peak_sources.empty()) {
|
||||
|
||||
Source* s = pending_peak_sources.front();
|
||||
pending_peak_sources.erase (pending_peak_sources.begin());
|
||||
|
||||
pthread_mutex_unlock (pending_peak_sources_lock.mutex());
|
||||
pending_peak_sources_lock.unlock();
|
||||
s->build_peaks();
|
||||
pthread_mutex_lock (pending_peak_sources_lock.mutex());
|
||||
pending_peak_sources_lock.lock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -272,7 +271,7 @@ Source::queue_for_peaks (Source& source)
|
|||
{
|
||||
if (have_peak_thread) {
|
||||
|
||||
LockMonitor lm (pending_peak_sources_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (pending_peak_sources_lock);
|
||||
|
||||
source.next_peak_clear_should_notify = true;
|
||||
|
||||
|
|
@ -291,7 +290,7 @@ void Source::clear_queue_for_peaks ()
|
|||
{
|
||||
/* this is done to cancel a group of running peak builds */
|
||||
if (have_peak_thread) {
|
||||
LockMonitor lm (pending_peak_sources_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (pending_peak_sources_lock);
|
||||
pending_peak_sources.clear ();
|
||||
}
|
||||
}
|
||||
|
|
@ -301,7 +300,7 @@ bool
|
|||
Source::peaks_ready (sigc::slot<void> the_slot, sigc::connection& conn) const
|
||||
{
|
||||
bool ret;
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
/* check to see if the peak data is ready. if not
|
||||
connect the slot while still holding the lock.
|
||||
|
|
@ -388,7 +387,7 @@ Source::initialize_peakfile (bool newfile, string audio_path)
|
|||
int
|
||||
Source::read_peaks (PeakData *peaks, jack_nframes_t npeaks, jack_nframes_t start, jack_nframes_t cnt, double samples_per_visual_peak) const
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
double scale;
|
||||
double expected_peaks;
|
||||
PeakData::PeakDatum xmax;
|
||||
|
|
@ -699,7 +698,7 @@ Source::build_peaks ()
|
|||
list<PeakBuildRecord*> copy;
|
||||
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
copy = pending_peak_builds;
|
||||
pending_peak_builds.clear ();
|
||||
}
|
||||
|
|
@ -719,7 +718,7 @@ Source::build_peaks ()
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
|
||||
if (status == 0) {
|
||||
_peaks_built = true;
|
||||
|
|
@ -830,7 +829,7 @@ Source::do_build_peak (jack_nframes_t first_frame, jack_nframes_t cnt)
|
|||
void
|
||||
Source::build_peaks_from_scratch ()
|
||||
{
|
||||
LockMonitor lp (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lp (_lock);
|
||||
|
||||
next_peak_clear_should_notify = true;
|
||||
pending_peak_builds.push_back (new PeakBuildRecord (0, _length));
|
||||
|
|
@ -883,7 +882,7 @@ Source::available_peaks (double zoom_factor) const
|
|||
}
|
||||
|
||||
{
|
||||
LockMonitor lm (_lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (_lock);
|
||||
end = lseek (peakfile, 0, SEEK_END);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <sigc++/bind.h>
|
||||
|
||||
#include <pbd/lockmonitor.h>
|
||||
#include <glibmm/thread.h>
|
||||
#include <pbd/xml++.h>
|
||||
#include <ardour/tempo.h>
|
||||
#include <ardour/utils.h>
|
||||
|
|
@ -240,7 +240,7 @@ TempoMap::move_metric_section (MetricSection& section, const BBT_Time& when)
|
|||
return 1;
|
||||
}
|
||||
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
MetricSectionSorter cmp;
|
||||
BBT_Time corrected (when);
|
||||
|
||||
|
|
@ -283,7 +283,7 @@ TempoMap::remove_tempo (const TempoSection& tempo)
|
|||
bool removed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
Metrics::iterator i;
|
||||
|
||||
for (i = metrics->begin(); i != metrics->end(); ++i) {
|
||||
|
|
@ -310,7 +310,7 @@ TempoMap::remove_meter (const MeterSection& tempo)
|
|||
bool removed = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
Metrics::iterator i;
|
||||
|
||||
for (i = metrics->begin(); i != metrics->end(); ++i) {
|
||||
|
|
@ -361,7 +361,7 @@ void
|
|||
TempoMap::add_tempo (const Tempo& tempo, BBT_Time where)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
/* new tempos always start on a beat */
|
||||
|
||||
|
|
@ -381,7 +381,7 @@ TempoMap::replace_tempo (TempoSection& existing, const Tempo& replacement)
|
|||
bool replaced = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
Metrics::iterator i;
|
||||
|
||||
for (i = metrics->begin(); i != metrics->end(); ++i) {
|
||||
|
|
@ -411,7 +411,7 @@ void
|
|||
TempoMap::add_meter (const Meter& meter, BBT_Time where)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
/* a new meter always starts a new bar on the first beat. so
|
||||
round the start time appropriately. remember that
|
||||
|
|
@ -443,7 +443,7 @@ TempoMap::replace_meter (MeterSection& existing, const Meter& replacement)
|
|||
bool replaced = false;
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
Metrics::iterator i;
|
||||
|
||||
for (i = metrics->begin(); i != metrics->end(); ++i) {
|
||||
|
|
@ -611,7 +611,7 @@ TempoMap::metric_at (BBT_Time bbt) const
|
|||
void
|
||||
TempoMap::bbt_time (jack_nframes_t frame, BBT_Time& bbt) const
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
bbt_time_unlocked (frame, bbt);
|
||||
}
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ TempoMap::bbt_duration_at (jack_nframes_t pos, const BBT_Time& bbt, int dir) con
|
|||
bbt_time(pos,when);
|
||||
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
frames = bbt_duration_at_unlocked (when, bbt,dir);
|
||||
}
|
||||
|
||||
|
|
@ -896,7 +896,7 @@ TempoMap::bbt_duration_at_unlocked (const BBT_Time& when, const BBT_Time& bbt, i
|
|||
jack_nframes_t
|
||||
TempoMap::round_to_bar (jack_nframes_t fr, int dir)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
return round_to_type (fr, dir, Bar);
|
||||
}
|
||||
|
||||
|
|
@ -904,7 +904,7 @@ TempoMap::round_to_bar (jack_nframes_t fr, int dir)
|
|||
jack_nframes_t
|
||||
TempoMap::round_to_beat (jack_nframes_t fr, int dir)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
return round_to_type (fr, dir, Beat);
|
||||
}
|
||||
|
||||
|
|
@ -912,7 +912,7 @@ jack_nframes_t
|
|||
|
||||
TempoMap::round_to_beat_subdivision (jack_nframes_t fr, int sub_num)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
TempoMap::BBTPointList::iterator i;
|
||||
TempoMap::BBTPointList *more_zoomed_bbt_points;
|
||||
jack_nframes_t frame_one_beats_worth;
|
||||
|
|
@ -1185,7 +1185,7 @@ TempoMap::meter_at (jack_nframes_t frame)
|
|||
XMLNode&
|
||||
TempoMap::get_state ()
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
Metrics::const_iterator i;
|
||||
XMLNode *root = new XMLNode ("TempoMap");
|
||||
|
||||
|
|
@ -1200,7 +1200,7 @@ int
|
|||
TempoMap::set_state (const XMLNode& node)
|
||||
{
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
XMLNodeList nlist;
|
||||
XMLNodeConstIterator niter;
|
||||
|
|
@ -1292,7 +1292,7 @@ TempoMap::get_memento () const
|
|||
Change
|
||||
TempoMap::restore_state (StateManager::State& state)
|
||||
{
|
||||
LockMonitor lm (lock, __LINE__, __FILE__);
|
||||
Glib::Mutex::Lock lm (lock);
|
||||
|
||||
TempoMapState* tmstate = dynamic_cast<TempoMapState*> (&state);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <gtkmm2ext/fastmeter.h>
|
||||
#include <gtkmm2ext/utils.h>
|
||||
#include <gtkmm/style.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace Gtk;
|
||||
using namespace Gdk;
|
||||
|
|
@ -32,15 +33,15 @@ using namespace Glib;
|
|||
using namespace Gtkmm2ext;
|
||||
using namespace std;
|
||||
|
||||
string FastMeter::v_image_path;
|
||||
string FastMeter::h_image_path;
|
||||
RefPtr<Pixbuf> FastMeter::v_pixbuf;
|
||||
gint FastMeter::v_pixheight = 0;
|
||||
gint FastMeter::v_pixwidth = 0;
|
||||
|
||||
RefPtr<Pixbuf> FastMeter::h_pixbuf;
|
||||
gint FastMeter::h_pixheight = 0;
|
||||
gint FastMeter::h_pixwidth = 0;
|
||||
int FastMeter::min_v_pixbuf_size = 50;
|
||||
int FastMeter::max_v_pixbuf_size = 1024;
|
||||
Glib::RefPtr<Gdk::Pixbuf>* FastMeter::v_pixbuf_cache = 0;
|
||||
|
||||
int FastMeter::min_h_pixbuf_size = 50;
|
||||
int FastMeter::max_h_pixbuf_size = 1024;
|
||||
Glib::RefPtr<Gdk::Pixbuf>* FastMeter::h_pixbuf_cache = 0;
|
||||
|
||||
|
||||
FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
||||
{
|
||||
|
|
@ -56,46 +57,184 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o)
|
|||
pixrect.x = 0;
|
||||
pixrect.y = 0;
|
||||
|
||||
if (!v_image_path.empty() && v_pixbuf == 0) {
|
||||
v_pixbuf = Pixbuf::create_from_file (v_image_path);
|
||||
v_pixheight = v_pixbuf->get_height();
|
||||
v_pixwidth = v_pixbuf->get_width();
|
||||
}
|
||||
|
||||
if (!h_image_path.empty() && h_pixbuf == 0) {
|
||||
h_pixbuf = Pixbuf::create_from_file (h_image_path);
|
||||
h_pixheight = h_pixbuf->get_height();
|
||||
h_pixwidth = h_pixbuf->get_width();
|
||||
}
|
||||
|
||||
if (orientation == Vertical) {
|
||||
pixrect.width = min (v_pixwidth, (gint) dimen);
|
||||
pixrect.height = v_pixheight;
|
||||
pixbuf = request_vertical_meter(250);
|
||||
} else {
|
||||
pixrect.width = h_pixwidth;
|
||||
pixrect.height = min (h_pixheight, (gint) dimen);
|
||||
pixbuf = request_horizontal_meter(186);
|
||||
}
|
||||
|
||||
pixheight = pixbuf->get_height();
|
||||
pixwidth = pixbuf->get_width();
|
||||
|
||||
if (orientation == Vertical) {
|
||||
pixrect.width = min (pixwidth, (gint) dimen);
|
||||
pixrect.height = pixheight;
|
||||
} else {
|
||||
pixrect.width = pixwidth;
|
||||
pixrect.height = min (pixheight, (gint) dimen);
|
||||
}
|
||||
|
||||
request_width = pixrect.width;
|
||||
request_height= pixrect.height;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_vertical_meter(int length)
|
||||
{
|
||||
if (length < min_v_pixbuf_size)
|
||||
length = min_v_pixbuf_size;
|
||||
if (length > max_v_pixbuf_size)
|
||||
length = max_v_pixbuf_size;
|
||||
|
||||
int index = length - 1;
|
||||
|
||||
if (v_pixbuf_cache == 0) {
|
||||
v_pixbuf_cache = (Glib::RefPtr<Gdk::Pixbuf>*) malloc(sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_v_pixbuf_size);
|
||||
memset(v_pixbuf_cache,0,sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_v_pixbuf_size);
|
||||
}
|
||||
Glib::RefPtr<Gdk::Pixbuf> ret = v_pixbuf_cache[index];
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
guint8* data;
|
||||
int width = 5;
|
||||
int height = length;
|
||||
|
||||
data = (guint8*) malloc(width*height * 3);
|
||||
|
||||
guint8 r,g,b;
|
||||
r=0;
|
||||
g=255;
|
||||
b=0;
|
||||
|
||||
// fake log calculation copied from log_meter.h
|
||||
// actual calculation:
|
||||
// log_meter(0.0f) =
|
||||
// def = (0.0f + 20.0f) * 2.5f + 50f
|
||||
// return def / 115.0f
|
||||
int knee = (int)floor((float)height * 100.0f / 115.0f);
|
||||
|
||||
int y;
|
||||
|
||||
for (y = 0; y < knee / 2; y++) {
|
||||
|
||||
r = (guint8)floor(255.0 * (float)y/(float)(knee / 2));
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
data[ (x+(height-y-1)*width) * 3 + 0 ] = r;
|
||||
data[ (x+(height-y-1)*width) * 3 + 1 ] = g;
|
||||
data[ (x+(height-y-1)*width) * 3 + 2 ] = b;
|
||||
}
|
||||
}
|
||||
|
||||
for (; y < knee; y++) {
|
||||
|
||||
g = 255 - (guint8)floor(170.0 * (float)(y - knee/ 2)/(float)(knee / 2));
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
data[ (x+(height-y-1)*width) * 3 + 0 ] = r;
|
||||
data[ (x+(height-y-1)*width) * 3 + 1 ] = g;
|
||||
data[ (x+(height-y-1)*width) * 3 + 2 ] = b;
|
||||
}
|
||||
}
|
||||
|
||||
r=255;
|
||||
g=0;
|
||||
b=0;
|
||||
for (; y < height; y++) {
|
||||
for (int x = 0; x < width; x++) {
|
||||
data[ (x+(height-y-1)*width) * 3 + 0 ] = r;
|
||||
data[ (x+(height-y-1)*width) * 3 + 1 ] = g;
|
||||
data[ (x+(height-y-1)*width) * 3 + 2 ] = b;
|
||||
}
|
||||
}
|
||||
|
||||
ret = Pixbuf::create_from_data(data, COLORSPACE_RGB, false, 8, width, height, width * 3);
|
||||
v_pixbuf_cache[index] = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> FastMeter::request_horizontal_meter(int length)
|
||||
{
|
||||
if (length < min_h_pixbuf_size)
|
||||
length = min_h_pixbuf_size;
|
||||
if (length > max_h_pixbuf_size)
|
||||
length = max_h_pixbuf_size;
|
||||
|
||||
int index = length - 1;
|
||||
|
||||
if (h_pixbuf_cache == 0) {
|
||||
h_pixbuf_cache = (Glib::RefPtr<Gdk::Pixbuf>*) malloc(sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_h_pixbuf_size);
|
||||
memset(h_pixbuf_cache,0,sizeof(Glib::RefPtr<Gdk::Pixbuf>) * max_h_pixbuf_size);
|
||||
}
|
||||
Glib::RefPtr<Gdk::Pixbuf> ret = h_pixbuf_cache[index];
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
guint8* data;
|
||||
int width = length;
|
||||
int height = 5;
|
||||
|
||||
data = (guint8*) malloc(width*height * 3);
|
||||
|
||||
guint8 r,g,b;
|
||||
r=0;
|
||||
g=255;
|
||||
b=0;
|
||||
|
||||
// fake log calculation copied from log_meter.h
|
||||
// actual calculation:
|
||||
// log_meter(0.0f) =
|
||||
// def = (0.0f + 20.0f) * 2.5f + 50f
|
||||
// return def / 115.0f
|
||||
int knee = (int)floor((float)width * 100.0f / 115.0f);
|
||||
|
||||
int x;
|
||||
|
||||
for (x = 0; x < knee / 2; x++) {
|
||||
|
||||
r = (guint8)floor(255.0 * (float)x/(float)(knee / 2));
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
data[ (x+(height-y-1)*width) * 3 + 0 ] = r;
|
||||
data[ (x+(height-y-1)*width) * 3 + 1 ] = g;
|
||||
data[ (x+(height-y-1)*width) * 3 + 2 ] = b;
|
||||
}
|
||||
}
|
||||
|
||||
for (; x < knee; x++) {
|
||||
|
||||
g = 255 - (guint8)floor(170.0 * (float)(x - knee/ 2)/(float)(knee / 2));
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
data[ (x+(height-y-1)*width) * 3 + 0 ] = r;
|
||||
data[ (x+(height-y-1)*width) * 3 + 1 ] = g;
|
||||
data[ (x+(height-y-1)*width) * 3 + 2 ] = b;
|
||||
}
|
||||
}
|
||||
|
||||
r=255;
|
||||
g=0;
|
||||
b=0;
|
||||
for (; x < width; x++) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
data[ (x+(height-y-1)*width) * 3 + 0 ] = r;
|
||||
data[ (x+(height-y-1)*width) * 3 + 1 ] = g;
|
||||
data[ (x+(height-y-1)*width) * 3 + 2 ] = b;
|
||||
}
|
||||
}
|
||||
|
||||
ret = Pixbuf::create_from_data(data, COLORSPACE_RGB, false, 8, width, height, width * 3);
|
||||
h_pixbuf_cache[index] = ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
FastMeter::~FastMeter ()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::set_vertical_xpm (std::string path)
|
||||
{
|
||||
v_image_path = path;
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::set_horizontal_xpm (std::string path)
|
||||
{
|
||||
h_image_path = path;
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::set_hold_count (long val)
|
||||
{
|
||||
|
|
@ -113,8 +252,63 @@ FastMeter::set_hold_count (long val)
|
|||
void
|
||||
FastMeter::on_size_request (GtkRequisition* req)
|
||||
{
|
||||
req->width = request_width;
|
||||
req->height = request_height;
|
||||
if (orientation == Vertical) {
|
||||
req->height = request_height;
|
||||
|
||||
req->height = max(req->height, min_v_pixbuf_size);
|
||||
req->height = min(req->height, max_v_pixbuf_size);
|
||||
|
||||
req->width = 5;
|
||||
} else {
|
||||
req->width = request_width;
|
||||
|
||||
req->width = max(req->width, min_h_pixbuf_size);
|
||||
req->width = min(req->width, max_h_pixbuf_size);
|
||||
|
||||
req->height = 5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
FastMeter::on_size_allocate (Gtk::Allocation &alloc)
|
||||
{
|
||||
if (orientation == Vertical) {
|
||||
if (alloc.get_width() != 5) {
|
||||
alloc.set_width(5);
|
||||
}
|
||||
|
||||
int h = alloc.get_height();
|
||||
h = max(h, min_v_pixbuf_size);
|
||||
h = min(h, max_v_pixbuf_size);
|
||||
|
||||
if ( h != alloc.get_height())
|
||||
alloc.set_height(h);
|
||||
|
||||
if (pixheight != h) {
|
||||
pixbuf = request_vertical_meter(h);
|
||||
}
|
||||
} else {
|
||||
if (alloc.get_height() != 5) {
|
||||
alloc.set_height(5);
|
||||
}
|
||||
|
||||
int w = alloc.get_width();
|
||||
w = max(w, min_h_pixbuf_size);
|
||||
w = min(w, max_h_pixbuf_size);
|
||||
|
||||
if ( w != alloc.get_width())
|
||||
alloc.set_width(w);
|
||||
|
||||
if (pixwidth != w) {
|
||||
pixbuf = request_horizontal_meter(w);
|
||||
}
|
||||
}
|
||||
|
||||
pixheight = pixbuf->get_height();
|
||||
pixwidth = pixbuf->get_width();
|
||||
|
||||
DrawingArea::on_size_allocate(alloc);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -134,78 +328,87 @@ FastMeter::vertical_expose (GdkEventExpose* ev)
|
|||
GdkRectangle intersection;
|
||||
GdkRectangle background;
|
||||
|
||||
top_of_meter = (gint) floor (v_pixheight * current_level);
|
||||
top_of_meter = (gint) floor (pixheight * current_level);
|
||||
pixrect.height = top_of_meter;
|
||||
|
||||
background.x = 0;
|
||||
background.y = 0;
|
||||
background.width = pixrect.width;
|
||||
background.height = v_pixheight - top_of_meter;
|
||||
background.height = pixheight - top_of_meter;
|
||||
|
||||
if (gdk_rectangle_intersect (&background, &ev->area, &intersection)) {
|
||||
if (gdk_rectangle_intersect (&background, &ev->area, &intersection)) {
|
||||
get_window()->draw_rectangle (get_style()->get_black_gc(), true,
|
||||
intersection.x, intersection.y,
|
||||
intersection.width, intersection.height);
|
||||
}
|
||||
|
||||
if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
|
||||
|
||||
/* draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
||||
*/
|
||||
|
||||
get_window()->draw_pixbuf(get_style()->get_fg_gc(get_state()), v_pixbuf,
|
||||
intersection.x, v_pixheight - top_of_meter,
|
||||
intersection.x, v_pixheight - top_of_meter,
|
||||
// draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
||||
get_window()->draw_pixbuf(get_style()->get_fg_gc(get_state()), pixbuf,
|
||||
intersection.x, pixheight - top_of_meter,
|
||||
intersection.x, pixheight - top_of_meter,
|
||||
intersection.width, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
/* draw peak bar */
|
||||
|
||||
if (hold_state) {
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), v_pixbuf,
|
||||
intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||
intersection.x, v_pixheight - (gint) floor (v_pixheight * current_peak),
|
||||
// draw peak bar
|
||||
if (hold_state && intersection.width > 0) {
|
||||
gint y = pixheight - (gint) floor (pixheight * current_peak);
|
||||
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), pixbuf,
|
||||
intersection.x, y,
|
||||
intersection.x, y,
|
||||
intersection.width, 3,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool
|
||||
FastMeter::horizontal_expose (GdkEventExpose* ev)
|
||||
{
|
||||
GdkRectangle intersection;
|
||||
gint right_of_meter;
|
||||
GdkRectangle intersection;
|
||||
GdkRectangle background;
|
||||
|
||||
right_of_meter = (gint) floor (h_pixwidth * current_level);
|
||||
right_of_meter = (gint) floor (pixwidth * current_level);
|
||||
pixrect.width = right_of_meter;
|
||||
|
||||
if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
|
||||
|
||||
/* draw the part of the meter image that we need.
|
||||
*/
|
||||
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), h_pixbuf,
|
||||
intersection.x, intersection.y,
|
||||
intersection.x, intersection.y,
|
||||
intersection.width, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
background.x = 0;
|
||||
background.y = 0;
|
||||
background.width = pixwidth - right_of_meter;
|
||||
background.height = pixrect.height;
|
||||
|
||||
if (gdk_rectangle_intersect (&background, &ev->area, &intersection)) {
|
||||
get_window()->draw_rectangle (get_style()->get_black_gc(), true,
|
||||
intersection.x + right_of_meter, intersection.y,
|
||||
intersection.width, intersection.height);
|
||||
}
|
||||
|
||||
/* draw peak bar */
|
||||
|
||||
if (hold_state) {
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), h_pixbuf,
|
||||
right_of_meter, intersection.y,
|
||||
right_of_meter, intersection.y,
|
||||
if (gdk_rectangle_intersect (&pixrect, &ev->area, &intersection)) {
|
||||
// draw the part of the meter image that we need. the area we draw is bounded "in reverse" (top->bottom)
|
||||
get_window()->draw_pixbuf(get_style()->get_fg_gc(get_state()), pixbuf,
|
||||
intersection.x, intersection.y,
|
||||
intersection.x, intersection.y,
|
||||
intersection.width, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
}
|
||||
|
||||
// draw peak bar
|
||||
// XXX: peaks don't work properly
|
||||
/*
|
||||
if (hold_state && intersection.height > 0) {
|
||||
gint x = (gint) floor(pixwidth * current_peak);
|
||||
|
||||
get_window()->draw_pixbuf (get_style()->get_fg_gc(get_state()), pixbuf,
|
||||
x, intersection.y,
|
||||
x, intersection.y,
|
||||
3, intersection.height,
|
||||
Gdk::RGB_DITHER_NONE, 0, 0);
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,23 +46,16 @@ class FastMeter : public Gtk::DrawingArea {
|
|||
long hold_count() { return hold_cnt; }
|
||||
void set_hold_count (long);
|
||||
|
||||
static void set_horizontal_xpm (std::string);
|
||||
static void set_vertical_xpm (std::string);
|
||||
|
||||
protected:
|
||||
bool on_expose_event (GdkEventExpose*);
|
||||
void on_size_request (GtkRequisition*);
|
||||
void on_size_allocate (Gtk::Allocation&);
|
||||
|
||||
private:
|
||||
static std::string h_image_path;
|
||||
static std::string v_image_path;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> h_pixbuf;
|
||||
static gint h_pixheight;
|
||||
static gint h_pixwidth;
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> v_pixbuf;
|
||||
static gint v_pixheight;
|
||||
static gint v_pixwidth;
|
||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
|
||||
gint pixheight;
|
||||
gint pixwidth;
|
||||
|
||||
Orientation orientation;
|
||||
GdkRectangle pixrect;
|
||||
|
|
@ -76,6 +69,18 @@ class FastMeter : public Gtk::DrawingArea {
|
|||
|
||||
bool vertical_expose (GdkEventExpose*);
|
||||
bool horizontal_expose (GdkEventExpose*);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> request_vertical_meter(int);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> *v_pixbuf_cache;
|
||||
static int min_v_pixbuf_size;
|
||||
static int max_v_pixbuf_size;
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> request_horizontal_meter(int);
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> *h_pixbuf_cache;
|
||||
static int min_h_pixbuf_size;
|
||||
static int max_h_pixbuf_size;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -36,11 +36,10 @@
|
|||
#include <gdkmm/color.h>
|
||||
#include <pbd/abstract_ui.h>
|
||||
#include <pbd/ringbufferNPT.h>
|
||||
#include <pbd/atomic.h>
|
||||
|
||||
#include <pbd/pool.h>
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/receiver.h>
|
||||
#include <pbd/lockmonitor.h>
|
||||
|
||||
using std::string;
|
||||
using std::queue;
|
||||
|
|
|
|||
14
libs/libsndfile/AUTHORS
Normal file
14
libs/libsndfile/AUTHORS
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
The main author of libsndfile is Erik de Castro Lopo <erikd@mega-nerd.com>.
|
||||
|
||||
The code in the src/GSM610 directory was written by Jutta Degener
|
||||
<jutta@cs.tu-berlin.de> and Carsten Bormann <cabo@cs.tu-berlin.de>.
|
||||
They should not be contacted in relation to libsndfile or the GSM 6.10 code
|
||||
that is part of libsndfile. Their original code can be found at:
|
||||
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
Code in the src/G72x directory was released by Sun Microsystems, Inc. to the
|
||||
public domain. Minor modifications were required to integrate these files
|
||||
into libsndfile. The changes are listed in src/G72x/ChangeLog.
|
||||
|
||||
|
||||
6107
libs/libsndfile/ChangeLog
Normal file
6107
libs/libsndfile/ChangeLog
Normal file
File diff suppressed because it is too large
Load diff
113
libs/libsndfile/Mingw-make-dist.sh
Executable file
113
libs/libsndfile/Mingw-make-dist.sh
Executable file
|
|
@ -0,0 +1,113 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2006 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# * Neither the author nor the names of any contributors may be used
|
||||
# to endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
set -e
|
||||
|
||||
if [ $# -lt 1 ] || [ $# -gt 2 ]; then
|
||||
echo "Usage : Mingw-make-dist.sh <source tarball>."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGZ=$1
|
||||
if [ ! -f $TARGZ ]; then
|
||||
echo "Can't find source tarball."
|
||||
fi
|
||||
|
||||
TARGZ=$1
|
||||
if [ ! -f $TARGZ.asc ]; then
|
||||
echo "Can't find source tarball signature."
|
||||
fi
|
||||
|
||||
UNAME=`uname -s`
|
||||
if [ x$UNAME != "xMINGW32_NT-5.1" ]; then
|
||||
echo "Not able to build Win32 binaries on this platform."
|
||||
fi
|
||||
|
||||
echo "Building MinGW binary/source zip file."
|
||||
|
||||
VERSION=`pwd | sed -e "s#.*/##" | sed -e s/libsndfile-//`
|
||||
BUILD=`echo $VERSION | sed -e "s/\./_/g"`
|
||||
INSTALL="libsndfile-$BUILD"
|
||||
ZIPNAME="$INSTALL.zip"
|
||||
|
||||
if [ -z "$BUILD" ]; then
|
||||
echo "Bad BUILD variable : '$BUILD'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $INSTALL/ ]; then
|
||||
mkdir $INSTALL
|
||||
fi
|
||||
|
||||
if [ ! -f config.status ]; then
|
||||
./configure --prefix=`pwd`/$INSTALL/
|
||||
else
|
||||
teststr=`grep "with options" config.status | grep -- --prefix=`
|
||||
if [ -z "$teststr" ]; then
|
||||
# --disable-static doesn't work.
|
||||
./configure --prefix=`pwd`/$INSTALL/
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f src/.libs/libsndfile-1.dll ]; then
|
||||
make all check
|
||||
fi
|
||||
|
||||
if [ ! -f $INSTALL/bin/libsndfile-1.dll ]; then
|
||||
make install
|
||||
rm -f $INSTALL/bin/sndfile-regtest.exe
|
||||
strip $INSTALL/bin/*.*
|
||||
mv $INSTALL/bin/*.* $INSTALL/include/*.* $INSTALL/
|
||||
rmdir $INSTALL/bin
|
||||
rm -rf $INSTALL/lib
|
||||
rmdir $INSTALL/include
|
||||
cp src/libsndfile.def $INSTALL/
|
||||
cp Win32/README-precompiled-dll.txt $INSTALL/
|
||||
fi
|
||||
|
||||
if [ ! -f $INSTALL/libsndfile-$VERSION.tar.gz ]; then
|
||||
cp $TARGZ $INSTALL/
|
||||
if [ -f $TARGZ.asc ]; then
|
||||
cp $TARGZ.asc $INSTALL/
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $ZIPNAME ]; then
|
||||
zip -r $ZIPNAME $INSTALL/
|
||||
fi
|
||||
|
||||
|
||||
# Do not edit or modify anything in this comment block.
|
||||
# The following line is a file identity tag for the GNU Arch
|
||||
# revision control system.
|
||||
#
|
||||
# arch-tag: 3f82cd8a-f800-48d7-9646-2cdcf03c81a0
|
||||
126
libs/libsndfile/NEWS
Normal file
126
libs/libsndfile/NEWS
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
Version 1.0.16 (2006-04-30)
|
||||
* Add support for Broadcast (BEXT) chunks in WAV files.
|
||||
* Implement new commands SFC_GET_SIGNAL_MAX and SFC_GET_MAX_ALL_CHANNELS.
|
||||
* Add support for RIFX (big endian WAV variant).
|
||||
* Fix configure script bugs.
|
||||
* Fix bug in INST and MARK chunk writing for AIFF files.
|
||||
|
||||
Version 1.0.15 (2006-03-16)
|
||||
* Fix some ia64 issues.
|
||||
* Fix precompiled DLL.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.14 (2006-02-19)
|
||||
* Really fix MinGW compile problems.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.13 (2006-01-21)
|
||||
* Fix for MinGW compiler problems.
|
||||
* Allow readin/write of instrument chunks from WAV and AIFF files.
|
||||
* Compile problem fix for Solaris compiler.
|
||||
* Minor cleanups and bug fixes.
|
||||
|
||||
Version 1.0.12 (2005-09-30)
|
||||
* Add support for FLAC and Apple's Core Audio Format (CAF).
|
||||
* Add virtual I/O interface (still needs docs).
|
||||
* Cygwin and other Win32 fixes.
|
||||
* Minor bug fixes and cleanups.
|
||||
|
||||
Version 1.0.11 (2004-11-15)
|
||||
* Add support for SD2 files.
|
||||
* Add read support for loop info in WAV and AIFF files.
|
||||
* Add more tests.
|
||||
* Improve type safety.
|
||||
* Minor optimisations and bug fixes.
|
||||
|
||||
Version 1.0.10 (2004-06-15)
|
||||
* Fix AIFF read/write mode bugs.
|
||||
* Add support for compiling Win32 DLLS using MinGW.
|
||||
* Fix problems resulting in failed compiles with gcc-2.95.
|
||||
* Improve test suite.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.9 (2004-03-30)
|
||||
* Add handling of AVR (Audio Visual Research) files.
|
||||
* Improve handling of WAVEFORMATEXTENSIBLE WAV files.
|
||||
* Fix for using pipes on Win32.
|
||||
|
||||
Version 1.0.8 (2004-03-14)
|
||||
* Correct peak chunk handing for files with > 16 tracks.
|
||||
* Fix for WAV files with huge number of CUE chunks.
|
||||
|
||||
Version 1.0.7 (2004-02-25)
|
||||
* Fix clip mode detection on ia64, MIPS and other CPUs.
|
||||
* Fix two MacOSX build problems.
|
||||
|
||||
Version 1.0.6 (2004-02-08)
|
||||
* Added support for native Win32 file access API (Ross Bencina).
|
||||
* New mode to add clippling then a converting from float/double to integer
|
||||
would otherwise wrap around.
|
||||
* Fixed a bug in reading/writing files > 2Gig on Linux, Solaris and others.
|
||||
* Many minor bug fixes.
|
||||
* Other random fixes for Win32.
|
||||
|
||||
Version 1.0.5 (2003-05-03)
|
||||
* Added support for HTK files.
|
||||
* Added new function sf_open_fd() to allow for secure opening of temporary
|
||||
files as well as reading/writing sound files embedded within larger
|
||||
container files.
|
||||
* Added string support for AIFF files.
|
||||
* Minor bug fixes and code cleanups.
|
||||
|
||||
Version 1.0.4 (2003-02-02)
|
||||
* Added suport of PVF and XI files.
|
||||
* Added functionality for setting and retreiving strings from sound files.
|
||||
* Minor code cleanups and bug fixes.
|
||||
|
||||
Version 1.0.3 (2002-12-09)
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.2 (2002-11-24)
|
||||
* Added support for VOX ADPCM.
|
||||
* Improved error reporting.
|
||||
* Added version scripting on Linux and Solaris.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.1 (2002-09-14)
|
||||
* Added MAT and MAT5 file formats.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.0 (2002-08-16)
|
||||
* Final release for 1.0.0.
|
||||
|
||||
Version 1.0.0rc6 (2002-08-14)
|
||||
* Release candidate 6 for the 1.0.0 series.
|
||||
* MacOS9 fixes.
|
||||
|
||||
Version 1.0.0rc5 (2002-08-10)
|
||||
* Release candidate 5 for the 1.0.0 series.
|
||||
* Changed the definition of sf_count_t which was causing problems when
|
||||
libsndfile was compiled with other libraries (ie WxWindows).
|
||||
* Minor bug fixes.
|
||||
* Documentation cleanup.
|
||||
|
||||
Version 1.0.0rc4 (2002-08-03)
|
||||
* Release candidate 4 for the 1.0.0 series.
|
||||
* Minor bug fixes.
|
||||
* Fix broken Win32 "make check".
|
||||
|
||||
Version 1.0.0rc3 (2002-08-02)
|
||||
* Release candidate 3 for the 1.0.0 series.
|
||||
* Fix bug where libsndfile was reading beyond the end of the data chunk.
|
||||
* Added on-the-fly header updates on write.
|
||||
* Fix a couple of documentation issues.
|
||||
|
||||
Version 1.0.0rc2 (2002-06-24)
|
||||
* Release candidate 2 for the 1.0.0 series.
|
||||
* Fix compile problem for Win32.
|
||||
|
||||
Version 1.0.0rc1 (2002-06-24)
|
||||
* Release candidate 1 for the 1.0.0 series.
|
||||
|
||||
Version 0.0.28 (2002-04-27)
|
||||
* Last offical release of 0.0.X series of the library.
|
||||
|
||||
Version 0.0.8 (1999-02-16)
|
||||
* First offical release.
|
||||
71
libs/libsndfile/README
Normal file
71
libs/libsndfile/README
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
This is libsndfile, 1.0.16
|
||||
|
||||
libsndfile is a library of C routines for reading and writing
|
||||
files containing sampled audio data.
|
||||
|
||||
The src/ directory contains the source code for library itself.
|
||||
|
||||
The doc/ directory contains the libsndfile documentation.
|
||||
|
||||
The examples/ directory contains examples of how to write code using
|
||||
libsndfile. 'wav32_aiff24' converts a WAV file containing 32 bit floating
|
||||
point data into a 24 bit PCM AIFF file. 'sndfile2oct' dumps the audio
|
||||
data of a file in a human readable format. 'sfconvert' is the beginnings
|
||||
of a audio file format conversion utility. 'make_sine' generates a WAV
|
||||
file containing one cycle of a sine wave with 4096 sample points in
|
||||
32 bit floating point format. 'sfinfo' opens a sound file and prints
|
||||
out information about that file.
|
||||
|
||||
The tests/ directory contains programs which link against libsndfile
|
||||
and test its functionality.
|
||||
|
||||
The Win32/ directory contains files and documentation to allow libsndfile
|
||||
to compile under Win32 with the Microsoft Visual C++ compiler.
|
||||
|
||||
The src/GSM610 directory contains code written by Jutta Degener and Carsten
|
||||
Bormann. Their original code can be found at :
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
|
||||
The src/G72x directory contains code written and released by Sun Microsystems
|
||||
under a suitably free license.
|
||||
|
||||
|
||||
Win32
|
||||
-----
|
||||
There are detailed instructions for building libsndfile on Win32 in the file
|
||||
|
||||
doc/win32.html
|
||||
|
||||
|
||||
MacOSX
|
||||
------
|
||||
Building on MacOSX should be the same as building it on any other Unix.
|
||||
|
||||
|
||||
OTHER PLATFORMS
|
||||
---------------
|
||||
To compile libsndfile on platforms which have a Bourne Shell compatible
|
||||
shell, an ANSI C compiler and a make utility should require no more that
|
||||
the following three commands :
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
For platforms without the required shell, it is usually sufficient to
|
||||
create an approriate config.h file in the src/ directory with correct
|
||||
values for the following #defines (this would work for AmigaOS) :
|
||||
|
||||
#define HAVE_ENDIAN_H 0
|
||||
#define GUESS_BIG_ENDIAN 1
|
||||
#define GUESS_LITTLE_ENDIAN 0
|
||||
#define FORCE_BROKEN_FLOAT 0
|
||||
|
||||
|
||||
CONTACTS
|
||||
--------
|
||||
|
||||
libsndfile was written by Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
The libsndfile home page is at :
|
||||
|
||||
http://www.mega-nerd.com/libsndfile/
|
||||
|
||||
43
libs/libsndfile/SConscript
Normal file
43
libs/libsndfile/SConscript
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# -*- python -*-
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
|
||||
sndfile_files = glob.glob('src/*.c') + glob.glob('src/GSM610/*.c') + glob.glob('src/G72x/*.c')
|
||||
|
||||
Import('env install_prefix')
|
||||
sndfile = env.Copy()
|
||||
|
||||
domain = 'libsndfile'
|
||||
|
||||
sndfile.Append(CCFLAGS = "-DPACKAGE=\\\"" + domain + "\\\"")
|
||||
sndfile.Append(CCFLAGS = "-DVERSION=\\\"ardour-special\\\"")
|
||||
# mingw may need this
|
||||
#sndfile.Append(CCFLAGS="-no-undefined")
|
||||
sndfile.Append(PACKAGE = domain)
|
||||
sndfile.Append(POTFILE = domain + '.pot')
|
||||
|
||||
conf = Configure(sndfile)
|
||||
|
||||
if conf.CheckCHeader('/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h'):
|
||||
sndfile.Append(LINKFLAGS = "-framework CoreServices")
|
||||
|
||||
sndfile = conf.Finish()
|
||||
|
||||
libsndfile = sndfile.SharedLibrary('sndfile', sndfile_files)
|
||||
|
||||
sndfile_h = sndfile.Command('src/sndfile.h', ['src/sndfile.h.in'], 'cd libs/libsndfile && ./configure && cd -', ENV=os.environ)
|
||||
|
||||
Default([sndfile_h,libsndfile])
|
||||
|
||||
env.Alias('install', env.Install(os.path.join(install_prefix, 'lib/ardour2'), libsndfile))
|
||||
|
||||
env.Alias('tarball', env.Distribute (env['DISTTREE'],
|
||||
[ 'NEWS', 'README', 'AUTHORS', 'ChangeLog',
|
||||
'configure', 'SConscript',] +
|
||||
sndfile_files +
|
||||
glob.glob('src/*.h') +
|
||||
[ 'src/sndfile.h.in', 'src/config.h.in', 'src/Symbols.linux', 'src/Symbols.darwin', 'src/libsndfile.def', 'src/cygsndfile.def' ]
|
||||
))
|
||||
|
||||
579
libs/libsndfile/acinclude.m4
Normal file
579
libs/libsndfile/acinclude.m4
Normal file
|
|
@ -0,0 +1,579 @@
|
|||
dnl By default, many hosts won't let programs access large files;
|
||||
dnl one must use special compiler options to get large-file access to work.
|
||||
dnl For more details about this brain damage please see:
|
||||
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
|
||||
|
||||
dnl Written by Paul Eggert <eggert@twinsun.com>.
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_FLAGS(FLAGSNAME)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_FLAGS],
|
||||
[AC_CACHE_CHECK([for $1 value to request large file support],
|
||||
ac_cv_sys_largefile_$1,
|
||||
[ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
|
||||
ac_cv_sys_largefile_$1=no
|
||||
ifelse($1, CFLAGS,
|
||||
[case "$host_os" in
|
||||
# IRIX 6.2 and later require cc -n32.
|
||||
changequote(, )dnl
|
||||
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
|
||||
changequote([, ])dnl
|
||||
if test "$GCC" != yes; then
|
||||
ac_cv_sys_largefile_CFLAGS=-n32
|
||||
fi
|
||||
ac_save_CC="$CC"
|
||||
CC="$CC $ac_cv_sys_largefile_CFLAGS"
|
||||
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
|
||||
CC="$ac_save_CC"
|
||||
esac])
|
||||
}])])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(VAR, VAL)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND],
|
||||
[case $2 in
|
||||
no) ;;
|
||||
?*)
|
||||
case "[$]$1" in
|
||||
'') $1=$2 ;;
|
||||
*) $1=[$]$1' '$2 ;;
|
||||
esac ;;
|
||||
esac])
|
||||
|
||||
dnl Internal subroutine of AC_SYS_EXTRA_LARGEFILE.
|
||||
dnl AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE],
|
||||
[AC_CACHE_CHECK([for $1], $2,
|
||||
[$2=no
|
||||
changequote(, )dnl
|
||||
$4
|
||||
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
||||
case "$ac_flag" in
|
||||
-D$1)
|
||||
$2=1 ;;
|
||||
-D$1=*)
|
||||
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
|
||||
esac
|
||||
done
|
||||
changequote([, ])dnl
|
||||
])
|
||||
if test "[$]$2" != no; then
|
||||
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
|
||||
fi])
|
||||
|
||||
AC_DEFUN([AC_SYS_EXTRA_LARGEFILE],
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])
|
||||
AC_ARG_ENABLE(largefile,
|
||||
[ --disable-largefile omit support for large files])
|
||||
if test "$enable_largefile" != no; then
|
||||
AC_CHECK_TOOL(GETCONF, getconf)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(CFLAGS)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(LDFLAGS)
|
||||
AC_SYS_EXTRA_LARGEFILE_FLAGS(LIBS)
|
||||
|
||||
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
|
||||
case "$ac_flag" in
|
||||
no) ;;
|
||||
-D_FILE_OFFSET_BITS=*) ;;
|
||||
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
|
||||
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
|
||||
-D?* | -I?*)
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
|
||||
*)
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
|
||||
esac
|
||||
done
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
|
||||
AC_SYS_EXTRA_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
|
||||
ac_cv_sys_file_offset_bits,
|
||||
[Number of bits in a file offset, on hosts where this is settable.])
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
ac_cv_sys_file_offset_bits=64 ;;
|
||||
esac]
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
|
||||
ac_cv_sys_largefile_source,
|
||||
[Define to make fseeko etc. visible, on some hosts.],
|
||||
[case "$host_os" in
|
||||
# HP-UX 10.20 and later
|
||||
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
|
||||
ac_cv_sys_largefile_source=1 ;;
|
||||
esac])
|
||||
AC_SYS_EXTRA_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
|
||||
ac_cv_sys_large_files,
|
||||
[Define for large files, on AIX-style hosts.],
|
||||
[case "$host_os" in
|
||||
# AIX 4.2 and later
|
||||
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
|
||||
ac_cv_sys_large_files=1 ;;
|
||||
esac])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dnl @synopsis AC_C_FIND_ENDIAN
|
||||
dnl
|
||||
dnl Determine endian-ness of target processor.
|
||||
dnl @version 1.1 Mar 03 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Majority written from scratch to replace the standard autoconf macro
|
||||
dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
|
||||
dnl of the AC_TRY_RUN macro.
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
dnl Find endian-ness in the following way:
|
||||
dnl 1) Look in <endian.h>.
|
||||
dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
|
||||
dnl 3) If 1) and 2) fails and not cross compiling run a test program.
|
||||
dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
|
||||
|
||||
AC_DEFUN([AC_C_FIND_ENDIAN],
|
||||
[AC_CACHE_CHECK(processor byte ordering,
|
||||
ac_cv_c_byte_order,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c_byte_order=unknown
|
||||
|
||||
if test x$ac_cv_header_endian_h = xyes ; then
|
||||
|
||||
# First try <endian.h> which should set BYTE_ORDER.
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=little
|
||||
)]
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <endian.h>
|
||||
#if BYTE_ORDER != BIG_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=big
|
||||
)]
|
||||
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_byte_order = unknown ; then
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
|
||||
bogus endian macros
|
||||
#endif
|
||||
], return 0 ;,
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=little
|
||||
)]
|
||||
|
||||
[AC_TRY_LINK([
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if BYTE_ORDER != LITTLE_ENDIAN
|
||||
not big endian
|
||||
#endif
|
||||
], return 0 ;,
|
||||
ac_cv_c_byte_order=little
|
||||
)]
|
||||
|
||||
)]
|
||||
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_byte_order = unknown ; then
|
||||
if test $cross_compiling = yes ; then
|
||||
# This is the last resort. Try to guess the target processor endian-ness
|
||||
# by looking at the target CPU type.
|
||||
[
|
||||
case "$target_cpu" in
|
||||
alpha* | i?86* | mipsel* | ia64*)
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=1
|
||||
;;
|
||||
|
||||
m68* | mips* | powerpc* | hppa* | sparc*)
|
||||
ac_cv_c_big_endian=1
|
||||
ac_cv_c_little_endian=0
|
||||
;;
|
||||
|
||||
esac
|
||||
]
|
||||
else
|
||||
AC_TRY_RUN(
|
||||
[[
|
||||
int main (void)
|
||||
{ /* Are we little or big endian? From Harbison&Steele. */
|
||||
union
|
||||
{ long l ;
|
||||
char c [sizeof (long)] ;
|
||||
} u ;
|
||||
u.l = 1 ;
|
||||
return (u.c [sizeof (long) - 1] == 1);
|
||||
}
|
||||
]], , ac_cv_c_byte_order=big,
|
||||
ac_cv_c_byte_order=unknown
|
||||
)
|
||||
|
||||
AC_TRY_RUN(
|
||||
[[int main (void)
|
||||
{ /* Are we little or big endian? From Harbison&Steele. */
|
||||
union
|
||||
{ long l ;
|
||||
char c [sizeof (long)] ;
|
||||
} u ;
|
||||
u.l = 1 ;
|
||||
return (u.c [0] == 1);
|
||||
}]], , ac_cv_c_byte_order=little,
|
||||
ac_cv_c_byte_order=unknown
|
||||
)
|
||||
fi
|
||||
fi
|
||||
|
||||
)
|
||||
]
|
||||
|
||||
if test $ac_cv_c_byte_order = big ; then
|
||||
ac_cv_c_big_endian=1
|
||||
ac_cv_c_little_endian=0
|
||||
elif test $ac_cv_c_byte_order = little ; then
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=1
|
||||
else
|
||||
ac_cv_c_big_endian=0
|
||||
ac_cv_c_little_endian=0
|
||||
|
||||
AC_MSG_WARN([[*****************************************************************]])
|
||||
AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
|
||||
AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
|
||||
AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]])
|
||||
AC_MSG_WARN([[*****************************************************************]])
|
||||
fi
|
||||
|
||||
)# AC_C_FIND_ENDIAN
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dnl @synopsis AC_C99_FLEXIBLE_ARRAY
|
||||
dnl
|
||||
dnl Dose the compiler support the 1999 ISO C Standard "stuct hack".
|
||||
dnl @version 1.1 Mar 15 2004
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
AC_DEFUN([AC_C99_FLEXIBLE_ARRAY],
|
||||
[AC_CACHE_CHECK(C99 struct flexible array support,
|
||||
ac_cv_c99_flexible_array,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c99_flexible_array=no
|
||||
|
||||
AC_TRY_LINK([[
|
||||
#include <stdlib.h>
|
||||
typedef struct {
|
||||
int k;
|
||||
char buffer [] ;
|
||||
} MY_STRUCT ;
|
||||
]],
|
||||
[ MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
|
||||
ac_cv_c99_flexible_array=yes,
|
||||
ac_cv_c99_flexible_array=no
|
||||
))]
|
||||
) # AC_C99_FLEXIBLE_ARRAY
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
dnl @synopsis AC_C99_FUNC_LRINT
|
||||
dnl
|
||||
dnl Check whether C99's lrint function is available.
|
||||
dnl @version 1.3 Feb 12 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
AC_DEFUN([AC_C99_FUNC_LRINT],
|
||||
[AC_CACHE_CHECK(for lrint,
|
||||
ac_cv_c99_lrint,
|
||||
[
|
||||
lrint_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-O2 -lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
|
||||
|
||||
CFLAGS=$lrint_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_lrint" = yes; then
|
||||
AC_DEFINE(HAVE_LRINT, 1,
|
||||
[Define if you have C99's lrint function.])
|
||||
fi
|
||||
])# AC_C99_FUNC_LRINT
|
||||
dnl @synopsis AC_C99_FUNC_LRINTF
|
||||
dnl
|
||||
dnl Check whether C99's lrintf function is available.
|
||||
dnl @version 1.3 Feb 12 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
AC_DEFUN([AC_C99_FUNC_LRINTF],
|
||||
[AC_CACHE_CHECK(for lrintf,
|
||||
ac_cv_c99_lrintf,
|
||||
[
|
||||
lrintf_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-O2 -lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
|
||||
|
||||
CFLAGS=$lrintf_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_lrintf" = yes; then
|
||||
AC_DEFINE(HAVE_LRINTF, 1,
|
||||
[Define if you have C99's lrintf function.])
|
||||
fi
|
||||
])# AC_C99_FUNC_LRINTF
|
||||
|
||||
|
||||
|
||||
|
||||
dnl @synopsis AC_C99_FUNC_LLRINT
|
||||
dnl
|
||||
dnl Check whether C99's llrint function is available.
|
||||
dnl @version 1.1 Sep 30 2002
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
dnl
|
||||
AC_DEFUN([AC_C99_FUNC_LLRINT],
|
||||
[AC_CACHE_CHECK(for llrint,
|
||||
ac_cv_c99_llrint,
|
||||
[
|
||||
llrint_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="-O2 -lm"
|
||||
AC_TRY_LINK([
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
|
||||
|
||||
CFLAGS=$llrint_save_CFLAGS
|
||||
|
||||
])
|
||||
|
||||
if test "$ac_cv_c99_llrint" = yes; then
|
||||
AC_DEFINE(HAVE_LLRINT, 1,
|
||||
[Define if you have C99's llrint function.])
|
||||
fi
|
||||
])# AC_C99_FUNC_LLRINT
|
||||
|
||||
|
||||
|
||||
dnl @synopsis AC_C_CLIP_MODE
|
||||
dnl
|
||||
dnl Determine the clipping mode when converting float to int.
|
||||
dnl @version 1.0 May 17 2003
|
||||
dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this file for any
|
||||
dnl purpose is hereby granted without fee, provided that the above copyright
|
||||
dnl and this permission notice appear in all copies. No representations are
|
||||
dnl made about the suitability of this software for any purpose. It is
|
||||
dnl provided "as is" without express or implied warranty.
|
||||
|
||||
|
||||
|
||||
dnl Find the clipping mode in the following way:
|
||||
dnl 1) If we are not cross compiling test it.
|
||||
dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
|
||||
|
||||
AC_DEFUN([AC_C_CLIP_MODE],
|
||||
[AC_CACHE_CHECK(processor clipping capabilities,
|
||||
ac_cv_c_clip_type,
|
||||
|
||||
# Initialize to unknown
|
||||
ac_cv_c_clip_positive=unknown
|
||||
ac_cv_c_clip_negative=unknown
|
||||
|
||||
if test $ac_cv_c_clip_positive = unknown ; then
|
||||
AC_TRY_RUN(
|
||||
[[
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = 1.0 * 0x7FFFFFFF ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != 127)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
]],
|
||||
ac_cv_c_clip_positive=yes,
|
||||
ac_cv_c_clip_positive=no,
|
||||
ac_cv_c_clip_positive=unknown
|
||||
)
|
||||
|
||||
AC_TRY_RUN(
|
||||
[[
|
||||
#define _ISOC9X_SOURCE 1
|
||||
#define _ISOC99_SOURCE 1
|
||||
#define __USE_ISOC99 1
|
||||
#define __USE_ISOC9X 1
|
||||
#include <math.h>
|
||||
int main (void)
|
||||
{ double fval ;
|
||||
int k, ival ;
|
||||
|
||||
fval = -8.0 * 0x10000000 ;
|
||||
for (k = 0 ; k < 100 ; k++)
|
||||
{ ival = (lrint (fval)) >> 24 ;
|
||||
if (ival != -128)
|
||||
return 1 ;
|
||||
|
||||
fval *= 1.2499999 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
]],
|
||||
ac_cv_c_clip_negative=yes,
|
||||
ac_cv_c_clip_negative=no,
|
||||
ac_cv_c_clip_negative=unknown
|
||||
)
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_clip_positive = yes ; then
|
||||
ac_cv_c_clip_positive=1
|
||||
else
|
||||
ac_cv_c_clip_positive=0
|
||||
fi
|
||||
|
||||
if test $ac_cv_c_clip_negative = yes ; then
|
||||
ac_cv_c_clip_negative=1
|
||||
else
|
||||
ac_cv_c_clip_negative=0
|
||||
fi
|
||||
|
||||
[[
|
||||
case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
|
||||
"00")
|
||||
ac_cv_c_clip_type="none"
|
||||
;;
|
||||
"10")
|
||||
ac_cv_c_clip_type="positive"
|
||||
;;
|
||||
"01")
|
||||
ac_cv_c_clip_type="negative"
|
||||
;;
|
||||
"11")
|
||||
ac_cv_c_clip_type="both"
|
||||
;;
|
||||
esac
|
||||
]]
|
||||
|
||||
)
|
||||
]
|
||||
|
||||
)# AC_C_CLIP_MODE
|
||||
|
||||
|
||||
dnl @synopsis AC_ADD_CFLAGS
|
||||
dnl
|
||||
dnl Add the given option to CFLAGS, if it doesn't break the compiler
|
||||
|
||||
AC_DEFUN([AC_ADD_CFLAGS],
|
||||
[AC_MSG_CHECKING([if $CC accepts $1])
|
||||
ac_add_cflags__old_cflags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $1"
|
||||
AC_TRY_LINK([#include <stdio.h>],
|
||||
[printf("Hello, World!\n"); return 0;],
|
||||
AC_MSG_RESULT([yes]),
|
||||
AC_MSG_RESULT([no])
|
||||
CFLAGS="$ac_add_cflags__old_cflags")
|
||||
])
|
||||
|
||||
|
||||
|
||||
|
||||
ifelse(dnl
|
||||
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: bc38294d-bb5c-42ad-90b9-779def5eaab7
|
||||
|
||||
)dnl
|
||||
72
libs/libsndfile/aclocal.m4
vendored
Normal file
72
libs/libsndfile/aclocal.m4
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# generated automatically by aclocal 1.9.2 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
|
||||
# Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
|
||||
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
|
||||
dnl also defines GSTUFF_PKG_ERRORS on error
|
||||
AC_DEFUN([PKG_CHECK_MODULES], [
|
||||
succeeded=no
|
||||
|
||||
if test -z "$PKG_CONFIG"; then
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
fi
|
||||
|
||||
if test "$PKG_CONFIG" = "no" ; then
|
||||
echo "*** The pkg-config script could not be found. Make sure it is"
|
||||
echo "*** in your path, or set the PKG_CONFIG environment variable"
|
||||
echo "*** to the full path to pkg-config."
|
||||
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
|
||||
else
|
||||
PKG_CONFIG_MIN_VERSION=0.9.0
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
|
||||
AC_MSG_CHECKING(for $2)
|
||||
|
||||
if $PKG_CONFIG --exists "$2" ; then
|
||||
AC_MSG_RESULT(yes)
|
||||
succeeded=yes
|
||||
|
||||
AC_MSG_CHECKING($1_CFLAGS)
|
||||
$1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
|
||||
AC_MSG_RESULT($$1_CFLAGS)
|
||||
|
||||
AC_MSG_CHECKING($1_LIBS)
|
||||
$1_LIBS=`$PKG_CONFIG --libs "$2"`
|
||||
AC_MSG_RESULT($$1_LIBS)
|
||||
else
|
||||
$1_CFLAGS=""
|
||||
$1_LIBS=""
|
||||
## If we have a custom action on failure, don't print errors, but
|
||||
## do set a variable so people can do so.
|
||||
$1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
|
||||
ifelse([$4], ,echo $$1_PKG_ERRORS,)
|
||||
fi
|
||||
|
||||
AC_SUBST($1_CFLAGS)
|
||||
AC_SUBST($1_LIBS)
|
||||
else
|
||||
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
|
||||
echo "*** See http://www.freedesktop.org/software/pkgconfig"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $succeeded = yes; then
|
||||
ifelse([$3], , :, [$3])
|
||||
else
|
||||
ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
|
||||
m4_include([acinclude.m4])
|
||||
107
libs/libsndfile/compile
Executable file
107
libs/libsndfile/compile
Executable file
|
|
@ -0,0 +1,107 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Wrapper for compilers which do not understand `-c -o'.
|
||||
|
||||
# Copyright 1999, 2000 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Usage:
|
||||
# compile PROGRAM [ARGS]...
|
||||
# `-o FOO.o' is removed from the args passed to the actual compile.
|
||||
|
||||
# Usage statement added by Billy Biggs <vektor@dumbterm.net>.
|
||||
if [ -z $1 ]; then
|
||||
echo "Wrapper for compilers which do not understand '-c -o'."
|
||||
echo "usage: compile PROGRAM [ARGS]..."
|
||||
echo "'-o FOO.o' is removed from the args passed to the actual compile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
prog=$1
|
||||
shift
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
args=
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-o)
|
||||
# configure might choose to run compile as `compile cc -o foo foo.c'.
|
||||
# So we do something ugly here.
|
||||
ofile=$2
|
||||
shift
|
||||
case "$ofile" in
|
||||
*.o | *.obj)
|
||||
;;
|
||||
*)
|
||||
args="$args -o $ofile"
|
||||
ofile=
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
args="$args $1"
|
||||
;;
|
||||
*)
|
||||
args="$args $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no `-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# `.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$prog" $args
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo $cfile | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use `[/.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo $cofile | sed -e 's|[/.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir $lockdir > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir $lockdir; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$prog" $args
|
||||
status=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
mv "$cofile" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir $lockdir
|
||||
exit $status
|
||||
1497
libs/libsndfile/config.guess
vendored
Executable file
1497
libs/libsndfile/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
1608
libs/libsndfile/config.sub
vendored
Executable file
1608
libs/libsndfile/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
13925
libs/libsndfile/configure
vendored
Executable file
13925
libs/libsndfile/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
541
libs/libsndfile/configure.ac
Normal file
541
libs/libsndfile/configure.ac
Normal file
|
|
@ -0,0 +1,541 @@
|
|||
# Copyright (C) 1999-2006 Erik de Castro Lopo (erikd AT mega-nerd DOT com).
|
||||
|
||||
dnl Require autoconf version
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
AC_INIT([libsndfile],[ardour-special],[ardour@ardour.org])
|
||||
AC_CONFIG_SRCDIR([src/sndfile.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
|
||||
AC_CONFIG_HEADERS(src/config.h)
|
||||
|
||||
AC_LANG([C])
|
||||
|
||||
#------------------------------------------------------------------------------------
|
||||
# Rules for library version information:
|
||||
#
|
||||
# 1. Start with version information of `0:0:0' for each libtool library.
|
||||
# 2. Update the version information only immediately before a public release of
|
||||
# your software. More frequent updates are unnecessary, and only guarantee
|
||||
# that the current interface number gets larger faster.
|
||||
# 3. If the library source code has changed at all since the last update, then
|
||||
# increment revision (`c:r:a' becomes `c:r+1:a').
|
||||
# 4. If any interfaces have been added, removed, or changed since the last update,
|
||||
# increment current, and set revision to 0.
|
||||
# 5. If any interfaces have been added since the last public release, then increment
|
||||
# age.
|
||||
# 6. If any interfaces have been removed since the last public release, then set age
|
||||
# to 0.
|
||||
|
||||
SHARED_VERSION_INFO="1:16:0"
|
||||
|
||||
AC_PROG_CC
|
||||
#AM_PROG_LIBTOOL
|
||||
|
||||
AC_CHECK_PROG(autogen, autogen, yes, no)
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
AC_HEADER_STDC
|
||||
|
||||
AC_CHECK_HEADERS(endian.h)
|
||||
AC_CHECK_HEADERS(byteswap.h)
|
||||
AC_CHECK_HEADERS(locale.h)
|
||||
AC_CHECK_HEADERS(inttypes.h)
|
||||
|
||||
AC_HEADER_SYS_WAIT
|
||||
|
||||
AC_CHECK_DECLS(S_IRGRP)
|
||||
AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP],${HAVE_DECL_S_IRGRP},
|
||||
[Set to 1 if S_IRGRP is defined.])
|
||||
|
||||
#====================================================================================
|
||||
# Check for support of the struct hack.
|
||||
|
||||
AC_C99_FLEXIBLE_ARRAY
|
||||
|
||||
if test x$ac_cv_c99_flexible_array = xyes ; then
|
||||
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],1, [Set to 1 if the compile supports the struct hack.])
|
||||
else
|
||||
AC_MSG_WARN([[*** This compiler does not support the 1999 ISO C Standard ***]])
|
||||
AC_MSG_WARN([[*** feature known as the flexible array struct member. ***]])
|
||||
AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0)
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Couple of initializations here. Fill in real values later.
|
||||
|
||||
SHLIB_VERSION_ARG=""
|
||||
|
||||
#====================================================================================
|
||||
# Finished checking, handle options.
|
||||
|
||||
AC_ARG_ENABLE(experimental,
|
||||
AC_HELP_STRING([--enable-experimental], [enable experimental code]))
|
||||
|
||||
EXPERIMENTAL_CODE=0
|
||||
if test x$enable_experimental = xyes ; then
|
||||
EXPERIMENTAL_CODE=1
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE],${EXPERIMENTAL_CODE}, [Set to 1 to enable experimental code.])
|
||||
|
||||
AC_ARG_ENABLE(gcc-werror,
|
||||
AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
|
||||
|
||||
AC_ARG_ENABLE(gcc-pipe,
|
||||
AC_HELP_STRING([--disable-gcc-pipe], [disable gcc -pipe option]))
|
||||
|
||||
AC_ARG_ENABLE(gcc-opt,
|
||||
AC_HELP_STRING([--disable-gcc-opt], [disable gcc optimisations]))
|
||||
|
||||
AC_ARG_ENABLE(cpu-clip,
|
||||
AC_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper]))
|
||||
|
||||
AC_ARG_ENABLE(bow-docs,
|
||||
AC_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs]))
|
||||
|
||||
AC_ARG_ENABLE(sqlite,
|
||||
AC_HELP_STRING([--disable-sqlite], [disable use of sqlite]))
|
||||
|
||||
AC_ARG_ENABLE(flac,
|
||||
AC_HELP_STRING([--disable-flac], [disable use of FLAC]))
|
||||
|
||||
AC_ARG_ENABLE(alsa,
|
||||
AC_HELP_STRING([--disable-alsa], [disable use of ALSA]))
|
||||
|
||||
#====================================================================================
|
||||
# Check types and their sizes.
|
||||
|
||||
AC_CHECK_SIZEOF(short,2)
|
||||
AC_CHECK_SIZEOF(int,4)
|
||||
AC_CHECK_SIZEOF(long,4)
|
||||
AC_CHECK_SIZEOF(float,4)
|
||||
AC_CHECK_SIZEOF(double,4)
|
||||
AC_CHECK_SIZEOF(void*,8)
|
||||
AC_CHECK_SIZEOF(size_t,4)
|
||||
AC_CHECK_SIZEOF(int64_t,8)
|
||||
AC_CHECK_SIZEOF(long long,8)
|
||||
|
||||
#====================================================================================
|
||||
# Find an appropriate type for sf_count_t.
|
||||
# On systems supporting files larger than 2 Gig, sf_count_t must be a 64 bit value.
|
||||
# Unfortunately there is more than one way of ensuring this so need to do some
|
||||
# pretty rigourous testing here.
|
||||
|
||||
unset ac_cv_sizeof_off_t
|
||||
|
||||
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
|
||||
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
TYPEOF_SF_COUNT_T="__int64"
|
||||
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
|
||||
SIZEOF_SF_COUNT_T=8
|
||||
;;
|
||||
*)
|
||||
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
|
||||
# If sizeof (off_t) is 8, no further checking is needed.
|
||||
TYPEOF_SF_COUNT_T="off_t"
|
||||
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
|
||||
SIZEOF_SF_COUNT_T=8
|
||||
else
|
||||
# Check for common 64 bit file offset types.
|
||||
AC_CHECK_SIZEOF(loff_t,1) # Fake default value.
|
||||
AC_CHECK_SIZEOF(off64_t,1) # Fake default value.
|
||||
|
||||
TYPEOF_SF_COUNT_T="unknown"
|
||||
if test "x$ac_cv_sizeof_loff_t" = "x8" ; then
|
||||
TYPEOF_SF_COUNT_T="loff_t"
|
||||
SIZEOF_SF_COUNT_T=8
|
||||
elif test "x$ac_cv_sizeof_off64_t" = "x8" ; then
|
||||
TYPEOF_SF_COUNT_T="off64_t"
|
||||
SIZEOF_SF_COUNT_T=8
|
||||
fi
|
||||
|
||||
# Save the old sizeof (off_t) value and then unset it to see if it
|
||||
# changes when Large File Support is enabled.
|
||||
|
||||
pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
|
||||
unset ac_cv_sizeof_off_t
|
||||
|
||||
AC_SYS_EXTRA_LARGEFILE
|
||||
|
||||
if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then
|
||||
ac_cv_sys_largefile_CFLAGS=""
|
||||
fi
|
||||
if test "x$ac_cv_sys_largefile_LDFLAGS" = "xno" ; then
|
||||
ac_cv_sys_largefile_LDFLAGS=""
|
||||
fi
|
||||
if test "x$ac_cv_sys_largefile_LIBS" = "xno" ; then
|
||||
ac_cv_sys_largefile_LIBS=""
|
||||
fi
|
||||
|
||||
AC_CHECK_SIZEOF(off_t,1) # Fake default value.
|
||||
|
||||
if test "x$ac_cv_sizeof_off_t" = "x8" ; then
|
||||
SF_COUNT_MAX="0x7FFFFFFFFFFFFFFFLL"
|
||||
elif test "x$ac_cv_sizeof_off_t" = "x$pre_largefile_sizeof_off_t" ; then
|
||||
AC_MSG_WARN([[This machine does not seem to support 64 bit file offsets.]])
|
||||
TYPEOF_SF_COUNT_T="off_t"
|
||||
SIZEOF_SF_COUNT_T=$ac_cv_sizeof_off_t
|
||||
elif test "x$TYPEOF_SF_COUNT_T" = "xunknown" ; then
|
||||
echo
|
||||
echo "*** The configure process has determined that this system is capable"
|
||||
echo "*** of Large File Support but has not been able to find a type which"
|
||||
echo "*** is an unambiguous 64 bit file offset."
|
||||
echo "*** Please contact the author to help resolve this problem."
|
||||
echo
|
||||
AC_MSG_ERROR([[Bad file offset type.]])
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if test $SIZEOF_SF_COUNT_T = 4 ; then
|
||||
SF_COUNT_MAX="0x7FFFFFFF"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([TYPEOF_SF_COUNT_T],${TYPEOF_SF_COUNT_T}, [Set to long if unknown.])
|
||||
AC_SUBST(TYPEOF_SF_COUNT_T)
|
||||
|
||||
AC_DEFINE_UNQUOTED([SIZEOF_SF_COUNT_T],${SIZEOF_SF_COUNT_T}, [Set to sizeof (long) if unknown.])
|
||||
AC_SUBST(SIZEOF_SF_COUNT_T)
|
||||
|
||||
AC_DEFINE_UNQUOTED([SF_COUNT_MAX],${SF_COUNT_MAX}, [Set to maximum allowed value of sf_count_t type.])
|
||||
AC_SUBST(SF_COUNT_MAX)
|
||||
|
||||
AC_CHECK_TYPES(ssize_t)
|
||||
AC_CHECK_SIZEOF(ssize_t,4)
|
||||
|
||||
#====================================================================================
|
||||
# Determine endian-ness of target processor.
|
||||
|
||||
AC_C_FIND_ENDIAN
|
||||
|
||||
AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
|
||||
[Target processor is big endian.])
|
||||
AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
|
||||
[Target processor is little endian.])
|
||||
|
||||
#====================================================================================
|
||||
# Check for functions.
|
||||
|
||||
AC_CHECK_FUNCS(malloc calloc realloc free)
|
||||
AC_CHECK_FUNCS(open read write lseek pread pwrite)
|
||||
AC_CHECK_FUNCS(fstat ftruncate fsync fdatasync)
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
||||
AC_CHECK_FUNCS(gmtime gmtime_r)
|
||||
AC_CHECK_FUNCS(mmap getpagesize)
|
||||
AC_CHECK_FUNCS(setlocale)
|
||||
|
||||
AC_CHECK_LIB([m],floor)
|
||||
AC_CHECK_FUNCS(floor ceil fmod)
|
||||
|
||||
case "$host_os" in
|
||||
cygwin*)
|
||||
AC_MSG_WARN([[Not using built-in lrint() and lrintf() because they are broken on Cygwin.]])
|
||||
;;
|
||||
*)
|
||||
AC_C99_FUNC_LRINT
|
||||
AC_C99_FUNC_LRINTF
|
||||
|
||||
if test "x$ac_cv_c99_lrint" = "xno" ; then
|
||||
if test "x$ac_cv_c99_lrintf" = "xno" ; then
|
||||
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
|
||||
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
#====================================================================================
|
||||
# Check for libsqlite3 (only used in regtest).
|
||||
|
||||
ac_cv_sqlite3=no
|
||||
if test x$enable_sqlite != xno ; then
|
||||
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= 3.2, ac_cv_sqlite3=yes, ac_cv_sqlite3=no)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_sqlite3 = "xyes" ; then
|
||||
HAVE_SQLITE3=1
|
||||
else
|
||||
HAVE_SQLITE3=0
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED([HAVE_SQLITE3],$HAVE_SQLITE3,[Set to 1 if you have libsqlite3.])
|
||||
|
||||
#====================================================================================
|
||||
# Determine if the processor can do clipping on float to int conversions.
|
||||
|
||||
if test x$enable_cpu_clip != "xno" ; then
|
||||
AC_C_CLIP_MODE
|
||||
else
|
||||
echo "checking processor clipping capabilities... disabled"
|
||||
ac_cv_c_clip_positive=0
|
||||
ac_cv_c_clip_negative=0
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(CPU_CLIPS_POSITIVE, ${ac_cv_c_clip_positive},
|
||||
[Target processor clips on positive float to int conversion.])
|
||||
AC_DEFINE_UNQUOTED(CPU_CLIPS_NEGATIVE, ${ac_cv_c_clip_negative},
|
||||
[Target processor clips on negative float to int conversion.])
|
||||
|
||||
#====================================================================================
|
||||
# Target OS specific stuff.
|
||||
|
||||
OS_SPECIFIC_CFLAGS=""
|
||||
OS_SPECIFIC_LINKS=""
|
||||
os_is_win32=0
|
||||
os_is_macosx=0
|
||||
use_windows_api=0
|
||||
|
||||
case "$host_os" in
|
||||
darwin* | rhapsody*)
|
||||
os_is_macosx=1
|
||||
OS_SPECIFIC_CFLAGS="-fpascal-strings -I/Developer/Headers/FlatCarbon"
|
||||
OS_SPECIFIC_LINKS="-framework CoreAudio"
|
||||
;;
|
||||
mingw*)
|
||||
os_is_win32=1
|
||||
use_windows_api=1
|
||||
OS_SPECIFIC_LINKS="-lwinmm"
|
||||
;;
|
||||
cygwin*)
|
||||
os_is_win32=1
|
||||
OS_SPECIFIC_LINKS="-lwinmm"
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_DEFINE_UNQUOTED(OS_IS_WIN32, ${os_is_win32}, [Set to 1 if compiling for Win32])
|
||||
AC_DEFINE_UNQUOTED(OS_IS_MACOSX, ${os_is_macosx}, [Set to 1 if compiling for MacOSX])
|
||||
AC_DEFINE_UNQUOTED(USE_WINDOWS_API, ${use_windows_api}, [Set to 1 to use the native windows API])
|
||||
|
||||
#====================================================================================
|
||||
# Check for ALSA.
|
||||
|
||||
ALSA_LIBS=""
|
||||
|
||||
if test x$enable_alsa != xno ; then
|
||||
AC_CHECK_HEADERS(alsa/asoundlib.h)
|
||||
if test x$ac_cv_header_alsa_asoundlib_h = xyes ; then
|
||||
ALSA_LIBS="-lasound"
|
||||
fi
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Check for FLAC
|
||||
|
||||
FLAC_LIBS=""
|
||||
|
||||
if test x$enable_flac != xno ; then
|
||||
AC_CHECK_HEADERS(FLAC/all.h)
|
||||
if test x$ac_cv_header_FLAC_all_h = xyes ; then
|
||||
AC_CHECK_LIB(FLAC, FLAC__seekable_stream_encoder_set_tell_callback, HAVE_FLAC_1_1_1="yes")
|
||||
if test "x$HAVE_FLAC_1_1_1" = xyes ; then
|
||||
AC_DEFINE(HAVE_FLAC_1_1_1, [1], [Define to 1 if you have libflac 1.1.1])
|
||||
fi
|
||||
FLAC_LIBS="-lFLAC"
|
||||
fi
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Test for sanity when cross-compiling.
|
||||
|
||||
if test x$cross_compiling = xyes ; then
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** We are cross-compiling, so have to assume sizeof (short) == 2 ]])
|
||||
AC_MSG_WARN([[*** and sizeof (int) == 4. If this is not the case there is no ]])
|
||||
AC_MSG_WARN([[*** chance of this working. Please contact the mantainer. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
fi
|
||||
|
||||
if test $ac_cv_sizeof_short != 2 ; then
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (short) != 2. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
fi
|
||||
|
||||
if test $ac_cv_sizeof_int != 4 ; then
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (int) != 4 ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
fi
|
||||
|
||||
if test $ac_cv_sizeof_float != 4 ; then
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (float) != 4. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
fi
|
||||
|
||||
if test $ac_cv_sizeof_double != 8 ; then
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
AC_MSG_WARN([[*** sizeof (double) != 8. ]])
|
||||
AC_MSG_WARN([[******************************************************************]])
|
||||
fi
|
||||
|
||||
if test x"$ac_cv_prog_autogen" = "xno" ; then
|
||||
AC_MSG_WARN([[Touching files in directory tests/.]])
|
||||
touch tests/*.c tests/*.h
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Settings for the HTML documentation.
|
||||
|
||||
htmldocdir=$prefix/share/doc/libsndfile1-dev/html
|
||||
|
||||
if test $prefix = "NONE" ; then
|
||||
htmldocdir=/usr/local/share/doc/libsndfile1-dev/html
|
||||
else
|
||||
htmldocdir=$prefix/share/doc/libsndfile1-dev/html
|
||||
fi
|
||||
|
||||
if test x$enable_bow_docs = "xyes" ; then
|
||||
HTML_BGCOLOUR="white"
|
||||
HTML_FGCOLOUR="black"
|
||||
else
|
||||
HTML_BGCOLOUR="black"
|
||||
HTML_FGCOLOUR="white"
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
# Now use the information from the checking stage.
|
||||
|
||||
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
AC_ADD_CFLAGS(-std=gnu99)
|
||||
|
||||
CFLAGS="$CFLAGS -W -Wall"
|
||||
|
||||
AC_ADD_CFLAGS(-Wdeclaration-after-statement)
|
||||
|
||||
if test x$enable_gcc_werror = "xyes" ; then
|
||||
CFLAGS="-Werror $CFLAGS"
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast -Wwrite-strings"
|
||||
# -Wpointer-arith -Wundef -Wmissing-declarations -Winline -Wconversion"
|
||||
|
||||
if test "x$enable_gcc_opt" = "xno" ; then
|
||||
temp_CFLAGS=`echo $CFLAGS | sed "s/O2/O0/"`
|
||||
CFLAGS=$temp_CFLAGS
|
||||
AC_MSG_WARN([[*** Compiler optimisations switched off. ***]])
|
||||
fi
|
||||
|
||||
# OS specific tweaks.
|
||||
case "$host_os" in
|
||||
darwin* | rhapsody*)
|
||||
# Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
|
||||
# System headers on these systems are broken.
|
||||
temp_CFLAGS=`echo $CFLAGS | sed "s/-Wall -pedantic//" | sed "s/-Wshadow//" | sed "s/-Waggregate-return//"`
|
||||
CFLAGS=$temp_CFLAGS
|
||||
SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(srcdir)/Symbols.darwin"
|
||||
;;
|
||||
linux*)
|
||||
SHLIB_VERSION_ARG="-Wl,--version-script=\$(srcdir)/Symbols.linux"
|
||||
;;
|
||||
mingw*)
|
||||
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/libsndfile.def"
|
||||
;;
|
||||
cygwin*)
|
||||
SHLIB_VERSION_ARG="-Wl,\$(srcdir)/cygsndfile.def"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
if test x$enable_gcc_pipe != "xno" ; then
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
fi
|
||||
|
||||
AC_DEFINE([COMPILER_IS_GCC],1, [Set to 1 if the compile is GNU GCC.])
|
||||
GCC_MAJOR_VERSION=`$CC -dumpversion | sed "s/\..*//"`
|
||||
AC_DEFINE_UNQUOTED([GCC_MAJOR_VERSION],${GCC_MAJOR_VERSION}, [Major version of GCC or 3 otherwise.])
|
||||
fi
|
||||
|
||||
CFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
|
||||
|
||||
if test x"$CFLAGS" = x ; then
|
||||
echo "Error in configure script. CFLAGS has been screwed up."
|
||||
exit
|
||||
fi
|
||||
|
||||
AC_SUBST(htmldocdir)
|
||||
AC_SUBST(HTML_BGCOLOUR)
|
||||
AC_SUBST(HTML_FGCOLOUR)
|
||||
|
||||
AC_SUBST(SHLIB_VERSION_ARG)
|
||||
AC_SUBST(SHARED_VERSION_INFO)
|
||||
AC_SUBST(OS_SPECIFIC_CFLAGS)
|
||||
AC_SUBST(OS_SPECIFIC_LINKS)
|
||||
AC_SUBST(ALSA_LIBS)
|
||||
AC_SUBST(FLAC_LIBS)
|
||||
AC_SUBST(ENABLE_EXPERIMENTAL_CODE)
|
||||
|
||||
AC_SUBST(COMPILER_IS_GCC)
|
||||
AC_SUBST(GCC_MAJOR_VERSION)
|
||||
|
||||
dnl The following line causes the libtool distributed with the source
|
||||
dnl to be replaced if the build system has a more recent version.
|
||||
AC_SUBST(LIBTOOL_DEPS)
|
||||
|
||||
AC_CONFIG_FILES([ \
|
||||
src/sndfile.h
|
||||
sndfile.pc \
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
#====================================================================================
|
||||
|
||||
AC_MSG_RESULT([
|
||||
-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
Configuration summary :
|
||||
|
||||
Version : ..................... ${VERSION}
|
||||
Experimental code : ........... ${enable_experimental:-no}
|
||||
])
|
||||
|
||||
if test x$ac_cv_c_compiler_gnu = xyes ; then
|
||||
echo -e " Tools :\n"
|
||||
echo " Compiler is GCC : ............. ${ac_cv_c_compiler_gnu}"
|
||||
echo " GCC major version : ........... ${GCC_MAJOR_VERSION}"
|
||||
if test $GCC_MAJOR_VERSION -lt 3 ; then
|
||||
echo -e "\n ** This compiler version allows applications to write"
|
||||
echo " ** to static strings within the library."
|
||||
echo " ** Compile with GCC version 3.X to avoid this problem."
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $libdir = "\${exec_prefix}/lib" ; then
|
||||
libdir="$prefix/lib"
|
||||
fi
|
||||
|
||||
if test $bindir = "\${exec_prefix}/bin" ; then
|
||||
bindir="$prefix/bin"
|
||||
fi
|
||||
|
||||
AC_MSG_RESULT([[
|
||||
Installation directories :
|
||||
|
||||
Library directory : ........... $libdir
|
||||
Program directory : ........... $bindir
|
||||
Pkgconfig directory : ......... $libdir/pkgconfig
|
||||
HTML docs directory : ......... $htmldocdir
|
||||
]])
|
||||
|
||||
if test x$prefix != "x/usr" ; then
|
||||
echo "Compiling some other packages against libsndfile may require"
|
||||
echo -e "the addition of \"$libdir/pkgconfig\" to the"
|
||||
echo -e "PKG_CONFIG_PATH environment variable.\n"
|
||||
fi
|
||||
|
||||
#====================================================================================
|
||||
|
||||
ifelse(dnl
|
||||
|
||||
Do not edit or modify anything in this comment block.
|
||||
The arch-tag line is a file identity tag for the GNU Arch
|
||||
revision control system.
|
||||
|
||||
arch-tag: 6391b316-6cfc-43c2-a18a-8defdc4ee359
|
||||
|
||||
)dnl
|
||||
479
libs/libsndfile/depcomp
Executable file
479
libs/libsndfile/depcomp
Executable file
|
|
@ -0,0 +1,479 @@
|
|||
#! /bin/sh
|
||||
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
# Copyright 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
||||
tmpdepfile2="$dir.libs/$base.d"
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1="$dir$base.o.d"
|
||||
tmpdepfile2="$dir$base.d"
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
294
libs/libsndfile/install-sh
Executable file
294
libs/libsndfile/install-sh
Executable file
|
|
@ -0,0 +1,294 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
#
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=""
|
||||
transform_arg=""
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
dir_arg=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd=$cpprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
# this colon is to work around a 386BSD /bin/sh bug
|
||||
:
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "$0: no input file specified" >&2
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]; then
|
||||
dst=$src
|
||||
src=""
|
||||
|
||||
if [ -d "$dst" ]; then
|
||||
instcmd=:
|
||||
chmodcmd=""
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
|
||||
if [ -f "$src" ] || [ -d "$src" ]
|
||||
then
|
||||
:
|
||||
else
|
||||
echo "$0: $src does not exist" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "$0: no destination specified" >&2
|
||||
exit 1
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d "$dst" ]
|
||||
then
|
||||
dst=$dst/`basename "$src"`
|
||||
else
|
||||
:
|
||||
fi
|
||||
fi
|
||||
|
||||
## this sed command emulates the dirname command
|
||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
# this part is taken from Noah Friedman's mkinstalldirs script
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if [ ! -d "$dstdir" ]; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=''
|
||||
|
||||
while [ $# -ne 0 ] ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
|
||||
if [ ! -d "$pathcomp" ] ;
|
||||
then
|
||||
$mkdirprog "$pathcomp"
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if [ x"$dir_arg" != x ]
|
||||
then
|
||||
$doit $instcmd "$dst" &&
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi
|
||||
else
|
||||
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
|
||||
if [ x"$transformarg" = x ]
|
||||
then
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
dstfile=`basename "$dst" $transformbasename |
|
||||
sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename
|
||||
|
||||
if [ x"$dstfile" = x ]
|
||||
then
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
:
|
||||
fi
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up temp files at exit.
|
||||
|
||||
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&
|
||||
|
||||
# Now remove or move aside any old file at destination location. We try this
|
||||
# two ways since rm can't unlink itself on some systems and the destination
|
||||
# file might be busy for other reasons. In this case, the final cleanup
|
||||
# might fail but the new file should still install successfully.
|
||||
|
||||
{
|
||||
if [ -f "$dstdir/$dstfile" ]
|
||||
then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||
|
||||
$doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||
|
||||
{
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
|
||||
fi &&
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
|
||||
{
|
||||
(exit 0); exit
|
||||
}
|
||||
69
libs/libsndfile/libsndfile.spec.in
Normal file
69
libs/libsndfile/libsndfile.spec.in
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
|
||||
%define name @PACKAGE@
|
||||
%define version @VERSION@
|
||||
%define release 1
|
||||
|
||||
Summary: A library to handle various audio file formats.
|
||||
Name: %{name}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Copyright: LGPL
|
||||
Group: Libraries/Sound
|
||||
Source: http://www.mega-nerd.com/libsndfile/libsndfile-%{version}.tar.gz
|
||||
URL: http://www.mega-nerd.com/libsndfile/
|
||||
BuildRoot: /var/tmp/%{name}-%{version}
|
||||
|
||||
%description
|
||||
libsndfile is a C library for reading and writing sound files such as
|
||||
AIFF, AU and WAV files through one standard interface. It can currently
|
||||
read/write 8, 16, 24 and 32-bit PCM files as well as 32-bit floating
|
||||
point WAV files and a number of compressed formats.
|
||||
|
||||
%package devel
|
||||
Summary: Libraries, includes, etc to develop libsndfile applications
|
||||
Group: Libraries
|
||||
|
||||
%description devel
|
||||
Libraries, include files, etc you can use to develop libsndfile applications.
|
||||
|
||||
%prep
|
||||
%setup
|
||||
|
||||
%build
|
||||
%configure
|
||||
make
|
||||
|
||||
%install
|
||||
if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi
|
||||
mkdir -p $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
%clean
|
||||
if [ -d $RPM_BUILD_ROOT ]; then rm -rf $RPM_BUILD_ROOT; fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README TODO doc
|
||||
%{_libdir}/libsndfile.so.*
|
||||
%{_bindir}/*
|
||||
%{_mandir}/man1/*
|
||||
%{_datadir}/octave/site/m/*
|
||||
%{_defaultdocdir}/libsndfile1-dev/html/*
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/libsndfile.a
|
||||
%{_libdir}/libsndfile.la
|
||||
%{_libdir}/libsndfile.so
|
||||
%{_includedir}/sndfile.h
|
||||
%{_libdir}/pkgconfig/sndfile.pc
|
||||
|
||||
%changelog
|
||||
* Sun May 15 2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
- Add html files to the files section.
|
||||
* Tue Sep 16 2003 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
- Apply corrections from Andrew Schultz.
|
||||
* Mon Oct 21 2002 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
- Force installation of sndfile.pc file.
|
||||
* Thu Jul 6 2000 Josh Green <jgreen@users.sourceforge.net>
|
||||
- Created libsndfile.spec.in
|
||||
|
||||
336
libs/libsndfile/missing
Executable file
336
libs/libsndfile/missing
Executable file
|
|
@ -0,0 +1,336 @@
|
|||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing 0.4 - GNU automake"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is missing on your system. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and you do not seem to have it handy on your
|
||||
system. You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
111
libs/libsndfile/mkinstalldirs
Executable file
111
libs/libsndfile/mkinstalldirs
Executable file
|
|
@ -0,0 +1,111 @@
|
|||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
errstatus=0
|
||||
dirmode=""
|
||||
|
||||
usage="\
|
||||
Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
|
||||
|
||||
# process command line arguments
|
||||
while test $# -gt 0 ; do
|
||||
case $1 in
|
||||
-h | --help | --h*) # -h for help
|
||||
echo "$usage" 1>&2
|
||||
exit 0
|
||||
;;
|
||||
-m) # -m PERM arg
|
||||
shift
|
||||
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
|
||||
dirmode=$1
|
||||
shift
|
||||
;;
|
||||
--) # stop option processing
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) # unknown option
|
||||
echo "$usage" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
*) # first non-opt arg
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
for file
|
||||
do
|
||||
if test -d "$file"; then
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
case $# in
|
||||
0) exit 0 ;;
|
||||
esac
|
||||
|
||||
case $dirmode in
|
||||
'')
|
||||
if mkdir -p -- . 2>/dev/null; then
|
||||
echo "mkdir -p -- $*"
|
||||
exec mkdir -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
|
||||
echo "mkdir -m $dirmode -p -- $*"
|
||||
exec mkdir -m "$dirmode" -p -- "$@"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case $pathcomp in
|
||||
-*) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp"
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
else
|
||||
if test ! -z "$dirmode"; then
|
||||
echo "chmod $dirmode $pathcomp"
|
||||
lasterr=""
|
||||
chmod "$dirmode" "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -z "$lasterr"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# End:
|
||||
# mkinstalldirs ends here
|
||||
11
libs/libsndfile/sndfile.pc.in
Normal file
11
libs/libsndfile/sndfile.pc.in
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
|
||||
Name: sndfile
|
||||
Description: A library for reading and writing audio files
|
||||
Requires:
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lsndfile
|
||||
Cflags: -I${includedir}
|
||||
50
libs/libsndfile/src/G72x/ChangeLog
Normal file
50
libs/libsndfile/src/G72x/ChangeLog
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
2001-06-05 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
|
||||
* g72x.c
|
||||
Added {} in function update () to prevent 'ambiguous else' warning messages.
|
||||
|
||||
2000-07-14 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
|
||||
* g72x.c
|
||||
Modified g72x_init_state () to fit in with the new structure of the code.
|
||||
Implemented g72x_encode_block () and g72x_decode_block ().
|
||||
|
||||
2000-07-12 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
|
||||
* g72x.h
|
||||
Moved nearly all definitions and function prototypes from this file have been
|
||||
moved to private.h.
|
||||
Added an enum defining the 4 different G72x ADPCM codecs.
|
||||
Added new function prototypes to define a cleaner interface to the encoder
|
||||
and decoder. This new interface also allows samples to be processed in blocks
|
||||
rather than on a sample by sample basis like the original code.
|
||||
|
||||
* private.h
|
||||
Added prototypes moved from g72x.h.
|
||||
Changed struct g72x_state to a typedef struct { .. } G72x_PRIVATE.
|
||||
Added fields to G72x_PRIVATE required for working on blocks of samples.
|
||||
|
||||
2000-06-07 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
|
||||
* g72x.c
|
||||
Fixed all compiler warnings.
|
||||
Removed functions tandem_adjust() which is not required by libsndfile.
|
||||
|
||||
* g721.c
|
||||
Fixed all compiler warnings.
|
||||
Removed functions tandem_adjust_alaw() and tandem_adjust_ulaw () which are not
|
||||
required by libsndfile.
|
||||
Removed second parameter to g721_encoder () which is not required.
|
||||
|
||||
* g72x.h
|
||||
Removed in_coding and out_coding parameters from all functions. These allowed
|
||||
g72x encoding/decoding to/from A-law or u-law and are not required by libsndfile.
|
||||
Removed unneeded defines for A-law, u-law and linear encoding.
|
||||
|
||||
* g723_16.c
|
||||
Removed second parameter (in_coding) for g723_16_encoder().
|
||||
Removed second parameter (out_coding) for g723_16_decoder().
|
||||
|
||||
* private.h
|
||||
New file containing prototypes and tyepdefs private to G72x code.
|
||||
|
||||
0
libs/libsndfile/src/G72x/README
Normal file
0
libs/libsndfile/src/G72x/README
Normal file
94
libs/libsndfile/src/G72x/README.original
Normal file
94
libs/libsndfile/src/G72x/README.original
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
The files in this directory comprise ANSI-C language reference implementations
|
||||
of the CCITT (International Telegraph and Telephone Consultative Committee)
|
||||
G.711, G.721 and G.723 voice compressions. They have been tested on Sun
|
||||
SPARCstations and passed 82 out of 84 test vectors published by CCITT
|
||||
(Dec. 20, 1988) for G.721 and G.723. [The two remaining test vectors,
|
||||
which the G.721 decoder implementation for u-law samples did not pass,
|
||||
may be in error because they are identical to two other vectors for G.723_40.]
|
||||
|
||||
This source code is released by Sun Microsystems, Inc. to the public domain.
|
||||
Please give your acknowledgement in product literature if this code is used
|
||||
in your product implementation.
|
||||
|
||||
Sun Microsystems supports some CCITT audio formats in Solaris 2.0 system
|
||||
software. However, Sun's implementations have been optimized for higher
|
||||
performance on SPARCstations.
|
||||
|
||||
|
||||
The source files for CCITT conversion routines in this directory are:
|
||||
|
||||
g72x.h header file for g721.c, g723_24.c and g723_40.c
|
||||
g711.c CCITT G.711 u-law and A-law compression
|
||||
g72x.c common denominator of G.721 and G.723 ADPCM codes
|
||||
g721.c CCITT G.721 32Kbps ADPCM coder (with g72x.c)
|
||||
g723_24.c CCITT G.723 24Kbps ADPCM coder (with g72x.c)
|
||||
g723_40.c CCITT G.723 40Kbps ADPCM coder (with g72x.c)
|
||||
|
||||
|
||||
Simple conversions between u-law, A-law, and 16-bit linear PCM are invoked
|
||||
as follows:
|
||||
|
||||
unsigned char ucode, acode;
|
||||
short pcm_val;
|
||||
|
||||
ucode = linear2ulaw(pcm_val);
|
||||
ucode = alaw2ulaw(acode);
|
||||
|
||||
acode = linear2alaw(pcm_val);
|
||||
acode = ulaw2alaw(ucode);
|
||||
|
||||
pcm_val = ulaw2linear(ucode);
|
||||
pcm_val = alaw2linear(acode);
|
||||
|
||||
|
||||
The other CCITT compression routines are invoked as follows:
|
||||
|
||||
#include "g72x.h"
|
||||
|
||||
struct g72x_state state;
|
||||
int sample, code;
|
||||
|
||||
g72x_init_state(&state);
|
||||
code = {g721,g723_24,g723_40}_encoder(sample, coding, &state);
|
||||
sample = {g721,g723_24,g723_40}_decoder(code, coding, &state);
|
||||
|
||||
where
|
||||
coding = AUDIO_ENCODING_ULAW for 8-bit u-law samples
|
||||
AUDIO_ENCODING_ALAW for 8-bit A-law samples
|
||||
AUDIO_ENCODING_LINEAR for 16-bit linear PCM samples
|
||||
|
||||
|
||||
|
||||
This directory also includes the following sample programs:
|
||||
|
||||
encode.c CCITT ADPCM encoder
|
||||
decode.c CCITT ADPCM decoder
|
||||
Makefile makefile for the sample programs
|
||||
|
||||
|
||||
The sample programs contain examples of how to call the various compression
|
||||
routines and pack/unpack the bits. The sample programs read byte streams from
|
||||
stdin and write to stdout. The input/output data is raw data (no file header
|
||||
or other identifying information is embedded). The sample programs are
|
||||
invoked as follows:
|
||||
|
||||
encode [-3|4|5] [-a|u|l] <infile >outfile
|
||||
decode [-3|4|5] [-a|u|l] <infile >outfile
|
||||
where:
|
||||
-3 encode to (decode from) G.723 24kbps (3-bit) data
|
||||
-4 encode to (decode from) G.721 32kbps (4-bit) data [the default]
|
||||
-5 encode to (decode from) G.723 40kbps (5-bit) data
|
||||
-a encode from (decode to) A-law data
|
||||
-u encode from (decode to) u-law data [the default]
|
||||
-l encode from (decode to) 16-bit linear data
|
||||
|
||||
Examples:
|
||||
# Read 16-bit linear and output G.721
|
||||
encode -4 -l <pcmfile >g721file
|
||||
|
||||
# Read 40Kbps G.723 and output A-law
|
||||
decode -5 -a <g723file >alawfile
|
||||
|
||||
# Compress and then decompress u-law data using 24Kbps G.723
|
||||
encode -3 <ulawin | deoced -3 >ulawout
|
||||
|
||||
162
libs/libsndfile/src/G72x/g721.c
Normal file
162
libs/libsndfile/src/G72x/g721.c
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
/*
|
||||
* g721.c
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* g721_encoder(), g721_decoder()
|
||||
*
|
||||
* These routines comprise an implementation of the CCITT G.721 ADPCM
|
||||
* coding algorithm. Essentially, this implementation is identical to
|
||||
* the bit level description except for a few deviations which
|
||||
* take advantage of work station attributes, such as hardware 2's
|
||||
* complement arithmetic and large memory. Specifically, certain time
|
||||
* consuming operations such as multiplications are replaced
|
||||
* with lookup tables and software 2's complement operations are
|
||||
* replaced with hardware 2's complement.
|
||||
*
|
||||
* The deviation from the bit level specification (lookup tables)
|
||||
* preserves the bit level performance specifications.
|
||||
*
|
||||
* As outlined in the G.721 Recommendation, the algorithm is broken
|
||||
* down into modules. Each section of code below is preceded by
|
||||
* the name of the module which it is implementing.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
static short qtab_721[7] = {-124, 80, 178, 246, 300, 349, 400};
|
||||
/*
|
||||
* Maps G.721 code word to reconstructed scale factor normalized log
|
||||
* magnitude values.
|
||||
*/
|
||||
static short _dqlntab[16] = {-2048, 4, 135, 213, 273, 323, 373, 425,
|
||||
425, 373, 323, 273, 213, 135, 4, -2048};
|
||||
|
||||
/* Maps G.721 code word to log of scale factor multiplier. */
|
||||
static short _witab[16] = {-12, 18, 41, 64, 112, 198, 355, 1122,
|
||||
1122, 355, 198, 112, 64, 41, 18, -12};
|
||||
/*
|
||||
* Maps G.721 code words to a set of values whose long and short
|
||||
* term averages are computed and then compared to give an indication
|
||||
* how stationary (steady state) the signal is.
|
||||
*/
|
||||
static short _fitab[16] = {0, 0, 0, 0x200, 0x200, 0x200, 0x600, 0xE00,
|
||||
0xE00, 0x600, 0x200, 0x200, 0x200, 0, 0, 0};
|
||||
|
||||
/*
|
||||
* g721_encoder()
|
||||
*
|
||||
* Encodes the input vale of linear PCM, A-law or u-law data sl and returns
|
||||
* the resulting code. -1 is returned for unknown input coding value.
|
||||
*/
|
||||
int
|
||||
g721_encoder(
|
||||
int sl,
|
||||
G72x_STATE *state_ptr)
|
||||
{
|
||||
short sezi, se, sez; /* ACCUM */
|
||||
short d; /* SUBTA */
|
||||
short sr; /* ADDB */
|
||||
short y; /* MIX */
|
||||
short dqsez; /* ADDC */
|
||||
short dq, i;
|
||||
|
||||
/* linearize input sample to 14-bit PCM */
|
||||
sl >>= 2; /* 14-bit dynamic range */
|
||||
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
se = (sezi + predictor_pole(state_ptr)) >> 1; /* estimated signal */
|
||||
|
||||
d = sl - se; /* estimation difference */
|
||||
|
||||
/* quantize the prediction difference */
|
||||
y = step_size(state_ptr); /* quantizer step size */
|
||||
i = quantize(d, y, qtab_721, 7); /* i = ADPCM code */
|
||||
|
||||
dq = reconstruct(i & 8, _dqlntab[i], y); /* quantized est diff */
|
||||
|
||||
sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconst. signal */
|
||||
|
||||
dqsez = sr + sez - se; /* pole prediction diff. */
|
||||
|
||||
update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/*
|
||||
* g721_decoder()
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* Decodes a 4-bit code of G.721 encoded data of i and
|
||||
* returns the resulting linear PCM, A-law or u-law value.
|
||||
* return -1 for unknown out_coding value.
|
||||
*/
|
||||
int
|
||||
g721_decoder(
|
||||
int i,
|
||||
G72x_STATE *state_ptr)
|
||||
{
|
||||
short sezi, sei, sez, se; /* ACCUM */
|
||||
short y; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dq;
|
||||
short dqsez;
|
||||
|
||||
i &= 0x0f; /* mask to get proper bits */
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
y = step_size(state_ptr); /* dynamic quantizer step size */
|
||||
|
||||
dq = reconstruct(i & 0x08, _dqlntab[i], y); /* quantized diff. */
|
||||
|
||||
sr = (dq < 0) ? (se - (dq & 0x3FFF)) : se + dq; /* reconst. signal */
|
||||
|
||||
dqsez = sr - se + sez; /* pole prediction diff. */
|
||||
|
||||
update(4, y, _witab[i] << 5, _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
/* sr was 14-bit dynamic range */
|
||||
return (sr << 2);
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 101b6e25-457d-490a-99ae-e2e74a26ea24
|
||||
*/
|
||||
|
||||
169
libs/libsndfile/src/G72x/g723_16.c
Normal file
169
libs/libsndfile/src/G72x/g723_16.c
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
/* 16kbps version created, used 24kbps code and changing as little as possible.
|
||||
* G.726 specs are available from ITU's gopher or WWW site (http://www.itu.ch)
|
||||
* If any errors are found, please contact me at mrand@tamu.edu
|
||||
* -Marc Randolph
|
||||
*/
|
||||
|
||||
/*
|
||||
* g723_16.c
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* g723_16_encoder(), g723_16_decoder()
|
||||
*
|
||||
* These routines comprise an implementation of the CCITT G.726 16 Kbps
|
||||
* ADPCM coding algorithm. Essentially, this implementation is identical to
|
||||
* the bit level description except for a few deviations which take advantage
|
||||
* of workstation attributes, such as hardware 2's complement arithmetic.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
/*
|
||||
* Maps G.723_16 code word to reconstructed scale factor normalized log
|
||||
* magnitude values. Comes from Table 11/G.726
|
||||
*/
|
||||
static short _dqlntab[4] = { 116, 365, 365, 116};
|
||||
|
||||
/* Maps G.723_16 code word to log of scale factor multiplier.
|
||||
*
|
||||
* _witab[4] is actually {-22 , 439, 439, -22}, but FILTD wants it
|
||||
* as WI << 5 (multiplied by 32), so we'll do that here
|
||||
*/
|
||||
static short _witab[4] = {-704, 14048, 14048, -704};
|
||||
|
||||
/*
|
||||
* Maps G.723_16 code words to a set of values whose long and short
|
||||
* term averages are computed and then compared to give an indication
|
||||
* how stationary (steady state) the signal is.
|
||||
*/
|
||||
|
||||
/* Comes from FUNCTF */
|
||||
static short _fitab[4] = {0, 0xE00, 0xE00, 0};
|
||||
|
||||
/* Comes from quantizer decision level tables (Table 7/G.726)
|
||||
*/
|
||||
static short qtab_723_16[1] = {261};
|
||||
|
||||
|
||||
/*
|
||||
* g723_16_encoder()
|
||||
*
|
||||
* Encodes a linear PCM, A-law or u-law input sample and returns its 2-bit code.
|
||||
* Returns -1 if invalid input coding value.
|
||||
*/
|
||||
int
|
||||
g723_16_encoder(
|
||||
int sl,
|
||||
G72x_STATE *state_ptr)
|
||||
{
|
||||
short sei, sezi, se, sez; /* ACCUM */
|
||||
short d; /* SUBTA */
|
||||
short y; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dqsez; /* ADDC */
|
||||
short dq, i;
|
||||
|
||||
/* linearize input sample to 14-bit PCM */
|
||||
sl >>= 2; /* sl of 14-bit dynamic range */
|
||||
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
d = sl - se; /* d = estimation diff. */
|
||||
|
||||
/* quantize prediction difference d */
|
||||
y = step_size(state_ptr); /* quantizer step size */
|
||||
i = quantize(d, y, qtab_723_16, 1); /* i = ADPCM code */
|
||||
|
||||
/* Since quantize() only produces a three level output
|
||||
* (1, 2, or 3), we must create the fourth one on our own
|
||||
*/
|
||||
if (i == 3) /* i code for the zero region */
|
||||
if ((d & 0x8000) == 0) /* If d > 0, i=3 isn't right... */
|
||||
i = 0;
|
||||
|
||||
dq = reconstruct(i & 2, _dqlntab[i], y); /* quantized diff. */
|
||||
|
||||
sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */
|
||||
|
||||
dqsez = sr + sez - se; /* pole prediction diff. */
|
||||
|
||||
update(2, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/*
|
||||
* g723_16_decoder()
|
||||
*
|
||||
* Decodes a 2-bit CCITT G.723_16 ADPCM code and returns
|
||||
* the resulting 16-bit linear PCM, A-law or u-law sample value.
|
||||
* -1 is returned if the output coding is unknown.
|
||||
*/
|
||||
int
|
||||
g723_16_decoder(
|
||||
int i,
|
||||
G72x_STATE *state_ptr)
|
||||
{
|
||||
short sezi, sei, sez, se; /* ACCUM */
|
||||
short y; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dq;
|
||||
short dqsez;
|
||||
|
||||
i &= 0x03; /* mask to get proper bits */
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
y = step_size(state_ptr); /* adaptive quantizer step size */
|
||||
dq = reconstruct(i & 0x02, _dqlntab[i], y); /* unquantize pred diff */
|
||||
|
||||
sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */
|
||||
|
||||
dqsez = sr - se + sez; /* pole prediction diff. */
|
||||
|
||||
update(2, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
/* sr was of 14-bit dynamic range */
|
||||
return (sr << 2);
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: ae265466-c3fc-4f83-bb32-edae488a5ca5
|
||||
*/
|
||||
|
||||
146
libs/libsndfile/src/G72x/g723_24.c
Normal file
146
libs/libsndfile/src/G72x/g723_24.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
/*
|
||||
* g723_24.c
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* g723_24_encoder(), g723_24_decoder()
|
||||
*
|
||||
* These routines comprise an implementation of the CCITT G.723 24 Kbps
|
||||
* ADPCM coding algorithm. Essentially, this implementation is identical to
|
||||
* the bit level description except for a few deviations which take advantage
|
||||
* of workstation attributes, such as hardware 2's complement arithmetic.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
/*
|
||||
* Maps G.723_24 code word to reconstructed scale factor normalized log
|
||||
* magnitude values.
|
||||
*/
|
||||
static short _dqlntab[8] = {-2048, 135, 273, 373, 373, 273, 135, -2048};
|
||||
|
||||
/* Maps G.723_24 code word to log of scale factor multiplier. */
|
||||
static short _witab[8] = {-128, 960, 4384, 18624, 18624, 4384, 960, -128};
|
||||
|
||||
/*
|
||||
* Maps G.723_24 code words to a set of values whose long and short
|
||||
* term averages are computed and then compared to give an indication
|
||||
* how stationary (steady state) the signal is.
|
||||
*/
|
||||
static short _fitab[8] = {0, 0x200, 0x400, 0xE00, 0xE00, 0x400, 0x200, 0};
|
||||
|
||||
static short qtab_723_24[3] = {8, 218, 331};
|
||||
|
||||
/*
|
||||
* g723_24_encoder()
|
||||
*
|
||||
* Encodes a linear PCM, A-law or u-law input sample and returns its 3-bit code.
|
||||
* Returns -1 if invalid input coding value.
|
||||
*/
|
||||
int
|
||||
g723_24_encoder(
|
||||
int sl,
|
||||
G72x_STATE *state_ptr)
|
||||
{
|
||||
short sei, sezi, se, sez; /* ACCUM */
|
||||
short d; /* SUBTA */
|
||||
short y; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dqsez; /* ADDC */
|
||||
short dq, i;
|
||||
|
||||
/* linearize input sample to 14-bit PCM */
|
||||
sl >>= 2; /* sl of 14-bit dynamic range */
|
||||
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
d = sl - se; /* d = estimation diff. */
|
||||
|
||||
/* quantize prediction difference d */
|
||||
y = step_size(state_ptr); /* quantizer step size */
|
||||
i = quantize(d, y, qtab_723_24, 3); /* i = ADPCM code */
|
||||
dq = reconstruct(i & 4, _dqlntab[i], y); /* quantized diff. */
|
||||
|
||||
sr = (dq < 0) ? se - (dq & 0x3FFF) : se + dq; /* reconstructed signal */
|
||||
|
||||
dqsez = sr + sez - se; /* pole prediction diff. */
|
||||
|
||||
update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/*
|
||||
* g723_24_decoder()
|
||||
*
|
||||
* Decodes a 3-bit CCITT G.723_24 ADPCM code and returns
|
||||
* the resulting 16-bit linear PCM, A-law or u-law sample value.
|
||||
* -1 is returned if the output coding is unknown.
|
||||
*/
|
||||
int
|
||||
g723_24_decoder(
|
||||
int i,
|
||||
G72x_STATE *state_ptr)
|
||||
{
|
||||
short sezi, sei, sez, se; /* ACCUM */
|
||||
short y; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dq;
|
||||
short dqsez;
|
||||
|
||||
i &= 0x07; /* mask to get proper bits */
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
y = step_size(state_ptr); /* adaptive quantizer step size */
|
||||
dq = reconstruct(i & 0x04, _dqlntab[i], y); /* unquantize pred diff */
|
||||
|
||||
sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq); /* reconst. signal */
|
||||
|
||||
dqsez = sr - se + sez; /* pole prediction diff. */
|
||||
|
||||
update(3, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
return (sr << 2); /* sr was of 14-bit dynamic range */
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 75389236-650b-4427-98f3-0df6e8fb24bc
|
||||
*/
|
||||
|
||||
160
libs/libsndfile/src/G72x/g723_40.c
Normal file
160
libs/libsndfile/src/G72x/g723_40.c
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
/*
|
||||
* g723_40.c
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* g723_40_encoder(), g723_40_decoder()
|
||||
*
|
||||
* These routines comprise an implementation of the CCITT G.723 40Kbps
|
||||
* ADPCM coding algorithm. Essentially, this implementation is identical to
|
||||
* the bit level description except for a few deviations which
|
||||
* take advantage of workstation attributes, such as hardware 2's
|
||||
* complement arithmetic.
|
||||
*
|
||||
* The deviation from the bit level specification (lookup tables),
|
||||
* preserves the bit level performance specifications.
|
||||
*
|
||||
* As outlined in the G.723 Recommendation, the algorithm is broken
|
||||
* down into modules. Each section of code below is preceded by
|
||||
* the name of the module which it is implementing.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
/*
|
||||
* Maps G.723_40 code word to ructeconstructed scale factor normalized log
|
||||
* magnitude values.
|
||||
*/
|
||||
static short _dqlntab[32] = {-2048, -66, 28, 104, 169, 224, 274, 318,
|
||||
358, 395, 429, 459, 488, 514, 539, 566,
|
||||
566, 539, 514, 488, 459, 429, 395, 358,
|
||||
318, 274, 224, 169, 104, 28, -66, -2048};
|
||||
|
||||
/* Maps G.723_40 code word to log of scale factor multiplier. */
|
||||
static short _witab[32] = {448, 448, 768, 1248, 1280, 1312, 1856, 3200,
|
||||
4512, 5728, 7008, 8960, 11456, 14080, 16928, 22272,
|
||||
22272, 16928, 14080, 11456, 8960, 7008, 5728, 4512,
|
||||
3200, 1856, 1312, 1280, 1248, 768, 448, 448};
|
||||
|
||||
/*
|
||||
* Maps G.723_40 code words to a set of values whose long and short
|
||||
* term averages are computed and then compared to give an indication
|
||||
* how stationary (steady state) the signal is.
|
||||
*/
|
||||
static short _fitab[32] = {0, 0, 0, 0, 0, 0x200, 0x200, 0x200,
|
||||
0x200, 0x200, 0x400, 0x600, 0x800, 0xA00, 0xC00, 0xC00,
|
||||
0xC00, 0xC00, 0xA00, 0x800, 0x600, 0x400, 0x200, 0x200,
|
||||
0x200, 0x200, 0x200, 0, 0, 0, 0, 0};
|
||||
|
||||
static short qtab_723_40[15] = {-122, -16, 68, 139, 198, 250, 298, 339,
|
||||
378, 413, 445, 475, 502, 528, 553};
|
||||
|
||||
/*
|
||||
* g723_40_encoder()
|
||||
*
|
||||
* Encodes a 16-bit linear PCM, A-law or u-law input sample and retuens
|
||||
* the resulting 5-bit CCITT G.723 40Kbps code.
|
||||
* Returns -1 if the input coding value is invalid.
|
||||
*/
|
||||
int g723_40_encoder (int sl, G72x_STATE *state_ptr)
|
||||
{
|
||||
short sei, sezi, se, sez; /* ACCUM */
|
||||
short d; /* SUBTA */
|
||||
short y; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dqsez; /* ADDC */
|
||||
short dq, i;
|
||||
|
||||
/* linearize input sample to 14-bit PCM */
|
||||
sl >>= 2; /* sl of 14-bit dynamic range */
|
||||
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
d = sl - se; /* d = estimation difference */
|
||||
|
||||
/* quantize prediction difference */
|
||||
y = step_size(state_ptr); /* adaptive quantizer step size */
|
||||
i = quantize(d, y, qtab_723_40, 15); /* i = ADPCM code */
|
||||
|
||||
dq = reconstruct(i & 0x10, _dqlntab[i], y); /* quantized diff */
|
||||
|
||||
sr = (dq < 0) ? se - (dq & 0x7FFF) : se + dq; /* reconstructed signal */
|
||||
|
||||
dqsez = sr + sez - se; /* dqsez = pole prediction diff. */
|
||||
|
||||
update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
return (i);
|
||||
}
|
||||
|
||||
/*
|
||||
* g723_40_decoder()
|
||||
*
|
||||
* Decodes a 5-bit CCITT G.723 40Kbps code and returns
|
||||
* the resulting 16-bit linear PCM, A-law or u-law sample value.
|
||||
* -1 is returned if the output coding is unknown.
|
||||
*/
|
||||
int g723_40_decoder (int i, G72x_STATE *state_ptr)
|
||||
{
|
||||
short sezi, sei, sez, se; /* ACCUM */
|
||||
short y ; /* MIX */
|
||||
short sr; /* ADDB */
|
||||
short dq;
|
||||
short dqsez;
|
||||
|
||||
i &= 0x1f; /* mask to get proper bits */
|
||||
sezi = predictor_zero(state_ptr);
|
||||
sez = sezi >> 1;
|
||||
sei = sezi + predictor_pole(state_ptr);
|
||||
se = sei >> 1; /* se = estimated signal */
|
||||
|
||||
y = step_size(state_ptr); /* adaptive quantizer step size */
|
||||
dq = reconstruct(i & 0x10, _dqlntab[i], y); /* estimation diff. */
|
||||
|
||||
sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq); /* reconst. signal */
|
||||
|
||||
dqsez = sr - se + sez; /* pole prediction diff. */
|
||||
|
||||
update(5, y, _witab[i], _fitab[i], dq, sr, dqsez, state_ptr);
|
||||
|
||||
return (sr << 2); /* sr was of 14-bit dynamic range */
|
||||
}
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: eb8d9a00-32bf-4dd2-b287-01b0336d72bf
|
||||
*/
|
||||
|
||||
652
libs/libsndfile/src/G72x/g72x.c
Normal file
652
libs/libsndfile/src/G72x/g72x.c
Normal file
|
|
@ -0,0 +1,652 @@
|
|||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
/*
|
||||
* g72x.c
|
||||
*
|
||||
* Common routines for G.721 and G.723 conversions.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
static G72x_STATE * g72x_state_new (void) ;
|
||||
static int unpack_bytes (int bits, int blocksize, const unsigned char * block, short * samples) ;
|
||||
static int pack_bytes (int bits, const short * samples, unsigned char * block) ;
|
||||
|
||||
static
|
||||
short power2 [15] =
|
||||
{ 1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80,
|
||||
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000
|
||||
} ;
|
||||
|
||||
/*
|
||||
* quan()
|
||||
*
|
||||
* quantizes the input val against the table of size short integers.
|
||||
* It returns i if table[i - 1] <= val < table[i].
|
||||
*
|
||||
* Using linear search for simple coding.
|
||||
*/
|
||||
static
|
||||
int quan (int val, short *table, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
if (val < *table++)
|
||||
break;
|
||||
return (i);
|
||||
}
|
||||
|
||||
/*
|
||||
* fmult()
|
||||
*
|
||||
* returns the integer product of the 14-bit integer "an" and
|
||||
* "floating point" representation (4-bit exponent, 6-bit mantessa) "srn".
|
||||
*/
|
||||
static
|
||||
int fmult (int an, int srn)
|
||||
{
|
||||
short anmag, anexp, anmant;
|
||||
short wanexp, wanmant;
|
||||
short retval;
|
||||
|
||||
anmag = (an > 0) ? an : ((-an) & 0x1FFF);
|
||||
anexp = quan(anmag, power2, 15) - 6;
|
||||
anmant = (anmag == 0) ? 32 :
|
||||
(anexp >= 0) ? anmag >> anexp : anmag << -anexp;
|
||||
wanexp = anexp + ((srn >> 6) & 0xF) - 13;
|
||||
|
||||
/*
|
||||
** The original was :
|
||||
** wanmant = (anmant * (srn & 0x37) + 0x30) >> 4 ;
|
||||
** but could see no valid reason for the + 0x30.
|
||||
** Removed it and it improved the SNR of the codec.
|
||||
*/
|
||||
|
||||
wanmant = (anmant * (srn & 0x37)) >> 4 ;
|
||||
|
||||
retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) :
|
||||
(wanmant >> -wanexp);
|
||||
|
||||
return (((an ^ srn) < 0) ? -retval : retval);
|
||||
}
|
||||
|
||||
static G72x_STATE * g72x_state_new (void)
|
||||
{ return calloc (1, sizeof (G72x_STATE)) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* private_init_state()
|
||||
*
|
||||
* This routine initializes and/or resets the G72x_PRIVATE structure
|
||||
* pointed to by 'state_ptr'.
|
||||
* All the initial state values are specified in the CCITT G.721 document.
|
||||
*/
|
||||
void private_init_state (G72x_STATE *state_ptr)
|
||||
{
|
||||
int cnta;
|
||||
|
||||
state_ptr->yl = 34816;
|
||||
state_ptr->yu = 544;
|
||||
state_ptr->dms = 0;
|
||||
state_ptr->dml = 0;
|
||||
state_ptr->ap = 0;
|
||||
for (cnta = 0; cnta < 2; cnta++) {
|
||||
state_ptr->a[cnta] = 0;
|
||||
state_ptr->pk[cnta] = 0;
|
||||
state_ptr->sr[cnta] = 32;
|
||||
}
|
||||
for (cnta = 0; cnta < 6; cnta++) {
|
||||
state_ptr->b[cnta] = 0;
|
||||
state_ptr->dq[cnta] = 32;
|
||||
}
|
||||
state_ptr->td = 0;
|
||||
} /* private_init_state */
|
||||
|
||||
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock)
|
||||
{ G72x_STATE *pstate ;
|
||||
|
||||
if ((pstate = g72x_state_new ()) == NULL)
|
||||
return NULL ;
|
||||
|
||||
private_init_state (pstate) ;
|
||||
|
||||
pstate->encoder = NULL ;
|
||||
|
||||
switch (codec)
|
||||
{ case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
|
||||
pstate->decoder = g723_16_decoder ;
|
||||
*blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 2 ;
|
||||
pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
|
||||
pstate->decoder = g723_24_decoder ;
|
||||
*blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 3 ;
|
||||
pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
|
||||
pstate->decoder = g721_decoder ;
|
||||
*blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 4 ;
|
||||
pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
|
||||
pstate->decoder = g723_40_decoder ;
|
||||
*blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 5 ;
|
||||
pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
free (pstate) ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
return pstate ;
|
||||
} /* g72x_reader_init */
|
||||
|
||||
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock)
|
||||
{ G72x_STATE *pstate ;
|
||||
|
||||
if ((pstate = g72x_state_new ()) == NULL)
|
||||
return NULL ;
|
||||
|
||||
private_init_state (pstate) ;
|
||||
pstate->decoder = NULL ;
|
||||
|
||||
switch (codec)
|
||||
{ case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
|
||||
pstate->encoder = g723_16_encoder ;
|
||||
*blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 2 ;
|
||||
pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
|
||||
pstate->encoder = g723_24_encoder ;
|
||||
*blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 3 ;
|
||||
pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
|
||||
pstate->encoder = g721_encoder ;
|
||||
*blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 4 ;
|
||||
pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
|
||||
pstate->encoder = g723_40_encoder ;
|
||||
*blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
pstate->codec_bits = 5 ;
|
||||
pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
|
||||
pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
|
||||
break ;
|
||||
|
||||
default :
|
||||
free (pstate) ;
|
||||
return NULL ;
|
||||
} ;
|
||||
|
||||
return pstate ;
|
||||
} /* g72x_writer_init */
|
||||
|
||||
int g72x_decode_block (G72x_STATE *pstate, const unsigned char *block, short *samples)
|
||||
{ int k, count ;
|
||||
|
||||
count = unpack_bytes (pstate->codec_bits, pstate->blocksize, block, samples) ;
|
||||
|
||||
for (k = 0 ; k < count ; k++)
|
||||
samples [k] = pstate->decoder (samples [k], pstate) ;
|
||||
|
||||
return 0 ;
|
||||
} /* g72x_decode_block */
|
||||
|
||||
int g72x_encode_block (G72x_STATE *pstate, short *samples, unsigned char *block)
|
||||
{ int k, count ;
|
||||
|
||||
for (k = 0 ; k < pstate->samplesperblock ; k++)
|
||||
samples [k] = pstate->encoder (samples [k], pstate) ;
|
||||
|
||||
count = pack_bytes (pstate->codec_bits, samples, block) ;
|
||||
|
||||
return count ;
|
||||
} /* g72x_encode_block */
|
||||
|
||||
/*
|
||||
* predictor_zero()
|
||||
*
|
||||
* computes the estimated signal from 6-zero predictor.
|
||||
*
|
||||
*/
|
||||
int predictor_zero (G72x_STATE *state_ptr)
|
||||
{
|
||||
int i;
|
||||
int sezi;
|
||||
|
||||
sezi = fmult(state_ptr->b[0] >> 2, state_ptr->dq[0]);
|
||||
for (i = 1; i < 6; i++) /* ACCUM */
|
||||
sezi += fmult(state_ptr->b[i] >> 2, state_ptr->dq[i]);
|
||||
return (sezi);
|
||||
}
|
||||
/*
|
||||
* predictor_pole()
|
||||
*
|
||||
* computes the estimated signal from 2-pole predictor.
|
||||
*
|
||||
*/
|
||||
int predictor_pole(G72x_STATE *state_ptr)
|
||||
{
|
||||
return (fmult(state_ptr->a[1] >> 2, state_ptr->sr[1]) +
|
||||
fmult(state_ptr->a[0] >> 2, state_ptr->sr[0]));
|
||||
}
|
||||
/*
|
||||
* step_size()
|
||||
*
|
||||
* computes the quantization step size of the adaptive quantizer.
|
||||
*
|
||||
*/
|
||||
int step_size (G72x_STATE *state_ptr)
|
||||
{
|
||||
int y;
|
||||
int dif;
|
||||
int al;
|
||||
|
||||
if (state_ptr->ap >= 256)
|
||||
return (state_ptr->yu);
|
||||
else {
|
||||
y = state_ptr->yl >> 6;
|
||||
dif = state_ptr->yu - y;
|
||||
al = state_ptr->ap >> 2;
|
||||
if (dif > 0)
|
||||
y += (dif * al) >> 6;
|
||||
else if (dif < 0)
|
||||
y += (dif * al + 0x3F) >> 6;
|
||||
return (y);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* quantize()
|
||||
*
|
||||
* Given a raw sample, 'd', of the difference signal and a
|
||||
* quantization step size scale factor, 'y', this routine returns the
|
||||
* ADPCM codeword to which that sample gets quantized. The step
|
||||
* size scale factor division operation is done in the log base 2 domain
|
||||
* as a subtraction.
|
||||
*/
|
||||
int quantize(
|
||||
int d, /* Raw difference signal sample */
|
||||
int y, /* Step size multiplier */
|
||||
short *table, /* quantization table */
|
||||
int size) /* table size of short integers */
|
||||
{
|
||||
short dqm; /* Magnitude of 'd' */
|
||||
short expon; /* Integer part of base 2 log of 'd' */
|
||||
short mant; /* Fractional part of base 2 log */
|
||||
short dl; /* Log of magnitude of 'd' */
|
||||
short dln; /* Step size scale factor normalized log */
|
||||
int i;
|
||||
|
||||
/*
|
||||
* LOG
|
||||
*
|
||||
* Compute base 2 log of 'd', and store in 'dl'.
|
||||
*/
|
||||
dqm = abs(d);
|
||||
expon = quan(dqm >> 1, power2, 15);
|
||||
mant = ((dqm << 7) >> expon) & 0x7F; /* Fractional portion. */
|
||||
dl = (expon << 7) + mant;
|
||||
|
||||
/*
|
||||
* SUBTB
|
||||
*
|
||||
* "Divide" by step size multiplier.
|
||||
*/
|
||||
dln = dl - (y >> 2);
|
||||
|
||||
/*
|
||||
* QUAN
|
||||
*
|
||||
* Obtain codword i for 'd'.
|
||||
*/
|
||||
i = quan(dln, table, size);
|
||||
if (d < 0) /* take 1's complement of i */
|
||||
return ((size << 1) + 1 - i);
|
||||
else if (i == 0) /* take 1's complement of 0 */
|
||||
return ((size << 1) + 1); /* new in 1988 */
|
||||
else
|
||||
return (i);
|
||||
}
|
||||
/*
|
||||
* reconstruct()
|
||||
*
|
||||
* Returns reconstructed difference signal 'dq' obtained from
|
||||
* codeword 'i' and quantization step size scale factor 'y'.
|
||||
* Multiplication is performed in log base 2 domain as addition.
|
||||
*/
|
||||
int
|
||||
reconstruct(
|
||||
int sign, /* 0 for non-negative value */
|
||||
int dqln, /* G.72x codeword */
|
||||
int y) /* Step size multiplier */
|
||||
{
|
||||
short dql; /* Log of 'dq' magnitude */
|
||||
short dex; /* Integer part of log */
|
||||
short dqt;
|
||||
short dq; /* Reconstructed difference signal sample */
|
||||
|
||||
dql = dqln + (y >> 2); /* ADDA */
|
||||
|
||||
if (dql < 0) {
|
||||
return ((sign) ? -0x8000 : 0);
|
||||
} else { /* ANTILOG */
|
||||
dex = (dql >> 7) & 15;
|
||||
dqt = 128 + (dql & 127);
|
||||
dq = (dqt << 7) >> (14 - dex);
|
||||
return ((sign) ? (dq - 0x8000) : dq);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* update()
|
||||
*
|
||||
* updates the state variables for each output code
|
||||
*/
|
||||
void
|
||||
update(
|
||||
int code_size, /* distinguish 723_40 with others */
|
||||
int y, /* quantizer step size */
|
||||
int wi, /* scale factor multiplier */
|
||||
int fi, /* for long/short term energies */
|
||||
int dq, /* quantized prediction difference */
|
||||
int sr, /* reconstructed signal */
|
||||
int dqsez, /* difference from 2-pole predictor */
|
||||
G72x_STATE *state_ptr) /* coder state pointer */
|
||||
{
|
||||
int cnt;
|
||||
short mag, expon; /* Adaptive predictor, FLOAT A */
|
||||
short a2p = 0; /* LIMC */
|
||||
short a1ul; /* UPA1 */
|
||||
short pks1; /* UPA2 */
|
||||
short fa1;
|
||||
char tr; /* tone/transition detector */
|
||||
short ylint, thr2, dqthr;
|
||||
short ylfrac, thr1;
|
||||
short pk0;
|
||||
|
||||
pk0 = (dqsez < 0) ? 1 : 0; /* needed in updating predictor poles */
|
||||
|
||||
mag = dq & 0x7FFF; /* prediction difference magnitude */
|
||||
/* TRANS */
|
||||
ylint = state_ptr->yl >> 15; /* exponent part of yl */
|
||||
ylfrac = (state_ptr->yl >> 10) & 0x1F; /* fractional part of yl */
|
||||
thr1 = (32 + ylfrac) << ylint; /* threshold */
|
||||
thr2 = (ylint > 9) ? 31 << 10 : thr1; /* limit thr2 to 31 << 10 */
|
||||
dqthr = (thr2 + (thr2 >> 1)) >> 1; /* dqthr = 0.75 * thr2 */
|
||||
if (state_ptr->td == 0) /* signal supposed voice */
|
||||
tr = 0;
|
||||
else if (mag <= dqthr) /* supposed data, but small mag */
|
||||
tr = 0; /* treated as voice */
|
||||
else /* signal is data (modem) */
|
||||
tr = 1;
|
||||
|
||||
/*
|
||||
* Quantizer scale factor adaptation.
|
||||
*/
|
||||
|
||||
/* FUNCTW & FILTD & DELAY */
|
||||
/* update non-steady state step size multiplier */
|
||||
state_ptr->yu = y + ((wi - y) >> 5);
|
||||
|
||||
/* LIMB */
|
||||
if (state_ptr->yu < 544) /* 544 <= yu <= 5120 */
|
||||
state_ptr->yu = 544;
|
||||
else if (state_ptr->yu > 5120)
|
||||
state_ptr->yu = 5120;
|
||||
|
||||
/* FILTE & DELAY */
|
||||
/* update steady state step size multiplier */
|
||||
state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6);
|
||||
|
||||
/*
|
||||
* Adaptive predictor coefficients.
|
||||
*/
|
||||
if (tr == 1) { /* reset a's and b's for modem signal */
|
||||
state_ptr->a[0] = 0;
|
||||
state_ptr->a[1] = 0;
|
||||
state_ptr->b[0] = 0;
|
||||
state_ptr->b[1] = 0;
|
||||
state_ptr->b[2] = 0;
|
||||
state_ptr->b[3] = 0;
|
||||
state_ptr->b[4] = 0;
|
||||
state_ptr->b[5] = 0;
|
||||
} else { /* update a's and b's */
|
||||
pks1 = pk0 ^ state_ptr->pk[0]; /* UPA2 */
|
||||
|
||||
/* update predictor pole a[1] */
|
||||
a2p = state_ptr->a[1] - (state_ptr->a[1] >> 7);
|
||||
if (dqsez != 0) {
|
||||
fa1 = (pks1) ? state_ptr->a[0] : -state_ptr->a[0];
|
||||
if (fa1 < -8191) /* a2p = function of fa1 */
|
||||
a2p -= 0x100;
|
||||
else if (fa1 > 8191)
|
||||
a2p += 0xFF;
|
||||
else
|
||||
a2p += fa1 >> 5;
|
||||
|
||||
if (pk0 ^ state_ptr->pk[1])
|
||||
{ /* LIMC */
|
||||
if (a2p <= -12160)
|
||||
a2p = -12288;
|
||||
else if (a2p >= 12416)
|
||||
a2p = 12288;
|
||||
else
|
||||
a2p -= 0x80;
|
||||
}
|
||||
else if (a2p <= -12416)
|
||||
a2p = -12288;
|
||||
else if (a2p >= 12160)
|
||||
a2p = 12288;
|
||||
else
|
||||
a2p += 0x80;
|
||||
}
|
||||
|
||||
/* TRIGB & DELAY */
|
||||
state_ptr->a[1] = a2p;
|
||||
|
||||
/* UPA1 */
|
||||
/* update predictor pole a[0] */
|
||||
state_ptr->a[0] -= state_ptr->a[0] >> 8;
|
||||
if (dqsez != 0)
|
||||
{ if (pks1 == 0)
|
||||
state_ptr->a[0] += 192;
|
||||
else
|
||||
state_ptr->a[0] -= 192;
|
||||
} ;
|
||||
|
||||
/* LIMD */
|
||||
a1ul = 15360 - a2p;
|
||||
if (state_ptr->a[0] < -a1ul)
|
||||
state_ptr->a[0] = -a1ul;
|
||||
else if (state_ptr->a[0] > a1ul)
|
||||
state_ptr->a[0] = a1ul;
|
||||
|
||||
/* UPB : update predictor zeros b[6] */
|
||||
for (cnt = 0; cnt < 6; cnt++) {
|
||||
if (code_size == 5) /* for 40Kbps G.723 */
|
||||
state_ptr->b[cnt] -= state_ptr->b[cnt] >> 9;
|
||||
else /* for G.721 and 24Kbps G.723 */
|
||||
state_ptr->b[cnt] -= state_ptr->b[cnt] >> 8;
|
||||
if (dq & 0x7FFF) { /* XOR */
|
||||
if ((dq ^ state_ptr->dq[cnt]) >= 0)
|
||||
state_ptr->b[cnt] += 128;
|
||||
else
|
||||
state_ptr->b[cnt] -= 128;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (cnt = 5; cnt > 0; cnt--)
|
||||
state_ptr->dq[cnt] = state_ptr->dq[cnt-1];
|
||||
/* FLOAT A : convert dq[0] to 4-bit exp, 6-bit mantissa f.p. */
|
||||
if (mag == 0) {
|
||||
state_ptr->dq[0] = (dq >= 0) ? 0x20 : 0xFC20;
|
||||
} else {
|
||||
expon = quan(mag, power2, 15);
|
||||
state_ptr->dq[0] = (dq >= 0) ?
|
||||
(expon << 6) + ((mag << 6) >> expon) :
|
||||
(expon << 6) + ((mag << 6) >> expon) - 0x400;
|
||||
}
|
||||
|
||||
state_ptr->sr[1] = state_ptr->sr[0];
|
||||
/* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
|
||||
if (sr == 0) {
|
||||
state_ptr->sr[0] = 0x20;
|
||||
} else if (sr > 0) {
|
||||
expon = quan(sr, power2, 15);
|
||||
state_ptr->sr[0] = (expon << 6) + ((sr << 6) >> expon);
|
||||
} else if (sr > -32768) {
|
||||
mag = -sr;
|
||||
expon = quan(mag, power2, 15);
|
||||
state_ptr->sr[0] = (expon << 6) + ((mag << 6) >> expon) - 0x400;
|
||||
} else
|
||||
state_ptr->sr[0] = (short) 0xFC20;
|
||||
|
||||
/* DELAY A */
|
||||
state_ptr->pk[1] = state_ptr->pk[0];
|
||||
state_ptr->pk[0] = pk0;
|
||||
|
||||
/* TONE */
|
||||
if (tr == 1) /* this sample has been treated as data */
|
||||
state_ptr->td = 0; /* next one will be treated as voice */
|
||||
else if (a2p < -11776) /* small sample-to-sample correlation */
|
||||
state_ptr->td = 1; /* signal may be data */
|
||||
else /* signal is voice */
|
||||
state_ptr->td = 0;
|
||||
|
||||
/*
|
||||
* Adaptation speed control.
|
||||
*/
|
||||
state_ptr->dms += (fi - state_ptr->dms) >> 5; /* FILTA */
|
||||
state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7); /* FILTB */
|
||||
|
||||
if (tr == 1)
|
||||
state_ptr->ap = 256;
|
||||
else if (y < 1536) /* SUBTC */
|
||||
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
|
||||
else if (state_ptr->td == 1)
|
||||
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
|
||||
else if (abs((state_ptr->dms << 2) - state_ptr->dml) >=
|
||||
(state_ptr->dml >> 3))
|
||||
state_ptr->ap += (0x200 - state_ptr->ap) >> 4;
|
||||
else
|
||||
state_ptr->ap += (-state_ptr->ap) >> 4;
|
||||
|
||||
return ;
|
||||
} /* update */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
static int
|
||||
unpack_bytes (int bits, int blocksize, const unsigned char * block, short * samples)
|
||||
{ unsigned int in_buffer = 0 ;
|
||||
unsigned char in_byte ;
|
||||
int k, in_bits = 0, bindex = 0 ;
|
||||
|
||||
for (k = 0 ; bindex <= blocksize && k < G72x_BLOCK_SIZE ; k++)
|
||||
{ if (in_bits < bits)
|
||||
{ in_byte = block [bindex++] ;
|
||||
|
||||
in_buffer |= (in_byte << in_bits);
|
||||
in_bits += 8;
|
||||
}
|
||||
samples [k] = in_buffer & ((1 << bits) - 1);
|
||||
in_buffer >>= bits;
|
||||
in_bits -= bits;
|
||||
} ;
|
||||
|
||||
return k ;
|
||||
} /* unpack_bytes */
|
||||
|
||||
static int
|
||||
pack_bytes (int bits, const short * samples, unsigned char * block)
|
||||
{
|
||||
unsigned int out_buffer = 0 ;
|
||||
int k, bindex = 0, out_bits = 0 ;
|
||||
unsigned char out_byte ;
|
||||
|
||||
for (k = 0 ; k < G72x_BLOCK_SIZE ; k++)
|
||||
{ out_buffer |= (samples [k] << out_bits) ;
|
||||
out_bits += bits ;
|
||||
if (out_bits >= 8)
|
||||
{ out_byte = out_buffer & 0xFF ;
|
||||
out_bits -= 8 ;
|
||||
out_buffer >>= 8 ;
|
||||
block [bindex++] = out_byte ;
|
||||
}
|
||||
} ;
|
||||
|
||||
return bindex ;
|
||||
} /* pack_bytes */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6298dc75-fd0f-4062-9b90-f73ed69f22d4
|
||||
*/
|
||||
|
||||
99
libs/libsndfile/src/G72x/g72x.h
Normal file
99
libs/libsndfile/src/G72x/g72x.h
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2005 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
** This file is not the same as the original file from Sun Microsystems. Nearly
|
||||
** all the original definitions and function prototypes that were in the file
|
||||
** of this name have been moved to g72x_priv.h.
|
||||
*/
|
||||
|
||||
#ifndef G72X_HEADER_FILE
|
||||
#define G72X_HEADER_FILE
|
||||
|
||||
/*
|
||||
** Number of samples per block to process.
|
||||
** Must be a common multiple of possible bits per sample : 2, 3, 4, 5 and 8.
|
||||
*/
|
||||
#define G72x_BLOCK_SIZE (3 * 5 * 8)
|
||||
|
||||
/*
|
||||
** Identifiers for the differing kinds of G72x ADPCM codecs.
|
||||
** The identifiers also define the number of encoded bits per sample.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ G723_16_BITS_PER_SAMPLE = 2,
|
||||
G723_24_BITS_PER_SAMPLE = 3,
|
||||
G723_40_BITS_PER_SAMPLE = 5,
|
||||
|
||||
G721_32_BITS_PER_SAMPLE = 4,
|
||||
G721_40_BITS_PER_SAMPLE = 5,
|
||||
|
||||
G723_16_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
|
||||
G723_24_SAMPLES_PER_BLOCK = G723_24_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_24_BITS_PER_SAMPLE),
|
||||
G723_40_SAMPLES_PER_BLOCK = G723_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G723_40_BITS_PER_SAMPLE),
|
||||
|
||||
G721_32_SAMPLES_PER_BLOCK = G72x_BLOCK_SIZE,
|
||||
G721_40_SAMPLES_PER_BLOCK = G721_40_BITS_PER_SAMPLE * (G72x_BLOCK_SIZE / G721_40_BITS_PER_SAMPLE),
|
||||
|
||||
G723_16_BYTES_PER_BLOCK = (G723_16_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
|
||||
G723_24_BYTES_PER_BLOCK = (G723_24_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
|
||||
G723_40_BYTES_PER_BLOCK = (G723_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
|
||||
|
||||
G721_32_BYTES_PER_BLOCK = (G721_32_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8,
|
||||
G721_40_BYTES_PER_BLOCK = (G721_40_BITS_PER_SAMPLE * G72x_BLOCK_SIZE) / 8
|
||||
} ;
|
||||
|
||||
/* Forward declaration of of g72x_state. */
|
||||
|
||||
struct g72x_state ;
|
||||
|
||||
/* External function definitions. */
|
||||
|
||||
struct g72x_state * g72x_reader_init (int codec, int *blocksize, int *samplesperblock) ;
|
||||
struct g72x_state * g72x_writer_init (int codec, int *blocksize, int *samplesperblock) ;
|
||||
/*
|
||||
** Initialize the ADPCM state table for the given codec.
|
||||
** Return 0 on success, 1 on fail.
|
||||
*/
|
||||
|
||||
int g72x_decode_block (struct g72x_state *pstate, const unsigned char *block, short *samples) ;
|
||||
/*
|
||||
** The caller fills data->block with data->bytes bytes before calling the
|
||||
** function. The value data->bytes must be an integer multiple of
|
||||
** data->blocksize and be <= data->max_bytes.
|
||||
** When it returns, the caller can read out data->samples samples.
|
||||
*/
|
||||
|
||||
int g72x_encode_block (struct g72x_state *pstate, short *samples, unsigned char *block) ;
|
||||
/*
|
||||
** The caller fills state->samples some integer multiple data->samples_per_block
|
||||
** (up to G72x_BLOCK_SIZE) samples before calling the function.
|
||||
** When it returns, the caller can read out bytes encoded bytes.
|
||||
*/
|
||||
|
||||
#endif /* !G72X_HEADER_FILE */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 6ca84e5f-f932-4ba1-87ee-37056d921621
|
||||
*/
|
||||
|
||||
118
libs/libsndfile/src/G72x/g72x_priv.h
Normal file
118
libs/libsndfile/src/G72x/g72x_priv.h
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
* This source code is a product of Sun Microsystems, Inc. and is provided
|
||||
* for unrestricted use. Users may copy or modify this source code without
|
||||
* charge.
|
||||
*
|
||||
* SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
|
||||
* THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
|
||||
*
|
||||
* Sun source code is provided with no support and without any obligation on
|
||||
* the part of Sun Microsystems, Inc. to assist in its use, correction,
|
||||
* modification or enhancement.
|
||||
*
|
||||
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
|
||||
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
|
||||
* OR ANY PART THEREOF.
|
||||
*
|
||||
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
|
||||
* or profits or other special, indirect and consequential damages, even if
|
||||
* Sun has been advised of the possibility of such damages.
|
||||
*
|
||||
* Sun Microsystems, Inc.
|
||||
* 2550 Garcia Avenue
|
||||
* Mountain View, California 94043
|
||||
*/
|
||||
|
||||
#ifndef G72X_PRIVATE_H
|
||||
#define G72X_PRIVATE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#error "This code is not designed to be compiled with a C++ compiler."
|
||||
#endif
|
||||
|
||||
/*
|
||||
** The following is the definition of the state structure used by the
|
||||
** G.721/G.723 encoder and decoder to preserve their internal state
|
||||
** between successive calls. The meanings of the majority of the state
|
||||
** structure fields are explained in detail in the CCITT Recommendation
|
||||
** G.721. The field names are essentially identical to variable names
|
||||
** in the bit level description of the coding algorithm included in this
|
||||
** Recommendation.
|
||||
*/
|
||||
|
||||
struct g72x_state
|
||||
{ long yl; /* Locked or steady state step size multiplier. */
|
||||
short yu; /* Unlocked or non-steady state step size multiplier. */
|
||||
short dms; /* Short term energy estimate. */
|
||||
short dml; /* Long term energy estimate. */
|
||||
short ap; /* Linear weighting coefficient of 'yl' and 'yu'. */
|
||||
|
||||
short a[2]; /* Coefficients of pole portion of prediction filter. */
|
||||
short b[6]; /* Coefficients of zero portion of prediction filter. */
|
||||
short pk[2]; /*
|
||||
** Signs of previous two samples of a partially
|
||||
** reconstructed signal.
|
||||
**/
|
||||
short dq[6]; /*
|
||||
** Previous 6 samples of the quantized difference
|
||||
** signal represented in an internal floating point
|
||||
** format.
|
||||
**/
|
||||
short sr[2]; /*
|
||||
** Previous 2 samples of the quantized difference
|
||||
** signal represented in an internal floating point
|
||||
** format.
|
||||
*/
|
||||
char td; /* delayed tone detect, new in 1988 version */
|
||||
|
||||
/* The following struct members were added for libsndfile. The original
|
||||
** code worked by calling a set of functions on a sample by sample basis
|
||||
** which is slow on architectures like Intel x86. For libsndfile, this
|
||||
** was changed so that the encoding and decoding routines could work on
|
||||
** a block of samples at a time to reduce the function call overhead.
|
||||
*/
|
||||
int (*encoder) (int, struct g72x_state* state) ;
|
||||
int (*decoder) (int, struct g72x_state* state) ;
|
||||
|
||||
int codec_bits, blocksize, samplesperblock ;
|
||||
} ;
|
||||
|
||||
typedef struct g72x_state G72x_STATE ;
|
||||
|
||||
int predictor_zero (G72x_STATE *state_ptr);
|
||||
|
||||
int predictor_pole (G72x_STATE *state_ptr);
|
||||
|
||||
int step_size (G72x_STATE *state_ptr);
|
||||
|
||||
int quantize (int d, int y, short *table, int size);
|
||||
|
||||
int reconstruct (int sign, int dqln, int y);
|
||||
|
||||
void update (int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, G72x_STATE *state_ptr);
|
||||
|
||||
int g721_encoder (int sample, G72x_STATE *state_ptr);
|
||||
int g721_decoder (int code, G72x_STATE *state_ptr);
|
||||
|
||||
int g723_16_encoder (int sample, G72x_STATE *state_ptr);
|
||||
int g723_16_decoder (int code, G72x_STATE *state_ptr);
|
||||
|
||||
int g723_24_encoder (int sample, G72x_STATE *state_ptr);
|
||||
int g723_24_decoder (int code, G72x_STATE *state_ptr);
|
||||
|
||||
int g723_40_encoder (int sample, G72x_STATE *state_ptr);
|
||||
int g723_40_decoder (int code, G72x_STATE *state_ptr);
|
||||
|
||||
void private_init_state (G72x_STATE *state_ptr) ;
|
||||
|
||||
#endif /* G72X_PRIVATE_H */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: d9ad4da7-0fa3-471d-8020-720b5cfb5e5b
|
||||
*/
|
||||
|
||||
222
libs/libsndfile/src/G72x/g72x_test.c
Normal file
222
libs/libsndfile/src/G72x/g72x_test.c
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
/*
|
||||
** Copyright (C) 1999-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "g72x.h"
|
||||
#include "g72x_priv.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846264338
|
||||
#endif
|
||||
|
||||
#define BUFFER_SIZE (1<<14) /* Should be (1<<14) */
|
||||
#define SAMPLE_RATE 11025
|
||||
|
||||
|
||||
static void g721_test (void) ;
|
||||
static void g723_test (double margin) ;
|
||||
|
||||
static void gen_signal_double (double *data, double scale, int datalen) ;
|
||||
static int error_function (double data, double orig, double margin) ;
|
||||
|
||||
static int oct_save_short (short *a, short *b, int len) ;
|
||||
|
||||
int
|
||||
main (int argc, char *argv [])
|
||||
{ int bDoAll = 0 ;
|
||||
int nTests = 0 ;
|
||||
|
||||
if (argc != 2)
|
||||
{ printf ("Usage : %s <test>\n", argv [0]) ;
|
||||
printf (" Where <test> is one of the following:\n") ;
|
||||
printf (" g721 - test G721 encoder and decoder\n") ;
|
||||
printf (" g723 - test G721 encoder and decoder\n") ;
|
||||
printf (" all - perform all tests\n") ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
|
||||
bDoAll=!strcmp (argv [1], "all");
|
||||
|
||||
if (bDoAll || ! strcmp (argv [1], "g721"))
|
||||
{ g721_test () ;
|
||||
nTests++ ;
|
||||
} ;
|
||||
|
||||
if (bDoAll || ! strcmp (argv [1], "g723"))
|
||||
{ g723_test (0.53) ;
|
||||
nTests++ ;
|
||||
} ;
|
||||
|
||||
if (nTests == 0)
|
||||
{ printf ("Mono : ************************************\n") ;
|
||||
printf ("Mono : * No '%s' test defined.\n", argv [1]) ;
|
||||
printf ("Mono : ************************************\n") ;
|
||||
return 1 ;
|
||||
} ;
|
||||
|
||||
return 0 ;
|
||||
} /* main */
|
||||
|
||||
static void
|
||||
g721_test (void)
|
||||
{
|
||||
return ;
|
||||
} /* g721_test */
|
||||
|
||||
static void
|
||||
g723_test (double margin)
|
||||
{ static double orig_buffer [BUFFER_SIZE] ;
|
||||
static short orig [BUFFER_SIZE] ;
|
||||
static short data [BUFFER_SIZE] ;
|
||||
|
||||
G72x_STATE encoder_state, decoder_state ;
|
||||
|
||||
long k ;
|
||||
int code, position, max_err ;
|
||||
|
||||
private_init_state (&encoder_state) ;
|
||||
encoder_state.encoder = g723_24_encoder ;
|
||||
encoder_state.codec_bits = 3 ;
|
||||
|
||||
private_init_state (&decoder_state) ;
|
||||
decoder_state.decoder = g723_24_decoder ;
|
||||
decoder_state.codec_bits = 3 ;
|
||||
|
||||
memset (data, 0, BUFFER_SIZE * sizeof (short)) ;
|
||||
memset (orig, 0, BUFFER_SIZE * sizeof (short)) ;
|
||||
|
||||
printf (" g723_test : ") ;
|
||||
fflush (stdout) ;
|
||||
|
||||
gen_signal_double (orig_buffer, 32000.0, BUFFER_SIZE) ;
|
||||
for (k = 0 ; k < BUFFER_SIZE ; k++)
|
||||
orig [k] = (short) orig_buffer [k] ;
|
||||
|
||||
/* Write and read data here. */
|
||||
position = 0 ;
|
||||
max_err = 0 ;
|
||||
for (k = 0 ; k < BUFFER_SIZE ; k++)
|
||||
{ code = encoder_state.encoder (orig [k], &encoder_state) ;
|
||||
data [k] = decoder_state.decoder (code, &decoder_state) ;
|
||||
if (abs (orig [k] - data [k]) > max_err)
|
||||
{ position = k ;
|
||||
max_err = abs (orig [k] - data [k]) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
printf ("\n\nMax error of %d at postion %d.\n", max_err, position) ;
|
||||
|
||||
for (k = 0 ; k < BUFFER_SIZE ; k++)
|
||||
{ if (error_function (data [k], orig [k], margin))
|
||||
{ printf ("Line %d: Incorrect sample A (#%ld : %d should be %d).\n", __LINE__, k, data [k], orig [k]) ;
|
||||
oct_save_short (orig, data, BUFFER_SIZE) ;
|
||||
exit (1) ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
|
||||
printf ("ok\n") ;
|
||||
|
||||
return ;
|
||||
} /* g723_test */
|
||||
|
||||
|
||||
#define SIGNAL_MAXVAL 30000.0
|
||||
#define DECAY_COUNT 1000
|
||||
|
||||
static void
|
||||
gen_signal_double (double *gendata, double scale, int gendatalen)
|
||||
{ int k, ramplen ;
|
||||
double amp = 0.0 ;
|
||||
|
||||
ramplen = DECAY_COUNT ;
|
||||
|
||||
for (k = 0 ; k < gendatalen ; k++)
|
||||
{ if (k <= ramplen)
|
||||
amp = scale * k / ((double) ramplen) ;
|
||||
else if (k > gendatalen - ramplen)
|
||||
amp = scale * (gendatalen - k) / ((double) ramplen) ;
|
||||
|
||||
gendata [k] = amp * (0.4 * sin (33.3 * 2.0 * M_PI * ((double) (k+1)) / ((double) SAMPLE_RATE))
|
||||
+ 0.3 * cos (201.1 * 2.0 * M_PI * ((double) (k+1)) / ((double) SAMPLE_RATE))) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* gen_signal_double */
|
||||
|
||||
static int
|
||||
error_function (double data, double orig, double margin)
|
||||
{ double error ;
|
||||
|
||||
if (fabs (orig) <= 500.0)
|
||||
error = fabs (fabs (data) - fabs(orig)) / 2000.0 ;
|
||||
else if (fabs (orig) <= 1000.0)
|
||||
error = fabs (data - orig) / 3000.0 ;
|
||||
else
|
||||
error = fabs (data - orig) / fabs (orig) ;
|
||||
|
||||
if (error > margin)
|
||||
{ printf ("\n\n*******************\nError : %f\n", error) ;
|
||||
return 1 ;
|
||||
} ;
|
||||
return 0 ;
|
||||
} /* error_function */
|
||||
|
||||
static int
|
||||
oct_save_short (short *a, short *b, int len)
|
||||
{ FILE *file ;
|
||||
int k ;
|
||||
|
||||
if (! (file = fopen ("error.dat", "w")))
|
||||
return 1 ;
|
||||
|
||||
fprintf (file, "# Not created by Octave\n") ;
|
||||
|
||||
fprintf (file, "# name: a\n") ;
|
||||
fprintf (file, "# type: matrix\n") ;
|
||||
fprintf (file, "# rows: %d\n", len) ;
|
||||
fprintf (file, "# columns: 1\n") ;
|
||||
|
||||
for (k = 0 ; k < len ; k++)
|
||||
fprintf (file, "% d\n", a [k]) ;
|
||||
|
||||
fprintf (file, "# name: b\n") ;
|
||||
fprintf (file, "# type: matrix\n") ;
|
||||
fprintf (file, "# rows: %d\n", len) ;
|
||||
fprintf (file, "# columns: 1\n") ;
|
||||
|
||||
for (k = 0 ; k < len ; k++)
|
||||
fprintf (file, "% d\n", b [k]) ;
|
||||
|
||||
fclose (file) ;
|
||||
return 0 ;
|
||||
} /* oct_save_short */
|
||||
|
||||
/*
|
||||
** Do not edit or modify anything in this comment block.
|
||||
** The arch-tag line is a file identity tag for the GNU Arch
|
||||
** revision control system.
|
||||
**
|
||||
** arch-tag: 0597b442-a5b0-4abf-92a4-92f6c24e85a6
|
||||
*/
|
||||
|
||||
16
libs/libsndfile/src/GSM610/COPYRIGHT
Normal file
16
libs/libsndfile/src/GSM610/COPYRIGHT
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann,
|
||||
Technische Universitaet Berlin
|
||||
|
||||
Any use of this software is permitted provided that this notice is not
|
||||
removed and that neither the authors nor the Technische Universitaet Berlin
|
||||
are deemed to have made any representations as to the suitability of this
|
||||
software for any purpose nor are held responsible for any defects of
|
||||
this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
|
||||
|
||||
As a matter of courtesy, the authors request to be informed about uses
|
||||
this software has found, about bugs in this software, and about any
|
||||
improvements that may be of general interest.
|
||||
|
||||
Berlin, 28.11.1994
|
||||
Jutta Degener
|
||||
Carsten Bormann
|
||||
56
libs/libsndfile/src/GSM610/ChangeLog
Normal file
56
libs/libsndfile/src/GSM610/ChangeLog
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
2004-05-12 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* gsm610_priv.h
|
||||
Replace ugly macros with inline functions.
|
||||
|
||||
* *.c
|
||||
Remove temporary variables used by macros and other minor fixes required by
|
||||
above change.
|
||||
|
||||
2003-06-02 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* rpe.c
|
||||
Renamed variables "exp" to "expon" to avoid shadowed parameter warnigns.
|
||||
|
||||
2002-06-08 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* long_term.c
|
||||
Changes tp removed compiler warnings about shadowed parameters.
|
||||
|
||||
2002-06-08 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* private.h
|
||||
Made declarations of gsm_A, gsm_B, gsm_MIC etc extern. This fixed a compile
|
||||
problem on MacOSX.
|
||||
|
||||
2002-05-10 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* *.[ch]
|
||||
Removed all pre-ANSI prototype kludges. Removed proto.h and unproto.h.
|
||||
Started work on making GSM 6.10 files seekable. Currently they are not.
|
||||
|
||||
* code.c private.h
|
||||
Function Gsm_Coder () used a statically defined array. This was obviously
|
||||
not re-entrant so moved it to struct gsm_state.
|
||||
|
||||
2001-09-16 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* code.c
|
||||
Added #includes for string.h and stdlib.h.
|
||||
|
||||
2000-10-27 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* config.h
|
||||
Removed some commented out #defines (ie //*efine) which were causing problems on
|
||||
the Sun cc compiler.
|
||||
|
||||
2000-02-29 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* private.h
|
||||
Added #defines to emulate normal compile time options.
|
||||
|
||||
2000-02-28 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
|
||||
|
||||
* everthing
|
||||
Created this directory and copied files from libgsm.
|
||||
http://kbs.cs.tu-berlin.de/~jutta/toast.html
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue