Merge remote-tracking branch 'remotes/origin/cairocanvas' into windows
authorJohn Emmas <johne53@tiscali.co.uk>
Sat, 21 Sep 2013 08:17:25 +0000 (09:17 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Sat, 21 Sep 2013 08:17:25 +0000 (09:17 +0100)
Conflicts (hopefully resolved):
gtk2_ardour/marker.cc
gtk2_ardour/midi_region_view.h
gtk2_ardour/region_gain_line.h
gtk2_ardour/utils.cc
gtk2_ardour/video_image_frame.cc
gtk2_ardour/wscript
libs/backends/jack/wscript

426 files changed:
.gitignore
gtk2_ardour/about.cc
gtk2_ardour/ardour_ui.cc
gtk2_ardour/ardour_ui.h
gtk2_ardour/ardour_ui_dialogs.cc
gtk2_ardour/audio_region_editor.cc
gtk2_ardour/audio_region_editor.h
gtk2_ardour/audio_region_view.h
gtk2_ardour/audio_time_axis.cc
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/bundle_manager.cc
gtk2_ardour/canvas-waveview.c
gtk2_ardour/editor_export_audio.cc
gtk2_ardour/editor_markers.cc
gtk2_ardour/editor_rulers.cc
gtk2_ardour/editor_timefx.cc
gtk2_ardour/editor_videotimeline.cc
gtk2_ardour/export_channel_selector.h
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_format_dialog.h
gtk2_ardour/export_timespan_selector.h
gtk2_ardour/export_video_dialog.cc
gtk2_ardour/export_video_infobox.cc
gtk2_ardour/generic_pluginui.cc
gtk2_ardour/global_port_matrix.cc
gtk2_ardour/global_port_matrix.h
gtk2_ardour/main.cc
gtk2_ardour/main_clock.cc
gtk2_ardour/midi_channel_selector.cc
gtk2_ardour/midi_time_axis.cc
gtk2_ardour/midi_tracer.cc
gtk2_ardour/missing_file_dialog.cc
gtk2_ardour/mixer_strip.cc
gtk2_ardour/panner2d.cc
gtk2_ardour/panner_ui.cc
gtk2_ardour/patch_change_dialog.cc
gtk2_ardour/pingback.cc
gtk2_ardour/plugin_selector.cc
gtk2_ardour/plugin_ui.cc
gtk2_ardour/port_matrix.cc
gtk2_ardour/processor_box.cc
gtk2_ardour/region_view.h
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_ui.cc
gtk2_ardour/session_metadata_dialog.h
gtk2_ardour/sfdb_ui.cc
gtk2_ardour/transcode_ffmpeg.cc
gtk2_ardour/transcode_video_dialog.cc
gtk2_ardour/ui_config.cc
gtk2_ardour/utils.cc
gtk2_ardour/video_image_frame.cc
gtk2_ardour/video_monitor.cc
gtk2_ardour/video_server_dialog.cc
gtk2_ardour/video_timeline.cc
gtk2_ardour/wscript
libs/ardour/ardour/async_midi_port.h
libs/ardour/ardour/audiofile_tagger.h
libs/ardour/ardour/audiofilesource.h
libs/ardour/ardour/audioplaylist.h
libs/ardour/ardour/backend_search_path.h
libs/ardour/ardour/butler.h
libs/ardour/ardour/chan_count.h
libs/ardour/ardour/control_protocol_search_path.h
libs/ardour/ardour/coreaudiosource.h
libs/ardour/ardour/cycles.h
libs/ardour/ardour/debug.h
libs/ardour/ardour/directory_names.h
libs/ardour/ardour/export_formats_search_path.h
libs/ardour/ardour/export_profile_manager.h
libs/ardour/ardour/file_source.h
libs/ardour/ardour/filesystem_paths.h
libs/ardour/ardour/interthread_info.h
libs/ardour/ardour/jack_utils.h [new file with mode: 0644]
libs/ardour/ardour/ladspa_plugin.h
libs/ardour/ardour/ladspa_search_path.h [new file with mode: 0644]
libs/ardour/ardour/lv2_bundled_search_path.h
libs/ardour/ardour/lv2_plugin.h
libs/ardour/ardour/midi_patch_search_path.h
libs/ardour/ardour/midi_playlist.h
libs/ardour/ardour/midi_track.h
libs/ardour/ardour/msvc_libardour.h [new file with mode: 0644]
libs/ardour/ardour/panner.h
libs/ardour/ardour/panner_manager.h
libs/ardour/ardour/panner_search_path.h
libs/ardour/ardour/playlist.h
libs/ardour/ardour/plugin_manager.h
libs/ardour/ardour/session.h
libs/ardour/ardour/silentfilesource.h
libs/ardour/ardour/sndfilesource.h
libs/ardour/async_midi_port.cc
libs/ardour/audio_diskstream.cc
libs/ardour/audio_library.cc
libs/ardour/audio_track.cc
libs/ardour/audio_unit.cc
libs/ardour/audioengine.cc
libs/ardour/audiofile_tagger.cc
libs/ardour/audiofilesource.cc
libs/ardour/audiosource.cc
libs/ardour/automation_watch.cc
libs/ardour/backend_search_path.cc
libs/ardour/broadcast_info.cc
libs/ardour/butler.cc
libs/ardour/control_protocol_manager.cc
libs/ardour/control_protocol_search_path.cc
libs/ardour/debug.cc
libs/ardour/default_click.cc
libs/ardour/directory_names.cc
libs/ardour/diskstream.cc
libs/ardour/export_format_base.cc
libs/ardour/export_formats_search_path.cc
libs/ardour/export_graph_builder.cc
libs/ardour/export_handler.cc
libs/ardour/export_profile_manager.cc
libs/ardour/file_source.cc
libs/ardour/filesystem_paths.cc
libs/ardour/find_session.cc
libs/ardour/globals.cc
libs/ardour/graph.cc
libs/ardour/import.cc
libs/ardour/io.cc
libs/ardour/ladspa_plugin.cc
libs/ardour/ladspa_search_path.cc [new file with mode: 0644]
libs/ardour/ltc_slave.cc
libs/ardour/lv2_bundled_search_path.cc
libs/ardour/lv2_evbuf.c
libs/ardour/lv2_plugin.cc
libs/ardour/meter.cc
libs/ardour/midi_clock_slave.cc
libs/ardour/midi_diskstream.cc
libs/ardour/midi_patch_manager.cc
libs/ardour/midi_patch_search_path.cc
libs/ardour/midi_source.cc
libs/ardour/midi_track.cc
libs/ardour/midi_ui.cc
libs/ardour/mix.cc
libs/ardour/msvc/msvc_libardour.cc [new file with mode: 0644]
libs/ardour/mtc_slave.cc
libs/ardour/panner_manager.cc
libs/ardour/panner_search_path.cc
libs/ardour/pcm_utils.cc
libs/ardour/playlist.cc
libs/ardour/plugin.cc
libs/ardour/plugin_manager.cc
libs/ardour/port.cc
libs/ardour/port_insert.cc
libs/ardour/port_set.cc
libs/ardour/rc_configuration.cc
libs/ardour/region_factory.cc
libs/ardour/resampled_source.cc
libs/ardour/route.cc
libs/ardour/session.cc
libs/ardour/session_butler.cc
libs/ardour/session_events.cc
libs/ardour/session_ltc.cc
libs/ardour/session_midi.cc
libs/ardour/session_playlists.cc
libs/ardour/session_state.cc
libs/ardour/session_vst.cc
libs/ardour/smf_source.cc
libs/ardour/sndfile_helpers.cc
libs/ardour/sndfileimportable.cc
libs/ardour/sndfilesource.cc
libs/ardour/source.cc
libs/ardour/sse_functions_xmm.cc
libs/ardour/template_utils.cc
libs/ardour/test/jack_utils_test.cc [new file with mode: 0644]
libs/ardour/test/jack_utils_test.h [new file with mode: 0644]
libs/ardour/test/midi_clock_slave_test.cc
libs/ardour/test/plugins_test.cc [new file with mode: 0644]
libs/ardour/test/plugins_test.h [new file with mode: 0644]
libs/ardour/test/resampled_source_test.cc
libs/ardour/test/test_common.cc
libs/ardour/test/test_common.h
libs/ardour/utils.cc
libs/ardour/vst_plugin.cc
libs/ardour/worker.cc
libs/ardour/wscript
libs/audiographer/audiographer/broadcast_info.h
libs/audiographer/audiographer/debug_utils.h
libs/audiographer/audiographer/sndfile/tmp_file.h
libs/audiographer/private/gdither/gdither.cc
libs/audiographer/src/general/broadcast_info.cc
libs/audiographer/tests/sndfile/tmp_file_test.cc
libs/backends/jack/jack_utils.cc
libs/backends/jack/wscript
libs/clearlooks-newer/animation.c
libs/clearlooks-newer/clearlooks_draw.c
libs/clearlooks-newer/clearlooks_draw_glossy.c
libs/clearlooks-newer/clearlooks_draw_gummy.c
libs/clearlooks-newer/clearlooks_rc_style.c
libs/clearlooks-newer/clearlooks_style.c
libs/evoral/evoral/Sequence.hpp
libs/evoral/evoral/midi_util.h
libs/evoral/src/ControlList.cpp
libs/evoral/src/Curve.cpp
libs/evoral/src/Sequence.cpp
libs/evoral/src/libsmf/smf.c
libs/evoral/src/libsmf/smf_decode.c
libs/evoral/src/libsmf/smf_load.c
libs/evoral/src/libsmf/smf_save.c
libs/evoral/src/libsmf/smf_tempo.c
libs/evoral/test/SMFTest.cpp
libs/gtkmm2ext/actions.cc
libs/gtkmm2ext/binding_proxy.cc
libs/gtkmm2ext/bindings.cc
libs/gtkmm2ext/cairocell.cc
libs/gtkmm2ext/fastmeter.cc
libs/gtkmm2ext/gtk_ui.cc
libs/gtkmm2ext/gtkapplication_win32.c [new file with mode: 0644]
libs/gtkmm2ext/gtkmm2ext/auto_spin.h
libs/gtkmm2ext/gtkmm2ext/click_box.h
libs/gtkmm2ext/gtkmm2ext/doi.h
libs/gtkmm2ext/gtkmm2ext/gtk_ui.h
libs/gtkmm2ext/gtkmm2ext/popup.h
libs/gtkmm2ext/gtkmm2ext/selector.h
libs/gtkmm2ext/gtkmm2ext/slider_controller.h
libs/gtkmm2ext/idle_adjustment.cc
libs/gtkmm2ext/motionfeedback.cc
libs/gtkmm2ext/popup.cc
libs/gtkmm2ext/prolooks_helpers.c
libs/gtkmm2ext/selector.cc
libs/midi++2/channel.cc
libs/midi++2/ipmidi_port.cc
libs/midi++2/midi++/ipmidi_port.h
libs/midi++2/midi++/port.h
libs/midi++2/midnam_patch.cc
libs/midi++2/mmc.cc
libs/midi++2/mtc.cc
libs/midi++2/parser.cc
libs/panners/1in2out/panner_1in2out.cc
libs/panners/1in2out/panner_1in2out.h
libs/panners/1in2out/wscript
libs/panners/2in2out/panner_2in2out.cc
libs/panners/2in2out/wscript
libs/panners/vbap/vbap.cc
libs/panners/vbap/vbap_speakers.cc
libs/panners/vbap/wscript
libs/pbd/base_ui.cc
libs/pbd/clear_dir.cc
libs/pbd/debug.cc
libs/pbd/debug_rt_alloc.c
libs/pbd/epa.cc
libs/pbd/fallback_folders.cc [new file with mode: 0644]
libs/pbd/ffs.cc [new file with mode: 0644]
libs/pbd/file_manager.cc
libs/pbd/file_utils.cc
libs/pbd/fpu.cc
libs/pbd/glib_semaphore.cc [new file with mode: 0644]
libs/pbd/localeguard.cc [new file with mode: 0644]
libs/pbd/localtime_r.cc [new file with mode: 0644]
libs/pbd/mountpoint.cc
libs/pbd/msvc/fpu.cc [new file with mode: 0644]
libs/pbd/msvc/getopt.c [new file with mode: 0644]
libs/pbd/msvc/getopt.h [new file with mode: 0644]
libs/pbd/msvc/getopt_long.c [new file with mode: 0644]
libs/pbd/msvc/mountpoint.cc [new file with mode: 0644]
libs/pbd/msvc/msvc_pbd.cc [new file with mode: 0644]
libs/pbd/msvc/msvc_poll.cc [new file with mode: 0644]
libs/pbd/pathexpand.cc
libs/pbd/pathscanner.cc
libs/pbd/pbd/abstract_ui.cc
libs/pbd/pbd/abstract_ui.h
libs/pbd/pbd/atomic_counter.h [new file with mode: 0644]
libs/pbd/pbd/base_ui.h
libs/pbd/pbd/debug.h
libs/pbd/pbd/fallback_folders.h [new file with mode: 0644]
libs/pbd/pbd/ffs.h [new file with mode: 0644]
libs/pbd/pbd/file_utils.h
libs/pbd/pbd/floating.h
libs/pbd/pbd/glib_semaphore.h [new file with mode: 0644]
libs/pbd/pbd/localeguard.h [new file with mode: 0644]
libs/pbd/pbd/localtime_r.h [new file with mode: 0644]
libs/pbd/pbd/msvc_pbd.h [new file with mode: 0644]
libs/pbd/pbd/pathexpand.h
libs/pbd/pbd/pathscanner.h
libs/pbd/pbd/pthread_utils.h
libs/pbd/pbd/resource.h [new file with mode: 0644]
libs/pbd/pbd/ringbuffer.h
libs/pbd/pbd/ringbufferNPT.h
libs/pbd/pbd/search_path.h
libs/pbd/pbd/semaphore.h
libs/pbd/pbd/semutils.h
libs/pbd/pbd/sequence_property.h
libs/pbd/pbd/timersub.h [new file with mode: 0644]
libs/pbd/pbd/undo.h
libs/pbd/pbd/uuid.h
libs/pbd/pbd/uuid_boost.h [deleted file]
libs/pbd/pool.cc
libs/pbd/pthread_utils.cc
libs/pbd/resource.cc [new file with mode: 0644]
libs/pbd/search_path.cc
libs/pbd/semutils.cc
libs/pbd/sndfile_manager.cc
libs/pbd/stateful.cc
libs/pbd/test/filesystem_test.cc
libs/pbd/test/mutex_test.cc [new file with mode: 0644]
libs/pbd/test/mutex_test.h [new file with mode: 0644]
libs/pbd/test/test_common.cc
libs/pbd/test/test_common.h
libs/pbd/test/testrunner.cc
libs/pbd/transmitter.cc
libs/pbd/uuid.cc
libs/pbd/uuid_boost.cc [deleted file]
libs/pbd/wscript
libs/pbd/xml++.cc
libs/qm-dsp/dsp/wavelet/Wavelet.cpp
libs/rubberband/rubberband/msvc_rubberband.h [new file with mode: 0644]
libs/rubberband/src/Profiler.h
libs/rubberband/src/RingBuffer.h
libs/rubberband/src/Scavenger.h
libs/rubberband/src/StretchCalculator.cpp
libs/rubberband/src/StretcherImpl.cpp
libs/rubberband/src/Thread.cpp
libs/rubberband/src/Thread.h
libs/rubberband/src/bsd-3rdparty/float_cast/float_cast.h
libs/rubberband/src/main.cpp
libs/rubberband/src/sysutils.h
libs/surfaces/control_protocol/control_protocol/basic_ui.h
libs/surfaces/control_protocol/control_protocol/control_protocol.h
libs/surfaces/control_protocol/wscript
libs/surfaces/frontier/kernel_drivers/tranzport.c
libs/surfaces/generic_midi/generic_midi_control_protocol.cc
libs/surfaces/generic_midi/interface.cc
libs/surfaces/generic_midi/midicontrollable.cc
libs/surfaces/generic_midi/wscript
libs/surfaces/mackie/device_info.cc
libs/surfaces/mackie/device_profile.cc
libs/surfaces/mackie/interface.cc
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/wscript
libs/surfaces/osc/interface.cc
libs/surfaces/osc/osc.cc
libs/surfaces/osc/wscript
libs/surfaces/tranzport/interface.cc
libs/surfaces/tranzport/wscript
libs/surfaces/wiimote/interface.cc
libs/surfaces/wiimote/wscript
libs/surfaces/wscript
libs/taglib/taglib/apefooter.h [deleted symlink]
libs/taglib/taglib/apeitem.h [deleted symlink]
libs/taglib/taglib/apetag.h [deleted symlink]
libs/taglib/taglib/attachedpictureframe.h [deleted symlink]
libs/taglib/taglib/commentsframe.h [deleted symlink]
libs/taglib/taglib/flacfile.h [deleted symlink]
libs/taglib/taglib/flacproperties.h [deleted symlink]
libs/taglib/taglib/generalencapsulatedobjectframe.h [deleted symlink]
libs/taglib/taglib/id3v1genres.h [deleted symlink]
libs/taglib/taglib/id3v1tag.h [deleted symlink]
libs/taglib/taglib/id3v2extendedheader.h [deleted symlink]
libs/taglib/taglib/id3v2footer.h [deleted symlink]
libs/taglib/taglib/id3v2frame.h [deleted symlink]
libs/taglib/taglib/id3v2framefactory.h [deleted symlink]
libs/taglib/taglib/id3v2header.h [deleted symlink]
libs/taglib/taglib/id3v2synchdata.h [deleted symlink]
libs/taglib/taglib/id3v2tag.h [deleted symlink]
libs/taglib/taglib/mpcfile.h [deleted symlink]
libs/taglib/taglib/mpcproperties.h [deleted symlink]
libs/taglib/taglib/mpegfile.h [deleted symlink]
libs/taglib/taglib/mpegheader.h [deleted symlink]
libs/taglib/taglib/mpegproperties.h [deleted symlink]
libs/taglib/taglib/oggfile.h [deleted symlink]
libs/taglib/taglib/oggflacfile.h [deleted symlink]
libs/taglib/taglib/oggpage.h [deleted symlink]
libs/taglib/taglib/oggpageheader.h [deleted symlink]
libs/taglib/taglib/relativevolumeframe.h [deleted symlink]
libs/taglib/taglib/speexfile.h [deleted symlink]
libs/taglib/taglib/speexproperties.h [deleted symlink]
libs/taglib/taglib/taglib.h [deleted symlink]
libs/taglib/taglib/tbytevector.h [deleted symlink]
libs/taglib/taglib/tbytevectorlist.h [deleted symlink]
libs/taglib/taglib/tdebug.h [deleted symlink]
libs/taglib/taglib/textidentificationframe.h [deleted symlink]
libs/taglib/taglib/tfile.h [deleted symlink]
libs/taglib/taglib/tlist.h [deleted symlink]
libs/taglib/taglib/tlist.tcc [deleted symlink]
libs/taglib/taglib/tmap.h [deleted symlink]
libs/taglib/taglib/tmap.tcc [deleted symlink]
libs/taglib/taglib/trueaudiofile.h [deleted symlink]
libs/taglib/taglib/trueaudioproperties.h [deleted symlink]
libs/taglib/taglib/tstring.h [deleted symlink]
libs/taglib/taglib/tstringlist.h [deleted symlink]
libs/taglib/taglib/unicode.h [deleted symlink]
libs/taglib/taglib/uniquefileidentifierframe.h [deleted symlink]
libs/taglib/taglib/unknownframe.h [deleted symlink]
libs/taglib/taglib/unsynchronizedlyricsframe.h [deleted symlink]
libs/taglib/taglib/urllinkframe.h [deleted symlink]
libs/taglib/taglib/vorbisfile.h [deleted symlink]
libs/taglib/taglib/vorbisproperties.h [deleted symlink]
libs/taglib/taglib/wavpackfile.h [deleted symlink]
libs/taglib/taglib/wavpackproperties.h [deleted symlink]
libs/taglib/taglib/xingheader.h [deleted symlink]
libs/taglib/taglib/xiphcomment.h [deleted symlink]
libs/taglib/wscript
libs/vamp-plugins/Onset.cpp
libs/vamp-plugins/OnsetDetect.cpp
libs/vamp-plugins/PercussionOnsetDetector.cpp
libs/vamp-plugins/SpectralCentroid.cpp
msvc_extra_headers/ardourext/float_cast.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/libcharset.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/localcharset.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/misc.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/pthread.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/ptw32/pthread.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/sched.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/semaphore.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/sys/targetsxs.h.input [new file with mode: 0644]
msvc_extra_headers/ardourext/sys/time.h.input [new file with mode: 0644]
msvc_extra_headers/unistd.h.input [new file with mode: 0644]
tools/windows_packaging/Fedora-16-mingw.txt [new file with mode: 0644]
tools/windows_packaging/README [new file with mode: 0644]
tools/windows_packaging/ardour.nsi [new file with mode: 0644]
tools/windows_packaging/clean.sh [new file with mode: 0755]
tools/windows_packaging/configure-debug.sh [new file with mode: 0755]
tools/windows_packaging/configure-release.sh [new file with mode: 0755]
tools/windows_packaging/cptovm.sh [new file with mode: 0755]
tools/windows_packaging/gdbinit [new file with mode: 0644]
tools/windows_packaging/loaders.cache [new file with mode: 0644]
tools/windows_packaging/make-installer.sh [new file with mode: 0755]
tools/windows_packaging/mingw-env.sh [new file with mode: 0755]
tools/windows_packaging/package.sh [new file with mode: 0755]
tools/windows_packaging/pango.modules [new file with mode: 0644]
tools/windows_packaging/print-env.sh [new file with mode: 0755]
tools/windows_packaging/run-wine.sh [new file with mode: 0755]
tools/windows_packaging/startvm.sh [new file with mode: 0755]
tools/windows_packaging/waf.sh [new file with mode: 0755]
wscript

index f2251ba2043692c4cddc334cfbcf70c168ddb4b1..f148f7e3fbdab925b96f1a0a2494717aec50c5ef 100644 (file)
@@ -79,3 +79,58 @@ tags
 # /libs/pbd/
 /libs/pbd/version.cc
 /libs/pbd/pbd/version.h
+
+/libs/taglib/taglib/flacproperties.h
+/libs/taglib/taglib/apefooter.h
+/libs/taglib/taglib/apeitem.h
+/libs/taglib/taglib/apetag.h
+/libs/taglib/taglib/attachedpictureframe.h
+/libs/taglib/taglib/commentsframe.h
+/libs/taglib/taglib/flacfile.h
+/libs/taglib/taglib/id3v2tag.h
+/libs/taglib/taglib/generalencapsulatedobjectframe.h
+/libs/taglib/taglib/id3v1genres.h
+/libs/taglib/taglib/id3v1tag.h
+/libs/taglib/taglib/id3v2extendedheader.h
+/libs/taglib/taglib/id3v2footer.h
+/libs/taglib/taglib/id3v2frame.h
+/libs/taglib/taglib/id3v2framefactory.h
+/libs/taglib/taglib/id3v2header.h
+/libs/taglib/taglib/id3v2synchdata.h
+/libs/taglib/taglib/oggpageheader.h
+/libs/taglib/taglib/mpcfile.h
+/libs/taglib/taglib/mpcproperties.h
+/libs/taglib/taglib/mpegfile.h
+/libs/taglib/taglib/mpegheader.h
+/libs/taglib/taglib/mpegproperties.h
+/libs/taglib/taglib/oggfile.h
+/libs/taglib/taglib/oggflacfile.h
+/libs/taglib/taglib/oggpage.h
+/libs/taglib/taglib/textidentificationframe.h
+/libs/taglib/taglib/relativevolumeframe.h
+/libs/taglib/taglib/speexfile.h
+/libs/taglib/taglib/speexproperties.h
+/libs/taglib/taglib/taglib.h
+/libs/taglib/taglib/tbytevector.h
+/libs/taglib/taglib/tbytevectorlist.h
+/libs/taglib/taglib/tdebug.h
+/libs/taglib/taglib/tlist.h
+/libs/taglib/taglib/tmap.h
+/libs/taglib/taglib/trueaudiofile.h
+/libs/taglib/taglib/trueaudioproperties.h
+/libs/taglib/taglib/tstring.h
+/libs/taglib/taglib/tstringlist.h
+/libs/taglib/taglib/tfile.h
+/libs/taglib/taglib/urllinkframe.h
+/libs/taglib/taglib/unicode.h
+/libs/taglib/taglib/uniquefileidentifierframe.h
+/libs/taglib/taglib/unknownframe.h
+/libs/taglib/taglib/unsynchronizedlyricsframe.h
+/libs/taglib/taglib/xiphcomment.h
+/libs/taglib/taglib/vorbisfile.h
+/libs/taglib/taglib/vorbisproperties.h
+/libs/taglib/taglib/wavpackfile.h
+/libs/taglib/taglib/wavpackproperties.h
+/libs/taglib/taglib/xingheader.h
+/libs/taglib/taglib/tlist.tcc
+/libs/taglib/taglib/tmap.tcc
\ No newline at end of file
index 280f72a8dcb46c434c56a589f741496bd2a65d5c..b656c29ad8175fde37d430a630095338fe0c6e93 100644 (file)
@@ -20,7 +20,6 @@
 #include <algorithm>
 #include <unistd.h>
 #include <sys/types.h>
-#include <sys/wait.h>
 #include <cstdio>
 #include <ctime>
 #include <cstdlib>
@@ -561,7 +560,7 @@ About::About ()
 
        std::string splash_file;
 
-       SearchPath spath(ardour_data_search_path());
+       Searchpath spath(ardour_data_search_path());
 
        if (find_file_in_search_path (spath, "splash.png", splash_file)) {
                set_logo (Gdk::Pixbuf::create_from_file (splash_file));
index 67520925d9ae6822c24a39e1f3e40a3f9ee95f59..16d468ea3e2d20f00f9d2f803334163ad7fce12b 100644 (file)
 #include <cerrno>
 #include <fstream>
 
+#ifndef WIN32
+#include <sys/resource.h>
+#endif
+
 #include <stdint.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <unistd.h>
 #include <time.h>
 
-#include <sys/resource.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
+#include <glib.h>
+#include <glib/gstdio.h>
 
 #include <gtkmm/messagedialog.h>
 #include <gtkmm/accelmap.h>
@@ -48,6 +51,7 @@
 #include "pbd/memento_command.h"
 #include "pbd/openuri.h"
 #include "pbd/file_utils.h"
+#include "pbd/localtime_r.h"
 
 #include "gtkmm2ext/application.h"
 #include "gtkmm2ext/bindings.h"
@@ -294,7 +298,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir)
 
        /* and ambiguous files */
 
-       ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2, _3));
+       ARDOUR::FileSource::AmbiguousFileName.connect_same_thread (forever_connections, boost::bind (&ARDOUR_UI::ambiguous_file, this, _1, _2));
 
        /* lets get this party started */
 
@@ -856,7 +860,7 @@ ARDOUR_UI::no_memory_warning ()
 void
 ARDOUR_UI::check_memory_locking ()
 {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(WIN32)
        /* OS X doesn't support mlockall(2), and so testing for memory locking capability there is pointless */
        return;
 #else // !__APPLE__
@@ -3372,15 +3376,23 @@ ARDOUR_UI::start_video_server (Gtk::Window* float_window, bool popup_msg)
                if (icsd_docroot.empty()) {icsd_docroot = X_("/");}
 
                struct stat sb;
-               if (!lstat (icsd_docroot.c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)) {
+               if (!g_lstat (icsd_docroot.c_str(), &sb) == 0 || !S_ISDIR(sb.st_mode)) {
                        warning << _("Specified docroot is not an existing directory.") << endmsg;
                        continue;
                }
-               if ( (!lstat (icsd_exec.c_str(), &sb) == 0)
+#ifndef WIN32
+               if ( (!g_lstat (icsd_exec.c_str(), &sb) == 0)
                     || (sb.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) == 0 ) {
                        warning << _("Given Video Server is not an executable file.") << endmsg;
                        continue;
                }
+#else
+               if ( (!g_lstat (icsd_exec.c_str(), &sb) == 0)
+                    || (sb.st_mode & (S_IXUSR)) == 0 ) {
+                       warning << _("Given Video Server is not an executable file.") << endmsg;
+                       continue;
+               }
+#endif
 
                char **argp;
                argp=(char**) calloc(9,sizeof(char*));
@@ -4037,7 +4049,7 @@ ARDOUR_UI::missing_file (Session*s, std::string str, DataType type)
 }
 
 int
-ARDOUR_UI::ambiguous_file (std::string file, std::string /*path*/, std::vector<std::string> hits)
+ARDOUR_UI::ambiguous_file (std::string file, std::vector<std::string> hits)
 {
        AmbiguousFileDialog dialog (file, hits);
 
index 09edb9de383d4c8c96b6a35a92b8d83db41eab70..bdc34d35b9e6a2e96b268acedb588580f4352329 100644 (file)
@@ -724,7 +724,7 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
        void fontconfig_dialog ();
 
         int missing_file (ARDOUR::Session*s, std::string str, ARDOUR::DataType type);
-        int ambiguous_file (std::string file, std::string path, std::vector<std::string> hits);
+        int ambiguous_file (std::string file, std::vector<std::string> hits);
 
        bool click_button_clicked (GdkEventButton *);
 
index db9e420206f0299fbbfe83d95f03f511bd00e0fc..a0d61afdffeac95411baeed35605486257237436 100644 (file)
 #include "ardour/audioengine.h"
 #include "ardour/automation_watch.h"
 
+#ifdef interface
+#undef interface
+#endif
+
 #include "actions.h"
 #include "add_route_dialog.h"
 #include "add_video_dialog.h"
index 2aeb2dbe60aae44ffe7cfcd737c19cf5dd3d8691..03d3e472640e4204ee8c00fce2619f34e633a2a6 100644 (file)
@@ -54,7 +54,9 @@ AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion>
        : RegionEditor (s, r)
        , _audio_region (r)
        , gain_adjustment(accurate_coefficient_to_dB(_audio_region->scale_amplitude()), -40.0, +40.0, 0.1, 1.0, 0)
+#ifndef WIN32
        , _peak_channel (false)
+#endif
 {
 
        Gtk::HBox* b = Gtk::manage (new Gtk::HBox);
@@ -91,7 +93,7 @@ AudioRegionEditor::AudioRegionEditor (Session* s, boost::shared_ptr<AudioRegion>
 
        PeakAmplitudeFound.connect (_peak_amplitude_connection, invalidator (*this), boost::bind (&AudioRegionEditor::peak_amplitude_found, this, _1), gui_context ());
        pthread_create_and_store (X_("peak-amplitude"), &_peak_amplitude_thread_handle, _peak_amplitude_thread, this);
-       _peak_channel.deliver ('c');
+       signal_peak_thread ();
 }
 
 AudioRegionEditor::~AudioRegionEditor ()
@@ -112,7 +114,7 @@ AudioRegionEditor::region_changed (const PBD::PropertyChange& what_changed)
 
        if (what_changed.contains (ARDOUR::Properties::start) || what_changed.contains (ARDOUR::Properties::length)) {
                /* ask the peak thread to run again */
-               _peak_channel.deliver ('c');
+               signal_peak_thread ();
        }
 }
 void
@@ -133,13 +135,33 @@ AudioRegionEditor::gain_adjustment_changed ()
        }
 }
 
+void
+AudioRegionEditor::signal_peak_thread ()
+{
+#ifdef WIN32
+       m_peak_sem.post ();
+#else
+       _peak_channel.deliver ('c');
+#endif
+}
+
+void
+AudioRegionEditor::wait_for_signal ()
+{
+#ifdef WIN32
+       m_peak_sem.wait ();
+#else
+       char msg;
+       _peak_channel.receive (msg);
+#endif
+}
+
 void
 AudioRegionEditor::peak_amplitude_thread ()
 {
        while (1) {
                /* await instructions to run */
-               char msg;
-               _peak_channel.receive (msg);
+               wait_for_signal ();
 
                /* compute peak amplitude and signal the fact */
                PeakAmplitudeFound (accurate_coefficient_to_dB (_audio_region->maximum_amplitude ())); /* EMIT SIGNAL */
index b72986ecf19034387bc5f9564b7a0f97ee0443a0..2552dfd16503ed7512ad6899ab6a975d154158e1 100644 (file)
 
 
 #include "pbd/signals.h"
+#ifdef WIN32
+#include "pbd/glib_semaphore.h"
+#else
 #include "pbd/crossthread.h"
+#endif
 
 #include "audio_clock.h"
 #include "ardour_dialog.h"
@@ -73,11 +77,17 @@ class AudioRegionEditor : public RegionEditor
        Gtk::Label _peak_amplitude_label;
        Gtk::Entry _peak_amplitude;
 
+       void signal_peak_thread ();
+       void wait_for_signal ();
        pthread_t _peak_amplitude_thread_handle;
        void peak_amplitude_found (double);
        PBD::Signal1<void, double> PeakAmplitudeFound;
        PBD::ScopedConnection _peak_amplitude_connection;
+#ifdef WIN32
+       PBD::GlibSemaphore m_peak_sem;
+#else
        CrossThreadChannel _peak_channel;
+#endif
 };
 
 #endif /* __gtk_ardour_audio_region_edit_h__ */
index 353d0dc93777aeccf0b58d2c123df5b81dfc622b..3bfa56d2856ee50a22da1d110933cbae8803e990 100644 (file)
 #ifndef __gtk_ardour_audio_region_view_h__
 #define __gtk_ardour_audio_region_view_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <vector>
 
 #include <sigc++/signal.h>
index d22806a8c005c9ead515ce677d9775f8eac7709b..8d48da7040f56401eccc52a5559c2e8f27f1946e 100644 (file)
@@ -385,14 +385,14 @@ AudioTimeAxisView::build_automation_action_menu (bool for_selection)
        MenuList& automation_items = automation_action_menu->items ();
 
        automation_items.push_back (CheckMenuElem (_("Fader"), sigc::mem_fun (*this, &AudioTimeAxisView::update_gain_track_visibility)));
-       gain_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
+       gain_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
        gain_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) && 
                                          (gain_track && string_is_affirmative (gain_track->gui_property ("visible"))));
 
        _main_automation_menu_map[Evoral::Parameter(GainAutomation)] = gain_automation_item;
 
        automation_items.push_back (CheckMenuElem (_("Pan"), sigc::mem_fun (*this, &AudioTimeAxisView::update_pan_track_visibility)));
-       pan_automation_item = dynamic_cast<CheckMenuItem*> (&automation_items.back ());
+       pan_automation_item = dynamic_cast<Gtk::CheckMenuItem*> (&automation_items.back ());
        pan_automation_item->set_active ((!for_selection || _editor.get_selection().tracks.size() == 1) &&
                                         (!pan_tracks.empty() && string_is_affirmative (pan_tracks.front()->gui_property ("visible"))));
 
index fd3c7aab52bb05488291335b83257d923d95f8ca..7b5771d74c9143dc3c8e7e9ad5a2ec23063bc1e0 100644 (file)
@@ -489,22 +489,22 @@ AutomationTimeAxisView::build_display_menu ()
        as_items.push_back (CheckMenuElem (S_("Automation|Manual"), sigc::bind (
                        sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
                        (AutoState) ARDOUR::Off)));
-       auto_off_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
+       auto_off_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
 
        as_items.push_back (CheckMenuElem (_("Play"), sigc::bind (
                        sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
                        (AutoState) Play)));
-       auto_play_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
+       auto_play_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
 
        as_items.push_back (CheckMenuElem (_("Write"), sigc::bind (
                        sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
                        (AutoState) Write)));
-       auto_write_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
+       auto_write_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
 
        as_items.push_back (CheckMenuElem (_("Touch"), sigc::bind (
                        sigc::mem_fun(*this, &AutomationTimeAxisView::set_automation_state),
                        (AutoState) Touch)));
-       auto_touch_item = dynamic_cast<CheckMenuItem*>(&as_items.back());
+       auto_touch_item = dynamic_cast<Gtk::CheckMenuItem*>(&as_items.back());
 
        items.push_back (MenuElem (_("State"), *auto_state_menu));
 
@@ -524,13 +524,13 @@ AutomationTimeAxisView::build_display_menu ()
                am_items.push_back (RadioMenuElem (group, _("Discrete"), sigc::bind (
                                sigc::mem_fun(*this, &AutomationTimeAxisView::set_interpolation),
                                AutomationList::Discrete)));
-               mode_discrete_item = dynamic_cast<CheckMenuItem*>(&am_items.back());
+               mode_discrete_item = dynamic_cast<Gtk::CheckMenuItem*>(&am_items.back());
                mode_discrete_item->set_active (s == AutomationList::Discrete);
 
                am_items.push_back (RadioMenuElem (group, _("Linear"), sigc::bind (
                                sigc::mem_fun(*this, &AutomationTimeAxisView::set_interpolation),
                                AutomationList::Linear)));
-               mode_line_item = dynamic_cast<CheckMenuItem*>(&am_items.back());
+               mode_line_item = dynamic_cast<Gtk::CheckMenuItem*>(&am_items.back());
                mode_line_item->set_active (s == AutomationList::Linear);
 
                items.push_back (MenuElem (_("Mode"), *auto_mode_menu));
index c7754f69cccf3541b9d8919e334c16cb5dd5bbca..035046c10b6b4eb4313ce5395f50d7ed888b00a2 100644 (file)
@@ -286,7 +286,7 @@ BundleManager::BundleManager (Session* session)
        edit_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::EDIT, Gtk::ICON_SIZE_BUTTON)));
        edit_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::edit_clicked));
        buttons->pack_start (edit_button, false, false);
-       delete_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::Stock::DELETE, Gtk::ICON_SIZE_BUTTON)));
+       delete_button.set_image (*Gtk::manage (new Gtk::Image (Gtk::StockID(GTK_STOCK_DELETE), Gtk::ICON_SIZE_BUTTON)));
        delete_button.signal_clicked().connect (sigc::mem_fun (*this, &BundleManager::delete_clicked));
        buttons->pack_start (delete_button, false, false);
 
index 2080b208d8a2eb6f839cc0657bf3c72e58d6a98c..51384c0fadd4234daa4abb1c569971c274bb60fa 100644 (file)
@@ -35,7 +35,7 @@
 /* POSIX guarantees casting between void* and function pointers, ISO C doesn't
  * We can work around warnings by going one step deeper in our casts
  */
-#ifdef _POSIX_VERSION
+#if defined(_POSIX_VERSION) || defined(__MINGW32__)
 #define POSIX_FUNC_PTR_CAST(type, object) *((type*) &(object))
 #endif // _POSIX_VERSION
 
index 877a39e7730478303b4898071a02230eb9583792..e40030d671d5a7fe6a0b7b65df792a7dba6b0511 100644 (file)
@@ -25,6 +25,8 @@
 
 #include <gtkmm/messagedialog.h>
 
+#include <glib/gstdio.h>
+
 #include "gtkmm2ext/choice.h"
 
 #include "pbd/pthread_utils.h"
@@ -158,11 +160,11 @@ Editor::export_region ()
 
                        switch (ret) {
                        case Gtk::RESPONSE_ACCEPT:
-                               /* force unlink because the backend code will
+                               /* force ::g_unlink because the backend code will
                                   go wrong if it tries to open an existing
                                   file for writing.
                                */
-                               ::unlink (path.c_str());
+                               ::g_unlink (path.c_str());
                                break;
                        default:
                                return;
index c9a151f96ea0073b7acb2b20ac233b79e7ec1309..f21f4b21bcb41e8f09f17016c08a9d6bb3b66836 100644 (file)
@@ -860,14 +860,14 @@ Editor::build_marker_menu (Location* loc)
        items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &Editor::marker_menu_rename)));
 
        items.push_back (CheckMenuElem (_("Lock")));
-       CheckMenuItem* lock_item = static_cast<CheckMenuItem*> (&items.back());
+       Gtk::CheckMenuItem* lock_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
        if (loc->locked ()) {
                lock_item->set_active ();
        }
        lock_item->signal_activate().connect (sigc::mem_fun (*this, &Editor::toggle_marker_menu_lock));
 
        items.push_back (CheckMenuElem (_("Glue to Bars and Beats")));
-       CheckMenuItem* glue_item = static_cast<CheckMenuItem*> (&items.back());
+       Gtk::CheckMenuItem* glue_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
        if (loc->position_lock_style() == MusicTime) {
                glue_item->set_active ();
        }
index 27a13a94b760a8e29037d9546526fcb3083a8a77..9f6e978dce5322380140cb664b8219d963919bef 100644 (file)
@@ -384,11 +384,11 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t)
                ruler_items.push_back (MenuElem (_("Timeline height")));
                static_cast<MenuItem*>(&ruler_items.back())->set_sensitive(false);
                ruler_items.push_back (CheckMenuElem (_("Large"),  sigc::bind ( sigc::mem_fun(*this, &Editor::set_video_timeline_height), 6)));
-               if (videotl_bar_height == 6) { static_cast<CheckMenuItem*>(&ruler_items.back())->set_active(true);}
+               if (videotl_bar_height == 6) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);}
                ruler_items.push_back (CheckMenuElem (_("Normal"), sigc::bind ( sigc::mem_fun(*this, &Editor::set_video_timeline_height), 4)));
-               if (videotl_bar_height == 4) { static_cast<CheckMenuItem*>(&ruler_items.back())->set_active(true);}
+               if (videotl_bar_height == 4) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);}
                ruler_items.push_back (CheckMenuElem (_("Small"),  sigc::bind ( sigc::mem_fun(*this, &Editor::set_video_timeline_height), 3)));
-               if (videotl_bar_height == 3) { static_cast<CheckMenuItem*>(&ruler_items.back())->set_active(true);}
+               if (videotl_bar_height == 3) { static_cast<Gtk::CheckMenuItem*>(&ruler_items.back())->set_active(true);}
                ruler_items.push_back (SeparatorElem ());
 
                ruler_items.push_back (MenuElem (_("Align Video Track")));
@@ -396,7 +396,7 @@ Editor::popup_ruler_menu (framepos_t where, ItemType t)
 
                ruler_items.push_back (CheckMenuElem (_("Lock")));
                {
-               CheckMenuItem* vtl_lock = static_cast<CheckMenuItem*>(&ruler_items.back());
+               Gtk::CheckMenuItem* vtl_lock = static_cast<Gtk::CheckMenuItem*>(&ruler_items.back());
                vtl_lock->set_active(is_video_timeline_locked());
                vtl_lock->signal_activate().connect (sigc::mem_fun(*this, &Editor::toggle_video_timeline_locked));
                }
index 2f0b09ed17a36f4d22b3990c30b6a47f027e1a9c..e43dae9e2b4cf2efe3f6e4fed88f0453300ccb84 100644 (file)
@@ -402,9 +402,12 @@ Editor::timefx_thread (void *arg)
            by the GUI ...
         */
 
+#ifdef WIN32
+       Sleep(2000);
+#else
         struct timespec t = { 2, 0 };
         nanosleep (&t, 0);
-
+#endif
        return 0;
 }
 
index 4bf8b047cbbbe7177ef82d7e5d8bb31fb698b2e2..1da9fb4f1983be0a25c11431c7c56833d864748a 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <jack/types.h>
 
+#include <glib/gstdio.h>
+
 #include "ardour/profile.h"
 #include "ardour/rc_configuration.h"
 #include "ardour/audio_track.h"
@@ -105,7 +107,7 @@ Editor::embed_audio_from_video (std::string path, framepos_t n)
 
        import_status.all_done = true;
 #endif
-       unlink(path.c_str());
+       ::g_unlink(path.c_str());
 }
 
 void
index 984026a74873b4b14df556e11734ddec42b30f8f..bc165273c73f1b66e81d32a6303253bae6348e68 100644 (file)
 
 #include "ardour/export_profile_manager.h"
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 #include <sigc++/signal.h>
 #include <boost/shared_ptr.hpp>
index a64acd16801af3c2ec619e39ce1ea44bc75fba59..8916806a15907a9c276cc0725a0528a76525aca5 100644 (file)
@@ -328,7 +328,7 @@ ExportDialog::show_progress ()
                if (gtk_events_pending()) {
                        gtk_main_iteration ();
                } else {
-                       usleep (10000);
+                       Glib::usleep (10000);
                }
        }
 
index 8d37ded2cdd5201c690cf73c82c8e277de398036..3e38cf09d662a55b3e67c8dbfb9706f7d4e3d9df 100644 (file)
 #include "ardour_dialog.h"
 #include "audio_clock.h"
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 
 class ExportFormatDialog : public ArdourDialog, public PBD::ScopedConnectionList {
index 2118a57b836f23353203524b41acdc4f25f7374e..5556f5f676eb4dae77abfa03a16b0e628b592d69 100644 (file)
 
 #include <list>
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 #include <boost/shared_ptr.hpp>
 
+
 #include "ardour/types.h"
 #include "ardour/session_handle.h"
 #include "ardour/export_profile_manager.h"
index b1b59fa0888399fe0e26de8a0c1b37fe8eb41336..7f6fcc2a8ad80088010e60f392479b48d1f322a4 100644 (file)
@@ -30,6 +30,8 @@
 #include <sigc++/bind.h>
 #include <libgen.h>
 
+#include <glib/gstdio.h>
+
 #include "pbd/error.h"
 #include "pbd/convert.h"
 #include "gtkmm2ext/utils.h"
@@ -411,8 +413,8 @@ void
 ExportVideoDialog::finished ()
 {
        if (aborted) {
-               unlink(outfn_path_entry.get_text().c_str());
-               unlink (insnd.c_str());
+               ::g_unlink(outfn_path_entry.get_text().c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_CANCEL);
        } else if (twopass && firstpass) {
                firstpass = false;
@@ -422,9 +424,9 @@ ExportVideoDialog::finished ()
                if (twopass_checkbox.get_active()) {
                        std::string outfn = outfn_path_entry.get_text();
                        std::string p2log = Glib::path_get_dirname (outfn) + G_DIR_SEPARATOR + "ffmpeg2pass";
-                       unlink (p2log.c_str());
+                       ::g_unlink (p2log.c_str());
                }
-               unlink (insnd.c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_ACCEPT);
        }
 }
@@ -565,7 +567,7 @@ ExportVideoDialog::launch_export ()
        audio_progress_connection.disconnect();
        status->finish ();
        if (status->aborted()) {
-               unlink (insnd.c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_CANCEL);
                return;
        }
@@ -582,14 +584,14 @@ ExportVideoDialog::encode_pass (int pass)
        transcoder = new TranscodeFfmpeg(invid);
        if (!transcoder->ffexec_ok()) {
                /* ffmpeg binary was not found. TranscodeFfmpeg prints a warning */
-               unlink (insnd.c_str());
+               ::g_unlink (insnd.c_str());
                Gtk::Dialog::response(RESPONSE_CANCEL);
                return;
        }
        if (!transcoder->probe_ok()) {
                /* video input file can not be read */
                warning << _("Export Video: Video input file cannot be read.") << endmsg;
-         unlink (insnd.c_str());
+         ::g_unlink (insnd.c_str());
          Gtk::Dialog::response(RESPONSE_CANCEL);
          return;
        }
index fbe28bd8214cd180f539d35a4439e59499355e1d..a3e356decc6a3cb7c9303a6f608a74e7e2c4c85b 100644 (file)
@@ -18,6 +18,9 @@
 
 */
 #include "ardour/session.h"
+#ifdef interface
+#undef interface
+#endif
 #include "export_video_infobox.h"
 #include "i18n.h"
 
index 100ab5337e3317483463bf868094c1a3b8717a96..ab22d972212b4360a5b9dab96e27a221a472fba2 100644 (file)
@@ -41,8 +41,6 @@
 #include "ardour/plugin_insert.h"
 #include "ardour/session.h"
 
-#include <lrdf.h>
-
 #include "ardour_ui.h"
 #include "prompter.h"
 #include "plugin_ui.h"
index 80e2616bd81088023092333720548767f89e5ec0..218cfe7a1cadb2d0b112a013ceabcf843cc9d95c 100644 (file)
@@ -48,7 +48,7 @@ GlobalPortMatrix::setup_ports (int dim)
        }
 
        _ports[dim].suspend_signals ();
-       _ports[dim].gather (_session, type(), dim == IN, false, show_only_bundles ());
+       _ports[dim].gather (_session, type(), dim == FLOW_IN, false, show_only_bundles ());
        _ports[dim].resume_signals ();
 }
 
@@ -59,8 +59,8 @@ GlobalPortMatrix::set_state (BundleChannel c[2], bool s)
                return;
        }
 
-       Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
-       Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
+       Bundle::PortList const & in_ports = c[FLOW_IN].bundle->channel_ports (c[FLOW_IN].channel);
+       Bundle::PortList const & out_ports = c[FLOW_OUT].bundle->channel_ports (c[FLOW_OUT].channel);
 
        for (Bundle::PortList::const_iterator i = in_ports.begin(); i != in_ports.end(); ++i) {
                for (Bundle::PortList::const_iterator j = out_ports.begin(); j != out_ports.end(); ++j) {
@@ -103,8 +103,8 @@ GlobalPortMatrix::get_state (BundleChannel c[2]) const
                return PortMatrixNode::NOT_ASSOCIATED;
        }
 
-       Bundle::PortList const & in_ports = c[IN].bundle->channel_ports (c[IN].channel);
-       Bundle::PortList const & out_ports = c[OUT].bundle->channel_ports (c[OUT].channel);
+       Bundle::PortList const & in_ports = c[FLOW_IN].bundle->channel_ports (c[FLOW_IN].channel);
+       Bundle::PortList const & out_ports = c[FLOW_OUT].bundle->channel_ports (c[FLOW_OUT].channel);
        if (in_ports.empty() || out_ports.empty()) {
                /* we're looking at a bundle with no parts associated with this channel,
                   so nothing to connect */
index d45a6390938c067f6d10bb10640b62da3c3b50a1..3def23a6a3d6c47c7f47d64d33931bbc015d04ea 100644 (file)
@@ -46,8 +46,8 @@ public:
 private:
        /* see PortMatrix: signal flow from 0 to 1 (out to in) */
        enum {
-               OUT = 0,
-               IN = 1,
+               FLOW_OUT = 0,
+               FLOW_IN = 1,
        };
 };
 
index c8f8d76a98a2edb291a8d3c24947b51ba3c201d7..f55405a84da856b20b2d57b93fc61d120614a365 100644 (file)
@@ -31,6 +31,7 @@
 #include "pbd/file_utils.h"
 #include "pbd/textreceiver.h"
 #include "pbd/failed_constructor.h"
+#include "pbd/pathexpand.h"
 #include "pbd/pthread_utils.h"
 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
 #include "pbd/boost_debug.h"
@@ -110,7 +111,7 @@ Please consider the possibilities, and perhaps (re)start JACK."), PROGRAM_NAME))
 static void export_search_path (const string& base_dir, const char* varname, const char* dir)
 {
        string path;
-       const char * cstr = getenv (varname);
+       const char * cstr = g_getenv (varname);
 
        if (cstr) {
                path = cstr;
@@ -121,7 +122,7 @@ static void export_search_path (const string& base_dir, const char* varname, con
        path += base_dir;
        path += dir;
 
-       setenv (varname, path.c_str(), 1);
+       g_setenv (varname, path.c_str(), 1);
 }
 
 #ifdef __APPLE__
@@ -134,7 +135,7 @@ extern void set_language_preference (); // cocoacarbon.mm
 void
 fixup_bundle_environment (int, char* [])
 {
-       if (!getenv ("ARDOUR_BUNDLED")) {
+       if (!g_getenv ("ARDOUR_BUNDLED")) {
                return;
        }
 
@@ -184,12 +185,12 @@ fixup_bundle_environment (int, char* [])
        export_search_path (bundle_dir, "SUIL_MODULE_DIR", "/lib");
        export_search_path (bundle_dir, "GTK_PATH", "/lib/gtkengines");
 
-       setenv ("PATH", (bundle_dir + "/MacOS:" + std::string(getenv ("PATH"))).c_str(), 1);
+       g_setenv ("PATH", (bundle_dir + "/MacOS:" + std::string(getenv ("PATH"))).c_str(), 1);
 
        /* unset GTK_RC_FILES so that we only load the RC files that we define
         */
 
-       unsetenv ("GTK_RC_FILES");
+       g_unsetenv ("GTK_RC_FILES");
 
        /* write a pango.rc file and tell pango to use it. we'd love
           to put this into the PROGRAM_NAME.app bundle and leave it there,
@@ -214,13 +215,13 @@ fixup_bundle_environment (int, char* [])
                                << endl;
                        pangorc.close ();
                        
-                       setenv ("PANGO_RC_FILE", path.c_str(), 1);
+                       g_setenv ("PANGO_RC_FILE", path.c_str(), 1);
                }
        }
        
-       setenv ("CHARSETALIASDIR", bundle_dir.c_str(), 1);
-       setenv ("FONTCONFIG_FILE", Glib::build_filename (bundle_dir, "Resources/fonts.conf").c_str(), 1);
-       setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (bundle_dir, "Resources/gdk-pixbuf.loaders").c_str(), 1);
+       g_setenv ("CHARSETALIASDIR", bundle_dir.c_str(), 1);
+       g_setenv ("FONTCONFIG_FILE", Glib::build_filename (bundle_dir, "Resources/fonts.conf").c_str(), 1);
+       g_setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (bundle_dir, "Resources/gdk-pixbuf.loaders").c_str(), 1);
 }
 
 static void load_custom_fonts() {
@@ -258,7 +259,7 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
         * acceptable to build paths directly using '/'.
         */
 
-       if (!getenv ("ARDOUR_BUNDLED")) {
+       if (!g_getenv ("ARDOUR_BUNDLED")) {
                return;
        }
 
@@ -277,7 +278,7 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
                lpath.push_back (dir_path);
                lpath.push_back ("share");
                lpath.push_back ("locale");
-               localedir = realpath (Glib::build_filename (lpath).c_str(), NULL);
+               localedir = canonical_path (Glib::build_filename (lpath)).c_str();
        }
 #endif
 
@@ -294,20 +295,20 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
        export_search_path (dir_path, "SUIL_MODULE_DIR", "/lib");
        export_search_path (dir_path, "GTK_PATH", "/lib/gtkengines");
 
-       setenv ("PATH", (dir_path + "/bin:" + std::string(getenv ("PATH"))).c_str(), 1);
+       g_setenv ("PATH", (dir_path + "/bin:" + std::string(getenv ("PATH"))).c_str(), 1);
 
        /* unset GTK_RC_FILES so that we only load the RC files that we define
         */
 
-       unsetenv ("GTK_RC_FILES");
+       g_unsetenv ("GTK_RC_FILES");
 
        /* Tell fontconfig where to find fonts.conf. Use the system version
           if it exists, otherwise use the stuff we included in the bundle
        */
 
        if (Glib::file_test ("/etc/fonts/fonts.conf", Glib::FILE_TEST_EXISTS)) {
-               setenv ("FONTCONFIG_FILE", "/etc/fonts/fonts.conf", 1);
-               setenv ("FONTCONFIG_PATH", "/etc/fonts", 1);
+               g_setenv ("FONTCONFIG_FILE", "/etc/fonts/fonts.conf", 1);
+               g_setenv ("FONTCONFIG_PATH", "/etc/fonts", 1);
        } else {
                error << _("No fontconfig file found on your system. Things may looked very odd or ugly") << endmsg;
        }
@@ -336,19 +337,19 @@ fixup_bundle_environment (int /*argc*/, char* argv[])
                        pangorc.close ();
                }
                
-               setenv ("PANGO_RC_FILE", path.c_str(), 1);
+               g_setenv ("PANGO_RC_FILE", path.c_str(), 1);
                
                /* similar for GDK pixbuf loaders, but there's no RC file required
                   to specify where it lives.
                */
                
-               setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (userconfigdir, "gdk-pixbuf.loaders").c_str(), 1);
+               g_setenv ("GDK_PIXBUF_MODULE_FILE", Glib::build_filename (userconfigdir, "gdk-pixbuf.loaders").c_str(), 1);
        }
 
         /* this doesn't do much but setting it should prevent various parts of the GTK/GNU stack
            from looking outside the bundle to find the charset.alias file.
         */
-        setenv ("CHARSETALIASDIR", dir_path.c_str(), 1);
+        g_setenv ("CHARSETALIASDIR", dir_path.c_str(), 1);
 
 }
 
@@ -469,7 +470,7 @@ int main (int argc, char *argv[])
        text_receiver.listen_to (warning);
 
 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
-       if (getenv ("BOOST_DEBUG")) {
+       if (g_getenv ("BOOST_DEBUG")) {
                boost_debug_shared_ptr_show_live_debugging (true);
        }
 #endif
@@ -514,9 +515,11 @@ int main (int argc, char *argv[])
                return curvetest (curvetest_file);
        }
 
+#ifndef WIN32
        if (::signal (SIGPIPE, sigpipe_handler)) {
                cerr << _("Cannot xinstall SIGPIPE error handler") << endl;
        }
+#endif
 
        try {
                ui = new ARDOUR_UI (&argc, &argv, localedir);
index c9361f609179f7f1e18c6f609b42865af7a868e4..36b398ee44b406e9c2f56b6726cc78c28647a4f9 100644 (file)
@@ -49,7 +49,7 @@ MainClock::build_ops_menu ()
        MenuList& ops_items = ops_menu->items();
        ops_items.push_back (SeparatorElem ());
        ops_items.push_back (CheckMenuElem (_("Display delta to edit cursor"), sigc::mem_fun (*this, &MainClock::display_delta_to_edit_cursor)));
-       CheckMenuItem* c = dynamic_cast<CheckMenuItem *> (&ops_items.back());
+       Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem *> (&ops_items.back());
        if (_primary) {
                if (ARDOUR::Config->get_primary_clock_delta_edit_cursor ()) {
                        ARDOUR::Config->set_primary_clock_delta_edit_cursor (false);
index 2f5ca729a6b942480d51ae963304670f181189d6..b51584aef50d1a109160a913ce62d22a22e5c31d 100644 (file)
@@ -516,7 +516,7 @@ MidiChannelSelectorWindow::set_playback_selected_channels (uint16_t mask)
        case ForceChannel:
                /* only set the lowest set channel in the mask as active */
                for (uint16_t i = 0; i < 16; i++) {
-                       playback_buttons[i]->set_active (i == (ffs (mask) - 1));
+                       playback_buttons[i]->set_active (i == (PBD::ffs (mask) - 1));
                }
                break;
        }
@@ -539,7 +539,7 @@ MidiChannelSelectorWindow::set_capture_selected_channels (uint16_t mask)
        case ForceChannel:
                /* only set the lowest set channel in the mask as active */
                for (uint16_t i = 0; i < 16; i++) {
-                       capture_buttons[i]->set_active (i == (ffs (mask) - 1));
+                       capture_buttons[i]->set_active (i == (PBD::ffs (mask) - 1));
                }
                break;
        }
@@ -595,7 +595,7 @@ MidiChannelSelectorWindow::playback_mode_changed ()
        case ForceChannel:
                if (last_drawn_playback_mode == AllChannels || last_drawn_playback_mode == FilterChannels) {
                        playback_buttons.clear ();
-                       first_channel = ffs (track->get_playback_channel_mask()) - 1;
+                       first_channel = PBD::ffs (track->get_playback_channel_mask()) - 1;
                }
                for (vector<Widget*>::iterator i = playback_mask_controls.begin(); i != playback_mask_controls.end(); ++i) {
                        (*i)->set_sensitive (false);
@@ -693,7 +693,7 @@ MidiChannelSelectorWindow::capture_mode_changed ()
        case ForceChannel:
                if (last_drawn_capture_mode == AllChannels || last_drawn_capture_mode == FilterChannels) {
                        capture_buttons.clear ();
-                       first_channel = ffs (track->get_capture_channel_mask()) - 1;
+                       first_channel = PBD::ffs (track->get_capture_channel_mask()) - 1;
                }
                for (vector<Widget*>::iterator i = capture_mask_controls.begin(); i != capture_mask_controls.end(); ++i) {
                        (*i)->set_sensitive (false);
index 002efb9910f2b6cf9b015096efbbb581f42a28e9..4884dc34f38c929f9b3b3edf9600925994bfd2e9 100644 (file)
@@ -19,8 +19,6 @@
 #include <cstdlib>
 #include <cmath>
 
-#include <strings.h> // for ffs(3)
-
 #include <algorithm>
 #include <string>
 #include <vector>
@@ -28,6 +26,7 @@
 #include <sigc++/bind.h>
 
 #include "pbd/error.h"
+#include "pbd/ffs.h"
 #include "pbd/stl_delete.h"
 #include "pbd/whitespace.h"
 #include "pbd/basename.h"
@@ -663,7 +662,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
                                        }
                                }
 
-                               CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
+                               Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&chn_items.back());
                                _channel_command_menu_map[fully_qualified_param] = cmi;
                                cmi->set_active (visible);
                        }
@@ -695,7 +694,7 @@ MidiTimeAxisView::add_channel_command_menu_item (Menu_Helpers::MenuList& items,
                                        }
                                }
 
-                               CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&items.back());
+                               Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&items.back());
                                _channel_command_menu_map[fully_qualified_param] = cmi;
                                cmi->set_active (visible);
 
@@ -737,7 +736,7 @@ MidiTimeAxisView::add_single_channel_controller_item(Menu_Helpers::MenuList& ctl
                                }
                        }
 
-                       CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&ctl_items.back());
+                       Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&ctl_items.back());
                        _controller_menu_map[fully_qualified_param] = cmi;
                        cmi->set_active (visible);
 
@@ -793,7 +792,7 @@ MidiTimeAxisView::add_multi_channel_controller_item(Menu_Helpers::MenuList& ctl_
                                }
                        }
 
-                       CheckMenuItem* cmi = static_cast<CheckMenuItem*>(&chn_items.back());
+                       Gtk::CheckMenuItem* cmi = static_cast<Gtk::CheckMenuItem*>(&chn_items.back());
                        _controller_menu_map[fully_qualified_param] = cmi;
                        cmi->set_active (visible);
                }
@@ -1489,7 +1488,7 @@ MidiTimeAxisView::playback_channel_mode_changed ()
                _playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Play"), _("some")));
                break;
        case ForceChannel:
-               _playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Play"), _("all"), ffs (midi_track()->get_playback_channel_mask())));
+               _playback_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Play"), _("all"), PBD::ffs (midi_track()->get_playback_channel_mask())));
                break;
        }
 }
@@ -1505,7 +1504,7 @@ MidiTimeAxisView::capture_channel_mode_changed ()
                _capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2</i>", _("Rec"), _("some")));
                break;
        case ForceChannel:
-               _capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Rec"), _("all"), ffs (midi_track()->get_capture_channel_mask())));
+               _capture_channel_status.set_markup (string_compose ("<b>%1</b>: <i>%2>%3</i>", _("Rec"), _("all"), PBD::ffs (midi_track()->get_capture_channel_mask())));
                break;
        }
 }
index ea4b0c2d545cdaae2e87e20cebf337645689eb85..934dffd11c161d88287dca38eea8460e837655d1 100644 (file)
@@ -23,6 +23,9 @@
 #include <sys/time.h>
 #include <time.h>
 
+#include "pbd/localtime_r.h"
+#include "pbd/timersub.h"
+
 #include "midi++/parser.h"
 
 #include "ardour/async_midi_port.h"
index c7cb7f5edccf8a08902bde16c6b0a7f9d54de28c..37868d55728569b4bdf159633e9fb7527f031e9f 100644 (file)
@@ -19,6 +19,7 @@
 #include "pbd/compose.h"
 #include "pbd/replace_all.h"
 #include "pbd/strsplit.h"
+#include "pbd/search_path.h"
 
 #include "ardour/session.h"
 
@@ -56,14 +57,18 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
                 break;
         }
 
-        string dirstr;
+       vector<string> source_dirs = s->source_search_path (type);
+       vector<string>::iterator i = source_dirs.begin();
+       ostringstream oss;
+       oss << *i << endl;
 
-        dirstr = s->source_search_path (type);
-        replace_all (dirstr, ":", "\n");
+       while (++i != source_dirs.end()) {
+               oss << *i << endl;
+       }
 
         msg.set_justify (JUSTIFY_CENTER);
         msg.set_markup (string_compose (_("%1 cannot find the %2 file\n\n<i>%3</i>\n\nin any of these folders:\n\n\
-<tt>%4</tt>\n\n"), PROGRAM_NAME, typestr, Glib::Markup::escape_text(path), Glib::Markup::escape_text (dirstr)));
+<tt>%4</tt>\n\n"), PROGRAM_NAME, typestr, Glib::Markup::escape_text(path), Glib::Markup::escape_text (oss.str())));
 
         HBox* hbox = manage (new HBox);
         hbox->pack_start (msg, false, true);
index d77023d2016f96565d18da0908598dc554df0b86..9e2140fd10f8b38ea11919cb781875f434cbb9e5 100644 (file)
@@ -1473,7 +1473,7 @@ MixerStrip::build_route_ops_menu ()
 
        items.push_back (SeparatorElem());
        items.push_back (CheckMenuElem (_("Active")));
-       CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
+       Gtk::CheckMenuItem* i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
        i->set_active (_route->active());
        i->signal_activate().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::set_route_active), !_route->active(), false));
 
@@ -1483,7 +1483,7 @@ MixerStrip::build_route_ops_menu ()
 
        items.push_back (SeparatorElem());
        items.push_back (CheckMenuElem (_("Protect Against Denormals"), sigc::mem_fun (*this, &RouteUI::toggle_denormal_protection)));
-       denormal_menu_item = dynamic_cast<CheckMenuItem *> (&items.back());
+       denormal_menu_item = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
        denormal_menu_item->set_active (_route->denormal_protection());
 
        if (!Profile->get_sae()) {
index 64d83ab162e08e80eeb8cb239aad3c644b0cea42..395cd2f5ddb361aa7157f420814871ac6c4ad2d6 100644 (file)
@@ -390,7 +390,7 @@ Panner2d::on_expose_event (GdkEventExpose *event)
 {
         CartesianVector c;
        cairo_t* cr;
-        bool small = (height <= large_size_threshold);
+        bool small_size = (height <= large_size_threshold);
         const double diameter = radius*2.0;
 
        cr = gdk_cairo_create (get_window()->gobj());
@@ -473,7 +473,7 @@ Panner2d::on_expose_event (GdkEventExpose *event)
 
                cairo_select_font_face (cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
 
-               if (small) {
+               if (small_size) {
                        arc_radius = 4.0;
                } else {
                        cairo_set_font_size (cr, 10);
@@ -498,10 +498,10 @@ Panner2d::on_expose_event (GdkEventExpose *event)
                                         cairo_set_source_rgba (cr, 0.517, 0.772, 0.882, 1.0);
                                         cairo_stroke (cr);
 
-                                        if (!small && !signal->text.empty()) {
+                                        if (!small_size && !signal->text.empty()) {
                                                 cairo_set_source_rgb (cr, 0.517, 0.772, 0.882);
                                                 /* the +/- adjustments are a hack to try to center the text in the circle */
-                                                if (small) {
+                                                if (small_size) {
                                                         cairo_move_to (cr, c.x - 1, c.y + 1);
                                                 } else {
                                                         cairo_move_to (cr, c.x - 4, c.y + 4);
@@ -535,7 +535,7 @@ Panner2d::on_expose_event (GdkEventExpose *event)
                                 cairo_move_to (cr, c.x, c.y);
                                 cairo_save (cr);
                                 cairo_rotate (cr, -(speaker->position.azi/360.0) * (2.0 * M_PI));
-                                if (small) {
+                                if (small_size) {
                                         cairo_scale (cr, 0.8, 0.8);
                                 } else {
                                         cairo_scale (cr, 1.2, 1.2);
@@ -553,7 +553,7 @@ Panner2d::on_expose_event (GdkEventExpose *event)
                                cairo_fill (cr);
                                 cairo_restore (cr);
 
-                                if (!small) {
+                                if (!small_size) {
                                         cairo_set_font_size (cr, 16);
 
                                         /* move the text in just a bit */
index c82a44f3992989a415759de024e6f301f5ad996d..95d7491921155a77440249189a504cf4051edd0e 100644 (file)
@@ -381,7 +381,7 @@ PannerUI::build_pan_menu ()
        items.clear ();
 
        items.push_back (CheckMenuElem (_("Bypass"), sigc::mem_fun(*this, &PannerUI::pan_bypass_toggle)));
-       bypass_menu_item = static_cast<CheckMenuItem*> (&items.back());
+       bypass_menu_item = static_cast<Gtk::CheckMenuItem*> (&items.back());
 
        /* set state first, connect second */
 
index 2ecfd4bdd7d47c98b1e3e55367d82932a6ab3c09..081604344cb971430eb4fe4acbde78b200bdd63c 100644 (file)
@@ -117,7 +117,7 @@ PatchChangeDialog::PatchChangeDialog (
        add_button (Stock::CANCEL, RESPONSE_CANCEL);
        add_button (ok, RESPONSE_ACCEPT);
        if (allow_delete) {
-               add_button (Stock::DELETE, RESPONSE_REJECT);
+               add_button (Gtk::StockID(GTK_STOCK_DELETE), RESPONSE_REJECT);
        }
        set_default_response (RESPONSE_ACCEPT);
 
index dea7f52f016286147060684162ffb1785541bbcb..ccec81cba7a70164d93728cd5a36e21c7e97470f 100644 (file)
 #include <fstream>
 #include <cstring>
 
+#ifndef WIN32
 #include <sys/utsname.h>
+#endif
+
 #include <curl/curl.h>
 
 #include <glibmm/miscutils.h>
@@ -70,6 +73,7 @@ struct ping_call {
 static void*
 _pingback (void *arg)
 {
+#ifndef WIN32
        ping_call* cm = static_cast<ping_call*> (arg);
        CURL* c;
        struct utsname utb;
@@ -158,6 +162,8 @@ _pingback (void *arg)
        curl_easy_cleanup (c);
        delete cm;
 
+#endif /* WIN32 */
+
        return 0;
 }
 
index 81adf40896669fb753d96d983de55aca21e66cfd..2a031318ff4426d3ef5a4ddf863b2d992cc868b8 100644 (file)
@@ -21,7 +21,6 @@
 #endif
 
 #include <cstdio>
-#include <lrdf.h>
 #include <map>
 
 #include <algorithm>
index 713b98cdaf7a3f0b20dea8ff851ae5353c3b98c9..28ef9b12972a870e4ddca1a7febbbbfc401076ac 100644 (file)
@@ -57,8 +57,6 @@
 #include "lv2_plugin_ui.h"
 #endif
 
-#include <lrdf.h>
-
 #include "ardour_window.h"
 #include "ardour_ui.h"
 #include "prompter.h"
index 2872ad66051cdecf6facbafee2200dcf01510333..e8108555e6f552d71e9aab673824aae42236291b 100644 (file)
@@ -527,7 +527,7 @@ PortMatrix::popup_menu (BundleChannel column, BundleChannel row, uint32_t t)
        items.push_back (MenuElem (_("Rescan"), sigc::mem_fun (*this, &PortMatrix::setup_all_ports)));
 
        items.push_back (CheckMenuElem (_("Show individual ports"), sigc::mem_fun (*this, &PortMatrix::toggle_show_only_bundles)));
-       CheckMenuItem* i = dynamic_cast<CheckMenuItem*> (&items.back());
+       Gtk::CheckMenuItem* i = dynamic_cast<Gtk::CheckMenuItem*> (&items.back());
        _inhibit_toggle_show_only_bundles = true;
        i->set_active (!_show_only_bundles);
        _inhibit_toggle_show_only_bundles = false;
index d475e2860503bc012f1aff905262fc2dfb607c58..07781fe7eed439f917532fa6b53c1c4cacaeaba4 100644 (file)
@@ -382,7 +382,7 @@ ProcessorEntry::build_controls_menu ()
        
        for (list<Control*>::iterator i = _controls.begin(); i != _controls.end(); ++i) {
                items.push_back (CheckMenuElem ((*i)->name ()));
-               CheckMenuItem* c = dynamic_cast<CheckMenuItem*> (&items.back ());
+               Gtk::CheckMenuItem* c = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
                c->set_active ((*i)->visible ());
                c->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &ProcessorEntry::toggle_control_visibility), *i));
        }
index 16df6be245c1705e0bddd2679e22921d40aa95e6..a5d5fddbd08acb5d2be6a0b4b82e0264e52a9a04 100644 (file)
 #ifndef __gtk_ardour_region_view_h__
 #define __gtk_ardour_region_view_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <vector>
 
 #include <sigc++/signal.h>
index ad2ad2233d77964e849c44251467850efa810cea..29794eb54f3fe52d40d23a5345713cf50dc975ec 100644 (file)
@@ -691,7 +691,7 @@ RouteTimeAxisView::build_display_menu ()
        }
 
        items.push_back (CheckMenuElem (_("Active")));
-       CheckMenuItem* i = dynamic_cast<CheckMenuItem *> (&items.back());
+       Gtk::CheckMenuItem* i = dynamic_cast<Gtk::CheckMenuItem *> (&items.back());
        bool click_sets_active = true;
        if (active > 0 && inactive == 0) {
                i->set_active (true);
@@ -2021,12 +2021,12 @@ RouteTimeAxisView::add_processor_to_subplugin_menu (boost::weak_ptr<Processor> p
        for (std::set<Evoral::Parameter>::const_iterator i = automatable.begin(); i != automatable.end(); ++i) {
 
                ProcessorAutomationNode* pan;
-               CheckMenuItem* mitem;
+               Gtk::CheckMenuItem* mitem;
 
                string name = processor->describe_parameter (*i);
 
                items.push_back (CheckMenuElem (name));
-               mitem = dynamic_cast<CheckMenuItem*> (&items.back());
+               mitem = dynamic_cast<Gtk::CheckMenuItem*> (&items.back());
                
                _subplugin_menu_map[*i] = mitem;
 
index 8cc1512d3b1f0271d9fd735eaa5a43527c52c16a..3b3f32ac04a1b9e61566dbf327ff14e10d6467a0 100644 (file)
@@ -784,7 +784,7 @@ RouteUI::build_record_menu ()
                 MenuList& items = record_menu->items();
 
                 items.push_back (CheckMenuElem (_("Step Entry"), sigc::mem_fun (*this, &RouteUI::toggle_step_edit)));
-                step_edit_item = dynamic_cast<CheckMenuItem*> (&items.back());
+                step_edit_item = dynamic_cast<Gtk::CheckMenuItem*> (&items.back());
 
                 if (_route->record_enabled()) {
                         step_edit_item->set_sensitive (false);
@@ -1206,20 +1206,20 @@ RouteUI::build_solo_menu (void)
        solo_menu = new Menu;
        solo_menu->set_name ("ArdourContextMenu");
        MenuList& items = solo_menu->items();
-       CheckMenuItem* check;
+       Gtk::CheckMenuItem* check;
 
-       check = new CheckMenuItem(_("Solo Isolate"));
+       check = new Gtk::CheckMenuItem(_("Solo Isolate"));
        check->set_active (_route->solo_isolated());
        check->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_solo_isolated), check));
        items.push_back (CheckMenuElem(*check));
-        solo_isolated_check = dynamic_cast<CheckMenuItem*>(&items.back());
+        solo_isolated_check = dynamic_cast<Gtk::CheckMenuItem*>(&items.back());
        check->show_all();
 
-       check = new CheckMenuItem(_("Solo Safe"));
+       check = new Gtk::CheckMenuItem(_("Solo Safe"));
        check->set_active (_route->solo_safe());
        check->signal_toggled().connect (sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_solo_safe), check));
        items.push_back (CheckMenuElem(*check));
-        solo_safe_check = dynamic_cast<CheckMenuItem*>(&items.back());
+        solo_safe_check = dynamic_cast<Gtk::CheckMenuItem*>(&items.back());
        check->show_all();
 
        //items.push_back (SeparatorElem());
@@ -1237,25 +1237,25 @@ RouteUI::build_mute_menu(void)
 
        MenuList& items = mute_menu->items();
 
-       pre_fader_mute_check = manage (new CheckMenuItem(_("Pre Fader")));
+       pre_fader_mute_check = manage (new Gtk::CheckMenuItem(_("Pre Fader")));
        init_mute_menu(MuteMaster::PreFader, pre_fader_mute_check);
        pre_fader_mute_check->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::PreFader, pre_fader_mute_check));
        items.push_back (CheckMenuElem(*pre_fader_mute_check));
        pre_fader_mute_check->show_all();
 
-       post_fader_mute_check = manage (new CheckMenuItem(_("Post Fader")));
+       post_fader_mute_check = manage (new Gtk::CheckMenuItem(_("Post Fader")));
        init_mute_menu(MuteMaster::PostFader, post_fader_mute_check);
        post_fader_mute_check->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::PostFader, post_fader_mute_check));
        items.push_back (CheckMenuElem(*post_fader_mute_check));
        post_fader_mute_check->show_all();
 
-       listen_mute_check = manage (new CheckMenuItem(_("Control Outs")));
+       listen_mute_check = manage (new Gtk::CheckMenuItem(_("Control Outs")));
        init_mute_menu(MuteMaster::Listen, listen_mute_check);
        listen_mute_check->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::Listen, listen_mute_check));
        items.push_back (CheckMenuElem(*listen_mute_check));
        listen_mute_check->show_all();
 
-       main_mute_check = manage (new CheckMenuItem(_("Main Outs")));
+       main_mute_check = manage (new Gtk::CheckMenuItem(_("Main Outs")));
        init_mute_menu(MuteMaster::Main, main_mute_check);
        main_mute_check->signal_toggled().connect(sigc::bind (sigc::mem_fun (*this, &RouteUI::toggle_mute_menu), MuteMaster::Main, main_mute_check));
        items.push_back (CheckMenuElem(*main_mute_check));
@@ -1268,7 +1268,7 @@ RouteUI::build_mute_menu(void)
 }
 
 void
-RouteUI::init_mute_menu(MuteMaster::MutePoint mp, CheckMenuItem* check)
+RouteUI::init_mute_menu(MuteMaster::MutePoint mp, Gtk::CheckMenuItem* check)
 {
        check->set_active (_route->mute_points() & mp);
 }
@@ -1958,7 +1958,7 @@ RouteUI::invert_press (GdkEventButton* ev)
 
        for (uint32_t i = 0; i < N; ++i) {
                items.push_back (CheckMenuElem (string_compose (X_("Ø%1"), i + 1), sigc::bind (sigc::mem_fun (*this, &RouteUI::invert_menu_toggled), i)));
-               CheckMenuItem* e = dynamic_cast<CheckMenuItem*> (&items.back ());
+               Gtk::CheckMenuItem* e = dynamic_cast<Gtk::CheckMenuItem*> (&items.back ());
                ++_i_am_the_modifier;
                e->set_active (_route->phase_invert (i));
                --_i_am_the_modifier;
index 9aa62ed4cae55922a94dfd658dc7878335f00024..1599e50bb3e9c5d804f8fac5eae821bab80d09f1 100644 (file)
 
 #include "ardour_dialog.h"
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 #include <boost/shared_ptr.hpp>
 
@@ -82,7 +86,7 @@ class TextMetadataField : public MetadataField {
        Gtk::Label* value_label;
        Gtk::Entry* entry;
 
-       uint width;
+       guint width;
 };
 
 /// MetadataField that accepts only numbers
index 5f8564374ef20d25ba298289b5a879eb89d167f0..2640af8379e440c0b1691c59ea19a93977bc6665 100644 (file)
@@ -31,6 +31,8 @@
 
 #include <gtkmm/box.h>
 #include <gtkmm/stock.h>
+
+#include <glib/gstdio.h>
 #include <glibmm/fileutils.h>
 
 #include "pbd/convert.h"
@@ -1457,6 +1459,9 @@ SoundFileOmega::check_info (const vector<string>& paths, bool& same_size, bool&
 bool
 SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths)
 {
+#ifdef WIN32
+       return false;
+#else
        std::string tmpdir(Glib::build_filename (s->session_directory().sound_path(), "linktest"));
        bool ret = false;
 
@@ -1478,7 +1483,7 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths
                        goto out;
                }
 
-               unlink (tmpc);
+               ::g_unlink (tmpc);
        }
 
        ret = true;
@@ -1486,6 +1491,7 @@ SoundFileOmega::check_link_status (const Session* s, const vector<string>& paths
   out:
        rmdir (tmpdir.c_str());
        return ret;
+#endif
 }
 
 SoundFileChooser::SoundFileChooser (string title, ARDOUR::Session* s)
index ea753104dbaf9d887aaac1634503d31cf53e7d13..08060b6a5174e0b7e1e7aab3bc763b84d38ab770 100644 (file)
@@ -51,7 +51,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
 #endif
 
        std::string ff_file_path;
-       if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
+       if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("ffmpeg_harvid"), ff_file_path)) { ffmpeg_exe = ff_file_path; }
        else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffmpeg.exe"), Glib::FILE_TEST_EXISTS)) {
                ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
        }
@@ -59,7 +59,7 @@ TranscodeFfmpeg::TranscodeFfmpeg (std::string f)
                ffmpeg_exe = X_("C:\\Program Files\\ffmpeg\\ffmpeg.exe");
        }
 
-       if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
+       if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("ffprobe_harvid"), ff_file_path)) { ffprobe_exe = ff_file_path; }
        else if (Glib::file_test(X_("C:\\Program Files\\harvid\\ffprobe.exe"), Glib::FILE_TEST_EXISTS)) {
                ffprobe_exe = X_("C:\\Program Files\\ffmpeg\\ffprobe.exe");
        }
@@ -124,7 +124,7 @@ TranscodeFfmpeg::probe ()
         * SystemExec::Terminated is emitted and ffcmd set to NULL */
        int timeout = 300; // 1.5 sec
        while (ffcmd && --timeout > 0) {
-               usleep(5000);
+               Glib::usleep(5000);
        }
        if (timeout == 0 || ffoutput.empty()) {
                return false;
@@ -505,7 +505,11 @@ TranscodeFfmpeg::cancel ()
 {
        if (!ffcmd || !ffcmd->is_running()) { return;}
        ffcmd->write_to_stdin("q");
+#ifdef WIN32
+       Sleep(1000);
+#else
        sleep (1);
+#endif
        if (ffcmd) {
          ffcmd->terminate();
        }
index d4ad8a24ed9a2bd3acf73642aea892bf8b6ec8c6..9f18e85b64880e1002d43ae5cb7edf8cb6479a50 100644 (file)
@@ -30,6 +30,8 @@
 #include <sigc++/bind.h>
 #include <libgen.h>
 
+#include <glib/gstdio.h>
+
 #include "pbd/error.h"
 #include "pbd/convert.h"
 #include "gtkmm2ext/utils.h"
@@ -302,9 +304,9 @@ void
 TranscodeVideoDialog::finished ()
 {
        if (aborted) {
-               unlink(path_entry.get_text().c_str());
+               ::g_unlink(path_entry.get_text().c_str());
                if (!audiofile.empty()) {
-                       unlink(audiofile.c_str());
+                       ::g_unlink(audiofile.c_str());
                }
                Gtk::Dialog::response(RESPONSE_CANCEL);
        } else {
index 7cb1953390ba232933727a719809d05ce124dfb7..215df25e7f2ea179c79d1a834d091c4b6a1837c4 100644 (file)
@@ -287,7 +287,7 @@ UIConfiguration::color_by_name (const std::string& name)
        }
 
        // cerr << string_compose (_("Color %1 not found"), name) << endl;
-       return RGBA_TO_UINT (random()%256,random()%256,random()%256,0xff);
+       return RGBA_TO_UINT (g_random_int()%256,g_random_int()%256,g_random_int()%256,0xff);
 }
 
 void
index 913d962831b919764c6959d2b5139616f97e2481..eb370be0dcc48087c2bc7267966cd8bf1a5135d7 100644 (file)
@@ -567,7 +567,7 @@ get_xpm (std::string name)
 {
        if (!xpm_map[name]) {
 
-               SearchPath spath(ARDOUR::ardour_data_search_path());
+               Searchpath spath(ARDOUR::ardour_data_search_path());
 
                spath.add_subdirectory_to_paths("pixmaps");
 
@@ -593,7 +593,7 @@ get_icon_path (const char* cname)
        string name = cname;
        name += X_(".png");
 
-       SearchPath spath(ARDOUR::ardour_data_search_path());
+       Searchpath spath(ARDOUR::ardour_data_search_path());
 
        spath.add_subdirectory_to_paths("icons");
 
@@ -740,7 +740,9 @@ set_pango_fontsize ()
 
        /* FT2 rendering - used by GnomeCanvas, sigh */
 
+#ifndef WIN32
        pango_ft2_font_map_set_resolution ((PangoFT2FontMap*) pango_ft2_font_map_new(), val/1024, val/1024);
+#endif
 
        /* Cairo rendering, in case there is any */
 
index e5cd197782e38bb5c1d92514de57a53923e96dd7..ebcb9e6f96c8b9aabc52806b18b20075b404cdfe 100644 (file)
@@ -211,7 +211,7 @@ http_get_thread (void *arg) {
        char *res = NULL;
        do {
                res=a3_curl_http_get(url, &status);
-               if (status == 503) usleep(5000); // try-again
+               if (status == 503) Glib::usleep(5000); // try-again
        } while (status == 503 && --timeout > 0);
 
        if (status != 200 || !res) {
@@ -250,8 +250,8 @@ VideoImageFrame::http_download_done (char *data){
        }
 
        exposeimg();
-       /* don't request frames rapidly, wait after user has zoomed */
-       usleep(20000);
+       /* don't request frames too quickly, wait after user has zoomed */
+       Glib::usleep(40000);
 
        if (queued_request) {
                http_get_again(want_video_frame_number);
index 3f69eea6e628dbd62e84f5d7fa9c044ad5d68f51..a94e89b50db0fe6bd44a352a2db16cead05ca692 100644 (file)
@@ -94,7 +94,7 @@ VideoMonitor::query_full_state (bool wait)
        process->write_to_stdin("get osdcfg\n");
        int timeout = 40;
        if (wait && knownstate !=127 && --timeout) {
-               usleep(50000);
+               Glib::usleep(50000);
                sched_yield();
        }
 }
@@ -113,7 +113,7 @@ VideoMonitor::quit ()
         */
        int timeout = 40;
        while (is_started() && --timeout) {
-               usleep(50000);
+               Glib::usleep(50000);
                sched_yield();
        }
        if (timeout <= 0) {
index 811c00f64f19405df90e6ae54ef51fc136bc1319..eefd87a0679bfd730fc502e7060f41efcad22051 100644 (file)
 #include "ardour/template_utils.h"
 #include "ardour/session.h"
 
+#ifdef interface
+#undef interface
+#endif
+
 #include "video_server_dialog.h"
 #include "utils_videotl.h"
 #include "i18n.h"
@@ -80,7 +84,7 @@ VideoServerDialog::VideoServerDialog (Session* s)
        listenaddr_combo.set_active(0);
 
        std::string icsd_file_path;
-       if (find_file_in_search_path (PBD::SearchPath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
+       if (find_file_in_search_path (PBD::Searchpath(Glib::getenv("PATH")), X_("harvid"), icsd_file_path)) {
                path_entry.set_text(icsd_file_path);
        }
        else if (Glib::file_test(X_("C:\\Program Files\\harvid\\harvid.exe"), Glib::FILE_TEST_EXISTS)) {
index a1a85a02439e785dcec93f71370b70904fa2cba2..10a444dadb3d51f44bdc9cb56bfa148d06c73afe 100644 (file)
@@ -717,7 +717,7 @@ VideoTimeLine::find_xjadeo () {
        std::string xjadeo_file_path;
        if (getenv("XJREMOTE")) {
                _xjadeo_bin = strdup(getenv("XJREMOTE")); // XXX TODO: free it?!
-       } else if (find_file_in_search_path (SearchPath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
+       } else if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
                _xjadeo_bin = xjadeo_file_path;
        }
        else if (Glib::file_test(X_("/Applications/Jadeo.app/Contents/MacOS/xjremote"), Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_EXECUTABLE)) {
index 4e5c41b8261a7ba8f51cde448e6c1a83f2b6a5a0..e6ce7bb3b6d0a6cbebfbda76a4edf14e223dfdd4 100644 (file)
@@ -258,8 +258,9 @@ def configure(conf):
         'gtk2_ardour', conf.env['MAJOR'], conf.env['MINOR'], 0)
     autowaf.configure(conf)
 
-    if re.search ("linux", sys.platform) != None:
-        autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
+    if Options.options.dist_target == 'auto':
+        if re.search ("linux", sys.platform) != None:
+            autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
 
     # TODO: Insert a sanity check for on OS X to ensure CoreAudio is present
 
@@ -408,6 +409,9 @@ def build(bld):
                          'libtaglib',
                          'libcanvas'
                          ]
+    if bld.env['build_target'] == 'mingw':
+       if bld.env['DEBUG'] == False:
+            obj.linkflags = ['-mwindows']
     if sys.platform == 'darwin':
         obj.uselib += ' AUDIOUNITS OSX GTKOSX'
         obj.use    += ' libappleutility'
index 76bdac04095ab5272882eb1377bdb7597e7e400b..896301b398d05dbb3a8d824308cbf11aebf50f94 100644 (file)
@@ -52,10 +52,16 @@ namespace ARDOUR {
         /* called from non-RT context */
     
        void parse (framecnt_t timestamp);
-        int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp);
+       int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp);
         int read (MIDI::byte *buf, size_t bufsize);
        void drain (int check_interval_usecs);
-       int selectable () const { return xthread.selectable(); }
+       int selectable () const {
+#ifdef PLATFORM_WINDOWS
+               return false;
+#else
+               return xthread.selectable();
+#endif
+       }
 
        static void set_process_thread (pthread_t);
        static pthread_t get_process_thread () { return _process_thread; }
@@ -66,8 +72,22 @@ namespace ARDOUR {
         MIDI::timestamp_t       _last_write_timestamp;
        RingBuffer< Evoral::Event<double> > output_fifo;
         Evoral::EventRingBuffer<MIDI::timestamp_t> input_fifo;
-        Glib::Threads::Mutex    output_fifo_lock;
-       CrossThreadChannel      xthread;
+        Glib::Threads::Mutex output_fifo_lock;
+#ifndef PLATFORM_WINDOWS
+       CrossThreadChannel xthread;
+#endif
+
+       int create_port ();
+
+       /** Channel used to signal to the MidiControlUI that input has arrived */
+       
+       std::string _connections;
+       PBD::ScopedConnection connect_connection;
+       PBD::ScopedConnection halt_connection;
+       void flush (void* jack_port_buffer);
+       void jack_halted ();
+       void make_connections ();
+       void init (std::string const &, Flags);
 
         void flush_output_fifo (pframes_t);
 
index 0519e2233c70f5f1dba69b4387d61a2308907410..9a46e235d8574944e64c1d2bb39cb44bb4a9f6ae 100644 (file)
@@ -24,8 +24,8 @@
 #include <string>
 
 #include "taglib/tag.h"
-#include "taglib/taglib.h"
-#include "taglib/xiphcomment.h"
+#include "taglib/toolkit/taglib.h"
+#include "taglib/ogg/xiphcomment.h"
 
 namespace ARDOUR
 {
index c5fd7b3af2ab3a25ad6087a81592ec3a147d05fc..af5dabe38880fc3cf0abf871124fb74596a5b0c5 100644 (file)
@@ -64,6 +64,7 @@ public:
        virtual void      clear_capture_marks() {}
        virtual bool      one_of_several_channels () const { return false; }
 
+       virtual void flush () = 0;
        virtual int update_header (framepos_t when, struct tm&, time_t) = 0;
        virtual int flush_header () = 0;
 
index 478d4872cdfe02afdd56503e3babc7a83b6a1871..3c987c0aa0d2efdb53bef32097e41321d4dc6cd0 100644 (file)
@@ -29,7 +29,6 @@
 namespace ARDOUR  {
 
 class Session;
-class Region;
 class AudioRegion;
 class Source;
 
index 2adc22bd6f86ab95a1db70b8036f78b8f4f92679..e8a5082c718f960c344f2f56563f452a6856caf2 100644 (file)
@@ -32,7 +32,7 @@ namespace ARDOUR {
         * contain the user and system directories which may contain audio/MIDI
         * backends.
         */
-       PBD::SearchPath backend_search_path ();
+       PBD::Searchpath backend_search_path ();
 
 } // namespace ARDOUR
 
index cdd48c3e3a2c655a89718b5320e65ff675eeb8ab..226aacbbaddae54b9a24d34b186f751b3d8e1602 100644 (file)
 #ifndef __ardour_butler_h__
 #define __ardour_butler_h__
 
+#include <pthread.h>
+
 #include <glibmm/threads.h>
 
+#ifdef PLATFORM_WINDOWS
+#include "pbd/glib_semaphore.h"
+#endif
+
 #include "pbd/ringbuffer.h"
 #include "pbd/pool.h"
 #include "ardour/types.h"
 #include "ardour/session_handle.h"
 
+
+
 namespace ARDOUR {
 
 /**
@@ -71,15 +79,43 @@ class Butler : public SessionHandleRef
         Glib::Threads::Cond   paused;
        bool         should_run;
        mutable gint should_do_transport_work;
-       int          request_pipe[2];
        framecnt_t   audio_dstream_capture_buffer_size;
        framecnt_t   audio_dstream_playback_buffer_size;
        uint32_t     midi_dstream_buffer_size;
        RingBuffer<CrossThreadPool*> pool_trash;
 
+#ifdef PLATFORM_WINDOWS
+       PBD::atomic_counter m_request_state;
+       PBD::GlibSemaphore   m_request_sem;
+#else
+       int          request_pipe[2];
+#endif
+
 private:
        void empty_pool_trash ();
        void config_changed (std::string);
+
+#ifndef PLATFORM_WINDOWS
+       int setup_request_pipe ();
+#endif
+
+       /**
+        * return true if there are requests to be processed
+        */
+       bool wait_for_requests ();
+
+       /**
+        * Remove request from butler request queue
+        *
+        * return true if there was another request and req is valid
+        */
+       bool dequeue_request (Request::Type& req);
+
+       /**
+        * Add request to butler thread request queue
+        */
+       void queue_request (Request::Type r);
+
 };
 
 } // namespace ARDOUR
index c4f3caef6b3fbeb256ebc79dd3211bbda28b4617..03e2fcd8fff58b27685f81710dd188381be959a4 100644 (file)
 #include "pbd/xml++.h"
 #include "ardour/data_type.h"
 
+#ifdef INFINITE
+#undef INFINITE
+#endif
+
 namespace ARDOUR {
 
 
index 8795f4501a64a9dd376db48924f751411389395d..4fe790ef80b6d2ade09605193c234ab50e1d3963 100644 (file)
 namespace ARDOUR {
 
        /**
-        * return a SearchPath containing directories in which to look for
+        * return a Searchpath containing directories in which to look for
         * control surface plugins.
         *
-        * If ARDOUR_SURFACES_PATH is defined then the SearchPath returned
+        * If ARDOUR_SURFACES_PATH is defined then the Searchpath returned
         * will contain only those directories specified in it, otherwise it will
         * contain the user and system directories which may contain control
         * surface plugins.
         */
-       PBD::SearchPath control_protocol_search_path ();
+       PBD::Searchpath control_protocol_search_path ();
 
 } // namespace ARDOUR
 
index 820fa0b9d84c61e63ffd6ff9d69395552112f6cf..30c66069f69949272cd6990fd37a553918a1b3b1 100644 (file)
@@ -43,6 +43,8 @@ class CoreAudioSource : public AudioFileSource {
        void set_header_timeline_position () {};
        bool clamped_at_unity () const { return false; }
 
+       void flush () {}
+
        static int get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg);
 
   protected:
index 01e1d55221f13891a53c96a74e9d0aa372309af3..dc1095db7b60939122a07b74f9e5629b92781f98 100644 (file)
@@ -216,7 +216,10 @@ static inline cycles_t get_cycles (void)
 
 /* debian: sparc, arm, m68k */
 
+#ifndef COMPILER_MSVC
+/* GRRR... Annoyingly, #warning aborts the compilation for MSVC !!  */
 #warning You are compiling libardour on a platform for which ardour/cycles.h needs work
+#endif
 
 #include <sys/time.h>
 
index 5811f7a484355a76b1ef3833df1c05a4dde0a5cb..47eee69df56fea6c3163765f70985f2bb1a19cd3 100644 (file)
@@ -34,6 +34,7 @@ namespace PBD {
                extern uint64_t SnapBBT;
                extern uint64_t Configuration;
                extern uint64_t Latency;
+               extern uint64_t Peaks;
                extern uint64_t Processors;
                extern uint64_t ProcessThreads;
                extern uint64_t Graph;
index 935cdd977bc44bdf642dbc4437195ed907adc87b..72a456efe670c8ab6ec653aeea1b5e90f0ff2029 100644 (file)
@@ -36,6 +36,7 @@ extern const char* const export_formats_dir_name;
 extern const char* const templates_dir_name;
 extern const char* const route_templates_dir_name;
 extern const char* const surfaces_dir_name;
+extern const char* const ladspa_dir_name;
 extern const char* const user_config_dir_name;
 extern const char* const panner_dir_name;
 extern const char* const backend_dir_name;
index 7b6fcea09b760107ee50a3c00e3f3c4ecaf0e325..771c6f9bd3246f6a1b33a9b8e9bb64e8ede541d5 100644 (file)
 namespace ARDOUR {
 
        /**
-        * return a SearchPath containing directories in which to look for
+        * return a Searchpath containing directories in which to look for
         * export_formats.
         */
-       PBD::SearchPath export_formats_search_path ();
+       PBD::Searchpath export_formats_search_path ();
 
 } // namespace ARDOUR
 
index 424e0fe163c7b0f552b5bd3aee520f5ecbfa6f12..77ace497c2d1f1375f2dae69160c888b5af0e33b 100644 (file)
@@ -102,7 +102,7 @@ class ExportProfileManager
        std::vector<std::string> find_file (std::string const & pattern);
 
        std::string  export_config_dir;
-       PBD::SearchPath search_path;
+       PBD::Searchpath search_path;
 
 /* Timespans */
   public:
index 5898d04f0abaff68ab1d4dbf23c1032b8e267913..52dca18feb4505741fcfe6f77038fb6d6691fb96 100644 (file)
@@ -79,7 +79,7 @@ public:
 
        virtual void set_path (const std::string&);
        
-       static PBD::Signal3<int,std::string,std::string,std::vector<std::string> > AmbiguousFileName;
+       static PBD::Signal2<int,std::string,std::vector<std::string> > AmbiguousFileName;
 
 protected:
        FileSource (Session& session, DataType type,
index cfeb633597cb2fac5c34c22d704e9d791cb3728c..e77de1c00fd683d96829337e8e443dd5ac1a0c5a 100644 (file)
@@ -41,14 +41,14 @@ namespace ARDOUR {
         * @return the search path to be used when looking for per-system
         * configuration files. This may include user configuration files.
         */
-       PBD::SearchPath ardour_config_search_path ();
+       PBD::Searchpath ardour_config_search_path ();
 
        /**
         * @return the search path to be used when looking for data files
         * that could be shared by systems (h/w and configuration independent
         * files, such as icons, XML files, etc)
         */
-       PBD::SearchPath ardour_data_search_path ();
+       PBD::Searchpath ardour_data_search_path ();
 
 } // namespace ARDOUR
 
index 01cacf437ca3694c50c8364db8d175b20d4ca957..a06fc649cadb905c8de466e19c06155dddf0ec1a 100644 (file)
@@ -29,7 +29,7 @@ namespace ARDOUR {
 
        class InterThreadInfo {
        public:
-               InterThreadInfo () : done (false), cancel (false), progress (0), thread (0) {}
+               InterThreadInfo () : done (false), cancel (false), progress (0), thread () {}
 
                volatile bool  done;
                volatile bool  cancel;
diff --git a/libs/ardour/ardour/jack_utils.h b/libs/ardour/ardour/jack_utils.h
new file mode 100644 (file)
index 0000000..40eb30f
--- /dev/null
@@ -0,0 +1,253 @@
+/*
+    Copyright (C) 2011 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdint.h>
+
+#include <vector>
+#include <map>
+#include <string>
+
+namespace ARDOUR {
+
+       // Names for the drivers on all possible systems
+       extern const char * const portaudio_driver_name;
+       extern const char * const coreaudio_driver_name;
+       extern const char * const alsa_driver_name;
+       extern const char * const oss_driver_name;
+       extern const char * const freebob_driver_name;
+       extern const char * const ffado_driver_name;
+       extern const char * const netjack_driver_name;
+       extern const char * const dummy_driver_name;
+
+       /**
+        * Get a list of possible JACK audio driver names based on platform
+        */
+       void get_jack_audio_driver_names (std::vector<std::string>& driver_names);
+
+       /**
+        * Get the default JACK audio driver based on platform
+        */
+       void get_jack_default_audio_driver_name (std::string& driver_name);
+
+       /**
+        * Get a list of possible JACK midi driver names based on platform
+        */
+       void get_jack_midi_system_names (const std::string& driver, std::vector<std::string>& driver_names);
+
+       /**
+        * Get the default JACK midi driver based on platform
+        */
+       void get_jack_default_midi_system_name (const std::string& driver_name, std::string& midi_system);
+
+       /**
+        * Get a list of possible samplerates supported be JACK
+        */
+       void get_jack_sample_rate_strings (std::vector<std::string>& sample_rates);
+
+       /**
+        * @return The default samplerate
+        */
+       std::string get_jack_default_sample_rate ();
+
+       /**
+        * @return true if sample rate string was able to be converted
+        */
+       bool get_jack_sample_rate_value_from_string (const std::string& srs, uint32_t& srv);
+
+       /**
+        * Get a list of possible period sizes supported be JACK
+        */
+       void get_jack_period_size_strings (std::vector<std::string>& samplerates);
+
+       /**
+        * @return The default period size
+        */
+       std::string get_jack_default_period_size ();
+
+       /**
+        * @return true if period size string was able to be converted
+        */
+       bool get_jack_period_size_value_from_string (const std::string& pss, uint32_t& psv);
+
+       /**
+        * These are driver specific I think, so it may require a driver arg
+        * in future
+        */
+       void get_jack_dither_mode_strings (const std::string& driver, std::vector<std::string>& dither_modes);
+
+       /**
+        * @return The default dither mode
+        */
+       std::string get_jack_default_dither_mode (const std::string& driver);
+
+       /**
+        * @return Estimate of latency
+        *
+        * API matches current use in GUI
+        */
+       std::string get_jack_latency_string (std::string samplerate, float periods, std::string period_size);
+
+       /**
+        * @return true if a JACK server is running
+        */
+       bool jack_server_running ();
+
+       /**
+        * Key being a readable name to display in a GUI
+        * Value being name used in a jack commandline
+        */
+       typedef std::map<std::string, std::string> device_map_t;
+
+       /**
+        * Use library specific code to find out what what devices exist for a given
+        * driver that might work in JACK. There is no easy way to find out what
+        * modules the JACK server supports so guess based on platform. For instance
+        * portaudio is cross-platform but we only return devices if built for
+        * windows etc
+        */
+       void get_jack_alsa_device_names (device_map_t& devices);
+       void get_jack_portaudio_device_names (device_map_t& devices);
+       void get_jack_coreaudio_device_names (device_map_t& devices);
+       void get_jack_oss_device_names (device_map_t& devices);
+       void get_jack_freebob_device_names (device_map_t& devices);
+       void get_jack_ffado_device_names (device_map_t& devices);
+       void get_jack_netjack_device_names (device_map_t& devices);
+       void get_jack_dummy_device_names (device_map_t& devices);
+
+       /*
+        * @return true if there were devices found for the driver
+        *
+        * @param driver The driver name returned by get_jack_audio_driver_names
+        * @param devices The map used to insert the drivers into, devices will be cleared before
+        * adding the available drivers
+        */
+       bool get_jack_device_names_for_audio_driver (const std::string& driver, device_map_t& devices);
+
+       /*
+        * @return a list of readable device names for a specific driver.
+        */
+       std::vector<std::string> get_jack_device_names_for_audio_driver (const std::string& driver);
+
+       /**
+        * @return true if the driver supports playback and recording
+        * on separate devices
+        */
+       bool get_jack_audio_driver_supports_two_devices (const std::string& driver);
+
+       bool get_jack_audio_driver_supports_latency_adjustment (const std::string& driver);
+
+       bool get_jack_audio_driver_supports_setting_period_count (const std::string& driver);
+
+       /**
+        * The possible names to use to try and find servers, this includes
+        * any file extensions like .exe on Windows
+        *
+        * @return true if the JACK application names for this platform could be guessed
+        */
+       bool get_jack_server_application_names (std::vector<std::string>& server_names);
+
+       /**
+        * Sets the PATH environment variable to contain directories likely to contain
+        * JACK servers so that if the JACK server is auto-started it can find the server
+        * executable.
+        *
+        * This is only modifies PATH on the mac at the moment.
+        */
+       void set_path_env_for_jack_autostart (const std::vector<std::string>&);
+
+       /**
+        * Get absolute paths to directories that might contain JACK servers on the system
+        *
+        * @return true if !server_paths.empty()
+        */
+       bool get_jack_server_dir_paths (std::vector<std::string>& server_dir_paths);
+
+       /**
+        * Get absolute paths to JACK servers on the system
+        *
+        * @return true if a server was found
+        */
+       bool get_jack_server_paths (const std::vector<std::string>& server_dir_paths,
+                       const std::vector<std::string>& server_names,
+                       std::vector<std::string>& server_paths);
+
+
+       bool get_jack_server_paths (std::vector<std::string>& server_paths);
+
+       /**
+        * Get absolute path to default JACK server
+        */
+       bool get_jack_default_server_path (std::string& server_path);
+
+       /**
+        * @return The name of the jack server config file
+        */
+       std::string get_jack_server_config_file_name ();
+
+       std::string get_jack_server_user_config_dir_path ();
+
+       std::string get_jack_server_user_config_file_path ();
+
+       bool write_jack_config_file (const std::string& config_file_path, const std::string& command_line);
+
+       struct JackCommandLineOptions {
+
+               // see implementation for defaults
+               JackCommandLineOptions ();
+
+               //operator bool
+               //operator ostream
+
+               std::string      server_path;
+               uint32_t         timeout;
+               bool             no_mlock;
+               uint32_t         ports_max;
+               bool             realtime;
+               uint32_t         priority;
+               bool             unlock_gui_libs;
+               bool             verbose;
+               bool             temporary;
+               bool             playback_only;
+               bool             capture_only;
+               std::string      driver;
+               std::string      input_device;
+               std::string      output_device;
+               uint32_t         num_periods;
+               uint32_t         period_size;
+               uint32_t         samplerate;
+               uint32_t         input_latency;
+               uint32_t         output_latency;
+               bool             hardware_metering;
+               bool             hardware_monitoring;
+               std::string      dither_mode;
+               bool             force16_bit;
+               bool             soft_mode;
+               std::string      midi_driver;
+       };
+
+       /**
+        * @return true if able to build a valid command line based on options
+        */
+       bool get_jack_command_line_string (const JackCommandLineOptions& options, std::string& command_line);
+
+       /**
+        * We don't need this at the moment because the gui stores all its settings
+        */
+       //std::string get_jack_command_line_from_config_file (const std::string& config_file_path);
+}
index 6853a1dc367f38c31c6749f1c1035cd96064bf8e..62cad017fc466a841360af3966f24099cb023be5 100644 (file)
@@ -23,8 +23,8 @@
 #include <set>
 #include <vector>
 #include <string>
-#include <dlfcn.h>
 
+#include <glibmm/module.h>
 
 #include "pbd/stateful.h"
 
@@ -39,7 +39,7 @@ class Session;
 class LadspaPlugin : public ARDOUR::Plugin
 {
   public:
-       LadspaPlugin (void *module, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, framecnt_t sample_rate);
+       LadspaPlugin (std::string module_path, ARDOUR::AudioEngine&, ARDOUR::Session&, uint32_t index, framecnt_t sample_rate);
        LadspaPlugin (const LadspaPlugin &);
        ~LadspaPlugin ();
 
@@ -122,7 +122,8 @@ class LadspaPlugin : public ARDOUR::Plugin
        void connect_port (uint32_t port, float *ptr) { _descriptor->connect_port (_handle, port, ptr); }
 
   private:
-       void*                    _module;
+       std::string              _module_path;
+       Glib::Module*            _module;
        const LADSPA_Descriptor* _descriptor;
        LADSPA_Handle            _handle;
        framecnt_t               _sample_rate;
@@ -134,7 +135,7 @@ class LadspaPlugin : public ARDOUR::Plugin
 
        void find_presets ();
 
-       void init (void *mod, uint32_t index, framecnt_t rate);
+       void init (std::string module_path, uint32_t index, framecnt_t rate);
        void run_in_place (pframes_t nsamples);
        void latency_compute_run ();
        int set_state_2X (const XMLNode&, int version);
diff --git a/libs/ardour/ardour/ladspa_search_path.h b/libs/ardour/ardour/ladspa_search_path.h
new file mode 100644 (file)
index 0000000..bc184b5
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+    Copyright (C) 2011 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef ARDOUR_LADSPA_SEARCH_PATH_INCLUDED
+#define ARDOUR_LADSPA_SEARCH_PATH_INCLUDED
+
+#include "pbd/search_path.h"
+
+namespace ARDOUR {
+
+       /**
+        * return a Searchpath containing directories in which to look for
+        * LADSPA plugins.
+        *
+        * If LADSPA_PATH is defined then the Searchpath returned
+        * will contain the directories specified in it as well as the
+        * user and system directories.
+        */
+       PBD::Searchpath ladspa_search_path ();
+
+} // namespace ARDOUR
+
+#endif
index f5780c5e0e6addee266f72f67e5659b36da60f7d..9314ee27d479f79b5c9b1dfb3ab827f56883a2d7 100644 (file)
 namespace ARDOUR {
 
        /**
-        * return a SearchPath containing directories in which to look for
+        * return a Searchpath containing directories in which to look for
         * lv2 plugins.
         */
-       PBD::SearchPath lv2_bundled_search_path ();
+       PBD::Searchpath lv2_bundled_search_path ();
 
 } // namespace ARDOUR
 
index 56aa9dc7cfb6d16e1d1e6d600376d8b1b127d3c4..6b4b1a1c67461e073cd2c8f169a0349e20a1b67e 100644 (file)
@@ -29,6 +29,8 @@
 #include "ardour/worker.h"
 #include "pbd/ringbuffer.h"
 
+typedef struct LV2_Evbuf_Impl LV2_Evbuf;
+
 namespace ARDOUR {
 
 // a callback function for lilv_state_new_from_instance(). friend of LV2Plugin
index 5d278234616d89b95fdf79654bd14f0592aa1247..168e75af4a8264c0337205857f6db0f5a7394be8 100644 (file)
 namespace ARDOUR {
 
        /**
-        * return a SearchPath containing directories in which to look for
+        * return a Searchpath containing directories in which to look for
         * MIDI patch files ("*.midnam") aka MIDNAM files
         *
-        * If ARDOUR_MIDI_PATCH_PATH is defined then the SearchPath returned
+        * If ARDOUR_MIDI_PATCH_PATH is defined then the Searchpath returned
         * will contain only those directories specified in it, otherwise it will
         * contain the user and system directories which may contain control
         * surface plugins.
         */
-       PBD::SearchPath midi_patch_search_path ();
+       PBD::Searchpath midi_patch_search_path ();
 
 } // namespace ARDOUR
 
index 543e1b353f4b44e2bde000f457f83da22c3402cc..99d0b983216ed0c0597bce3e2f1e2702e0c468d7 100644 (file)
@@ -32,7 +32,6 @@ namespace ARDOUR
 {
 
 class Session;
-class Region;
 class MidiRegion;
 class Source;
 template<typename T> class MidiRingBuffer;
index 3b75c0a51b9c18d232aa15fc5305a2b0c548ee81..9c1d21a3e4e9106ea02274728a30ce58ddac9789 100644 (file)
@@ -20,6 +20,8 @@
 #ifndef __ardour_midi_track_h__
 #define __ardour_midi_track_h__
 
+#include "pbd/ffs.h"
+
 #include "ardour/track.h"
 #include "ardour/midi_ring_buffer.h"
 
@@ -183,7 +185,7 @@ private:
 /* if mode is ForceChannel, force mask to the lowest set channel or 1 if no
  * channels are set.
  */
-#define force_mask(mode,mask) (((mode) == ForceChannel) ? (((mask) ? (1<<(ffs((mask))-1)) : 1)) : mask)
+#define force_mask(mode,mask) (((mode) == ForceChannel) ? (((mask) ? (1<<(PBD::ffs((mask))-1)) : 1)) : mask)
 
        void _set_playback_channel_mode(ChannelMode mode, uint16_t mask) {
                mask = force_mask (mode, mask);
diff --git a/libs/ardour/ardour/msvc_libardour.h b/libs/ardour/ardour/msvc_libardour.h
new file mode 100644 (file)
index 0000000..75c9329
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#ifndef __msvc_libardour_h__
+#define __msvc_libardour_h__
+
+#include <limits.h>
+
+#ifdef  LIBARDOUR_IS_IN_WIN_STATIC_LIB  // #define if your project uses libardour (under Windows) as a static library
+#define LIBARDOUR_IS_IN_WINDLL 0
+#endif
+
+#if !defined(LIBARDOUR_IS_IN_WINDLL)
+       #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+       // If you need '__declspec' compatibility, add extra compilers to the above as necessary
+               #define LIBARDOUR_IS_IN_WINDLL 1
+       #else
+               #define LIBARDOUR_IS_IN_WINDLL 0
+       #endif
+#endif
+
+#if LIBARDOUR_IS_IN_WINDLL && !defined(LIBARDOUR_API)
+       #if defined(BUILDING_LIBARDOUR)
+               #define LIBARDOUR_API __declspec(dllexport)
+               #define LIBARDOUR_APICALLTYPE __stdcall
+       #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+               #define LIBARDOUR_API __declspec(dllimport)
+               #define LIBARDOUR_APICALLTYPE __stdcall
+       #else
+               #error "Attempting to define __declspec with an incompatible compiler !"
+       #endif
+#elif !defined(LIBARDOUR_API)
+       // Other compilers / platforms could be accommodated here
+       #define LIBARDOUR_API
+       #define LIBARDOUR_APICALLTYPE
+#endif
+
+#ifndef _MAX_PATH
+#define _MAX_PATH  260
+#endif
+#ifndef  PATH_MAX
+#define  PATH_MAX _MAX_PATH
+#endif
+
+namespace ARDOUR {
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// LIBARDOUR_API char*  LIBARDOUR_APICALLTYPE placeholder_for_non_msvc_specific_function(s);
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+}  // namespace ARDOUR
+
+#ifdef COMPILER_MSVC
+#include <rpc.h>
+//#include <io.h>
+
+#ifndef __THROW
+#define __THROW throw()
+#endif
+#include <ardourext/sys/time.h>
+
+namespace ARDOUR {
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+LIBARDOUR_API int    LIBARDOUR_APICALLTYPE symlink(const char *dest, const char *shortcut, const char *working_directory = 0);
+LIBARDOUR_API int    LIBARDOUR_APICALLTYPE readlink(const char *__restrict shortcut, char *__restrict buf, size_t bufsize);
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+}  // namespace ARDOUR
+
+#endif  //     COMPILER_MSVC
+#endif  // __mavc_libardour_h__
index b30b1859a3ec2e7dca916d386657c4f9951895bc..024dcd150c802e2ab74630ff4e8edb046fadf4f4 100644 (file)
 #include "ardour/types.h"
 #include "ardour/automation_control.h"
 #include "ardour/automatable.h"
+#include "ardour/visibility.h"
+
+#ifdef ARDOURPANNER_DLL_EXPORTS // defined if we are building the ARDOUR Panners DLLs (instead of using them)
+    #define ARDOURPANNER_API LIBARDOUR_HELPER_DLL_EXPORT
+#else
+    #define ARDOURPANNER_API LIBARDOUR_HELPER_DLL_IMPORT
+#endif 
+#define ARDOURPANNER_LOCAL LIBARDOUR_HELPER_DLL_LOCAL
 
 namespace ARDOUR {
 
index 016ba56ce3c4efbcc3d76c4d6e88f687beab4442..c34d22285d2a5210d77f21459d855865b2da0cc3 100644 (file)
@@ -20,7 +20,8 @@
 #ifndef __ardour_panner_manager_h__
 #define __ardour_panner_manager_h__
 
-#include <dlfcn.h>
+#include <glibmm/module.h>
+
 #include "ardour/panner.h"
 #include "ardour/session_handle.h"
 
@@ -28,15 +29,15 @@ namespace ARDOUR {
 
 struct PannerInfo {
        PanPluginDescriptor descriptor;
-       void* module;
+       Glib::Module* module;
 
-       PannerInfo (PanPluginDescriptor& d, void* handle)
+       PannerInfo (PanPluginDescriptor& d, Glib::Module* m)
        : descriptor (d)
-       , module (handle)
+       , module (m)
        {}
 
        ~PannerInfo () {
-               dlclose (module);
+               delete module;
        }
 };
 
index 889b9efb236e50557574cb78aaa1f1c57f22e69e..23004223b4b193cebebfd96df754ca699930bc73 100644 (file)
 namespace ARDOUR {
 
        /**
-        * return a SearchPath containing directories in which to look for
+        * return a Searchpath containing directories in which to look for
         * panner plugins.
         *
-        * If ARDOUR_PANNER_PATH is defined then the SearchPath returned
+        * If ARDOUR_PANNER_PATH is defined then the Searchpath returned
         * will contain only those directories specified in it, otherwise it will
         * contain the user and system directories which may contain control
         * surface plugins.
         */
-       PBD::SearchPath panner_search_path ();
+       PBD::Searchpath panner_search_path ();
 
 } // namespace ARDOUR
 
index 754e48cc25d1fbf71a2956c9e1250295b62bd71b..fbe747b29720818ccdbd108d0f7f85f7b8726f4c 100644 (file)
 #include "evoral/types.hpp"
 
 #include "ardour/ardour.h"
+#include "ardour/region.h"
 #include "ardour/session_object.h"
 #include "ardour/data_type.h"
 
 namespace ARDOUR  {
 
 class Session;
-class Region;
 class Playlist;
 class Crossfade;
 
index a7a57036905a110d722cea3ee8c4359a8e652843..2464368ae7b84b31bbd47ac09f4532178961beaf 100644 (file)
@@ -51,7 +51,6 @@ class PluginManager : public boost::noncopyable {
 
        void refresh ();
 
-       int add_ladspa_directory (std::string dirpath);
        int add_windows_vst_directory (std::string dirpath);
        int add_lxvst_directory (std::string dirpath);
 
@@ -103,7 +102,6 @@ class PluginManager : public boost::noncopyable {
 
        std::map<uint32_t, std::string> rdf_type;
 
-       std::string ladspa_path;
        std::string windows_vst_path;
        std::string lxvst_path;
 
@@ -127,7 +125,6 @@ class PluginManager : public boost::noncopyable {
        int lxvst_discover_from_path (std::string path);
        int lxvst_discover (std::string path);
 
-       int ladspa_discover_from_path (std::string path);
        int ladspa_discover (std::string path);
 
        std::string get_ladspa_category (uint32_t id);
index 7337e2d1ea5039e39f0a086cee77eb5f4fab1d10..3fa9fbcb280152c86fc183c91dbc3360cbb14c25 100644 (file)
@@ -826,7 +826,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void request_resume_timecode_transmission ();
        bool timecode_transmission_suspended () const;
 
-       std::string source_search_path(DataType) const;
+       std::vector<std::string> source_search_path(DataType) const;
        void ensure_search_path_includes (const std::string& path, DataType type);
 
        std::list<std::string> unknown_processors () const;
index 25e94d6134b51fa9d4eb9c2aac12e8d17b6a1076..1ff251e71a170f4adddbe2e997a5544aadc515d1 100644 (file)
@@ -32,6 +32,7 @@ public:
        float sample_rate () const { return _sample_rate; }
 
        void set_length (framecnt_t len) { _length = len; }
+       void flush () {}
 
        bool destructive() const { return false; }
        bool can_be_analysed() const { return false; }
index 3f63f1c59898b5f4c568a824938db1eef01f057d..bed431c4902d5f5845b0b5c24b5f4f7b240587b4 100644 (file)
@@ -46,6 +46,7 @@ class SndFileSource : public AudioFileSource {
        float sample_rate () const;
        int update_header (framepos_t when, struct tm&, time_t);
        int flush_header ();
+       void flush ();
 
        framepos_t natural_position () const;
 
index 5bc8e2283357c225a256d1ccb5f6043fa6eb5429..bd583328c30f1781a768d3268f27c1053bb64265 100644 (file)
@@ -19,6 +19,9 @@
 */
 
 #include <iostream>
+#include <vector>
+
+#include <glibmm/timer.h>
 
 #include "pbd/error.h"
 #include "pbd/stacktrace.h"
@@ -35,7 +38,7 @@ using namespace std;
 using namespace PBD;
 
 namespace Evoral {
-       template class EventRingBuffer<timestamp_t>;
+       template class EventRingBuffer<MIDI::timestamp_t>;
 }
 
 pthread_t AsyncMIDIPort::_process_thread;
@@ -49,7 +52,9 @@ AsyncMIDIPort::AsyncMIDIPort (string const & name, PortFlags flags)
        , _last_write_timestamp (0)
        , output_fifo (512)
        , input_fifo (1024)
+#ifndef PLATFORM_WINDOWS
        , xthread (true)
+#endif
 {
 }
 
@@ -58,7 +63,7 @@ AsyncMIDIPort::~AsyncMIDIPort ()
 }
 
 void
-AsyncMIDIPort::flush_output_fifo (pframes_t nframes)
+AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
 {
        RingBuffer< Evoral::Event<double> >::rw_vector vec = { { 0, 0 }, { 0, 0 } };
        size_t written;
@@ -89,7 +94,7 @@ AsyncMIDIPort::flush_output_fifo (pframes_t nframes)
 }
 
 void
-AsyncMIDIPort::cycle_start (pframes_t nframes)
+AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes)
 {
        _currently_in_cycle = true;
        MidiPort::cycle_start (nframes);
@@ -113,16 +118,17 @@ AsyncMIDIPort::cycle_start (pframes_t nframes)
                for (MidiBuffer::iterator b = mb.begin(); b != mb.end(); ++b) {
                        input_fifo.write (when, (Evoral::EventType) 0, (*b).size(), (*b).buffer());
                }
-               
+
+#ifndef PLATFORM_WINDOWS
                if (!mb.empty()) {
                        xthread.wakeup ();
                }
+#endif
        }
-
 }
 
 void
-AsyncMIDIPort::cycle_end (pframes_t nframes)
+AsyncMIDIPort::cycle_end (MIDI::pframes_t nframes)
 {
        if (ARDOUR::Port::sends_output()) {
                /* move any additional data from output FIFO into the port
@@ -161,12 +167,12 @@ AsyncMIDIPort::drain (int check_interval_usecs)
                if (vec.len[0] + vec.len[1] >= output_fifo.bufsize() - 1) {
                        break;
                }
-               usleep (check_interval_usecs);
+               Glib::usleep (check_interval_usecs);
        }
 }
 
 int
-AsyncMIDIPort::write (const byte * msg, size_t msglen, timestamp_t timestamp)
+AsyncMIDIPort::write (const MIDI::byte * msg, size_t msglen, MIDI::timestamp_t timestamp)
 {
        int ret = 0;
 
@@ -219,7 +225,7 @@ AsyncMIDIPort::write (const byte * msg, size_t msglen, timestamp_t timestamp)
                }
 
                if (timestamp >= _cycle_nframes) {
-                       std::cerr << "attempting to write MIDI event of " << msglen << " bytes at time "
+                       std::cerr << "attempting to write MIDI event of " << msglen << " MIDI::bytes at time "
                                  << timestamp << " of " << _cycle_nframes
                                  << " (this will not work - needs a code fix)"
                                  << std::endl;
@@ -268,9 +274,9 @@ AsyncMIDIPort::read (MIDI::byte *, size_t)
        timestamp_t time;
        Evoral::EventType type;
        uint32_t size;
-       byte buffer[input_fifo.capacity()];
+       vector<MIDI::byte> buffer(input_fifo.capacity());
 
-       while (input_fifo.read (&time, &type, &size, buffer)) {
+       while (input_fifo.read (&time, &type, &size, &buffer[0])) {
                _parser->set_timestamp (time);
                for (uint32_t i = 0; i < size; ++i) {
                        _parser->scanner (buffer[i]);
@@ -281,7 +287,7 @@ AsyncMIDIPort::read (MIDI::byte *, size_t)
 }
 
 void
-AsyncMIDIPort::parse (framecnt_t)
+AsyncMIDIPort::parse (MIDI::framecnt_t)
 {
        MIDI::byte buf[1];
 
index a9f9f40d642b111054f15c72fc745f990546dea5..f4d10c2043041dc41e83926acb9aceed428a944e 100644 (file)
@@ -27,8 +27,6 @@
 #include <fcntl.h>
 #include <cstdlib>
 #include <ctime>
-#include <sys/stat.h>
-#include <sys/mman.h>
 
 #include "pbd/error.h"
 #include "pbd/xml++.h"
@@ -925,7 +923,7 @@ AudioDiskstream::internal_playback_seek (framecnt_t distance)
        boost::shared_ptr<ChannelList> c = channels.reader();
 
        for (chan = c->begin(); chan != c->end(); ++chan) {
-               (*chan)->playback_buf->increment_read_ptr (std::llabs(distance));
+               (*chan)->playback_buf->increment_read_ptr (llabs(distance));
        }
 
        if (first_recordable_frame < max_framepos) {
index c2b2f1bff736c05cbfc70621c4f88d89661dcc60..4a6089dac3668ba6273a7d1c10b6122c4b51a9e6 100644 (file)
 
 */
 
+#ifdef WAF_BUILD
+#include "libardour-config.h"
+#endif
+
 #include <sstream>
 
 #include <libxml/uri.h>
 
+#ifdef HAVE_LRDF
 #include <lrdf.h>
+#endif
+
 #include <glibmm/miscutils.h>
 
 #include <glibmm/convert.h>
@@ -57,7 +64,9 @@ AudioLibrary::AudioLibrary ()
 
        touch_file(sfdb_file_path);
 
+#ifdef HAVE_LRDF
        lrdf_read_file(src.c_str());
+#endif
 }
 
 AudioLibrary::~AudioLibrary ()
@@ -67,14 +76,17 @@ AudioLibrary::~AudioLibrary ()
 void
 AudioLibrary::save_changes ()
 {
+#ifdef HAVE_LRDF
        if (lrdf_export_by_source(src.c_str(), src.substr(5).c_str())) {
                PBD::warning << string_compose(_("Could not open %1.  Audio Library not saved"), src) << endmsg;
        }
+#endif
 }
 
 void
 AudioLibrary::set_tags (string member, vector<string> tags)
 {
+#ifdef HAVE_LRDF
        sort (tags.begin(), tags.end());
        tags.erase (unique(tags.begin(), tags.end()), tags.end());
 
@@ -85,12 +97,14 @@ AudioLibrary::set_tags (string member, vector<string> tags)
        for (vector<string>::iterator i = tags.begin(); i != tags.end(); ++i) {
                lrdf_add_triple (src.c_str(), file_uri.c_str(), TAG, (*i).c_str(), lrdf_literal);
        }
+#endif
 }
 
 vector<string>
 AudioLibrary::get_tags (string member)
 {
        vector<string> tags;
+#ifdef HAVE_LRDF
 
        lrdf_statement pattern;
        pattern.subject = strdup(Glib::filename_to_uri(member).c_str());
@@ -111,13 +125,14 @@ AudioLibrary::get_tags (string member)
        lrdf_free_statements (matches);
 
        sort (tags.begin(), tags.end());
-
+#endif
        return tags;
 }
 
 void
 AudioLibrary::search_members_and (vector<string>& members, const vector<string>& tags)
 {
+#ifdef HAVE_LRDF
        lrdf_statement **head;
        lrdf_statement* pattern = 0;
        lrdf_statement* old = 0;
@@ -153,4 +168,5 @@ AudioLibrary::search_members_and (vector<string>& members, const vector<string>&
                pattern = pattern->next;
                delete old;
        }
+#endif
 }
index 7f77f637a36bfe413bf370b703e1521283f33915..a82c109cbaa1ad216ed89d117a6561232e980d84 100644 (file)
@@ -315,7 +315,7 @@ AudioTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_fram
        if (!lm.locked()) {
                boost::shared_ptr<AudioDiskstream> diskstream = audio_diskstream();
                framecnt_t playback_distance = diskstream->calculate_playback_distance(nframes);
-               if (can_internal_playback_seek(std::llabs(playback_distance))) {
+               if (can_internal_playback_seek(llabs(playback_distance))) {
                        /* TODO should declick */
                        internal_playback_seek(playback_distance);
                }
index 538a905ca2f2bdf8e5ff2c2407161fa5680ebcb2..1a24977399e504d8c4a1ca8522b0c7f723d49f7f 100644 (file)
@@ -34,6 +34,7 @@
 #include <glibmm/threads.h>
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
+#include <glib/gstdio.h>
 
 #include "ardour/ardour.h"
 #include "ardour/audioengine.h"
@@ -2453,7 +2454,7 @@ AUPluginInfo::save_cached_info ()
 
        if (!tree.write (path)) {
                error << string_compose (_("could not save AU cache to %1"), path) << endmsg;
-               unlink (path.c_str());
+               g_unlink (path.c_str());
        }
 }
 
index 465f88de5663202306cbb099767ce5cc0e61801a..05fc469c773bbe57895e7f48d679daf764c71b7e 100644 (file)
@@ -34,8 +34,6 @@
 #include "pbd/stacktrace.h"
 #include "pbd/unknown_type.h"
 
-#include <jack/weakjack.h>
-
 #include "midi++/port.h"
 #include "midi++/mmc.h"
 
index 57650860eeb8b28b8781e32af991564bf62ee3c6..53b9afdd3ed37403d8732582f734973ebb336ad9 100644 (file)
 #include "pbd/convert.h"
 
 #include "taglib/fileref.h"
-#include "taglib/flacfile.h"
-#include "taglib/oggfile.h"
+#include "taglib/flac/flacfile.h"
+#include "taglib/ogg/oggfile.h"
 #include "taglib/tag.h"
-#include "taglib/taglib.h"
-#include "taglib/xiphcomment.h"
+#include "taglib/toolkit/taglib.h"
+#include "taglib/ogg/xiphcomment.h"
 
 /* Convert string to TagLib::String */
 #define TL_STR(string) TagLib::String ((string).c_str(), TagLib::String::UTF8)
index 13b03f8f4828fdaa3998ef7b09b7c4938d89eb00..014baa90317b13c420af7c9863378ef6ddd4f976 100644 (file)
@@ -40,6 +40,7 @@
 
 #include <sndfile.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/fileutils.h>
 #include <glibmm/threads.h>
@@ -133,8 +134,8 @@ AudioFileSource::~AudioFileSource ()
 {
        DEBUG_TRACE (DEBUG::Destruction, string_compose ("AudioFileSource destructor %1, removable? %2\n", _path, removable()));
        if (removable()) {
-               unlink (_path.c_str());
-               unlink (peakpath.c_str());
+               ::g_unlink (_path.c_str());
+               ::g_unlink (peakpath.c_str());
        }
 }
 
@@ -292,7 +293,7 @@ AudioFileSource::mark_streaming_write_completed ()
 int
 AudioFileSource::move_dependents_to_trash()
 {
-       return ::unlink (peakpath.c_str());
+       return ::g_unlink (peakpath.c_str());
 }
 
 void
index 3c6d4f81b869bd878ddf483f06b3d2b7175986c0..d0b6205cb211d14c97bde11dcbceaa8e1b7c9a2a 100644 (file)
 
 */
 
-#include <sys/stat.h>
+#ifdef COMPILER_MSVC
+#include <sys/utime.h>
+#else
 #include <unistd.h>
+#include <utime.h>
+#endif
+#include <sys/stat.h>
 #include <fcntl.h>
-#include <poll.h>
 #include <float.h>
-#include <utime.h>
 #include <cerrno>
 #include <ctime>
 #include <cmath>
 #include <algorithm>
 #include <vector>
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
+#include <boost/scoped_array.hpp>
+#include <boost/scoped_ptr.hpp>
+
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
 
@@ -42,6 +51,8 @@
 
 #include "i18n.h"
 
+#include "ardour/debug.h"
+
 using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
@@ -173,9 +184,9 @@ AudioSource::peaks_ready (boost::function<void()> doThisWhenReady, ScopedConnect
 void
 AudioSource::touch_peakfile ()
 {
-       struct stat statbuf;
+       GStatBuf statbuf;
 
-       if (stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) {
+       if (g_stat (peakpath.c_str(), &statbuf) != 0 || statbuf.st_size == 0) {
                return;
        }
 
@@ -184,7 +195,7 @@ AudioSource::touch_peakfile ()
        tbuf.actime = statbuf.st_atime;
        tbuf.modtime = time ((time_t*) 0);
 
-       utime (peakpath.c_str(), &tbuf);
+       g_utime (peakpath.c_str(), &tbuf);
 }
 
 int
@@ -195,7 +206,7 @@ AudioSource::rename_peakfile (string newpath)
        string oldpath = peakpath;
 
        if (Glib::file_test (oldpath, Glib::FILE_TEST_EXISTS)) {
-               if (rename (oldpath.c_str(), newpath.c_str()) != 0) {
+               if (g_rename (oldpath.c_str(), newpath.c_str()) != 0) {
                        error << string_compose (_("cannot rename peakfile for %1 from %2 to %3 (%4)"), _name, oldpath, newpath, strerror (errno)) << endmsg;
                        return -1;
                }
@@ -209,17 +220,19 @@ AudioSource::rename_peakfile (string newpath)
 int
 AudioSource::initialize_peakfile (string audio_path)
 {
-       struct stat statbuf;
+       GStatBuf statbuf;
 
        peakpath = peak_path (audio_path);
 
+       DEBUG_TRACE(DEBUG::Peaks, string_compose ("Initialize Peakfile %1 for Audio file %2\n", peakpath, audio_path));
+
        /* if the peak file should be there, but isn't .... */
 
        if (!empty() && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
                peakpath = find_broken_peakfile (peakpath, audio_path);
        }
 
-       if (stat (peakpath.c_str(), &statbuf)) {
+       if (g_stat (peakpath.c_str(), &statbuf)) {
                if (errno != ENOENT) {
                        /* it exists in the peaks dir, but there is some kind of error */
 
@@ -227,7 +240,7 @@ AudioSource::initialize_peakfile (string audio_path)
                        return -1;
                }
 
-               /* peakfile does not exist */
+               DEBUG_TRACE(DEBUG::Peaks, string_compose("Peakfile %1 does not exist\n", peakpath));
 
                _peaks_built = false;
 
@@ -236,7 +249,7 @@ AudioSource::initialize_peakfile (string audio_path)
                /* we found it in the peaks dir, so check it out */
 
                if (statbuf.st_size == 0 || (statbuf.st_size < (off_t) ((length(_timeline_position) / _FPP) * sizeof (PeakData)))) {
-                       // empty
+                       DEBUG_TRACE(DEBUG::Peaks, string_compose("Peakfile %1 is empty\n", peakpath));
                        _peaks_built = false;
                } else {
                        // Check if the audio file has changed since the peakfile was built.
@@ -248,6 +261,7 @@ AudioSource::initialize_peakfile (string audio_path)
                                /* no audio path - nested source or we can't
                                   read it or ... whatever, use the peakfile as-is.
                                */
+                               DEBUG_TRACE(DEBUG::Peaks, string_compose("Error when calling stat on Peakfile %1\n", peakpath));
 
                                _peaks_built = true;
                                _peak_byte_max = statbuf.st_size;
@@ -316,28 +330,15 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
        int32_t to_read;
        uint32_t nread;
        framecnt_t zero_fill = 0;
-       int ret = -1;
-       PeakData* staging = 0;
-       Sample* raw_staging = 0;
 
-       FdFileDescriptor* peakfile_descriptor = new FdFileDescriptor (peakpath, false, 0664);
+       boost::scoped_ptr<FdFileDescriptor> peakfile_descriptor(new FdFileDescriptor (peakpath, false, 0664));
        int peakfile_fd = -1;
 
        expected_peaks = (cnt / (double) samples_per_file_peak);
        scale = npeaks/expected_peaks;
 
-#undef DEBUG_READ_PEAKS
-#ifdef DEBUG_READ_PEAKS
-       cerr << "======>RP: npeaks = " << npeaks
-            << " start = " << start
-            << " cnt = " << cnt
-            << " len = " << _length
-            << "   samples_per_visual_peak =" << samples_per_visual_peak
-            << " expected was " << expected_peaks << " ... scale = " << scale
-            << " PD ptr = " << peaks
-            <<endl;
-
-#endif
+       DEBUG_TRACE (DEBUG::Peaks, string_compose (" ======>RP: npeaks = %1 start = %2 cnt = %3 len = %4 samples_per_visual_peak = %5 expected was %6 ... scale =  %7 PD ptr = %8\n"
+                       , npeaks, start, cnt, _length, samples_per_visual_peak, expected_peaks, scale, peaks));
 
        /* fix for near-end-of-file conditions */
 
@@ -353,16 +354,15 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
 
        if (npeaks == cnt) {
 
-#ifdef DEBUG_READ_PEAKS
-               cerr << "RAW DATA\n";
-#endif
+               DEBUG_TRACE (DEBUG::Peaks, "RAW DATA\n");
+
                /* no scaling at all, just get the sample data and duplicate it for
                   both max and min peak values.
                */
 
-               Sample* raw_staging = new Sample[cnt];
+               boost::scoped_array<Sample> raw_staging(new Sample[cnt]);
 
-               if (read_unlocked (raw_staging, start, cnt) != cnt) {
+               if (read_unlocked (raw_staging.get(), start, cnt) != cnt) {
                        error << _("cannot read sample data for unscaled peak computation") << endmsg;
                        return -1;
                }
@@ -372,43 +372,35 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                        peaks[i].min = raw_staging[i];
                }
 
-               delete peakfile_descriptor;
-               delete [] raw_staging;
                return 0;
        }
 
        if (scale == 1.0) {
 
+               off_t offset = 0;
                off_t first_peak_byte = (start / samples_per_file_peak) * sizeof (PeakData);
-
+               ssize_t bytes_to_read = sizeof (PeakData)* npeaks;
                /* open, read, close */
 
                if ((peakfile_fd = peakfile_descriptor->allocate ()) < 0) {
                        error << string_compose(_("AudioSource: cannot open peakpath (a) \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg;
-                       delete peakfile_descriptor;
                        return -1;
                }
 
-#ifdef DEBUG_READ_PEAKS
-               cerr << "DIRECT PEAKS\n";
-#endif
+               DEBUG_TRACE (DEBUG::Peaks, "DIRECT PEAKS\n");
 
-               nread = ::pread (peakfile_fd, peaks, sizeof (PeakData)* npeaks, first_peak_byte);
-
-               if (nread != sizeof (PeakData) * npeaks) {
-                       cerr << "AudioSource["
-                            << _name
-                            << "]: cannot read peaks from peakfile! (read only "
-                            << nread
-                            << " not "
-                            << npeaks
-                             << "at sample "
-                            << start
-                            << " = byte "
-                            << first_peak_byte
-                            << ')'
-                            << endl;
-                       delete peakfile_descriptor;
+               offset = lseek (peakfile_fd, first_peak_byte, SEEK_SET);
+
+               if (offset != first_peak_byte) {
+                       error << string_compose(_("AudioSource: could not seek to correct location in peak file \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg;
+                       return -1;
+               }
+
+               nread = ::read (peakfile_fd, peaks, bytes_to_read);
+
+               if (nread != bytes_to_read) {
+                       DEBUG_TRACE (DEBUG::Peaks,  string_compose ("[%1]: Cannot read peaks from peakfile! (read only %2 not %3 at sample %4 = byte %5 )\n"
+                            , _name, nread, npeaks, start, first_peak_byte));
                        return -1;
                }
 
@@ -416,7 +408,6 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                        memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill);
                }
 
-               delete peakfile_descriptor;
                return 0;
        }
 
@@ -425,9 +416,8 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
 
        if (scale < 1.0) {
 
-#ifdef DEBUG_READ_PEAKS
-               cerr << "DOWNSAMPLE\n";
-#endif
+               DEBUG_TRACE (DEBUG::Peaks, "DOWNSAMPLE\n");
+
                /* the caller wants:
 
                    - more frames-per-peak (lower resolution) than the peakfile, or to put it another way,
@@ -440,7 +430,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
 
                const framecnt_t chunksize = (framecnt_t) min (expected_peaks, 65536.0);
 
-               staging = new PeakData[chunksize];
+               boost::scoped_array<PeakData> staging(new PeakData[chunksize]);
 
                /* compute the rounded up frame position  */
 
@@ -461,8 +451,6 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
 
                if ((peakfile_fd = peakfile_descriptor->allocate ()) < 0) {
                        error << string_compose(_("AudioSource: cannot open peakpath (b) \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg;
-                       delete peakfile_descriptor;
-                       delete [] staging;
                        return 0;
                }
 
@@ -473,33 +461,27 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                                uint32_t       start_byte = current_stored_peak * sizeof(PeakData);
                                tnp = min ((framecnt_t)(_length/samples_per_file_peak - current_stored_peak), (framecnt_t) expected_peaks);
                                to_read = min (chunksize, tnp);
+                               ssize_t bytes_to_read = sizeof (PeakData) * to_read;
 
-#ifdef DEBUG_READ_PEAKS
-                               cerr << "read " << sizeof (PeakData) * to_read << " from peakfile @ " << start_byte << endl;
-#endif
+                               DEBUG_TRACE (DEBUG::Peaks, string_compose ("reading %1 bytes from peakfile @ %2\n"
+                                               , bytes_to_read, start_byte));
 
-                               if ((nread = ::pread (peakfile_fd, staging, sizeof (PeakData) * to_read, start_byte))
-                                   != sizeof (PeakData) * to_read) {
 
-                                       off_t fend = lseek (peakfile_fd, 0, SEEK_END);
+                               off_t offset = lseek (peakfile_fd, start_byte, SEEK_SET);
 
-                                       cerr << "AudioSource["
-                                            << _name
-                                            << "]: cannot read peak data from peakfile ("
-                                            << (nread / sizeof(PeakData))
-                                            << " peaks instead of "
-                                            << to_read
-                                            << ") ("
-                                            << strerror (errno)
-                                            << ')'
-                                            << " at start_byte = " << start_byte
-                                            << " _length = " << _length << " versus len = " << fend
-                                            << " expected maxpeaks = " << (_length - current_frame)/samples_per_file_peak
-                                            << " npeaks was " << npeaks
-                                            << endl;
-                                       goto out;
+                               if (offset != start_byte) {
+                                       error << string_compose(_("AudioSource: could not seek to correct location in peak file \"%1\" (%2)"), peakpath, strerror (errno)) << endmsg;
+                                       return -1;
                                }
 
+                               if ((nread = ::read (peakfile_fd, staging.get(), bytes_to_read)) != bytes_to_read) {
+
+                                       off_t fend = lseek (peakfile_fd, 0, SEEK_END);
+
+                                       DEBUG_TRACE (DEBUG::Peaks, string_compose ("[%1]: cannot read peak data from peakfile (%2 peaks instead of %3) (%4) at start_byte = %5 _length = %6 versus len = %7 expected maxpeaks = %8 npeaks was %9"
+                                            , _name, (nread / sizeof(PeakData)), to_read, g_strerror (errno), start_byte, _length, fend, ((_length - current_frame)/samples_per_file_peak), npeaks));
+                                       return -1;
+                               }
                                i = 0;
                                stored_peaks_read = nread / sizeof(PeakData);
                        }
@@ -531,13 +513,10 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                        memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill);
                }
 
-               ret = 0;
-
        } else {
 
-#ifdef DEBUG_READ_PEAKS
-               cerr << "UPSAMPLE\n";
-#endif
+               DEBUG_TRACE (DEBUG::Peaks, "UPSAMPLE\n");
+
                /* the caller wants
 
                     - less frames-per-peak (more resolution)
@@ -552,7 +531,7 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                framecnt_t i = 0;
                framecnt_t nvisual_peaks = 0;
                framecnt_t chunksize = (framecnt_t) min (cnt, (framecnt_t) 4096);
-               raw_staging = new Sample[chunksize];
+               boost::scoped_array<Sample> raw_staging(new Sample[chunksize]);
 
                framepos_t frame_pos = start;
                double pixel_pos = floor (frame_pos / samples_per_visual_peak);
@@ -577,18 +556,18 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                                            this loop early
                                        */
 
-                                        memset (raw_staging, 0, sizeof (Sample) * chunksize);
+                                        memset (raw_staging.get(), 0, sizeof (Sample) * chunksize);
 
                                 } else {
 
                                         to_read = min (chunksize, (_length - current_frame));
 
 
-                                        if ((frames_read = read_unlocked (raw_staging, current_frame, to_read)) == 0) {
+                                        if ((frames_read = read_unlocked (raw_staging.get(), current_frame, to_read)) == 0) {
                                                 error << string_compose(_("AudioSource[%1]: peak read - cannot read %2 samples at offset %3 of %4 (%5)"),
                                                                         _name, to_read, current_frame, _length, strerror (errno))
                                                       << endmsg;
-                                                goto out;
+                                                return -1;
                                         }
                                 }
 
@@ -616,32 +595,19 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
                if (zero_fill) {
                        memset (&peaks[npeaks], 0, sizeof (PeakData) * zero_fill);
                }
-
-               ret = 0;
        }
 
-  out:
-       delete peakfile_descriptor;
-
-       delete [] staging;
-       delete [] raw_staging;
-
-#ifdef DEBUG_READ_PEAKS
-       cerr << "RP DONE\n";
-#endif
-
-       return ret;
+       DEBUG_TRACE (DEBUG::Peaks, "READPEAKS DONE\n");
+       return 0;
 }
 
-#undef DEBUG_PEAK_BUILD
-
 int
 AudioSource::build_peaks_from_scratch ()
 {
-       Sample* buf = 0;
-
        const framecnt_t bufsize = 65536; // 256kB per disk read for mono data is about ideal
 
+       DEBUG_TRACE (DEBUG::Peaks, "Building peaks from scratch\n");
+
        int ret = -1;
 
        {
@@ -657,20 +623,20 @@ AudioSource::build_peaks_from_scratch ()
                framecnt_t cnt = _length;
 
                _peaks_built = false;
-               buf = new Sample[bufsize];
+               boost::scoped_array<Sample> buf(new Sample[bufsize]);
 
                while (cnt) {
 
                        framecnt_t frames_to_read = min (bufsize, cnt);
                        framecnt_t frames_read;
                        
-                       if ((frames_read = read_unlocked (buf, current_frame, frames_to_read)) != frames_to_read) {
+                       if ((frames_read = read_unlocked (buf.get(), current_frame, frames_to_read)) != frames_to_read) {
                                error << string_compose(_("%1: could not write read raw data for peak computation (%2)"), _name, strerror (errno)) << endmsg;
                                done_with_peakfile_writes (false);
                                goto out;
                        }
 
-                       if (compute_and_write_peaks (buf, current_frame, frames_read, true, false, _FPP)) {
+                       if (compute_and_write_peaks (buf.get(), current_frame, frames_read, true, false, _FPP)) {
                                break;
                        }
 
@@ -691,11 +657,10 @@ AudioSource::build_peaks_from_scratch ()
 
   out:
        if (ret) {
-               unlink (peakpath.c_str());
+               DEBUG_TRACE (DEBUG::Peaks, string_compose("Could not write peak data, attempting to remove peakfile %1\n", peakpath));
+               ::g_unlink (peakpath.c_str());
        }
 
-       delete [] buf;
-
        return ret;
 }
 
@@ -739,15 +704,13 @@ int
 AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
                                      bool force, bool intermediate_peaks_ready, framecnt_t fpp)
 {
-       Sample* buf2 = 0;
        framecnt_t to_do;
        uint32_t  peaks_computed;
-       PeakData* peakbuf = 0;
-       int ret = -1;
        framepos_t current_frame;
        framecnt_t frames_done;
        const size_t blocksize = (128 * 1024);
        off_t first_peak_byte;
+       boost::scoped_array<Sample> buf2;
 
        if (_peakfile_descriptor == 0) {
                prepare_for_peakfile_writes ();
@@ -770,9 +733,16 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
 
                        off_t byte = (peak_leftover_frame / fpp) * sizeof (PeakData);
 
-                       if (::pwrite (_peakfile_fd, &x, sizeof (PeakData), byte) != sizeof (PeakData)) {
+                       off_t offset = lseek (_peakfile_fd, byte, SEEK_SET);
+
+                       if (offset != byte) {
+                               error << string_compose(_("%1: could not seek in peak file data (%2)"), _name, strerror (errno)) << endmsg;
+                               return -1;
+                       }
+
+                       if (::write (_peakfile_fd, &x, sizeof (PeakData)) != sizeof (PeakData)) {
                                error << string_compose(_("%1: could not write peak file data (%2)"), _name, strerror (errno)) << endmsg;
-                               goto out;
+                               return -1;
                        }
 
                        _peak_byte_max = max (_peak_byte_max, (off_t) (byte + sizeof(PeakData)));
@@ -798,19 +768,19 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
                /* make a new contiguous buffer containing leftovers and the new stuff */
 
                to_do = cnt + peak_leftover_cnt;
-               buf2 = new Sample[to_do];
+               buf2.reset(new Sample[to_do]);
 
                /* the remnants */
-               memcpy (buf2, peak_leftovers, peak_leftover_cnt * sizeof (Sample));
+               memcpy (buf2.get(), peak_leftovers, peak_leftover_cnt * sizeof (Sample));
 
                /* the new stuff */
-               memcpy (buf2+peak_leftover_cnt, buf, cnt * sizeof (Sample));
+               memcpy (buf2.get()+peak_leftover_cnt, buf, cnt * sizeof (Sample));
 
                /* no more leftovers */
                peak_leftover_cnt = 0;
 
                /* use the temporary buffer */
-               buf = buf2;
+               buf = buf2.get();
 
                /* make sure that when we write into the peakfile, we startup where we left off */
 
@@ -820,7 +790,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
                to_do = cnt;
        }
 
-       peakbuf = new PeakData[(to_do/fpp)+1];
+       boost::scoped_array<PeakData> peakbuf(new PeakData[(to_do/fpp)+1]);
        peaks_computed = 0;
        current_frame = first_frame;
        frames_done = 0;
@@ -877,18 +847,31 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
                off_t target_length = blocksize * ((first_peak_byte + blocksize + 1) / blocksize);
 
                if (endpos < target_length) {
+                       DEBUG_TRACE(DEBUG::Peaks, string_compose ("Truncating Peakfile %1\n", peakpath));
                        if (ftruncate (_peakfile_fd, target_length)) {
                                /* error doesn't actually matter so continue on without testing */
                        }
                }
        }
 
-       if (::pwrite (_peakfile_fd, peakbuf, sizeof (PeakData) * peaks_computed, first_peak_byte) != (ssize_t) (sizeof (PeakData) * peaks_computed)) {
+
+       off_t offset = lseek(_peakfile_fd, first_peak_byte, SEEK_SET);
+
+       if (offset != first_peak_byte) {
+               error << string_compose(_("%1: could not seek in peak file data (%2)"), _name, strerror (errno)) << endmsg;
+               return -1;
+       }
+
+       ssize_t bytes_to_write = sizeof (PeakData) * peaks_computed;
+
+       ssize_t bytes_written = ::write (_peakfile_fd, peakbuf.get(), bytes_to_write);
+
+       if (bytes_written != bytes_to_write) {
                error << string_compose(_("%1: could not write peak file data (%2)"), _name, strerror (errno)) << endmsg;
-               goto out;
+               return -1;
        }
 
-       _peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + sizeof(PeakData)*peaks_computed));
+       _peak_byte_max = max (_peak_byte_max, (off_t) (first_peak_byte + bytes_to_write));
 
        if (frames_done) {
                Glib::Threads::Mutex::Lock lm (_peaks_ready_lock);
@@ -898,13 +881,7 @@ AudioSource::compute_and_write_peaks (Sample* buf, framecnt_t first_frame, frame
                }
        }
 
-       ret = 0;
-
-  out:
-       delete [] peakbuf;
-       delete [] buf2;
-
-       return ret;
+       return 0;
 }
 
 void
@@ -921,6 +898,7 @@ AudioSource::truncate_peakfile ()
        off_t end = lseek (_peakfile_fd, 0, SEEK_END);
 
        if (end > _peak_byte_max) {
+               DEBUG_TRACE(DEBUG::Peaks, string_compose ("Truncating Peakfile  %1\n", peakpath));
                if (ftruncate (_peakfile_fd, _peak_byte_max)) {
                        error << string_compose (_("could not truncate peakfile %1 to %2 (error: %3)"),
                                                 peakpath, _peak_byte_max, errno) << endmsg;
index 16e10c95f941f938340488419fae9f3c88545dc3..91fe4d38edbcf727aa5830aa21dea432ee10adb0 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <iostream>
 
+#include <glibmm/timer.h>
+
 #include "pbd/compose.h"
 
 #include "ardour/automation_control.h"
@@ -134,7 +136,7 @@ void
 AutomationWatch::thread ()
 {
        while (_run_thread) {
-               usleep ((useconds_t) floor (Config->get_automation_interval_msecs() * 1000));
+               Glib::usleep ((gulong) floor (Config->get_automation_interval_msecs() * 1000));
                timer ();
        }
 }
index 9a0425094b388033b41b7f9afb4ceb47f11aea1a..4c5ff40e7da07d8fc3238fd2ce359727609ccfec 100644 (file)
@@ -31,14 +31,14 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 backend_search_path ()
 {
-       SearchPath spath(user_config_directory ());
+       Searchpath spath(user_config_directory ());
        spath += ardour_dll_directory ();
        spath.add_subdirectory_to_paths(backend_dir_name);
 
-       spath += SearchPath(Glib::getenv(backend_env_variable_name));
+       spath += Searchpath(Glib::getenv(backend_env_variable_name));
        return spath;
 }
 
index a7fa41aaf9217d6330366ba2a97392112d22fd91..a08d2c7991c6b0044bea6625b0a7c969db05066b 100644 (file)
@@ -22,6 +22,7 @@
 #include <iostream>
 #include <sstream>
 #include <iomanip>
+#include <vector>
 
 #include <glibmm.h>
 
@@ -37,15 +38,15 @@ namespace ARDOUR
 static void
 snprintf_bounded_null_filled (char* target, size_t target_size, char const * fmt, ...)
 {
-       char buf[target_size+1];
+       std::vector<char> buf(target_size+1);
        va_list ap;
 
        va_start (ap, fmt);
-       vsnprintf (buf, target_size+1, fmt, ap);
+       vsnprintf (&buf[0], target_size+1, fmt, ap);
        va_end (ap);
 
        memset (target, 0, target_size);
-       memcpy (target, buf, target_size);
+       memcpy (target, &buf[0], target_size);
 
 }
 
@@ -84,7 +85,7 @@ BroadcastInfo::set_originator_ref_from_session (Session const & /*session*/)
 
        /* random code is 9 digits */
 
-       int random_code = random() % 999999999;
+       int random_code = g_random_int() % 999999999;
 
        /* Serial number is 12 chars */
 
index 89b2cc1303cab4ac04b852427517400383c14930..1fe15246183c89575782e5e4f505c562bcbf6bb7 100644 (file)
 #include <errno.h>
 #include <fcntl.h>
 #include <unistd.h>
+
+#ifndef PLATFORM_WINDOWS
 #include <poll.h>
+#endif
+
 #include "pbd/error.h"
 #include "pbd/pthread_utils.h"
 #include "ardour/butler.h"
@@ -38,7 +42,7 @@ namespace ARDOUR {
 
 Butler::Butler(Session& s)
        : SessionHandleRef (s)
-       , thread(0)
+       , thread()
        , audio_dstream_capture_buffer_size(0)
        , audio_dstream_playback_buffer_size(0)
        , midi_dstream_buffer_size(0)
@@ -68,25 +72,10 @@ Butler::config_changed (std::string p)
         }
 }
 
+#ifndef PLATFORM_WINDOWS
 int
-Butler::start_thread()
+Butler::setup_request_pipe ()
 {
-       const float rate = (float)_session.frame_rate();
-
-       /* size is in Samples, not bytes */
-       audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate);
-       audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * rate);
-
-       /* size is in bytes
-        * XXX: Jack needs to tell us the MIDI buffer size
-        * (i.e. how many MIDI bytes we might see in a cycle)
-        */
-       midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * rate);
-
-       MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate));
-
-       should_run = false;
-
        if (pipe (request_pipe)) {
                error << string_compose(_("Cannot create transport request signal pipe (%1)"),
                                strerror (errno)) << endmsg;
@@ -104,6 +93,32 @@ Butler::start_thread()
                                strerror (errno)) << endmsg;
                return -1;
        }
+       return 0;
+}
+#endif
+
+int
+Butler::start_thread()
+{
+       const float rate = (float)_session.frame_rate();
+
+       /* size is in Samples, not bytes */
+       audio_dstream_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * rate);
+       audio_dstream_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * rate);
+
+       /* size is in bytes
+        * XXX: Jack needs to tell us the MIDI buffer size
+        * (i.e. how many MIDI bytes we might see in a cycle)
+        */
+       midi_dstream_buffer_size = (uint32_t) floor (Config->get_midi_track_buffer_seconds() * rate);
+
+       MidiDiskstream::set_readahead_frames ((framecnt_t) (Config->get_midi_readahead() * rate));
+
+       should_run = false;
+
+#ifndef PLATFORM_WINDOWS
+       if (setup_request_pipe() != 0) return -1;
+#endif
 
        if (pthread_create_and_store ("disk butler", &thread, _thread_work, this)) {
                error << _("Session: could not create butler thread") << endmsg;
@@ -118,12 +133,9 @@ Butler::start_thread()
 void
 Butler::terminate_thread ()
 {
-       if (thread) {
-               void* status;
-               const char c = Request::Quit;
-               (void) ::write (request_pipe[1], &c, 1);
-               pthread_join (thread, &status);
-       }
+       void* status;
+       queue_request (Request::Quit);
+       pthread_join (thread, &status);
 }
 
 void *
@@ -134,28 +146,25 @@ Butler::_thread_work (void* arg)
        return ((Butler *) arg)->thread_work ();
 }
 
-void *
-Butler::thread_work ()
+bool
+Butler::wait_for_requests ()
 {
-       uint32_t err = 0;
-
+#ifndef PLATFORM_WINDOWS
        struct pollfd pfd[1];
-       bool disk_work_outstanding = false;
-       RouteList::iterator i;
 
-       while (true) {
-               pfd[0].fd = request_pipe[0];
-               pfd[0].events = POLLIN|POLLERR|POLLHUP;
+       pfd[0].fd = request_pipe[0];
+       pfd[0].events = POLLIN|POLLERR|POLLHUP;
 
-               if (poll (pfd, 1, (disk_work_outstanding ? 0 : -1)) < 0) {
+       while(true) {
+               if (poll (pfd, 1, -1) < 0) {
 
                        if (errno == EINTR) {
                                continue;
                        }
 
                        error << string_compose (_("poll on butler request pipe failed (%1)"),
-                                         strerror (errno))
-                             << endmsg;
+                                       strerror (errno))
+                               << endmsg;
                        break;
                }
 
@@ -165,16 +174,60 @@ Butler::thread_work ()
                }
 
                if (pfd[0].revents & POLLIN) {
+                       return true;
+               }
+       }
+       return false;
+#else
+       m_request_sem.wait ();
+       return true;
+#endif
+}
 
-                       char req;
+bool
+Butler::dequeue_request (Request::Type& r)
+{
+#ifndef PLATFORM_WINDOWS
+       char req;
+       size_t nread = ::read (request_pipe[0], &req, sizeof (req));
+       if (nread == 1) {
+               r = (Request::Type) req;
+               return true;
+       } else if (nread == 0) {
+               return false;
+       } else if (errno == EAGAIN) {
+               return false;
+       } else {
+               fatal << _("Error reading from butler request pipe") << endmsg;
+               /*NOTREACHED*/
+       }
+#else
+       r = (Request::Type) m_request_state.get();
+#endif
+       return false;
+}
 
-                       /* empty the pipe of all current requests */
+       void *
+Butler::thread_work ()
+{
+       uint32_t err = 0;
 
-                       while (1) {
-                               size_t nread = ::read (request_pipe[0], &req, sizeof (req));
-                               if (nread == 1) {
+       bool disk_work_outstanding = false;
+       RouteList::iterator i;
 
-                                       switch ((Request::Type) req) {
+       while (true) {
+               if(!disk_work_outstanding) {
+                       if (wait_for_requests ()) {
+                               Request::Type req;
+
+                               /* empty the pipe of all current requests */
+#ifdef PLATFORM_WINDOWS
+                               dequeue_request (req);
+                               {
+#else
+                               while(dequeue_request(req)) {
+#endif
+                                       switch (req) {
 
                                        case Request::Run:
                                                should_run = true;
@@ -192,14 +245,6 @@ Butler::thread_work ()
                                        default:
                                                break;
                                        }
-
-                               } else if (nread == 0) {
-                                       break;
-                               } else if (errno == EAGAIN) {
-                                       break;
-                               } else {
-                                       fatal << _("Error reading from butler request pipe") << endmsg;
-                                       /*NOTREACHED*/
                                }
                        }
                }
@@ -338,18 +383,28 @@ Butler::schedule_transport_work ()
 }
 
 void
-Butler::summon ()
+Butler::queue_request (Request::Type r)
 {
-       char c = Request::Run;
+#ifndef PLATFORM_WINDOWS
+       char c = r;
        (void) ::write (request_pipe[1], &c, 1);
+#else
+       m_request_state.set (r);
+       m_request_sem.post ();
+#endif
+}
+
+void
+Butler::summon ()
+{
+       queue_request (Request::Run);
 }
 
 void
 Butler::stop ()
 {
        Glib::Threads::Mutex::Lock lm (request_lock);
-       char c = Request::Pause;
-       (void) ::write (request_pipe[1], &c, 1);
+       queue_request (Request::Pause);
        paused.wait(request_lock);
 }
 
@@ -357,8 +412,7 @@ void
 Butler::wait_until_finished ()
 {
        Glib::Threads::Mutex::Lock lm (request_lock);
-       char c = Request::Pause;
-       (void) ::write (request_pipe[1], &c, 1);
+       queue_request (Request::Pause);
        paused.wait(request_lock);
 }
 
index 2e65a8d6f89241e6f68ad37fff60bdf7ba467bb8..06c9c72cb450afb7e74a13c73b4d968743299147 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-#include <dlfcn.h>
+#include <glibmm/module.h>
 
 #include <glibmm/fileutils.h>
 
 
 #include "ardour/debug.h"
 #include "ardour/control_protocol_manager.h"
+
 #include "ardour/control_protocol_search_path.h"
 
+
 using namespace ARDOUR;
 using namespace std;
 using namespace PBD;
@@ -179,7 +181,7 @@ ControlProtocolManager::teardown (ControlProtocolInfo& cpi)
        cpi.protocol = 0;
        delete cpi.state;
        cpi.state = 0;
-       dlclose (cpi.descriptor->module);
+       delete (Glib::Module*)cpi.descriptor->module;
 
        ProtocolStatusChange (&cpi);
 
@@ -264,7 +266,7 @@ ControlProtocolManager::control_protocol_discover (string path)
                                     string_compose(_("Control surface protocol discovered: \"%1\"\n"), cpi->name));
                }
 
-               dlclose (descriptor->module);
+               delete (Glib::Module*)descriptor->module;
        }
 
        return 0;
@@ -273,31 +275,31 @@ ControlProtocolManager::control_protocol_discover (string path)
 ControlProtocolDescriptor*
 ControlProtocolManager::get_descriptor (string path)
 {
-       void *module;
+       Glib::Module* module = new Glib::Module(path);
        ControlProtocolDescriptor *descriptor = 0;
        ControlProtocolDescriptor* (*dfunc)(void);
-       const char *errstr;
+       void* func = 0;
 
-       if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
-               error << string_compose(_("ControlProtocolManager: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
+       if (!(*module)) {
+               error << string_compose(_("ControlProtocolManager: cannot load module \"%1\" (%2)"), path, Glib::Module::get_last_error()) << endmsg;
+               delete module;
                return 0;
        }
 
-
-       dfunc = (ControlProtocolDescriptor* (*)(void)) dlsym (module, "protocol_descriptor");
-
-       if ((errstr = dlerror()) != 0) {
+       if (!module->get_symbol("protocol_descriptor", func)) {
                error << string_compose(_("ControlProtocolManager: module \"%1\" has no descriptor function."), path) << endmsg;
-               error << errstr << endmsg;
-               dlclose (module);
+               error << Glib::Module::get_last_error() << endmsg;
+               delete module;
                return 0;
        }
 
+       dfunc = (ControlProtocolDescriptor* (*)(void))func;
        descriptor = dfunc();
+
        if (descriptor) {
-               descriptor->module = module;
+               descriptor->module = (void*)module;
        } else {
-               dlclose (module);
+               delete module;
        }
 
        return descriptor;
index 254cd03fe94c23fb9a91c4460d6b76d97ea4c706..c5c5d0ba00a3000f34f87a00d342192a411b7d14 100644 (file)
@@ -33,14 +33,14 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 control_protocol_search_path ()
 {
-       SearchPath spath(user_config_directory ());
+       Searchpath spath(user_config_directory ());
        spath += ardour_dll_directory ();
        spath.add_subdirectory_to_paths (surfaces_dir_name);
        
-       spath += SearchPath(Glib::getenv(surfaces_env_variable_name));
+       spath += Searchpath(Glib::getenv(surfaces_env_variable_name));
        return spath;
 }
 
index fb122dd83c340cf9e9f241899ecf0b310646ae81..dc762299e9c3f6a1ac95415a7bcf0af6fac57d7a 100644 (file)
@@ -31,6 +31,7 @@ uint64_t PBD::DEBUG::MidiDiskstreamIO = PBD::new_debug_bit ("mididiskstreamio");
 uint64_t PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt");
 uint64_t PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration");
 uint64_t PBD::DEBUG::Latency = PBD::new_debug_bit ("latency");
+uint64_t PBD::DEBUG::Peaks = PBD::new_debug_bit ("peaks");
 uint64_t PBD::DEBUG::Processors = PBD::new_debug_bit ("processors");
 uint64_t PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads");
 uint64_t PBD::DEBUG::Graph = PBD::new_debug_bit ("graph");
index fd23f0166de206d62cc8c0f932a380a0f8963a7a..7e8eca8fd29c98ea4b5b4b0c4ea02ecb6fe34467 100644 (file)
 #include "ardour/session.h"
 #include "ardour/types.h"
 
+#ifdef COMPILER_MSVC
+#pragma warning(disable:4305)
+#endif
+
 using namespace ARDOUR;
 
 const Sample Session::default_click_emphasis[] = {
index af7f7f550c33cf9fe1ac57256cad27819098750f..f01c024435a67d10dde70763c081222882b982e0 100644 (file)
@@ -36,6 +36,7 @@ const char* const export_formats_dir_name = X_("export");
 const char* const templates_dir_name = X_("templates");
 const char* const route_templates_dir_name = X_("route_templates");
 const char* const surfaces_dir_name = X_("surfaces");
+const char* const ladspa_dir_name = X_("ladspa");
 const char* const panner_dir_name = X_("panners");
 const char* const backend_dir_name = X_("backends");
 
index a359f228e8d68c7818d46141578cfb696e2bd8a9..e046d5a830beda849f45ab7a77208f8de90a18ba 100644 (file)
@@ -29,7 +29,6 @@
 #include <cstdlib>
 #include <ctime>
 #include <sys/stat.h>
-#include <sys/mman.h>
 
 #include <glibmm/threads.h>
 
@@ -571,7 +570,7 @@ Diskstream::move_processor_automation (boost::weak_ptr<Processor> p, list< Evora
 
        set<Evoral::Parameter> const a = processor->what_can_be_automated ();
 
-       for (set<Evoral::Parameter>::iterator i = a.begin (); i != a.end (); ++i) {
+       for (set<Evoral::Parameter>::const_iterator i = a.begin (); i != a.end (); ++i) {
                boost::shared_ptr<AutomationList> al = processor->automation_control(*i)->alist();
                XMLNode & before = al->get_state ();
                bool const things_moved = al->move_ranges (movements);
@@ -601,7 +600,7 @@ Diskstream::check_record_status (framepos_t transport_frame, bool can_record)
        */
 
        rolling = _session.transport_speed() != 0.0f;
-       possibly_recording = (rolling << 2) | (record_enabled() << 1) | can_record;
+       possibly_recording = (rolling << 2) | ((int)record_enabled() << 1) | (int)can_record;
        change = possibly_recording ^ last_possibly_recording;
 
        if (possibly_recording == last_possibly_recording) {
index ed8bb9d5f875f934217e9cf039c566034ba228aa..1eda44991550f3e6267170c3f3718faef8c80fc7 100644 (file)
@@ -185,7 +185,7 @@ ExportFormatBase::nearest_sample_rate (framecnt_t sample_rate)
        SampleRate best_match = SR_None;
 
        #define DO_SR_COMPARISON(rate) \
-       diff = std::fabs((rate) - sample_rate); \
+       diff = std::fabs((double)((rate) - sample_rate)); \
        if(diff < smallest_diff) { \
                smallest_diff = diff; \
                best_match = (rate); \
index cf18b14a1865bff1fa2f22d71828a51e726344e4..ffa096d33ac55d9fc4b1d364550fd538d8fbb817 100644 (file)
@@ -32,14 +32,14 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 export_formats_search_path ()
 {
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths (export_formats_dir_name);
 
        bool export_formats_path_defined = false;
-       SearchPath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined));
+       Searchpath spath_env (Glib::getenv(export_env_variable_name, export_formats_path_defined));
 
        if (export_formats_path_defined) {
                spath += spath_env;
index 301914b0ae0b6ae70cd0f3a36d6f3f4b8d32a944..2c0c44033d1bab3cf50dc542fb18836e3ae61860 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "ardour/export_graph_builder.h"
 
+#include <vector>
+
 #include <glibmm/miscutils.h>
 
 #include "audiographer/process_context.h"
@@ -317,8 +319,8 @@ ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpe
 {
        std::string tmpfile_path = parent.session.session_directory().export_path();
        tmpfile_path = Glib::build_filename(tmpfile_path, "XXXXXX");
-       char tmpfile_path_buf[tmpfile_path.size() + 1];
-       std::copy(tmpfile_path.begin(), tmpfile_path.end(), tmpfile_path_buf);
+       std::vector<char> tmpfile_path_buf(tmpfile_path.size() + 1);
+       std::copy(tmpfile_path.begin(), tmpfile_path.end(), tmpfile_path_buf.begin());
        tmpfile_path_buf[tmpfile_path.size()] = '\0';
 
        config = new_config;
@@ -334,7 +336,7 @@ ExportGraphBuilder::Normalizer::Normalizer (ExportGraphBuilder & parent, FileSpe
        normalizer->add_output (threader);
 
        int format = ExportFormatBase::F_RAW | ExportFormatBase::SF_Float;
-       tmp_file.reset (new TmpFile<float> (tmpfile_path_buf, format, channels, config.format->sample_rate()));
+       tmp_file.reset (new TmpFile<float> (&tmpfile_path_buf[0], format, channels, config.format->sample_rate()));
        tmp_file->FileWritten.connect_same_thread (post_processing_connection,
                                                   boost::bind (&Normalizer::start_post_processing, this));
 
index 4a6b0552c5bfce4d98512dbe0274a0ebb32b089f..5710ecc45213624d2749bff190b5c41903cb3608 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "ardour/export_handler.h"
 
+#include <glib/gstdio.h>
 #include <glibmm.h>
 #include <glibmm/convert.h>
 
@@ -415,10 +416,10 @@ ExportHandler::export_cd_marker_file (ExportTimespanPtr timespan, ExportFormatSp
 
        } catch (std::exception& e) {
                error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg;
-               ::unlink (filepath.c_str());
+               ::g_unlink (filepath.c_str());
        } catch (Glib::Exception& e) {
                error << string_compose (_("an error occured while writing a TOC/CUE file: %1"), e.what()) << endmsg;
-               ::unlink (filepath.c_str());
+               ::g_unlink (filepath.c_str());
        }
 }
 
index 42e494c0cb3c9e1d56f289085149c3d7cae0f678..7ff4282c74bcdea5ee64ff28ce57313689cda6bc 100644 (file)
@@ -685,7 +685,7 @@ ExportProfileManager::FormatStatePtr
 ExportProfileManager::deserialize_format (XMLNode & root)
 {
        XMLProperty * prop;
-       UUID id;
+       PBD::UUID id;
 
        if ((prop = root.property ("id"))) {
                id = prop->value();
index 09214981861f142536d714b894b44adeb8e2d2a1..e06b3d624ef09adadc3b7f3131be8074d9fbe4bf 100644 (file)
@@ -51,7 +51,7 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace Glib;
 
-PBD::Signal3<int,std::string,std::string,std::vector<std::string> > FileSource::AmbiguousFileName;
+PBD::Signal2<int,std::string,std::vector<std::string> > FileSource::AmbiguousFileName;
 
 FileSource::FileSource (Session& session, DataType type, const string& path, const string& origin, Source::Flag flag)
        : Source(session, type, path, flag)
@@ -240,19 +240,15 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
        isnew = false;
 
         if (!Glib::path_is_absolute (path)) {
-                vector<string> dirs;
                 vector<string> hits;
                 string fullpath;
+               std::vector<std::string> dirs = s.source_search_path (type);
 
-                string search_path = s.source_search_path (type);
-
-                if (search_path.length() == 0) {
+                if (dirs.size() == 0) {
                         error << _("FileSource: search path not set") << endmsg;
                         goto out;
                 }
 
-                split (search_path, dirs, ':');
-
                 hits.clear ();
 
                 for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
@@ -296,7 +292,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
 
                        /* more than one match: ask the user */
 
-                        int which = FileSource::AmbiguousFileName (path, search_path, de_duped_hits).get_value_or (-1);
+                        int which = FileSource::AmbiguousFileName (path, de_duped_hits).get_value_or (-1);
 
                         if (which < 0) {
                                 goto out;
@@ -310,8 +306,7 @@ FileSource::find (Session& s, DataType type, const string& path, bool must_exist
 
                         if (must_exist) {
                                 error << string_compose(
-                                        _("Filesource: cannot find required file (%1): while searching %2"),
-                                        path, search_path) << endmsg;
+                                        _("Filesource: cannot find required file (%1)"), path) << endmsg;
                                 goto out;
                         } else {
                                 isnew = true;
@@ -357,8 +352,6 @@ bool
 FileSource::find_2X (Session& s, DataType type, const string& path, bool must_exist,
                      bool& isnew, uint16_t& chan, string& found_path)
 {
-       string search_path = s.source_search_path (type);
-
        string pathstr = path;
        string::size_type pos;
        bool ret = false;
@@ -369,18 +362,17 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex
 
                /* non-absolute pathname: find pathstr in search path */
 
-               vector<string> dirs;
+               vector<string> dirs = s.source_search_path (type);
+
                int cnt;
                string fullpath;
                string keeppath;
 
-               if (search_path.length() == 0) {
+               if (dirs.size() == 0) {
                        error << _("FileSource: search path not set") << endmsg;
                        goto out;
                }
 
-               split (search_path, dirs, ':');
-
                cnt = 0;
 
                for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
@@ -437,16 +429,15 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex
                if (cnt > 1) {
 
                        error << string_compose (
-                                       _("FileSource: \"%1\" is ambigous when searching %2\n\t"),
-                                       pathstr, search_path) << endmsg;
+                                       _("FileSource: \"%1\" is ambigous when searching\n\t"), pathstr) << endmsg;
                        goto out;
 
                } else if (cnt == 0) {
 
                        if (must_exist) {
                                error << string_compose(
-                                               _("Filesource: cannot find required file (%1): while searching %2"),
-                                               pathstr, search_path) << endmsg;
+                                               _("Filesource: cannot find required file (%1): while searching")
+                                               , pathstr) << endmsg;
                                goto out;
                        } else {
                                isnew = true;
@@ -496,13 +487,14 @@ FileSource::find_2X (Session& s, DataType type, const string& path, bool must_ex
                                goto out;
                        }
 
+#ifndef PLATFORM_WINDOWS
                        if (errno != ENOENT) {
                                error << string_compose(
                                                _("Filesource: cannot check for existing file (%1): %2"),
                                                path, strerror (errno)) << endmsg;
                                goto out;
                        }
-
+#endif
                        /* a new file */
                        isnew = true;
                        ret = true;
index 73bfaff137f726c0b9854d9516d552ebf8d7e958..54f7508b659d92ce55b34410dcbbd1fb35b26f1b 100644 (file)
@@ -86,49 +86,71 @@ user_config_directory ()
 std::string
 ardour_dll_directory ()
 {
+#ifdef PLATFORM_WINDOWS
+       std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL));
+       dll_dir_path = Glib::build_filename (dll_dir_path, "lib");
+       return Glib::build_filename (dll_dir_path, "ardour3");
+#else
        std::string s = Glib::getenv("ARDOUR_DLL_PATH");
        if (s.empty()) {
                std::cerr << _("ARDOUR_DLL_PATH not set in environment - exiting\n");
                ::exit (1);
        }       
        return s;
+#endif
+}
+
+#ifdef PLATFORM_WINDOWS
+Searchpath
+windows_search_path ()
+{
+       std::string dll_dir_path(g_win32_get_package_installation_directory_of_module(NULL));
+       dll_dir_path = Glib::build_filename (dll_dir_path, "share");
+       return Glib::build_filename (dll_dir_path, "ardour3");
 }
+#endif
 
-SearchPath
+Searchpath
 ardour_config_search_path ()
 {
-       static SearchPath search_path;
+       static Searchpath search_path;
 
        if (search_path.empty()) {
                search_path += user_config_directory();
-               
+#ifdef PLATFORM_WINDOWS
+               search_path += windows_search_path ();
+#else
                std::string s = Glib::getenv("ARDOUR_CONFIG_PATH");
                if (s.empty()) {
                        std::cerr << _("ARDOUR_CONFIG_PATH not set in environment - exiting\n");
                        ::exit (1);
                }
                
-               search_path += SearchPath (s);
+               search_path += Searchpath (s);
+#endif
        }
 
        return search_path;
 }
 
-SearchPath
+Searchpath
 ardour_data_search_path ()
 {
-       static SearchPath search_path;
+       static Searchpath search_path;
 
        if (search_path.empty()) {
                search_path += user_config_directory();
-               
+#ifdef PLATFORM_WINDOWS
+               search_path += windows_search_path ();
+#else
                std::string s = Glib::getenv("ARDOUR_DATA_PATH");
                if (s.empty()) {
                        std::cerr << _("ARDOUR_DATA_PATH not set in environment - exiting\n");
                        ::exit (1);
                }
                
-               search_path += SearchPath (s);
+               search_path += Searchpath (s);
+#endif
        }
 
        return search_path;
index f0a034d8d434301546a17608b3f9b572d9a36955..afcbe7393b0f50c32e06fb0e6630d16b9e44b808 100644 (file)
@@ -27,6 +27,7 @@
 #include <glibmm/miscutils.h>
 
 #include "pbd/compose.h"
+#include "pbd/pathexpand.h"
 #include "pbd/error.h"
 
 #include "ardour/filename_extensions.h"
@@ -43,16 +44,10 @@ int
 find_session (string str, string& path, string& snapshot, bool& isnew)
 {
        struct stat statbuf;
-       char buf[PATH_MAX+1];
 
        isnew = false;
 
-       if (!realpath (str.c_str(), buf) && (errno != ENOENT && errno != ENOTDIR)) {
-               error << string_compose (_("Could not resolve path: %1 (%2)"), buf, strerror(errno)) << endmsg;
-               return -1;
-       }
-
-       str = buf;
+       str = canonical_path (str);
 
        /* check to see if it exists, and what it is */
 
index aac7709f90da8c7c1dd610f552870d9e1ddc6c0a..0cda9ebdf404fe81773763aad7e8f8610cbeaf87 100644 (file)
 #include "libardour-config.h"
 #endif
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <cstdio> // Needed so that libraptor (included in lrdf) won't complain
 #include <cstdlib>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/time.h>
+#ifndef PLATFORM_WINDOWS
 #include <sys/resource.h>
+#endif
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -43,7 +49,7 @@
 #include "ardour/audio_unit.h"
 #endif
 
-#ifdef __SSE__
+#if defined(__SSE__) || defined(USE_XMMINTRIN)
 #include <xmmintrin.h>
 #endif
 
@@ -54,7 +60,9 @@
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
 
+#ifdef HAVE_LRDF
 #include <lrdf.h>
+#endif
 
 #include "pbd/cpus.h"
 #include "pbd/error.h"
@@ -196,6 +204,7 @@ setup_hardware_optimization (bool try_optimization)
 static void
 lotsa_files_please ()
 {
+#ifndef PLATFORM_WINDOWS
        struct rlimit rl;
 
        if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
@@ -216,6 +225,7 @@ lotsa_files_please ()
        } else {
                error << string_compose (_("Could not get system open files limit (%1)"), strerror (errno)) << endmsg;
        }
+#endif
 }
 
 bool
@@ -262,7 +272,9 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
        // allow ardour the absolute maximum number of open files
        lotsa_files_please ();
 
+#ifdef HAVE_LRDF
        lrdf_init();
+#endif
        Library = new AudioLibrary;
 
        BootMessage (_("Loading configuration"));
@@ -358,7 +370,9 @@ int
 ARDOUR::cleanup ()
 {
        delete Library;
+#ifdef HAVE_LRDF
        lrdf_cleanup ();
+#endif
        delete &ControlProtocolManager::instance();
 #ifdef WINDOWS_VST_SUPPORT
        fst_exit ();
@@ -375,7 +389,7 @@ void
 ARDOUR::find_bindings_files (map<string,string>& files)
 {
        vector<std::string> found;
-       SearchPath spath = ardour_config_search_path();
+       Searchpath spath = ardour_config_search_path();
 
        if (getenv ("ARDOUR_SAE")) {
                Glib::PatternSpec pattern("*SAE-*.bindings");
@@ -570,10 +584,21 @@ clock_gettime (int /*clk_id*/, struct timespec *t)
 microseconds_t
 ARDOUR::get_microseconds ()
 {
+#ifdef PLATFORM_WINDOWS
+       microseconds_t ret = 0;
+       LARGE_INTEGER freq, time;
+
+       if (QueryPerformanceFrequency(&freq))
+               if (QueryPerformanceCounter(&time))
+                       ret = (microseconds_t)((time.QuadPart * 1000000) / freq.QuadPart);
+
+       return ret;
+#else
        struct timespec ts;
        if (clock_gettime (CLOCK_MONOTONIC, &ts) != 0) {
                /* EEEK! */
                return 0;
        }
        return (microseconds_t) ts.tv_sec * 1000000 + (ts.tv_nsec/1000);
+#endif
 }
index b37de547cdf3e32617cdb265460c26c2d71af6bd..69c49532725f4d8588a1250327dcfe5d06f3f088 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "pbd/compose.h"
 #include "pbd/debug_rt_alloc.h"
+#include "pbd/pthread_utils.h"
 
 #include "ardour/debug.h"
 #include "ardour/graph.h"
@@ -365,7 +366,7 @@ Graph::run_one()
        /* update the number of threads that will still be sleeping */
         _execution_tokens -= wakeup;
 
-        DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 signals %2\n", pthread_self(), wakeup));
+        DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 signals %2\n", pthread_name(), wakeup));
 
         for (int i = 0; i < wakeup; i++) {
                 _execution_sem.signal ();
@@ -374,12 +375,12 @@ Graph::run_one()
         while (to_run == 0) {
                 _execution_tokens += 1;
                 pthread_mutex_unlock (&_trigger_mutex);
-                DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_self()));
+                DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 goes to sleep\n", pthread_name()));
                 _execution_sem.wait ();
                 if (_quit_threads) {
                         return true;
                 }
-                DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_self()));
+                DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 is awake\n", pthread_name()));
                 pthread_mutex_lock (&_trigger_mutex);
                 if (_trigger_queue.size()) {
                         to_run = _trigger_queue.back();
@@ -391,7 +392,7 @@ Graph::run_one()
         to_run->process();
         to_run->finish (_current_chain);
 
-        DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_self()));
+        DEBUG_TRACE(DEBUG::ProcessThreads, string_compose ("%1 has finished run_one()\n", pthread_name()));
 
         return false;
 }
@@ -559,7 +560,7 @@ Graph::process_one_route (Route* route)
 
         assert (route);
 
-        DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_self(), route->name()));
+        DEBUG_TRACE (DEBUG::ProcessThreads, string_compose ("%1 runs route %2\n", pthread_name(), route->name()));
 
         if (_process_silent) {
                 retval = route->silent_roll (_process_nframes, _process_start_frame, _process_end_frame, need_butler);
index 047b46f55305d5ff68d3beda87e0623ce60abe7d..b66f3542249bcb042e771c8e405bd97ff57fbbf4 100644 (file)
@@ -34,6 +34,7 @@
 #include <sndfile.h>
 #include <samplerate.h>
 
+#include <glib/gstdio.h>
 #include <glibmm.h>
 
 #include <boost/scoped_array.hpp>
@@ -117,7 +118,7 @@ open_importable_source (const string& path, framecnt_t samplerate, ARDOUR::SrcQu
 }
 
 static std::string
-get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_replacing, const std::string& destdir, const std::string& basename, uint channel, uint channels)
+get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_replacing, const std::string& destdir, const std::string& basename, uint32_t channel, uint32_t channels)
 {
        char buf[PATH_MAX+1];
        bool goodfile = false;
@@ -172,14 +173,14 @@ get_non_existent_filename (HeaderFormat hf, DataType type, const bool allow_repl
 }
 
 static vector<string>
-get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const string& import_file_path, const string& session_dir, uint channels)
+get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const string& import_file_path, const string& session_dir, uint32_t channels)
 {
        vector<string> new_paths;
        const string basename = basename_nosuffix (import_file_path);
 
        SessionDirectory sdir(session_dir);
 
-       for (uint n = 0; n < channels; ++n) {
+       for (uint32_t n = 0; n < channels; ++n) {
 
                const DataType type = SMFSource::safe_midi_file_extension (import_file_path) ? DataType::MIDI : DataType::AUDIO;
 
@@ -196,7 +197,7 @@ get_paths_for_new_sources (HeaderFormat hf, const bool allow_replacing, const st
 
 static bool
 map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/,
-                           uint /*samplerate*/, vector<boost::shared_ptr<Source> >& newfiles, Session *session)
+                           uint32_t /*samplerate*/, vector<boost::shared_ptr<Source> >& newfiles, Session *session)
 {
        for (vector<string>::const_iterator i = new_paths.begin();
             i != new_paths.end(); ++i)
@@ -215,7 +216,7 @@ map_existing_mono_sources (const vector<string>& new_paths, Session& /*sess*/,
 
 static bool
 create_mono_sources_for_writing (const vector<string>& new_paths,
-                                 Session& sess, uint samplerate,
+                                 Session& sess, uint32_t samplerate,
                                  vector<boost::shared_ptr<Source> >& newfiles,
                                  framepos_t timeline_position)
 {
@@ -253,10 +254,10 @@ create_mono_sources_for_writing (const vector<string>& new_paths,
 
 static string
 compose_status_message (const string& path,
-                        uint file_samplerate,
-                        uint session_samplerate,
-                        uint /* current_file */,
-                        uint /* total_files */)
+                        uint32_t file_samplerate,
+                        uint32_t session_samplerate,
+                        uint32_t /* current_file */,
+                        uint32_t /* total_files */)
 {
        if (file_samplerate != session_samplerate) {
                return string_compose (_("Resampling %1 from %2kHz to %3kHz"),
@@ -274,12 +275,12 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
 {
        const framecnt_t nframes = ResampledImportableSource::blocksize;
        boost::shared_ptr<AudioFileSource> afs;
-       uint channels = source->channels();
+       uint32_t channels = source->channels();
 
        boost::scoped_array<float> data(new float[nframes * channels]);
        vector<boost::shared_array<Sample> > channel_data;
 
-       for (uint n = 0; n < channels; ++n) {
+       for (uint32_t n = 0; n < channels; ++n) {
                channel_data.push_back(boost::shared_array<Sample>(new Sample[nframes]));
        }
 
@@ -300,7 +301,7 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
                */
 
                float peak = 0;
-               uint read_count = 0;
+               uint32_t read_count = 0;
 
                while (!status.cancel) {
                        framecnt_t const nread = source->read (data.get(), nframes);
@@ -324,15 +325,23 @@ write_audio_data_to_new_files (ImportableSource* source, ImportStatus& status,
                progress_base = 0.5;
        }
 
-       uint read_count = 0;
+       uint32_t read_count = 0;
 
        while (!status.cancel) {
 
                framecnt_t nread, nfread;
-               uint x;
-               uint chn;
+               uint32_t x;
+               uint32_t chn;
 
                if ((nread = source->read (data.get(), nframes)) == 0) {
+#ifdef PLATFORM_WINDOWS
+                       /* Flush the data once we've finished importing the file. Windows can  */
+                       /* cache the data for very long periods of time (perhaps not writing   */
+                       /* it to disk until Ardour closes). So let's force it to flush now.    */
+                       for (chn = 0; chn < channels; ++chn)
+                               if ((afs = boost::dynamic_pointer_cast<AudioFileSource>(newfiles[chn])) != 0)
+                                       afs->flush ();
+#endif
                        break;
                }
 
@@ -464,7 +473,7 @@ remove_file_source (boost::shared_ptr<Source> source)
        boost::shared_ptr<FileSource> fs = boost::dynamic_pointer_cast<FileSource> (source);
 
        if (fs) {
-               ::unlink (fs->path().c_str());
+               ::g_unlink (fs->path().c_str());
        }
 }
 
@@ -479,7 +488,7 @@ Session::import_files (ImportStatus& status)
        Sources all_new_sources;
        boost::shared_ptr<AudioFileSource> afs;
        boost::shared_ptr<SMFSource> smfs;
-       uint channels = 0;
+       uint32_t channels = 0;
 
        status.sources.clear ();
 
index 6f5b5a63dae90167970fda91ef78b6e51a72ea5f..ebd295411e9cdfaf3d5198e0c36f0a737cd86d92 100644 (file)
@@ -19,6 +19,7 @@
 #include <fstream>
 #include <algorithm>
 #include <cmath>
+#include <vector>
 
 #include <unistd.h>
 #include <locale.h>
@@ -395,7 +396,9 @@ IO::disconnect (void* src)
 int
 IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed)
 {
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
+#endif
 
        boost::shared_ptr<Port> port;
 
@@ -466,7 +469,9 @@ IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed)
 int
 IO::ensure_ports (ChanCount count, bool clear, void* src)
 {
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
+#endif
 
        bool changed = false;
 
@@ -501,7 +506,9 @@ IO::ensure_ports (ChanCount count, bool clear, void* src)
 int
 IO::ensure_io (ChanCount count, bool clear, void* src)
 {
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
+#endif
 
        return ensure_ports (count, clear, src);
 }
@@ -1373,20 +1380,20 @@ IO::build_legal_port_name (DataType type)
 
        limit = name_size - AudioEngine::instance()->my_name().length() - (suffix.length() + 5);
 
-       char buf1[name_size+1];
-       char buf2[name_size+1];
+       std::vector<char> buf1(name_size+1);
+       std::vector<char> buf2(name_size+1);
 
        /* colons are illegal in port names, so fix that */
 
        string nom = _name.val();
        replace_all (nom, ":", ";");
 
-       snprintf (buf1, name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str());
+       snprintf (&buf1[0], name_size+1, ("%.*s/%s"), limit, nom.c_str(), suffix.c_str());
 
-       int port_number = find_port_hole (buf1);
-       snprintf (buf2, name_size+1, "%s %d", buf1, port_number);
+       int port_number = find_port_hole (&buf1[0]);
+       snprintf (&buf2[0], name_size+1, "%s %d", &buf1[0], port_number);
 
-       return string (buf2);
+       return string (&buf2[0]);
 }
 
 int32_t
@@ -1404,14 +1411,13 @@ IO::find_port_hole (const char* base)
         */
 
        for (n = 1; n < 9999; ++n) {
-               size_t size = AudioEngine::instance()->port_name_size() + 1;
-               char buf[size];
+               std::vector<char> buf (AudioEngine::instance()->port_name_size());
                PortSet::iterator i = _ports.begin();
 
-               snprintf (buf, size, _("%s %u"), base, n);
+               snprintf (&buf[0], jack_port_name_size(), _("%s %u"), base, n);
 
                for ( ; i != _ports.end(); ++i) {
-                       if (i->name() == buf) {
+                       if (string(i->name()) == string(&buf[0])) {
                                break;
                        }
                }
index bc3a83799bd45356424107c5b1d13509b530c7dc..8b089929b50c53ff021e59f64ea6b90de332d8d2 100644 (file)
 
 */
 
+#ifdef WAF_BUILD
+#include "libardour-config.h"
+#endif
+
 #include <inttypes.h>
 
 #include <vector>
 #include <cstdlib>
 #include <cstdio> // so libraptor doesn't complain
 #include <cmath>
+#ifndef COMPILER_MSVC
 #include <dirent.h>
+#endif
 #include <sys/stat.h>
 #include <cerrno>
 
+#ifdef HAVE_LRDF
 #include <lrdf.h>
+#endif
 
 #include "pbd/compose.h"
 #include "pbd/error.h"
@@ -50,16 +58,16 @@ using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 
-LadspaPlugin::LadspaPlugin (void *mod, AudioEngine& e, Session& session, uint32_t index, framecnt_t rate)
+LadspaPlugin::LadspaPlugin (string module_path, AudioEngine& e, Session& session, uint32_t index, framecnt_t rate)
        : Plugin (e, session)
 {
-       init (mod, index, rate);
+       init (module_path, index, rate);
 }
 
 LadspaPlugin::LadspaPlugin (const LadspaPlugin &other)
        : Plugin (other)
 {
-       init (other._module, other._index, other._sample_rate);
+       init (other._module_path, other._index, other._sample_rate);
 
        for (uint32_t i = 0; i < parameter_count(); ++i) {
                _control_data[i] = other._shadow_data[i];
@@ -68,25 +76,32 @@ LadspaPlugin::LadspaPlugin (const LadspaPlugin &other)
 }
 
 void
-LadspaPlugin::init (void *mod, uint32_t index, framecnt_t rate)
+LadspaPlugin::init (string module_path, uint32_t index, framecnt_t rate)
 {
+       void* func;
        LADSPA_Descriptor_Function dfunc;
        uint32_t i, port_cnt;
-       const char *errstr;
 
-       _module = mod;
+       _module_path = module_path;
+       _module = new Glib::Module(_module_path);
        _control_data = 0;
        _shadow_data = 0;
        _latency_control_port = 0;
        _was_activated = false;
 
-       dfunc = (LADSPA_Descriptor_Function) dlsym (_module, "ladspa_descriptor");
+       if (!(*_module)) {
+               error << _("LADSPA: Unable to open module: ") << Glib::Module::get_last_error() << endmsg;
+               delete _module;
+               throw failed_constructor();
+       }
 
-       if ((errstr = dlerror()) != NULL) {
+       if (!_module->get_symbol("ladspa_descriptor", func)) {
                error << _("LADSPA: module has no descriptor function.") << endmsg;
                throw failed_constructor();
        }
 
+       dfunc = (LADSPA_Descriptor_Function)func;
+
        if ((_descriptor = dfunc (index)) == 0) {
                error << _("LADSPA: plugin has gone away since discovery!") << endmsg;
                throw failed_constructor();
@@ -142,9 +157,8 @@ LadspaPlugin::~LadspaPlugin ()
        deactivate ();
        cleanup ();
 
-       /* XXX who should close a plugin? */
-
-        // dlclose (module);
+       // glib has internal reference counting on modules so this is ok
+       delete _module;
 
        delete [] _control_data;
        delete [] _shadow_data;
@@ -629,10 +643,11 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const
 boost::shared_ptr<Plugin::ScalePoints>
 LadspaPlugin::get_scale_points(uint32_t port_index) const
 {
+       boost::shared_ptr<Plugin::ScalePoints> ret;
+#ifdef HAVE_LRDF
        const uint32_t id     = atol(unique_id().c_str());
        lrdf_defaults* points = lrdf_get_scale_values(id, port_index);
 
-       boost::shared_ptr<Plugin::ScalePoints> ret;
        if (!points) {
                return ret;
        }
@@ -645,6 +660,7 @@ LadspaPlugin::get_scale_points(uint32_t port_index) const
        }
 
        lrdf_free_setting_values(points);
+#endif
        return ret;
 }
 
@@ -710,17 +726,7 @@ PluginPtr
 LadspaPluginInfo::load (Session& session)
 {
        try {
-               PluginPtr plugin;
-               void *module;
-
-               if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
-                       error << string_compose(_("LADSPA: cannot load module from \"%1\""), path) << endmsg;
-                       error << dlerror() << endmsg;
-                        return PluginPtr ((Plugin*) 0);
-               } else {
-                       plugin.reset (new LadspaPlugin (module, session.engine(), session, index, session.frame_rate()));
-               }
-
+               PluginPtr plugin (new LadspaPlugin (path, session.engine(), session, index, session.frame_rate()));
                plugin->set_info(PluginInfoPtr(new LadspaPluginInfo(*this)));
                return plugin;
        }
@@ -739,6 +745,7 @@ LadspaPluginInfo::LadspaPluginInfo()
 void
 LadspaPlugin::find_presets ()
 {
+#ifdef HAVE_LRDF
        uint32_t id;
        std::string unique (unique_id());
 
@@ -759,12 +766,14 @@ LadspaPlugin::find_presets ()
                }
                lrdf_free_uris(set_uris);
        }
+#endif
 }
 
 
 bool
 LadspaPlugin::load_preset (PresetRecord r)
 {
+#ifdef HAVE_LRDF
        lrdf_defaults* defs = lrdf_get_setting_values (r.uri.c_str());
 
        if (defs) {
@@ -777,6 +786,7 @@ LadspaPlugin::load_preset (PresetRecord r)
        }
 
        Plugin::load_preset (r);
+#endif
        return true;
 }
 
@@ -784,6 +794,7 @@ LadspaPlugin::load_preset (PresetRecord r)
 static void
 lrdf_remove_preset (const char* /*source*/, const char *setting_uri)
 {
+#ifdef HAVE_LRDF
        lrdf_statement p;
        lrdf_statement *q;
        lrdf_statement *i;
@@ -817,11 +828,13 @@ lrdf_remove_preset (const char* /*source*/, const char *setting_uri)
        p.predicate = NULL;
        p.object = NULL;
        lrdf_remove_matches (&p);
+#endif
 }
 
 void
 LadspaPlugin::do_remove_preset (string name)
 {
+#ifdef HAVE_LRDF
        string const envvar = preset_envvar ();
        if (envvar.empty()) {
                warning << _("Could not locate HOME.  Preset not removed.") << endmsg;
@@ -837,6 +850,7 @@ LadspaPlugin::do_remove_preset (string name)
        lrdf_remove_preset (source.c_str(), p->uri.c_str ());
 
        write_preset_file (envvar);
+#endif
 }
 
 string
@@ -859,6 +873,7 @@ LadspaPlugin::preset_source (string envvar) const
 bool
 LadspaPlugin::write_preset_file (string envvar)
 {
+#ifdef HAVE_LRDF
        string path = string_compose("%1/.ladspa", envvar);
        if (g_mkdir_with_parents (path.c_str(), 0775)) {
                warning << string_compose(_("Could not create %1.  Preset not saved. (%2)"), path, strerror(errno)) << endmsg;
@@ -879,11 +894,15 @@ LadspaPlugin::write_preset_file (string envvar)
        }
 
        return true;
+#else
+       return false;
+#endif
 }
 
 string
 LadspaPlugin::do_save_preset (string name)
 {
+#ifdef HAVE_LRDF
        /* make a vector of pids that are input parameters */
        vector<int> input_parameter_pids;
        for (uint32_t i = 0; i < parameter_count(); ++i) {
@@ -902,8 +921,8 @@ LadspaPlugin::do_save_preset (string name)
 
        lrdf_defaults defaults;
        defaults.count = input_parameter_pids.size ();
-       lrdf_portvalue portvalues[input_parameter_pids.size()];
-       defaults.items = portvalues;
+       std::vector<lrdf_portvalue> portvalues(input_parameter_pids.size());
+       defaults.items = &portvalues[0];
 
        for (vector<int>::size_type i = 0; i < input_parameter_pids.size(); ++i) {
                portvalues[i].pid = input_parameter_pids[i];
@@ -927,6 +946,9 @@ LadspaPlugin::do_save_preset (string name)
        }
 
        return uri;
+#else
+       return string();
+#endif
 }
 
 LADSPA_PortDescriptor
diff --git a/libs/ardour/ladspa_search_path.cc b/libs/ardour/ladspa_search_path.cc
new file mode 100644 (file)
index 0000000..49a2645
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+    Copyright (C) 2011 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <glibmm/miscutils.h>
+
+#include "pbd/pathexpand.h"
+
+#include "ardour/ladspa_search_path.h"
+#include "ardour/directory_names.h"
+#include "ardour/filesystem_paths.h"
+
+namespace {
+       const char * const ladspa_env_variable_name = "LADSPA_PATH";
+} // anonymous
+
+using namespace PBD;
+
+namespace ARDOUR {
+
+Searchpath
+ladspa_search_path ()
+{
+       Searchpath spath_env (Glib::getenv(ladspa_env_variable_name));
+
+       Searchpath spath (user_config_directory ());
+
+       spath += ardour_dll_directory ();
+       spath.add_subdirectory_to_paths (ladspa_dir_name);
+
+#ifndef PLATFORM_WINDOWS
+       spath.push_back ("/usr/local/lib64/ladspa");
+       spath.push_back ("/usr/local/lib/ladspa");
+       spath.push_back ("/usr/lib64/ladspa");
+       spath.push_back ("/usr/lib/ladspa");
+#endif
+
+#ifdef __APPLE__
+       spath.push_back (path_expand ("~/Library/Audio/Plug-Ins/LADSPA"));
+       spath.push_back ("/Library/Audio/Plug-Ins/LADSPA");
+#endif
+
+       return spath_env + spath;
+}
+
+} // namespace ARDOUR
index b4c4a1446bfde6e091949abaa72bc978aadbcc87..ced0226d00ea3c001267a66ac0be6280bd07b447 100644 (file)
 */
 #include <iostream>
 #include <errno.h>
-#include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include "pbd/error.h"
+#include "pbd/pthread_utils.h"
 
 #include "ardour/debug.h"
 #include "ardour/slave.h"
@@ -150,7 +150,7 @@ LTC_Slave::reset()
 }
 
 void
-LTC_Slave::parse_ltc(const pframes_t nframes, const Sample* const in, const framecnt_t posinfo)
+LTC_Slave::parse_ltc(const ARDOUR::pframes_t nframes, const Sample* const in, const ARDOUR::framecnt_t posinfo)
 {
        pframes_t i;
        unsigned char sound[8192];
@@ -432,7 +432,7 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
 
        frameoffset_t skip = now - (monotonic_cnt + nframes);
        monotonic_cnt = now;
-       DEBUG_TRACE (DEBUG::LTC, string_compose ("speed_and_position - TID:%1 | latency: %2 | skip %3\n", ::pthread_self(), ltc_slave_latency.max, skip));
+       DEBUG_TRACE (DEBUG::LTC, string_compose ("speed_and_position - TID:%1 | latency: %2 | skip %3\n", pthread_name(), ltc_slave_latency.max, skip));
 
        if (last_timestamp == 0) {
                engine_dll_initstate = 0;
@@ -591,7 +591,7 @@ LTC_Slave::approximate_current_delta() const
                snprintf(delta, sizeof(delta), "%s", _("flywheel"));
        } else {
                snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%s%" PRIi64 "</span>sm",
-                               LEADINGZERO(abs(current_delta)), PLUSMINUS(-current_delta), abs(current_delta));
+                               LEADINGZERO(llabs(current_delta)), PLUSMINUS(-current_delta), llabs(current_delta));
        }
        return std::string(delta);
 }
index d8cd1c1075221ee7d95fdd178375aa250c318df6..2454ea2ae15d2965bb1a2ca4a62eb8f51bada8b0 100644 (file)
@@ -29,10 +29,10 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 lv2_bundled_search_path ()
 {
-       SearchPath spath( ardour_dll_directory () );
+       Searchpath spath( ardour_dll_directory () );
        spath.add_subdirectory_to_paths ("LV2");
 
        return spath;
index 8942d19a9b2b038cb2ad9599939508b051250375..fba7fd521ddc42dd7aa78f63121045e804877895 100644 (file)
@@ -219,7 +219,7 @@ lv2_evbuf_get(LV2_Evbuf_Iterator iter,
                *subframes = 0;
                *type      = aev->body.type;
                *size      = aev->body.size;
-               *data      = LV2_ATOM_BODY(&aev->body);
+               *data      = (uint8_t*)LV2_ATOM_BODY(&aev->body);
                break;
        }
 
index 9538cef8b6defcafce0e865483ed8e388d284a15..6288616824c2b70c7c8689117059e7b5f57717eb 100644 (file)
@@ -25,6 +25,7 @@
 #include <cstdlib>
 #include <cstring>
 
+#include <glib/gstdio.h>
 #include <giomm/file.h>
 #include <glib/gprintf.h>
 #include <glibmm.h>
@@ -1104,7 +1105,7 @@ LV2Plugin::do_remove_preset(string name)
                        name + ".ttl"
                )
        );
-       unlink(preset_file.c_str());
+       ::g_unlink(preset_file.c_str());
 }
 
 bool
@@ -1132,16 +1133,16 @@ LV2Plugin::write_to(RingBuffer<uint8_t>* dest,
                     uint32_t             size,
                     const uint8_t*       body)
 {
-       const uint32_t buf_size = sizeof(UIMessage) + size;
-       uint8_t        buf[buf_size];
+       const uint32_t  buf_size = sizeof(UIMessage) + size;
+       vector<uint8_t> buf(buf_size);
 
-       UIMessage* msg = (UIMessage*)buf;
+       UIMessage* msg = (UIMessage*)&buf[0];
        msg->index    = index;
        msg->protocol = protocol;
        msg->size     = size;
        memcpy(msg + 1, body, size);
 
-       return (dest->write(buf, buf_size) == buf_size);
+       return (dest->write(&buf[0], buf_size) == buf_size);
 }
 
 bool
@@ -1212,13 +1213,13 @@ LV2Plugin::emit_to_ui(void* controller, UIMessageSink sink)
                        error << "Error reading from Plugin=>UI RingBuffer" << endmsg;
                        break;
                }
-               uint8_t body[msg.size];
-               if (_to_ui->read(body, msg.size) != msg.size) {
+               vector<uint8_t> body(msg.size);
+               if (_to_ui->read(&body[0], msg.size) != msg.size) {
                        error << "Error reading from Plugin=>UI RingBuffer" << endmsg;
                        break;
                }
 
-               sink(controller, msg.index, msg.size, msg.protocol, body);
+               sink(controller, msg.index, msg.size, msg.protocol, &body[0]);
 
                read_space -= sizeof(msg) + msg.size;
        }
@@ -1693,15 +1694,15 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
                                error << "Error reading from UI=>Plugin RingBuffer" << endmsg;
                                break;
                        }
-                       uint8_t body[msg.size];
-                       if (_from_ui->read(body, msg.size) != msg.size) {
+                       vector<uint8_t> body(msg.size);
+                       if (_from_ui->read(&body[0], msg.size) != msg.size) {
                                error << "Error reading from UI=>Plugin RingBuffer" << endmsg;
                                break;
                        }
                        if (msg.protocol == urids.atom_eventTransfer) {
                                LV2_Evbuf*            buf  = _ev_buffers[msg.index];
                                LV2_Evbuf_Iterator    i    = lv2_evbuf_end(buf);
-                               const LV2_Atom* const atom = (const LV2_Atom*)body;
+                               const LV2_Atom* const atom = (const LV2_Atom*)&body[0];
                                if (!lv2_evbuf_write(&i, nframes, 0, atom->type, atom->size,
                                                (const uint8_t*)(atom + 1))) {
                                        error << "Failed to write data to LV2 event buffer\n";
@@ -2007,7 +2008,7 @@ LV2World::load_bundled_plugins()
                vector<string *> *plugin_objects = scanner (ARDOUR::lv2_bundled_search_path().to_string(), lv2_filter, 0, true, true);
                if (plugin_objects) {
                        for ( vector<string *>::iterator x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
-#ifdef WINDOWS
+#ifdef PLATFORM_WINDOWS
                                string uri = "file:///" + **x + "/";
 #else
                                string uri = "file://" + **x + "/";
index a7857f58596d3546a64a52979a9bfdbebaf8b2a9..6c5470bbb942b20de692e450248ba6fcea2fac9b 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <algorithm>
 #include <cmath>
+#include <limits>
 
 #include "pbd/compose.h"
 
@@ -149,7 +150,7 @@ void
 PeakMeter::reset_max ()
 {
        for (size_t i = 0; i < _max_peak_power.size(); ++i) {
-               _max_peak_power[i] = -INFINITY;
+               _max_peak_power[i] = -std::numeric_limits<float>::infinity();
                _max_peak_signal[i] = 0;
        }
 
@@ -159,7 +160,7 @@ PeakMeter::reset_max ()
                if (n < n_midi) {
                        _visible_peak_power[n] = 0;
                } else {
-                       _visible_peak_power[n] = -INFINITY;
+                       _visible_peak_power[n] = -std::numeric_limits<float>::infinity();
                }
        }
 }
@@ -298,7 +299,7 @@ PeakMeter::meter ()
                _peak_signal[n] = 0;              /* ... to here */
 
                if (n < n_midi) {
-                       _max_peak_power[n] = -INFINITY; // std::max (new_peak, _max_peak_power[n]); // XXX
+                       _max_peak_power[n] = -std::numeric_limits<float>::infinity(); // std::max (new_peak, _max_peak_power[n]); // XXX
                        _max_peak_signal[n] = 0;
                        if (midi_meter_falloff == 0.0f || new_peak > _visible_peak_power[n]) {
                                ;
@@ -332,7 +333,7 @@ PeakMeter::meter ()
                } else {
                        // do falloff
                        new_peak = _visible_peak_power[n] - (audio_meter_falloff);
-                       _visible_peak_power[n] = std::max (new_peak, -INFINITY);
+                       _visible_peak_power[n] = std::max (new_peak, -std::numeric_limits<float>::infinity());
                }
        }
 }
index 7eaeeb9e07a5fe75551675a7502433d7c68f3c95..a52854d954be24cfd56b7f49fda8100d5fc4cc7e 100644 (file)
@@ -20,7 +20,6 @@
 
 #include <cmath>
 #include <errno.h>
-#include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include "pbd/error.h"
@@ -253,7 +252,7 @@ MIDIClock_Slave::stop (Parser& /*parser*/, framepos_t /*timestamp*/)
 }
 
 void
-MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size)
+MIDIClock_Slave::position (Parser& /*parser*/, MIDI::byte* message, size_t size)
 {
        // we are note supposed to get position messages while we are running
        // so lets be robust and ignore those
@@ -262,8 +261,8 @@ MIDIClock_Slave::position (Parser& /*parser*/, byte* message, size_t size)
        }
 
        assert(size == 3);
-       byte lsb = message[1];
-       byte msb = message[2];
+       MIDI::byte lsb = message[1];
+       MIDI::byte msb = message[2];
        assert((lsb <= 0x7f) && (msb <= 0x7f));
 
        uint16_t position_in_sixteenth_notes = (uint16_t(msb) << 7) | uint16_t(lsb);
index 4771f7128cf7ac3e6263e07273be7fd456f42fd9..a1a640cd1c08475391d3ab34c44464f2a2dfc63b 100644 (file)
 #include <fcntl.h>
 #include <cstdlib>
 #include <ctime>
-#include <strings.h> // for ffs(3)
 #include <sys/stat.h>
-#include <sys/mman.h>
 
 #include "pbd/error.h"
+#include "pbd/ffs.h"
 #include "pbd/basename.h"
 #include <glibmm/threads.h>
 #include "pbd/xml++.h"
@@ -439,7 +438,7 @@ MidiDiskstream::process (BufferSet& bufs, framepos_t transport_frame, pframes_t
                                break;
                        case ForceChannel:
                                if (ev.is_channel_event()) {
-                                       ev.set_channel (ffs(mask) - 1);
+                                       ev.set_channel (PBD::ffs(mask) - 1);
                                }
                                _capture_buf->write(transport_frame + loop_offset + ev.time(),
                                                    ev.type(), ev.size(), ev.buffer());
index 4bced4e46dbaabc89112d28acf20a3de57f2e31c..f2d964bb77ba0acb2554a40401c5ea11ee76843e 100644 (file)
@@ -28,6 +28,7 @@
 #include "ardour/session.h"
 #include "ardour/session_directory.h"
 #include "ardour/midi_patch_manager.h"
+
 #include "ardour/midi_patch_search_path.h"
 
 #include "i18n.h"
@@ -102,7 +103,7 @@ MidiPatchManager::refresh()
        _master_devices_by_model.clear();
        _all_models.clear();
 
-       SearchPath search_path = midi_patch_search_path ();
+       Searchpath search_path = midi_patch_search_path ();
        Glib::PatternSpec pattern (string("*.midnam"));
        vector<std::string> result;
 
index ccad1de4664c482cce83f8201dc39e7a3fa703a1..c099c379e94926d3ee65ec76c02e9f0baf3a01b1 100644 (file)
@@ -31,14 +31,14 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 midi_patch_search_path ()
 {
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(midi_patch_dir_name);
 
        bool midi_patch_path_defined = false;
-       SearchPath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined));
+       Searchpath spath_env (Glib::getenv(midi_patch_env_variable_name, midi_patch_path_defined));
 
        if (midi_patch_path_defined) {
                spath += spath_env;
index 124d3f7c9bf11b4443befe29d068bbce86bcf074..1887b74302104db67fc2018d8bc3bb43f5d5994e 100644 (file)
@@ -20,7 +20,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <fcntl.h>
-#include <poll.h>
 #include <float.h>
 #include <cerrno>
 #include <ctime>
index 7dff7ac639768ae1bfc13292ecbe2c1d4fce356c..6a998de90e42b1c1565a3fbf938b4dcd03836ab6 100644 (file)
@@ -17,8 +17,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <strings.h> // for ffs(3)
-
+#include "pbd/ffs.h"
 #include "pbd/enumwriter.h"
 #include "pbd/convert.h"
 #include "evoral/midi_util.h"
@@ -321,7 +320,7 @@ MidiTrack::roll (pframes_t nframes, framepos_t start_frame, framepos_t end_frame
        if (!lm.locked()) {
                boost::shared_ptr<MidiDiskstream> diskstream = midi_diskstream();
                framecnt_t playback_distance = diskstream->calculate_playback_distance(nframes);
-               if (can_internal_playback_seek(std::llabs(playback_distance))) {
+               if (can_internal_playback_seek(llabs(playback_distance))) {
                        /* TODO should declick, and/or note-off */
                        internal_playback_seek(playback_distance);
                }
@@ -513,7 +512,7 @@ MidiTrack::filter_channels (BufferSet& bufs, ChannelMode mode, uint32_t mask)
                                }
                                break;
                        case ForceChannel:
-                               ev.set_channel (ffs (mask) - 1);
+                               ev.set_channel (PBD::ffs (mask) - 1);
                                ++e;
                                break;
                        case AllChannels:
@@ -633,9 +632,9 @@ void
 MidiTrack::MidiControl::set_value(double val)
 {
        bool valid = false;
-       if (std::isinf(val)) {
+       if (isinf(val)) {
                cerr << "MIDIControl value is infinity" << endl;
-       } else if (std::isnan(val)) {
+       } else if (isnan(val)) {
                cerr << "MIDIControl value is NaN" << endl;
        } else if (val < _list->parameter().min()) {
                cerr << "MIDIControl value is < " << _list->parameter().min() << endl;
index 7346c0244ca92287008494bc0b9f886658f90ac7..e6d49175bd143ac4b9f4154732f170b1ad73f3fa 100644 (file)
@@ -93,7 +93,9 @@ MidiControlUI::midi_input_handler (IOCondition ioc, AsyncMIDIPort* port)
 
        if (ioc & IO_IN) {
 
+#ifndef PLATFORM_WINDOWS
                CrossThreadChannel::drain (port->selectable());
+#endif
 
                DEBUG_TRACE (DEBUG::MidiIO, string_compose ("data available on %1\n", ((ARDOUR::Port*)port)->name()));
                framepos_t now = _session.engine().sample_time();
index 3a873a8e5049d9e091ef9cd43cfdc5cefdb6fe08..220cd0660c205c3a9889c8d9090dff0d9ab37222 100644 (file)
@@ -24,6 +24,8 @@
 #include "ardour/runtime_functions.h"
 #include <stdint.h>
 
+using std::min;
+using std::max;
 using namespace ARDOUR;
 
 #if defined (ARCH_X86) && defined (BUILD_SSE_OPTIMIZATIONS)
@@ -93,22 +95,22 @@ default_compute_peak (const ARDOUR::Sample * buf, pframes_t nsamples, float curr
 }
 
 void
-default_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *min, float *max)
+default_find_peaks (const ARDOUR::Sample * buf, pframes_t nframes, float *minf, float *maxf)
 {
        pframes_t i;
        float a, b;
 
-       a = *max;
-       b = *min;
+       a = *maxf;
+       b = *minf;
 
        for (i = 0; i < nframes; i++)
        {
-               a = fmax (buf[i], a);
-               b = fmin (buf[i], b);
+               a = max (buf[i], a);
+               b = min (buf[i], b);
        }
 
-       *max = a;
-       *min = b;
+       *maxf = a;
+       *minf = b;
 }
 
 void
diff --git a/libs/ardour/msvc/msvc_libardour.cc b/libs/ardour/msvc/msvc_libardour.cc
new file mode 100644 (file)
index 0000000..bd18672
--- /dev/null
@@ -0,0 +1,276 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#if (defined(PLATFORM_WINDOWS) && !defined(COMPILER_CYGWIN))
+#include <shlobj.h>
+#include <glibmm.h>
+#ifdef COMPILER_MSVC
+#pragma warning(disable:4996)
+#endif
+#else
+#include <glib.h>
+#endif
+
+#include <string.h>
+#include <stdlib.h>
+#include <ardour/msvc_libardour.h>
+
+namespace ARDOUR {
+
+//***************************************************************
+//
+// placeholder_for_non_msvc_specific_function()
+//
+// Description
+//
+//     Returns:
+//
+//    On Success:
+//
+//    On Failure:
+//
+/* LIBARDOUR_API char* LIBARDOUR_APICALLTYPE
+   placeholder_for_non_msvc_specific_function()
+{
+char *pRet = buffer;
+
+       return (pRet);
+}
+*/
+
+}  // namespace ARDOUR
+
+#ifdef COMPILER_MSVC
+
+#include <errno.h>
+
+namespace ARDOUR {
+
+//***************************************************************
+//
+//     symlink()
+//
+// Emulates POSIX symlink() but creates a Windows shortcut. To
+// create a Windows shortcut the supplied shortcut name must end
+// in ".lnk"
+// Note that you can only create a shortcut in a folder for which
+// you have appropriate access rights. Note also that the folder
+// must already exist. If it doesn't exist or if you don't have
+// sufficient access rights to it, symlink() will generate an
+// error (in common with its POSIX counterpart).
+//
+//     Returns:
+//
+//    On Success: Zero
+//    On Failure: -1 ('errno' will contain the specific error)
+//
+LIBARDOUR_API int LIBARDOUR_APICALLTYPE
+symlink(const char *dest, const char *shortcut, const char *working_directory /*= NULL */)
+{
+IShellLinkA  *pISL = NULL;    
+IPersistFile *ppf  = NULL;
+int           ret  = (-1);
+
+       if ((NULL == dest) || (NULL == shortcut) || (strlen(shortcut) < 5) || (strlen(dest) == 0))
+               _set_errno(EINVAL);
+       else if ((strlen(shortcut) > _MAX_PATH) || (strlen(dest) > _MAX_PATH))
+               _set_errno(ENAMETOOLONG);
+       else if (Glib::file_test(shortcut, Glib::FILE_TEST_EXISTS))
+               _set_errno(EEXIST);
+       else
+       {
+               HRESULT hRet = 0;
+
+               if (SUCCEEDED (hRet = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pISL)))
+               {
+                       if (SUCCEEDED (pISL->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf)))
+                       {
+                               char  sc_path_lower_case[_MAX_PATH];
+                               WCHAR shortcut_path[_MAX_PATH];
+
+                               // Fail if the path isn't a shortcut
+                               strcpy(sc_path_lower_case, shortcut);
+                               strlwr(sc_path_lower_case);
+                               const char *p = strlen(sc_path_lower_case) + sc_path_lower_case - 4;
+
+                               if (0 == strcmp(p, ".lnk"))
+                               {
+                                       HRESULT hr;
+
+                                       // We're apparently been given valid Windows shortcut name
+                                       MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, shortcut, -1, shortcut_path, _MAX_PATH);
+
+                                       // Create the shortcut
+                                       if (FAILED (hr = ppf->Load(shortcut_path, STGM_CREATE|STGM_READWRITE|STGM_SHARE_EXCLUSIVE)))
+                                               hr = ppf->Save(shortcut_path, TRUE);
+
+                                       if (S_OK == hr)
+                                       {
+                                               // Set its target path
+                                               if (S_OK == pISL->SetPath(dest))
+                                               {
+                                                       // Set its working directory
+                                                       if (working_directory)
+                                                               p = working_directory;
+                                                       else
+                                                               p = "";
+
+                                                       if (S_OK == pISL->SetWorkingDirectory(p))
+                                                       {
+                                                               // Set its 'Show' command
+                                                               if (S_OK == pISL->SetShowCmd(SW_SHOWNORMAL))
+                                                               {
+                                                                       // And finally, set its icon to the same file as the target.
+                                                                       // For the time being, don't fail if the target has no icon.
+                                                       if (Glib::file_test(dest, Glib::FILE_TEST_IS_DIR))
+                                                                               pISL->SetIconLocation("%SystemRoot%\\system32\\shell32.dll", 1);
+                                                                       else
+                                                                               pISL->SetIconLocation(dest, 0);
+
+                                                                       if (S_OK == ppf->Save(shortcut_path, FALSE))
+                                                                       {
+                                                                               Sleep(1500);
+
+                                                                               ret = 0;
+                                                                               // _set_errno(0);
+                                                                       }
+                                                                       else
+                                                                               _set_errno(EACCES);
+                                                               }
+                                                               else
+                                                                       _set_errno(EACCES);
+                                                       }
+                                                       else
+                                                               _set_errno(EACCES);
+                                               }
+                                               else
+                                                       _set_errno(EACCES);
+                                       }
+                                       else
+                                               _set_errno(EBADF);
+                               }
+                               else
+                                       _set_errno(EACCES);
+                       }
+                       else
+                               _set_errno(EBADF);
+               }
+               else
+               {
+                       if (E_POINTER == hRet)
+                               _set_errno(EINVAL);
+                       else
+                               _set_errno(EIO);
+               }
+       }
+
+       return (ret);
+}
+
+
+//***************************************************************
+//
+//     readlink()
+//
+// Emulates POSIX readlink() but using Windows shortcuts
+// Doesn't (currently) resolve shortcuts to shortcuts. This would
+// be quite simple to incorporate but we'd need to check for
+// recursion (i.e. a shortcut that points to an earlier shortcut
+// in the same chain).
+//
+//     Returns:
+//
+//    On Success: Zero
+//    On Failure: -1 ('errno' will contain the specific error)
+//
+LIBARDOUR_API int LIBARDOUR_APICALLTYPE
+readlink(const char *__restrict shortcut, char *__restrict buf, size_t bufsize)
+{
+IShellLinkA  *pISL = NULL;    
+IPersistFile *ppf  = NULL;
+int           ret  = (-1);
+
+       if ((NULL == shortcut) || (NULL == buf) || (strlen(shortcut) < 5) || (bufsize == 0))
+               _set_errno(EINVAL);
+       else if ((bufsize > _MAX_PATH) || (strlen(shortcut) > _MAX_PATH))
+               _set_errno(ENAMETOOLONG);
+       else
+       {
+               HRESULT hRet = 0;
+
+               if (SUCCEEDED (hRet = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&pISL)))
+               {
+                       if (SUCCEEDED (pISL->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf)))
+                       {
+                               char  target_path[_MAX_PATH];
+                               WCHAR shortcut_path[_MAX_PATH];
+
+                               // Fail if the path isn't a shortcut
+                               strcpy(target_path, shortcut); // Use 'target_path' temporarily
+                               strlwr(target_path);
+                               const char *p = strlen(target_path) + target_path - 4;
+
+                               if (0 == strcmp(p, ".lnk"))
+                               {
+                                       // We're apparently pointing to a valid Windows shortcut
+                                       MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, shortcut, -1, shortcut_path, _MAX_PATH);
+
+                                       // Load the shortcut into our persistent file
+                                       if (SUCCEEDED (ppf->Load(shortcut_path, 0)))
+                                       {
+                                               // Read the target information from the shortcut object
+                                               if (S_OK == (pISL->GetPath (target_path, _MAX_PATH, NULL, SLGP_UNCPRIORITY)))
+                                               {
+                                                       strncpy(buf, target_path, bufsize); 
+                                                       ret = ((ret = strlen(buf)) > bufsize) ? bufsize : ret;
+                                                       // _set_errno(0);
+                                               }
+                                               else
+                                                       _set_errno(EACCES);
+                                       }
+                                       else
+                                               _set_errno(EBADF);
+                               }
+                               else
+                                       _set_errno(EINVAL);
+                       }
+                       else
+                               _set_errno(EBADF);
+               }
+               else
+               {
+                       if (E_POINTER == hRet)
+                               _set_errno(EINVAL);
+                       else
+                               _set_errno(EIO);
+               }
+
+               if (ppf)
+                       ppf->Release();
+
+               if (pISL)
+                       pISL->Release();
+       }
+
+       return (ret);
+}
+
+}  // namespace ARDOUR
+
+#endif  // COMPILER_MSVC
index e9071af61917690bc7d86d4eb25205c2ebdb2f24..0dee2a071bdd4e3ce5035a25589cde25ee5d8009 100644 (file)
 */
 #include <iostream>
 #include <errno.h>
-#include <poll.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include "pbd/error.h"
+#include "pbd/pthread_utils.h"
 
 #include "ardour/audioengine.h"
 #include "ardour/debug.h"
@@ -32,6 +32,8 @@
 #include "ardour/session.h"
 #include "ardour/slave.h"
 
+#include <glibmm/timer.h>
+
 #include "i18n.h"
 
 using namespace std;
@@ -236,7 +238,7 @@ MTC_Slave::read_current (SafeTime *st) const
        do {
                if (tries == 10) {
                        error << _("MTC Slave: atomic read of current time failed, sleeping!") << endmsg;
-                       usleep (20);
+                       Glib::usleep (20);
                        tries = 0;
                }
                *st = current;
@@ -299,7 +301,7 @@ MTC_Slave::update_mtc_qtr (Parser& /*p*/, int which_qtr, framepos_t now)
  * when a full TC has been received
  * OR on locate */
 void
-MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
+MTC_Slave::update_mtc_time (const MIDI::byte *msg, bool was_full, framepos_t now)
 {
        busy_guard1++;
 
@@ -307,8 +309,11 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
           to use a timestamp indicating when this MTC time was received. example: when we received
           a locate command via MMC.
        */
-
+#ifdef COMPILER_MSVC
+       DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", ::pthread_self().p));
+#else
        DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", ::pthread_self()));
+#endif
        TimecodeFormat tc_format;
        bool reset_tc = true;
 
@@ -488,7 +493,7 @@ MTC_Slave::update_mtc_status (MIDI::MTC_Status status)
        /* XXX !!! thread safety ... called from MIDI I/O context
         * on locate (via ::update_mtc_time())
         */
-       DEBUG_TRACE (DEBUG::MTC, string_compose("MTC_Slave::update_mtc_status - TID:%1\n", ::pthread_self()));
+       DEBUG_TRACE (DEBUG::MTC, string_compose("MTC_Slave::update_mtc_status - TID:%1\n", pthread_name()));
        return; // why was this fn needed anyway ? it just messes up things -> use reset.
        busy_guard1++;
 
index 94e8d4ff2f0eb38b1ee051083dd90c8cc3ffe12c..8611c7bc86d5b4ba9c183a25014126b45e1e8f58 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "ardour/debug.h"
 #include "ardour/panner_manager.h"
+
 #include "ardour/panner_search_path.h"
 
 #include "i18n.h"
@@ -66,6 +67,7 @@ PannerManager::discover_panners ()
 
        Glib::PatternSpec so_extension_pattern("*.so");
        Glib::PatternSpec dylib_extension_pattern("*.dylib");
+       Glib::PatternSpec dll_extension_pattern("*.dll");
 
        find_matching_files_in_search_path (panner_search_path (),
                                            so_extension_pattern, panner_modules);
@@ -73,6 +75,9 @@ PannerManager::discover_panners ()
        find_matching_files_in_search_path (panner_search_path (),
                                            dylib_extension_pattern, panner_modules);
 
+       find_matching_files_in_search_path (panner_search_path (),
+                                           dll_extension_pattern, panner_modules);
+
        DEBUG_TRACE (DEBUG::Panning, string_compose (_("looking for panners in %1"), panner_search_path().to_string()));
 
        for (vector<std::string>::iterator i = panner_modules.begin(); i != panner_modules.end(); ++i) {
@@ -107,31 +112,33 @@ PannerManager::panner_discover (string path)
 PannerInfo*
 PannerManager::get_descriptor (string path)
 {
-       void *module;
+       Glib::Module* module = new Glib::Module(path);
        PannerInfo* info = 0;
        PanPluginDescriptor *descriptor = 0;
        PanPluginDescriptor* (*dfunc)(void);
-       const char *errstr;
+       void* func = 0;
 
-       if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
-               error << string_compose(_("PannerManager: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
+       if (!module) {
+               error << string_compose(_("PannerManager: cannot load module \"%1\" (%2)"), path,
+                               Glib::Module::get_last_error()) << endmsg;
+               delete module;
                return 0;
        }
 
-       dfunc = (PanPluginDescriptor* (*)(void)) dlsym (module, "panner_descriptor");
-
-       if ((errstr = dlerror()) != 0) {
+       if (!module->get_symbol("panner_descriptor", func)) {
                error << string_compose(_("PannerManager: module \"%1\" has no descriptor function."), path) << endmsg;
-               error << errstr << endmsg;
-               dlclose (module);
+               error << Glib::Module::get_last_error() << endmsg;
+               delete module;
                return 0;
        }
 
+       dfunc = (PanPluginDescriptor* (*)(void))func;
        descriptor = dfunc();
+
        if (descriptor) {
                info = new PannerInfo (*descriptor, module);
        } else {
-               dlclose (module);
+               delete module;
        }
 
        return info;
index 63802ffc4e7e113a3e717236ca9a94b7d87eb375..100c406edd6d37314c92054596f916ef5c2fe922 100644 (file)
@@ -31,14 +31,14 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 panner_search_path ()
 {
-       SearchPath spath(user_config_directory ());
+       Searchpath spath(user_config_directory ());
        spath += ardour_dll_directory ();
        spath.add_subdirectory_to_paths(panner_dir_name);
 
-       spath += SearchPath(Glib::getenv(panner_env_variable_name));
+       spath += Searchpath(Glib::getenv(panner_env_variable_name));
        return spath;
 }
 
index de3497d97709c27127f025e177eaa8bcb0b95013..ae3bd4a4e06f4c6c8f90e8a9ef178e415d756560 100644 (file)
 
 */
 
+#ifdef COMPILER_MSVC
+#include <ardourext/float_cast.h>
+#endif
 #include "ardour/pcm_utils.h"
-
 #include <cmath>
 
 using namespace std;
index bb79801c9f0b45342f7de4e3d3650aa19d082af3..47462a3575be3b19274698290d9dbf861f68a3d8 100644 (file)
@@ -1997,11 +1997,11 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir)
 
         freeze ();
         /* add the added regions */
-        for (RegionListProperty::ChangeContainer::iterator i = change.added.begin(); i != change.added.end(); ++i) {
+        for (RegionListProperty::ChangeContainer::const_iterator i = change.added.begin(); i != change.added.end(); ++i) {
                 add_region_internal ((*i), (*i)->position());
         }
         /* remove the removed regions */
-        for (RegionListProperty::ChangeContainer::iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
+        for (RegionListProperty::ChangeContainer::const_iterator i = change.removed.begin(); i != change.removed.end(); ++i) {
                 remove_region (*i);
         }
 
@@ -2488,7 +2488,7 @@ Playlist::uses_source (boost::shared_ptr<const Source> src) const
 {
        RegionReadLock rlock (const_cast<Playlist*> (this));
 
-       for (set<boost::shared_ptr<Region> >::iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
+       for (set<boost::shared_ptr<Region> >::const_iterator r = all_regions.begin(); r != all_regions.end(); ++r) {
                if ((*r)->uses_source (src)) {
                        return true;
                }
@@ -2533,7 +2533,7 @@ Playlist::region_by_id (const ID& id) const
 {
        /* searches all regions ever added to this playlist */
 
-       for (set<boost::shared_ptr<Region> >::iterator i = all_regions.begin(); i != all_regions.end(); ++i) {
+       for (set<boost::shared_ptr<Region> >::const_iterator i = all_regions.begin(); i != all_regions.end(); ++i) {
                if ((*i)->id() == id) {
                        return *i;
                }
index 9b2170c349e49bd362c461fa6200337e5261ecfd..11d859ed8c81fe3558d5effcd200dfb5781b0e1f 100644 (file)
 #include <cstdlib>
 #include <cstdio> // so libraptor doesn't complain
 #include <cmath>
+#ifndef COMPILER_MSVC
 #include <dirent.h>
+#endif
 #include <sys/stat.h>
 #include <cerrno>
 #include <utility>
 
+#ifdef HAVE_LRDF
 #include <lrdf.h>
+#endif
 
 #include "pbd/compose.h"
 #include "pbd/error.h"
index 90522a7e06b2ca76efea55d2bff2b49e7f5b355f..8d209cc78e29c936519a1b874036e13249ec7600 100644 (file)
 
 #include <sys/types.h>
 #include <cstdio>
-#include <lrdf.h>
-#include <dlfcn.h>
 #include <cstdlib>
 #include <fstream>
 
+#ifdef HAVE_LRDF
+#include <lrdf.h>
+#endif
+
 #ifdef WINDOWS_VST_SUPPORT
 #include "fst.h"
 #include "pbd/basename.h"
 #endif //LXVST_SUPPORT
 
 #include <glibmm/miscutils.h>
+#include <glibmm/pattern.h>
 
 #include "pbd/pathscanner.h"
 #include "pbd/whitespace.h"
+#include "pbd/file_utils.h"
 
 #include "ardour/debug.h"
 #include "ardour/filesystem_paths.h"
@@ -55,6 +59,8 @@
 #include "ardour/plugin_manager.h"
 #include "ardour/rc_configuration.h"
 
+#include "ardour/ladspa_search_path.h"
+
 #ifdef LV2_SUPPORT
 #include "ardour/lv2_plugin.h"
 #endif
@@ -77,6 +83,8 @@
 
 #include "i18n.h"
 
+#include "ardour/debug.h"
+
 using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
@@ -126,10 +134,6 @@ PluginManager::PluginManager ()
        }
 #endif /* Native LinuxVST support*/
 
-       if ((s = getenv ("LADSPA_PATH"))) {
-               ladspa_path = s;
-       }
-
        if ((s = getenv ("VST_PATH"))) {
                windows_vst_path = s;
        } else if ((s = getenv ("VST_PLUGINS"))) {
@@ -198,91 +202,38 @@ PluginManager::refresh ()
 void
 PluginManager::ladspa_refresh ()
 {
-       if (_ladspa_plugin_info)
+       if (_ladspa_plugin_info) {
                _ladspa_plugin_info->clear ();
-       else
+       } else {
                _ladspa_plugin_info = new ARDOUR::PluginInfoList ();
-
-       static const char *standard_paths[] = {
-               "/usr/local/lib64/ladspa",
-               "/usr/local/lib/ladspa",
-               "/usr/lib64/ladspa",
-               "/usr/lib/ladspa",
-               "/Library/Audio/Plug-Ins/LADSPA",
-               ""
-       };
+       }
 
        /* allow LADSPA_PATH to augment, not override standard locations */
 
        /* Only add standard locations to ladspa_path if it doesn't
         * already contain them. Check for trailing G_DIR_SEPARATOR too.
         */
+       
+       vector<string> ladspa_modules;
 
-       int i;
-       for (i = 0; standard_paths[i][0]; i++) {
-               size_t found = ladspa_path.find(standard_paths[i]);
-               if (found != ladspa_path.npos) {
-                       switch (ladspa_path[found + strlen(standard_paths[i])]) {
-                               case ':' :
-                               case '\0':
-                                       continue;
-                               case G_DIR_SEPARATOR :
-                                       if (ladspa_path[found + strlen(standard_paths[i]) + 1] == ':' ||
-                                           ladspa_path[found + strlen(standard_paths[i]) + 1] == '\0') {
-                                               continue;
-                                       }
-                       }
-               }
-               if (!ladspa_path.empty())
-                       ladspa_path += ":";
-
-               ladspa_path += standard_paths[i];
-
-       }
-
-       DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA: search along: [%1]\n", ladspa_path));
-
-       ladspa_discover_from_path (ladspa_path);
-}
-
-
-int
-PluginManager::add_ladspa_directory (string path)
-{
-       if (ladspa_discover_from_path (path) == 0) {
-               ladspa_path += ':';
-               ladspa_path += path;
-               return 0;
-       }
-       return -1;
-}
-
-static bool ladspa_filter (const string& str, void */*arg*/)
-{
-       /* Not a dotfile, has a prefix before a period, suffix is "so" */
+       DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA: search along: [%1]\n", ladspa_search_path().to_string()));
 
-       return str[0] != '.' && (str.length() > 3 && str.find (".so") == (str.length() - 3));
-}
-
-int
-PluginManager::ladspa_discover_from_path (string /*path*/)
-{
-       PathScanner scanner;
-       vector<string *> *plugin_objects;
-       vector<string *>::iterator x;
-       int ret = 0;
+       Glib::PatternSpec so_extension_pattern("*.so");
+       Glib::PatternSpec dylib_extension_pattern("*.dylib");
+       Glib::PatternSpec dll_extension_pattern("*.dll");
 
-       plugin_objects = scanner (ladspa_path, ladspa_filter, 0, false, true);
+       find_matching_files_in_search_path (ladspa_search_path (),
+                                           so_extension_pattern, ladspa_modules);
 
-       if (plugin_objects) {
-               for (x = plugin_objects->begin(); x != plugin_objects->end (); ++x) {
-                       ladspa_discover (**x);
-               }
+       find_matching_files_in_search_path (ladspa_search_path (),
+                                           dylib_extension_pattern, ladspa_modules);
+       find_matching_files_in_search_path (ladspa_search_path (),
+                                           dll_extension_pattern, ladspa_modules);
 
-               vector_delete (plugin_objects);
+       for (vector<std::string>::iterator i = ladspa_modules.begin(); i != ladspa_modules.end(); ++i) {
+               ladspa_discover (*i);
        }
-
-       return ret;
 }
 
 static bool rdf_filter (const string &str, void* /*arg*/)
@@ -315,7 +266,7 @@ PluginManager::add_lxvst_presets()
 void
 PluginManager::add_presets(string domain)
 {
-
+#ifdef HAVE_LRDF
        PathScanner scanner;
        vector<string *> *presets;
        vector<string *>::iterator x;
@@ -338,11 +289,13 @@ PluginManager::add_presets(string domain)
                
                vector_delete (presets);
        }
+#endif
 }
 
 void
 PluginManager::add_lrdf_data (const string &path)
 {
+#ifdef HAVE_LRDF
        PathScanner scanner;
        vector<string *>* rdf_files;
        vector<string *>::iterator x;
@@ -360,30 +313,36 @@ PluginManager::add_lrdf_data (const string &path)
 
                vector_delete (rdf_files);
        }
+#endif
 }
 
 int
 PluginManager::ladspa_discover (string path)
 {
-       void *module;
+       DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Checking for LADSPA plugin at %1\n", path));
+
+       Glib::Module module(path);
        const LADSPA_Descriptor *descriptor;
        LADSPA_Descriptor_Function dfunc;
-       const char *errstr;
+       void* func = 0;
 
-       if ((module = dlopen (path.c_str(), RTLD_NOW)) == 0) {
-               error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"), path, dlerror()) << endmsg;
+       if (!module) {
+               error << string_compose(_("LADSPA: cannot load module \"%1\" (%2)"),
+                       path, Glib::Module::get_last_error()) << endmsg;
                return -1;
        }
 
-       dfunc = (LADSPA_Descriptor_Function) dlsym (module, "ladspa_descriptor");
 
-       if ((errstr = dlerror()) != 0) {
+       if (!module.get_symbol("ladspa_descriptor", func)) {
                error << string_compose(_("LADSPA: module \"%1\" has no descriptor function."), path) << endmsg;
-               error << errstr << endmsg;
-               dlclose (module);
+               error << Glib::Module::get_last_error() << endmsg;
                return -1;
        }
 
+       dfunc = (LADSPA_Descriptor_Function)func;
+
+       DEBUG_TRACE (DEBUG::PluginManager, string_compose ("LADSPA plugin found at %1\n", path));
+
        for (uint32_t i = 0; ; ++i) {
                if ((descriptor = dfunc (i)) == 0) {
                        break;
@@ -437,6 +396,8 @@ PluginManager::ladspa_discover (string path)
                if(!found){
                    _ladspa_plugin_info->push_back (info);
                }
+
+               DEBUG_TRACE (DEBUG::PluginManager, string_compose ("Found LADSPA plugin, name: %1, Inputs: %2, Outputs: %3\n", info->name, info->n_inputs, info->n_outputs));
        }
 
 // GDB WILL NOT LIKE YOU IF YOU DO THIS
@@ -448,6 +409,7 @@ PluginManager::ladspa_discover (string path)
 string
 PluginManager::get_ladspa_category (uint32_t plugin_id)
 {
+#ifdef HAVE_LRDF
        char buf[256];
        lrdf_statement pattern;
 
@@ -505,6 +467,9 @@ PluginManager::get_ladspa_category (uint32_t plugin_id)
        } else {
                return label;
        }
+#else
+               return ("Unknown");
+#endif
 }
 
 #ifdef LV2_SUPPORT
index cf961d68286d92281591d1561dc8d6ad8b04c4c6..bc5d26fb805431059246f5f29dd46c820ea125d0 100644 (file)
@@ -21,7 +21,9 @@
 #include "libardour-config.h"
 #endif
 
+#ifndef PLATFORM_WINDOWS
 #include <jack/weakjack.h> // so that we can test for new functions at runtime
+#endif
 
 #include "pbd/compose.h"
 #include "pbd/error.h"
index 97fe082c815c0957ba1013591038ccda81f77643..2519451b8960f8cbda91d26c62ff8f3d8014d65d 100644 (file)
@@ -250,7 +250,9 @@ PortInsert::signal_latency() const
 bool
 PortInsert::configure_io (ChanCount in, ChanCount out)
 {
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
+#endif
 
        /* for an insert, processor input corresponds to IO output, and vice versa */
 
index 6096e356f5d69faf326977a3697a0ea54fe3ca23..c7f5e2e674e7557cc1ca7eb3ce33a38dc0ce6a3e 100644 (file)
@@ -56,7 +56,7 @@ static bool sort_ports_by_name (boost::shared_ptr<Port> a, boost::shared_ptr<Por
 
        // if some of the names don't have a number as posfix, compare as strings
 
-       if (last_digit_position_a == aname.size() or last_digit_position_b == bname.size()) {
+       if (last_digit_position_a == aname.size() || last_digit_position_b == bname.size()) {
                return aname < bname;
        }
 
index f4612699d49a2c426c28c5b1fdae3485be444725..7fe030fb7e0102e3d39acc2a44586f45f253900f 100644 (file)
@@ -72,7 +72,7 @@ int
 RCConfiguration::load_state ()
 {
        std::string rcfile;
-       struct stat statbuf;
+       GStatBuf statbuf;
 
        /* load system configuration first */
 
index 3e815247504ee3cab21387c2a47877853f0054fd..44f8c34ddd3be482fd5377805f83bce3371ae571 100644 (file)
@@ -564,7 +564,7 @@ RegionFactory::new_region_name (string old)
        uint32_t number;
        string::size_type len = old.length() + 64;
        string remainder;
-       char buf[len];
+       std::vector<char> buf(len);
 
        if ((last_period = old.find_last_of ('.')) == string::npos) {
 
@@ -603,8 +603,8 @@ RegionFactory::new_region_name (string old)
 
                number++;
 
-               snprintf (buf, len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str());
-               sbuf = buf;
+               snprintf (&buf[0], len, "%s%" PRIu32 "%s", old.substr (0, last_period + 1).c_str(), number, remainder.c_str());
+               sbuf = &buf[0];
 
                if (region_name_map.find (sbuf) == region_name_map.end ()) {
                        break;
@@ -612,7 +612,7 @@ RegionFactory::new_region_name (string old)
        }
 
        if (number != (UINT_MAX-1)) {
-               return buf;
+               return &buf[0];
        }
 
        error << string_compose (_("cannot create new name for region \"%1\""), old) << endmsg;
index 6184e1a3d636879fabdfc6d32d63de363df53141..0a8131910827fefd5817ae76ece8619d572cdead 100644 (file)
 using namespace ARDOUR;
 using namespace PBD;
 
+#ifdef PLATFORM_WINDOWS
+const uint32_t ResampledImportableSource::blocksize = 524288U;
+#else
 const uint32_t ResampledImportableSource::blocksize = 16384U;
+#endif
 
 ResampledImportableSource::ResampledImportableSource (boost::shared_ptr<ImportableSource> src, framecnt_t rate, SrcQuality srcq)
        : source (src)
index d0b2260c3d7094ff1e9ec1b3002f0f6752231588..026ee4ec5c18ef7435d5944ac938a40591e3e286 100644 (file)
@@ -1616,7 +1616,9 @@ Route::reset_instrument_info ()
 int
 Route::configure_processors (ProcessorStreams* err)
 {
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
+#endif
 
        if (!_in_configure_processors) {
                Glib::Threads::RWLock::WriterLock lm (_processor_lock);
@@ -1687,7 +1689,9 @@ Route::try_configure_processors_unlocked (ChanCount in, ProcessorStreams* err)
 int
 Route::configure_processors_unlocked (ProcessorStreams* err)
 {
+#ifndef PLATFORM_WINDOWS
        assert (!AudioEngine::instance()->process_lock().trylock());
+#endif
 
        if (_in_configure_processors) {
                return 0;
@@ -2850,7 +2854,7 @@ Route::feeds (boost::shared_ptr<Route> other, bool* via_sends_only)
 {
        const FedBy& fed_by (other->fed_by());
 
-       for (FedBy::iterator f = fed_by.begin(); f != fed_by.end(); ++f) {
+       for (FedBy::const_iterator f = fed_by.begin(); f != fed_by.end(); ++f) {
                boost::shared_ptr<Route> sr = f->r.lock();
 
                if (sr && (sr.get() == this)) {
index 746732f76e1bd1f5abfe379514280d7a4b910859..2a081086d46b5dd0d74dbb12dbd3cd2dd8bc509a 100644 (file)
@@ -44,8 +44,8 @@
 #include "pbd/stacktrace.h"
 #include "pbd/file_utils.h"
 #include "pbd/convert.h"
-#include "pbd/strsplit.h"
 #include "pbd/unwind.h"
+#include "pbd/search_path.h"
 
 #include "ardour/amp.h"
 #include "ardour/analyser.h"
@@ -4553,18 +4553,18 @@ Session::end_time_changed (framepos_t old)
        }
 }
 
-string
+std::vector<std::string>
 Session::source_search_path (DataType type) const
 {
-       vector<string> s;
+       Searchpath sp;
 
        if (session_dirs.size() == 1) {
                switch (type) {
                case DataType::AUDIO:
-                       s.push_back (_session_dir->sound_path());
+                       sp.push_back (_session_dir->sound_path());
                        break;
                case DataType::MIDI:
-                       s.push_back (_session_dir->midi_path());
+                       sp.push_back (_session_dir->midi_path());
                        break;
                }
        } else {
@@ -4572,10 +4572,10 @@ Session::source_search_path (DataType type) const
                        SessionDirectory sdir (i->path);
                        switch (type) {
                        case DataType::AUDIO:
-                               s.push_back (sdir.sound_path());
+                               sp.push_back (sdir.sound_path());
                                break;
                        case DataType::MIDI:
-                               s.push_back (sdir.midi_path());
+                               sp.push_back (sdir.midi_path());
                                break;
                        }
                }
@@ -4584,49 +4584,30 @@ Session::source_search_path (DataType type) const
        if (type == DataType::AUDIO) {
                const string sound_path_2X = _session_dir->sound_path_2X();
                if (Glib::file_test (sound_path_2X, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_DIR)) {
-                       if (find (s.begin(), s.end(), sound_path_2X) == s.end()) {
-                               s.push_back (sound_path_2X);
+                       if (find (sp.begin(), sp.end(), sound_path_2X) == sp.end()) {
+                               sp.push_back (sound_path_2X);
                        }
                }
        }
 
-       /* now check the explicit (possibly user-specified) search path
-        */
-
-       vector<string> dirs;
+       // now check the explicit (possibly user-specified) search path
 
        switch (type) {
        case DataType::AUDIO:
-               split (config.get_audio_search_path (), dirs, ':');
+               sp += Searchpath(config.get_audio_search_path ());
                break;
        case DataType::MIDI:
-               split (config.get_midi_search_path (), dirs, ':');
+               sp += Searchpath(config.get_midi_search_path ());
                break;
        }
 
-       for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
-               if (find (s.begin(), s.end(), *i) == s.end()) {
-                       s.push_back (*i);
-               }
-       }
-       
-       string search_path;
-
-       for (vector<string>::iterator si = s.begin(); si != s.end(); ++si) {
-               if (!search_path.empty()) {
-                       search_path += ':';
-               }
-               search_path += *si;
-       }
-
-       return search_path;
+       return sp;
 }
 
 void
 Session::ensure_search_path_includes (const string& path, DataType type)
 {
-       string search_path;
-       vector<string> dirs;
+       Searchpath sp;
 
        if (path == ".") {
                return;
@@ -4634,16 +4615,14 @@ Session::ensure_search_path_includes (const string& path, DataType type)
 
        switch (type) {
        case DataType::AUDIO:
-               search_path = config.get_audio_search_path ();
+               sp += Searchpath(config.get_audio_search_path ());
                break;
        case DataType::MIDI:
-               search_path = config.get_midi_search_path ();
+               sp += Searchpath (config.get_midi_search_path ());
                break;
        }
 
-       split (search_path, dirs, ':');
-
-       for (vector<string>::iterator i = dirs.begin(); i != dirs.end(); ++i) {
+       for (vector<std::string>::iterator i = sp.begin(); i != sp.end(); ++i) {
                /* No need to add this new directory if it has the same inode as
                   an existing one; checking inode rather than name prevents duplicated
                   directories when we are using symlinks.
@@ -4655,18 +4634,14 @@ Session::ensure_search_path_includes (const string& path, DataType type)
                }
        }
 
-       if (!search_path.empty()) {
-               search_path += ':';
-       }
-
-       search_path += path;
+       sp += path;
 
        switch (type) {
        case DataType::AUDIO:
-               config.set_audio_search_path (search_path);
+               config.set_audio_search_path (sp.to_string());
                break;
        case DataType::MIDI:
-               config.set_midi_search_path (search_path);
+               config.set_midi_search_path (sp.to_string());
                break;
        }
 }
index 1d235b051aad98888c70b9b35a15c59a2893ac1e..3e7c2226ccb4d9c56b5cbf9e78e742b365f98291 100644 (file)
 
 */
 
-#include <algorithm>
-#include <string>
-#include <cmath>
-#include <cerrno>
-#include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
-
-#include <glibmm/threads.h>
-
 #include "pbd/error.h"
 #include "pbd/pthread_utils.h"
 #include "pbd/stacktrace.h"
index 6c828ac6f0d490f0217c69171aa02d833974595e..19034da24767b79f36748f567690d4d7aa0928de 100644 (file)
@@ -23,6 +23,7 @@
 #include "pbd/error.h"
 #include "pbd/enumwriter.h"
 #include "pbd/stacktrace.h"
+#include "pbd/pthread_utils.h"
 
 #include "ardour/debug.h"
 #include "ardour/session_event.h"
@@ -56,7 +57,7 @@ SessionEvent::operator new (size_t)
 {
        CrossThreadPool* p = pool->per_thread_pool ();
        SessionEvent* ev = static_cast<SessionEvent*> (p->alloc ());
-       DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_self(), p->name(), ev));
+       DEBUG_TRACE (DEBUG::SessionEvents, string_compose ("%1 Allocating SessionEvent from %2 ev @ %3\n", pthread_name(), p->name(), ev));
 #ifndef NDEBUG
        if (DEBUG::SessionEvents & PBD::debug_bits) {
                stacktrace (cerr, 40);
@@ -74,7 +75,7 @@ SessionEvent::operator delete (void *ptr, size_t /*size*/)
 
        DEBUG_TRACE (DEBUG::SessionEvents, string_compose (
                             "%1 Deleting SessionEvent @ %2 ev thread pool = %3 ev pool = %4\n",
-                            pthread_self(), ev, p->name(), ev->own_pool->name()
+                            pthread_name(), ev, p->name(), ev->own_pool->name()
                             ));
 
 #ifndef NDEBUG
index b2fbaf602c7dfad95f2a8f203ed2b3d55b8a4134..2ce25b5a4808853754f969707b918f1db40f21fc 100644 (file)
@@ -31,7 +31,6 @@
 
 using namespace std;
 using namespace ARDOUR;
-using namespace MIDI;
 using namespace PBD;
 using namespace Timecode;
 
index 6d3083df7736deb09f1376969388af970102a25c..ea6dfe81cf17f6bd5f9bb5542103af04f39a90b5 100644 (file)
@@ -22,8 +22,6 @@
 #include <cerrno>
 #include <cassert>
 #include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
 
 #include <boost/shared_ptr.hpp>
 
@@ -34,6 +32,7 @@
 
 #include "pbd/error.h"
 #include "pbd/pthread_utils.h"
+#include "pbd/timersub.h"
 
 #include "timecode/time.h"
 
@@ -349,7 +348,7 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled)
  * @param t time to send.
  */
 int
-Session::send_full_time_code (framepos_t const t, pframes_t nframes)
+Session::send_full_time_code (framepos_t const t, MIDI::pframes_t nframes)
 {
        /* This function could easily send at a given frame offset, but would
         * that be useful?  Does ardour do sub-block accurate locating? [DR] */
@@ -440,7 +439,7 @@ Session::send_full_time_code (framepos_t const t, pframes_t nframes)
  * earlier already this cycle by send_full_time_code)
  */
 int
-Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, pframes_t nframes)
+Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_frame, ARDOUR::pframes_t nframes)
 {
        if (_engine.freewheeling() || !_send_qf_mtc || transmitting_timecode_time.negative || (next_quarter_frame_to_send < 0)) {
                // cerr << "(MTC) Not sending MTC\n";
@@ -512,7 +511,7 @@ Session::send_midi_time_code_for_cycle (framepos_t start_frame, framepos_t end_f
                assert (msg_time < end_frame);
 
                /* convert from session frames back to JACK frames using the transport speed */
-               pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed;
+               ARDOUR::pframes_t const out_stamp = (msg_time - start_frame) / _transport_speed;
                assert (out_stamp < nframes);
 
                MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer(nframes));
index b2c4640880284bf0d83364fe0946265e383167b6..b586ab196ebd318d65f09d9951fe86fa815664ac 100644 (file)
@@ -221,11 +221,11 @@ SessionPlaylists::get (vector<boost::shared_ptr<Playlist> >& s) const
 {
        Glib::Threads::Mutex::Lock lm (lock);
 
-       for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+       for (List::const_iterator i = playlists.begin(); i != playlists.end(); ++i) {
                s.push_back (*i);
        }
 
-       for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
+       for (List::const_iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
                s.push_back (*i);
        }
 }
@@ -448,11 +448,11 @@ SessionPlaylists::region_use_count (boost::shared_ptr<Region> region) const
        Glib::Threads::Mutex::Lock lm (lock);
         uint32_t cnt = 0;
 
-       for (List::iterator i = playlists.begin(); i != playlists.end(); ++i) {
+       for (List::const_iterator i = playlists.begin(); i != playlists.end(); ++i) {
                 cnt += (*i)->region_use_count (region);
        }
 
-       for (List::iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
+       for (List::const_iterator i = unused_playlists.begin(); i != unused_playlists.end(); ++i) {
                 cnt += (*i)->region_use_count (region);
        }
 
index c33fd91b5d62b00fe62949dfc62f06acbb5eb4f8..1a605d2fd5e35e98c922e5d81d79872a58991729 100644 (file)
 #include <unistd.h>
 #include <sys/stat.h>
 #include <climits>
-#include <fcntl.h>
-#include <poll.h>
 #include <signal.h>
-#include <sys/mman.h>
 #include <sys/time.h>
 
 #ifdef HAVE_SYS_VFS_H
 #include <sys/vfs.h>
-#else
+#endif
+
+#ifdef __APPLE__
 #include <sys/param.h>
 #include <sys/mount.h>
 #endif
 #include "pbd/enumwriter.h"
 #include "pbd/error.h"
 #include "pbd/file_utils.h"
+#include "pbd/pathexpand.h"
 #include "pbd/pathscanner.h"
 #include "pbd/pthread_utils.h"
 #include "pbd/stacktrace.h"
 #include "pbd/convert.h"
 #include "pbd/clear_dir.h"
+#include "pbd/localtime_r.h"
 
 #include "ardour/amp.h"
 #include "ardour/audio_diskstream.h"
@@ -355,7 +356,7 @@ Session::post_engine_init ()
 string
 Session::raid_path () const
 {
-       SearchPath raid_search_path;
+       Searchpath raid_search_path;
 
        for (vector<space_and_path>::const_iterator i = session_dirs.begin(); i != session_dirs.end(); ++i) {
                raid_search_path += (*i).path;
@@ -376,11 +377,11 @@ Session::setup_raid_path (string path)
 
        session_dirs.clear ();
 
-       SearchPath search_path(path);
-       SearchPath sound_search_path;
-       SearchPath midi_search_path;
+       Searchpath search_path(path);
+       Searchpath sound_search_path;
+       Searchpath midi_search_path;
 
-       for (SearchPath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) {
+       for (Searchpath::const_iterator i = search_path.begin(); i != search_path.end(); ++i) {
                sp.path = *i;
                sp.blocks = 0; // not needed
                session_dirs.push_back (sp);
@@ -725,9 +726,9 @@ Session::save_state (string snapshot_name, bool pending, bool switch_to_snapshot
 
        } else {
 
-               if (::rename (tmp_path.c_str(), xml_path.c_str()) != 0) {
-                       error << string_compose (_("could not rename temporary session file %1 to %2"),
-                                       tmp_path, xml_path) << endmsg;
+               if (::g_rename (tmp_path.c_str(), xml_path.c_str()) != 0) {
+                       error << string_compose (_("could not rename temporary session file %1 to %2 (%3)"),
+                                       tmp_path, xml_path, g_strerror(errno)) << endmsg;
                        if (g_remove (tmp_path.c_str()) != 0) {
                                error << string_compose(_("Could not remove temporary session file at path \"%1\" (%2)"),
                                                tmp_path, g_strerror (errno)) << endmsg;
@@ -2046,6 +2047,54 @@ Session::refresh_disk_space ()
                        _total_free_4k_blocks_uncertain = true;
                }
        }
+#elif defined (COMPILER_MSVC)
+       vector<string> scanned_volumes;
+       vector<string>::iterator j;
+       vector<space_and_path>::iterator i;
+    DWORD nSectorsPerCluster, nBytesPerSector,
+          nFreeClusters, nTotalClusters;
+    char disk_drive[4];
+       bool volume_found;
+
+       _total_free_4k_blocks = 0;
+
+       for (i = session_dirs.begin(); i != session_dirs.end(); i++) {
+               strncpy (disk_drive, (*i).path.c_str(), 3);
+               disk_drive[3] = 0;
+               strupr(disk_drive);
+
+               volume_found = false;
+               if (0 != (GetDiskFreeSpace(disk_drive, &nSectorsPerCluster, &nBytesPerSector, &nFreeClusters, &nTotalClusters)))
+               {
+                       int64_t nBytesPerCluster = nBytesPerSector * nSectorsPerCluster;
+                       int64_t nFreeBytes = nBytesPerCluster * (int64_t)nFreeClusters;
+                       i->blocks = (uint32_t)(nFreeBytes / 4096);
+
+                       for (j = scanned_volumes.begin(); j != scanned_volumes.end(); j++) {
+                               if (0 == j->compare(disk_drive)) {
+                                       volume_found = true;
+                                       break;
+                               }
+                       }
+
+                       if (!volume_found) {
+                               scanned_volumes.push_back(disk_drive);
+                               _total_free_4k_blocks += i->blocks;
+                       }
+               }
+       }
+
+       if (0 == _total_free_4k_blocks) {
+               strncpy (disk_drive, path().c_str(), 3);
+               disk_drive[3] = 0;
+
+               if (0 != (GetDiskFreeSpace(disk_drive, &nSectorsPerCluster, &nBytesPerSector, &nFreeClusters, &nTotalClusters)))
+               {
+                       int64_t nBytesPerCluster = nBytesPerSector * nSectorsPerCluster;
+                       int64_t nFreeBytes = nBytesPerCluster * (int64_t)nFreeClusters;
+                       _total_free_4k_blocks = (uint32_t)(nFreeBytes / 4096);
+               }
+       }
 #endif
 }
 
@@ -2232,7 +2281,7 @@ Session::auto_save()
 }
 
 static bool
-state_file_filter (const string &str, void */*arg*/)
+state_file_filter (const string &str, void/*arg*/)
 {
        return (str.length() > strlen(statefile_suffix) &&
                str.find (statefile_suffix) == (str.length() - strlen (statefile_suffix)));
@@ -2409,7 +2458,7 @@ Session::commit_reversible_command (Command *cmd)
 }
 
 static bool
-accept_all_audio_files (const string& path, void */*arg*/)
+accept_all_audio_files (const string& path, void/*arg*/)
 {
         if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) {
                 return false;
@@ -2423,7 +2472,7 @@ accept_all_audio_files (const string& path, void */*arg*/)
 }
 
 static bool
-accept_all_midi_files (const string& path, void */*arg*/)
+accept_all_midi_files (const string& path, void/*arg*/)
 {
         if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) {
                 return false;
@@ -2435,7 +2484,7 @@ accept_all_midi_files (const string& path, void */*arg*/)
 }
 
 static bool
-accept_all_state_files (const string& path, void */*arg*/)
+accept_all_state_files (const string& path, void/*arg*/)
 {
         if (!Glib::file_test (path, Glib::FILE_TEST_IS_REGULAR)) {
                 return false;
@@ -2591,6 +2640,8 @@ Session::cleanup_sources (CleanupReport& rep)
        bool used;
        string spath;
        int ret = -1;
+       string tmppath1;
+       string tmppath2;
 
        _state_of_the_state = (StateOfTheState) (_state_of_the_state | InCleanup);
 
@@ -2715,9 +2766,6 @@ Session::cleanup_sources (CleanupReport& rep)
                 i = tmp;
        }
 
-       char tmppath1[PATH_MAX+1];
-       char tmppath2[PATH_MAX+1];
-
         if (candidates) {
                 for (vector<string*>::iterator x = candidates->begin(); x != candidates->end(); ++x) {
 
@@ -2726,19 +2774,10 @@ Session::cleanup_sources (CleanupReport& rep)
 
                         for (set<string>::iterator i = all_sources.begin(); i != all_sources.end(); ++i) {
 
-                                if (realpath(spath.c_str(), tmppath1) == 0) {
-                                        error << string_compose (_("Cannot expand path %1 (%2)"),
-                                                                 spath, strerror (errno)) << endmsg;
-                                        continue;
-                                }
-
-                                if (realpath((*i).c_str(),  tmppath2) == 0) {
-                                        error << string_compose (_("Cannot expand path %1 (%2)"),
-                                                                 (*i), strerror (errno)) << endmsg;
-                                        continue;
-                                }
+                               tmppath1 = canonical_path (spath);
+                               tmppath2 = canonical_path ((*i));
 
-                                if (strcmp(tmppath1, tmppath2) == 0) {
+                               if (tmppath1 == tmppath2) {
                                         used = true;
                                         break;
                                 }
@@ -2842,7 +2881,7 @@ Session::cleanup_sources (CleanupReport& rep)
                string peakpath = peak_path (base);
 
                if (Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
-                       if (::unlink (peakpath.c_str()) != 0) {
+                       if (::g_unlink (peakpath.c_str()) != 0) {
                                error << string_compose (_("cannot remove peakfile %1 for %2 (%3)"),
                                                          peakpath, _path, strerror (errno))
                                      << endmsg;
index 644fb19ffbd1c38a11081437d9360f237991f676..06a6b80e99b39c34ce1f2836af803eb9d2c5729a 100644 (file)
@@ -17,7 +17,9 @@
 
 */
 
+#ifndef COMPILER_MSVC
 #include <stdbool.h>
+#endif
 #include <cstdio>
 
 #include "ardour/session.h"
@@ -59,11 +61,19 @@ intptr_t Session::vst_callback (
        if (effect && effect->user) {
                plug = (VSTPlugin *) (effect->user);
                session = &plug->session();
+#ifdef COMPILER_MSVC
+               SHOW_CALLBACK ("am callback 0x%x, opcode = %d, plugin = \"%s\" ", (int) pthread_self().p, opcode, plug->name());
+#else
                SHOW_CALLBACK ("am callback 0x%x, opcode = %d, plugin = \"%s\" ", (int) pthread_self(), opcode, plug->name());
+#endif
        } else {
                plug = 0;
                session = 0;
+#ifdef COMPILER_MSVC
+               SHOW_CALLBACK ("am callback 0x%x, opcode = %d", (int) pthread_self().p, opcode);
+#else
                SHOW_CALLBACK ("am callback 0x%x, opcode = %d", (int) pthread_self(), opcode);
+#endif
        }
 
        switch(opcode){
index 830fd75fdf6a9df618f09ea7a56918db7c7c63bb..d915bba8456025805284055bbd70604c12077a2c 100644 (file)
@@ -30,6 +30,7 @@
 #include "pbd/stl_delete.h"
 #include "pbd/strsplit.h"
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 
 #include "evoral/Control.hpp"
@@ -96,7 +97,7 @@ SMFSource::SMFSource (Session& s, const XMLNode& node, bool must_exist)
 SMFSource::~SMFSource ()
 {
        if (removable()) {
-               unlink (_path.c_str());
+               ::g_unlink (_path.c_str());
        }
 }
 
index 459890e82926d58a83e66ea43e563c8ac1088cea..2e618e043bb3b5cba8f52a297ff9ab5a1f00373c 100644 (file)
@@ -17,7 +17,9 @@
 
 */
 
+#ifndef COMPILER_MSVC
 #include <strings.h>
+#endif
 #include <map>
 
 #include <sndfile.h>
index c9f6c4014f272f75e54b99610c2a70f7d3eebf63..ceb88eddc9f80c4ae61a87b41e9c1b092a59dad3 100644 (file)
@@ -51,7 +51,7 @@ SndFileImportableSource::read (Sample* buffer, framecnt_t nframes)
        return per_channel * sf_info.channels;
 }
 
-uint
+uint32_t
 SndFileImportableSource::channels () const
 {
        return sf_info.channels;
index cf75cffba3efeac06ef379ec70188461a73e20e9..1c3144f16421177f140b7da1753ec7bfaa8cf92f 100644 (file)
 #include <climits>
 #include <cstdarg>
 
-#include <pwd.h>
-#include <sys/utsname.h>
 #include <sys/stat.h>
 
+#ifdef PLATFORM_WINDOWS
+#include <glibmm/convert.h>
+#endif
 #include <glibmm/miscutils.h>
 
 #include "ardour/sndfilesource.h"
@@ -184,22 +185,30 @@ SndFileSource::init_sndfile ()
 int
 SndFileSource::open ()
 {
-       _descriptor = new SndFileDescriptor (_path, writable(), &_info);
+       string path_to_open;
+
+#ifdef PLATFORM_WINDOWS
+       path_to_open = Glib::locale_from_utf8(_path);
+#else
+       path_to_open = _path;
+#endif
+
+       _descriptor = new SndFileDescriptor (path_to_open.c_str(), writable(), &_info);
        _descriptor->Closed.connect_same_thread (file_manager_connection, boost::bind (&SndFileSource::file_closed, this));
        SNDFILE* sf = _descriptor->allocate ();
 
        if (sf == 0) {
-               char errbuf[256];
+               char errbuf[1024];
                sf_error_str (0, errbuf, sizeof (errbuf) - 1);
 #ifndef HAVE_COREAUDIO
                /* if we have CoreAudio, we will be falling back to that if libsndfile fails,
                   so we don't want to see this message.
                */
 
-                cerr << "failed to open " << _path << " with name " << _name << endl;
+                cerr << "failed to open " << path_to_open << " with name " << _name << endl;
 
                error << string_compose(_("SndFileSource: cannot open file \"%1\" for %2 (%3)"),
-                                       _path, (writable() ? "read+write" : "reading"), errbuf) << endmsg;
+                                       path_to_open, (writable() ? "read+write" : "reading"), errbuf) << endmsg;
 #endif
                return -1;
        }
@@ -253,7 +262,7 @@ SndFileSource::open ()
 
                         if (!_broadcast_info->write_to_file (sf)) {
                                 error << string_compose (_("cannot set broadcast info for audio file %1 (%2); dropping broadcast info for this file"),
-                                                         _path, _broadcast_info->get_error())
+                                                         path_to_open, _broadcast_info->get_error())
                                       << endmsg;
                                 _flags = Flag (_flags & ~Broadcast);
                                 delete _broadcast_info;
@@ -541,6 +550,30 @@ SndFileSource::flush_header ()
        return r;
 }
 
+void
+SndFileSource::flush ()
+{
+       if (!_open) {
+               warning << string_compose (_("attempt to flush an un-opened audio file source (%1)"), _path) << endmsg;
+               return;
+       }
+
+       if (!writable()) {
+               warning << string_compose (_("attempt to flush a non-writable audio file source (%1)"), _path) << endmsg;
+               return;
+       }
+
+       SNDFILE* sf = _descriptor->allocate ();
+       if (sf == 0) {
+               error << string_compose (_("could not allocate file %1 to flush contents"), _path) << endmsg;
+               return;
+       }
+
+       // Hopefully everything OK
+       sf_write_sync (sf);
+       _descriptor->release ();
+}
+
 int
 SndFileSource::setup_broadcast_info (framepos_t /*when*/, struct tm& now, time_t /*tnow*/)
 {
@@ -768,12 +801,12 @@ SndFileSource::crossfade (Sample* data, framecnt_t cnt, int fade_in)
 
        } else if (xfade < xfade_frames) {
 
-               gain_t in[xfade];
-               gain_t out[xfade];
+               std::vector<gain_t> in(xfade);
+               std::vector<gain_t> out(xfade);
 
                /* short xfade, compute custom curve */
 
-               compute_equal_power_fades (xfade, in, out);
+               compute_equal_power_fades (xfade, &in[0], &out[0]);
 
                for (framecnt_t n = 0; n < xfade; ++n) {
                        xfade_buf[n] = (xfade_buf[n] * out[n]) + (fade_data[n] * in[n]);
index 618dddc70b75808e63550b53a42b1fb945cb5d7b..03039fea5baf5f9abc8205132e821f51fb4645ec 100644 (file)
@@ -19,8 +19,6 @@
 
 #include <sys/stat.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <poll.h>
 #include <float.h>
 #include <cerrno>
 #include <ctime>
index 48212ea8e1b839363cc08e45e2ce2e86222cf72b..f8a53cc6f8be6694a4d97197795926be021d3c7d 100644 (file)
@@ -45,8 +45,11 @@ x86_sse_find_peaks(const ARDOUR::Sample* buf, ARDOUR::pframes_t nframes, float *
 
         // use 64 byte prefetch for quadruple quads
         while (nframes >= 16) {
+#ifdef COMPILER_MSVC                                    
+                               _mm_prefetch(((char*)buf+64), 0);  // A total guess! Assumed to be eqivalent to
+#else                                              // the line below but waiting to be tested !!
                 __builtin_prefetch(buf+64,0,0);
-
+#endif
                 work = _mm_load_ps(buf);
                 current_min = _mm_min_ps(current_min, work);
                 current_max = _mm_max_ps(current_max, work);
index 05007b0ade901f391425f4974079d7f1212e7e05..b912fdc446620a6630f352f5ef6337226ef9865b 100644 (file)
@@ -37,18 +37,18 @@ using namespace PBD;
 
 namespace ARDOUR {
 
-SearchPath
+Searchpath
 template_search_path ()
 {
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(templates_dir_name);
        return spath;
 }
 
-SearchPath
+Searchpath
 route_template_search_path ()
 {
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(route_templates_dir_name);
        return spath;
 }
@@ -66,7 +66,7 @@ user_route_template_directory ()
 }
 
 static bool
-template_filter (const string &str, void */*arg*/)
+template_filter (const string &str, void/*arg*/)
 {
        if (!Glib::file_test (str, Glib::FILE_TEST_IS_DIR)) {
                return false;
@@ -76,7 +76,7 @@ template_filter (const string &str, void */*arg*/)
 }
 
 static bool
-route_template_filter (const string &str, void */*arg*/)
+route_template_filter (const string &str, void/*arg*/)
 {
        if (str.find (template_suffix) == str.length() - strlen (template_suffix)) {
                return true;
@@ -97,7 +97,7 @@ find_session_templates (vector<TemplateInfo>& template_names)
 {
        vector<string *> *templates;
        PathScanner scanner;
-       SearchPath spath (template_search_path());
+       Searchpath spath (template_search_path());
 
        templates = scanner (spath.to_string(), template_filter, 0, true, true);
 
@@ -133,7 +133,7 @@ find_route_templates (vector<TemplateInfo>& template_names)
 {
        vector<string *> *templates;
        PathScanner scanner;
-       SearchPath spath (route_template_search_path());
+       Searchpath spath (route_template_search_path());
 
        templates = scanner (spath.to_string(), route_template_filter, 0, false, true);
 
diff --git a/libs/ardour/test/jack_utils_test.cc b/libs/ardour/test/jack_utils_test.cc
new file mode 100644 (file)
index 0000000..7645df6
--- /dev/null
@@ -0,0 +1,290 @@
+
+#include <stdexcept>
+
+#ifdef PLATFORM_WINDOWS
+#include <windows.h> // only for Sleep
+#endif
+
+#include <glibmm/miscutils.h>
+
+#include "ardour/jack_utils.h"
+
+#include "jack_utils_test.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (JackUtilsTest);
+
+using namespace std;
+using namespace ARDOUR;
+
+void
+JackUtilsTest::test_driver_names ()
+{
+       vector<string> driver_names;
+
+       get_jack_audio_driver_names (driver_names);
+
+       CPPUNIT_ASSERT(!driver_names.empty());
+
+       cout << endl;
+       cout << "Number of possible JACK Audio drivers found on this system: " << driver_names.size () << endl;
+
+       for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+               cout << "JACK Audio driver found: " << *i << endl;
+       }
+
+       string default_audio_driver;
+       get_jack_default_audio_driver_name (default_audio_driver);
+
+       cout << "The default audio driver on this system is: " << default_audio_driver << endl;
+
+       driver_names.clear();
+
+       get_jack_midi_system_names (default_audio_driver, driver_names);
+
+       CPPUNIT_ASSERT(!driver_names.empty());
+
+       cout << "Number of possible JACK MIDI drivers found on this system for default audio driver: " << driver_names.size () << endl;
+
+       for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+               cout << "JACK MIDI driver found: " << *i << endl;
+       }
+
+       string default_midi_driver;
+       get_jack_default_midi_system_name (default_audio_driver, default_midi_driver);
+
+       cout << "The default midi driver on this system is: " << default_midi_driver << endl;
+}
+
+string
+devices_string (const vector<string>& devices)
+{
+       std::string str;
+       for (vector<string>::const_iterator i = devices.begin(); i != devices.end();) {
+               str += *i;
+               if (++i != devices.end()) str += ", ";
+       }
+       return str;
+}
+
+void
+JackUtilsTest::test_device_names ()
+{
+       vector<string> driver_names;
+
+       get_jack_audio_driver_names (driver_names);
+
+       CPPUNIT_ASSERT(!driver_names.empty());
+
+       cout << endl;
+
+       for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+               string devices = devices_string (get_jack_device_names_for_audio_driver (*i));
+               cout << "JACK Audio driver found: " << *i << " with devices: " << devices << endl;
+       }
+}
+
+void
+JackUtilsTest::test_samplerates ()
+{
+       vector<string> samplerates;
+
+       get_jack_sample_rate_strings (samplerates);
+       cout << endl;
+       cout << "Number of possible Samplerates supported by JACK: " << samplerates.size () << endl;
+
+       for (vector<string>::const_iterator i = samplerates.begin(); i != samplerates.end(); ++i) {
+               cout << "Samplerate: " << *i << endl;
+       }
+}
+
+void
+JackUtilsTest::test_period_sizes ()
+{
+       vector<string> period_sizes;
+
+       get_jack_period_size_strings (period_sizes);
+       cout << endl;
+       cout << "Number of possible Period sizes supported by JACK: " << period_sizes.size () << endl;
+
+       for (vector<string>::const_iterator i = period_sizes.begin(); i != period_sizes.end(); ++i) {
+               cout << "Period size: " << *i << endl;
+       }
+}
+
+void
+JackUtilsTest::test_dither_modes ()
+{
+       vector<string> driver_names;
+
+       get_jack_audio_driver_names (driver_names);
+
+       CPPUNIT_ASSERT(!driver_names.empty());
+
+       cout << endl;
+
+       for (vector<string>::const_iterator i = driver_names.begin(); i != driver_names.end(); ++i) {
+               vector<string> dither_modes;
+
+               get_jack_dither_mode_strings (*i, dither_modes);
+               cout << "Number of possible Dither Modes supported by JACK driver " << *i <<
+                       ": " << dither_modes.size () << endl;
+               for (vector<string>::const_iterator j = dither_modes.begin(); j != dither_modes.end(); ++j) {
+                       cout << "Dither Mode: " << *j << endl;
+               }
+               cout << endl;
+       }
+
+}
+
+void
+JackUtilsTest::test_connect_server ()
+{
+       cout << endl;
+       if (jack_server_running ()) {
+               cout << "Jack server running " << endl;
+       } else {
+               cout << "Jack server not running " << endl;
+       }
+}
+
+void
+JackUtilsTest::test_set_jack_path_env ()
+{
+       cout << endl;
+
+       bool path_env_set = false;
+
+       string path_env = Glib::getenv ("PATH", path_env_set);
+
+       if (path_env_set) {
+               cout << "PATH env set to: " << path_env << endl;
+       } else {
+               cout << "PATH env not set" << endl;
+       }
+       vector<string> server_dirs;
+       get_jack_server_dir_paths (server_dirs);
+       set_path_env_for_jack_autostart (server_dirs);
+
+       path_env_set = false;
+
+       path_env = Glib::getenv ("PATH", path_env_set);
+
+       CPPUNIT_ASSERT (path_env_set);
+
+       cout << "After set_jack_path_env PATH env set to: " << path_env << endl;
+}
+
+void
+JackUtilsTest::test_server_paths ()
+{
+       cout << endl;
+
+       vector<std::string> server_dirs;
+
+       CPPUNIT_ASSERT (get_jack_server_dir_paths (server_dirs));
+
+       cout << "Number of Directories that may contain JACK servers: " << server_dirs.size () << endl;
+
+       for (vector<std::string>::const_iterator i = server_dirs.begin(); i != server_dirs.end(); ++i) {
+               cout << "JACK server directory path: " << *i << endl;
+       }
+
+       vector<string> server_names;
+
+       CPPUNIT_ASSERT (get_jack_server_application_names (server_names));
+
+       cout << "Number of possible JACK server names on this system: " << server_names.size () << endl;
+
+       for (vector<string>::const_iterator i = server_names.begin(); i != server_names.end(); ++i) {
+               cout << "JACK server name: " << *i << endl;
+       }
+
+       vector<std::string> server_paths;
+
+       CPPUNIT_ASSERT (get_jack_server_paths (server_dirs, server_names, server_paths));
+
+       cout << "Number of JACK servers on this system: " << server_paths.size () << endl;
+
+       for (vector<std::string>::const_iterator i = server_paths.begin(); i != server_paths.end(); ++i) {
+               cout << "JACK server path: " << *i << endl;
+       }
+
+       vector<std::string> server_paths2;
+
+       CPPUNIT_ASSERT (get_jack_server_paths (server_paths2));
+
+       CPPUNIT_ASSERT (server_paths.size () == server_paths2.size ());
+
+       std::string default_server_path;
+
+       CPPUNIT_ASSERT (get_jack_default_server_path (default_server_path));
+
+       cout << "The default JACK server on this system: " << default_server_path << endl;
+}
+
+bool
+get_default_jack_command_line (std::string& command_line)
+{
+       cout << endl;
+
+       JackCommandLineOptions options;
+
+       CPPUNIT_ASSERT (get_jack_default_server_path (options.server_path));
+
+       get_jack_default_audio_driver_name (options.driver);
+
+
+       // should fail, haven't set any device yet
+       CPPUNIT_ASSERT (!get_jack_command_line_string (options, command_line));
+
+       vector<string> devices = get_jack_device_names_for_audio_driver (options.driver);
+
+       if (!devices.empty()) {
+               options.input_device = devices.front ();
+               options.output_device = devices.front ();
+       } else {
+               cout << "No audio devices available using default JACK driver using Dummy driver" << endl;
+               options.driver = dummy_driver_name;
+               devices = get_jack_device_names_for_audio_driver (options.driver);
+               CPPUNIT_ASSERT (!devices.empty ());
+               options.input_device = devices.front ();
+               options.output_device = devices.front ();
+       }
+
+       options.input_device = devices.front ();
+       options.output_device = devices.front ();
+
+       string midi_driver;
+
+       get_jack_default_midi_system_name (options.driver, options.midi_driver);
+       //
+       // this at least should create a valid jack command line
+       return get_jack_command_line_string (options, command_line);
+
+}
+
+void
+JackUtilsTest::test_config ()
+{
+       std::string config_path(get_jack_server_user_config_file_path());
+
+       cout << "Jack server config file path: " << config_path << endl;
+
+       std::string command_line;
+
+       CPPUNIT_ASSERT (get_default_jack_command_line (command_line));
+       
+       CPPUNIT_ASSERT (write_jack_config_file (config_path, command_line));
+}
+
+
+void
+JackUtilsTest::test_command_line ()
+{
+       string command_line;
+
+       // this at least should create a valid jack command line
+       CPPUNIT_ASSERT (get_default_jack_command_line (command_line));
+
+       cout << "Default JACK command line: " << command_line << endl;
+}
diff --git a/libs/ardour/test/jack_utils_test.h b/libs/ardour/test/jack_utils_test.h
new file mode 100644 (file)
index 0000000..08fad2f
--- /dev/null
@@ -0,0 +1,31 @@
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class JackUtilsTest : public CppUnit::TestFixture
+{
+       CPPUNIT_TEST_SUITE (JackUtilsTest);
+       CPPUNIT_TEST (test_driver_names);
+       CPPUNIT_TEST (test_device_names);
+       CPPUNIT_TEST (test_samplerates);
+       CPPUNIT_TEST (test_period_sizes);
+       CPPUNIT_TEST (test_dither_modes);
+       CPPUNIT_TEST (test_connect_server);
+       CPPUNIT_TEST (test_set_jack_path_env);
+       CPPUNIT_TEST (test_server_paths);
+       CPPUNIT_TEST (test_config);
+       CPPUNIT_TEST (test_command_line);
+       CPPUNIT_TEST_SUITE_END ();
+
+public:
+       void test_driver_names ();
+       void test_device_names ();
+       void test_samplerates ();
+       void test_period_sizes ();
+       void test_dither_modes ();
+       void test_connect_server ();
+       void test_set_jack_path_env ();
+       void test_server_paths ();
+       void test_config ();
+       void test_command_line ();
+};
index dcb159cb2ca681682396458b13a5ffb1405c2c9c..4349df22eb1896365df24cafe1d584d0d6255c04 100644 (file)
@@ -27,7 +27,7 @@ MIDIClock_SlaveTest::testStepResponse ()
  
   for (framecnt_t i = 1; i<= 100 * period_size; i++) {
     // simulate jitter
-    framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(random()) / double (RAND_MAX)) * one_ppqn_in_frames);
+    framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames);
     
     if (i % input_delta == 0) {
       update_midi_clock (*parser, start_time + i);
diff --git a/libs/ardour/test/plugins_test.cc b/libs/ardour/test/plugins_test.cc
new file mode 100644 (file)
index 0000000..0e4bddc
--- /dev/null
@@ -0,0 +1,54 @@
+#include <iostream>
+
+#include "ardour/plugin_manager.h"
+#include "ardour/ladspa_search_path.h"
+
+#include "plugins_test.h"
+#include "test_common.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PluginsTest);
+
+using namespace std;
+using namespace ARDOUR;
+using namespace PBD;
+
+void
+print_plugin_info (PluginInfoPtr pp)
+{
+       cout << "LADSPA Plugin, name " << pp->name
+               << ", category " << pp->category
+               << ", creator " << pp->creator
+               << ", path " << pp->path
+               << ", n_inputs " << pp->n_inputs.n_audio ()
+               << ", n_outputs " << pp->n_outputs.n_audio ()
+               << endl;
+
+}
+
+void
+PluginsTest::test ()
+{
+       PluginManager& pm = PluginManager::instance ();
+
+       pm.refresh ();
+
+       Searchpath ladspa_paths(ladspa_search_path ());
+
+       cout << "Number of Ladspa paths found: " << ladspa_paths.size () << endl;
+
+       for (vector<std::string>::iterator i = ladspa_paths.begin (); i != ladspa_paths.end(); ++i)
+       {
+               cout << "LADSPA search path includes: " << *i << endl;
+       }
+
+       PluginInfoList& ladspa_list = pm.ladspa_plugin_info ();
+
+       cout << "Number of Ladspa plugins found: " << ladspa_list.size () << endl;
+
+       for (PluginInfoList::iterator i = ladspa_list.begin (); i != ladspa_list.end(); ++i)
+       {
+               print_plugin_info (*i);
+       }
+
+
+}
diff --git a/libs/ardour/test/plugins_test.h b/libs/ardour/test/plugins_test.h
new file mode 100644 (file)
index 0000000..1503b2b
--- /dev/null
@@ -0,0 +1,12 @@
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PluginsTest : public CppUnit::TestFixture
+{
+       CPPUNIT_TEST_SUITE (PluginsTest);
+       CPPUNIT_TEST (test);
+       CPPUNIT_TEST_SUITE_END ();
+
+public:
+       void test ();
+};
index 5aaf71b7aaf5b89da03a811d0388108274fcae4a..c8ef0f4a95b84cef5926b8278934c55a9af73f66 100644 (file)
@@ -1,4 +1,4 @@
-// this is included first to avoid SearchPath definition on windows
+// this is included first to avoid Searchpath definition on windows
 #include "test_common.h"
 
 #include "pbd/file_utils.h"
index 8364d91be17dd47344c001fb2be1db193dedff0b..5f802fbf5af8a4099c85c8b0117dcf802025bafe 100644 (file)
 
 using namespace std;
 
-PBD::SearchPath
+PBD::Searchpath
 test_search_path ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
        return Glib::build_filename (wsp, "ardour_testdata");
 #else
index 9e154587818b5428da33a70d64f986c21cd7b7bf..10bfdbc694d6e50f1ec80ded2d422db616098927 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "pbd/search_path.h"
 
-PBD::SearchPath test_search_path ();
+PBD::Searchpath test_search_path ();
 
 std::string new_test_output_dir ();
 
index e7b76481493155ffcbb7beb22aacc16b0b64505f..f23f1332b8a471333a04d1ca33e81058a37aab34 100644 (file)
@@ -36,7 +36,9 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <fcntl.h>
+#ifndef COMPILER_MSVC
 #include <dirent.h>
+#endif
 #include <errno.h>
 #include <regex.h>
 
index b80a594495d8c936125d3fff58853aeb1f77a35c..5eafe7a612664991ba3bf94639f0b4296e36fd3c 100644 (file)
@@ -528,8 +528,9 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
 {
        Plugin::connect_and_run (bufs, in_map, out_map, nframes, offset);
 
-       float *ins[_plugin->numInputs];
-       float *outs[_plugin->numOutputs];
+       // VC++ doesn't support this C99 extension. Use alloca instead of dynamic array (rather than std::vector which allocs on the heap)
+       float** ins = (float**)alloca(_plugin->numInputs*sizeof(float*));
+       float** outs = (float**)alloca(_plugin->numInputs*sizeof(float*));
        int32_t i;
 
        const uint32_t nbufs = bufs.count().n_audio();
@@ -552,7 +553,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
        }
 
        /* we already know it can support processReplacing */
-       _plugin->processReplacing (_plugin, ins, outs, nframes);
+       _plugin->processReplacing (_plugin, &ins[0], &outs[0], nframes);
 
        return 0;
 }
index b13398c69d9aabab1d4839cd5178ff460242fcdd..d5238adb60e49377e95810c5b3e1451b28e688a6 100644 (file)
@@ -23,6 +23,8 @@
 #include "ardour/worker.h"
 #include "pbd/error.h"
 
+#include <glibmm/timer.h>
+
 namespace ARDOUR {
 
 Worker::Worker(Workee* workee, uint32_t ring_size)
@@ -128,7 +130,7 @@ Worker::run()
                        continue;
                }
                while (!verify_message_completeness(_requests)) {
-                       ::usleep(2000);
+                       Glib::usleep(2000);
                        if (_exit) {
                                return;
                        }
index 733900e3f604b24993d8e0353119b63a4ed73129..e8c9fb8328a7f9aace1a07b31684c4e7f11b9789 100644 (file)
@@ -2,6 +2,7 @@
 from waflib.extras import autowaf as autowaf
 from waflib import Options
 import os
+import sys
 import re
 import subprocess
 import sys
@@ -106,6 +107,7 @@ libardour_sources = [
         'jack_slave.cc',
         'kmeterdsp.cc',
         'ladspa_plugin.cc',
+        'ladspa_search_path.cc',
         'location.cc',
         'location_importer.cc',
         'ltc_slave.cc',
@@ -244,13 +246,17 @@ def configure(conf):
         path_prefix + 'version.cc',
         'libardour3', conf.env['MAJOR'], conf.env['MINOR'], 0)
     autowaf.configure(conf)
-    autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
-                      atleast_version='0.3.2')
     autowaf.check_pkg(conf, 'jack', uselib_store='JACK',
                       atleast_version='0.118.2')
+    if Options.options.dist_target == 'auto':
+        if re.search ("linux", sys.platform) != None:
+            autowaf.check_pkg(conf, 'alsa', uselib_store='ALSA')
     autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
-    autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
-                      atleast_version='0.4.0')
+    if Options.options.dist_target != 'mingw':
+        autowaf.check_pkg(conf, 'lrdf', uselib_store='LRDF',
+                          atleast_version='0.4.0')
+        autowaf.check_pkg(conf, 'aubio', uselib_store='AUBIO',
+                          atleast_version='0.3.2')
     autowaf.check_pkg(conf, 'samplerate', uselib_store='SAMPLERATE',
                       atleast_version='0.1.0')
     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP',
@@ -337,8 +343,8 @@ def build(bld):
     obj.name         = 'libardour'
     obj.target       = 'ardour'
     obj.uselib       = ['GLIBMM','GTHREAD','AUBIO','SIGCPP','XML','UUID',
-                        'JACK','SNDFILE','SAMPLERATE','LRDF','AUDIOUNITS',
-                        'OSX','BOOST','CURL','DL']
+                        'JACK', 'ALSA', 'SNDFILE','SAMPLERATE','LRDF',
+                        'AUDIOUNITS', 'OSX','BOOST','CURL','DL']
     obj.use          = ['libpbd','libmidipp','libevoral','libvamphost',
                         'libvampplugin','libtaglib','librubberband',
                         'libaudiographer','libltc']
@@ -439,6 +445,7 @@ def build(bld):
             create_ardour_test_program(bld, obj.includes, 'framepos_minus_beats', 'test_framepos_minus_beats', ['test/framepos_minus_beats_test.cc'])
             create_ardour_test_program(bld, obj.includes, 'playlist_equivalent_regions', 'test_playlist_equivalent_regions', ['test/playlist_equivalent_regions_test.cc'])
             create_ardour_test_program(bld, obj.includes, 'playlist_layering', 'test_playlist_layering', ['test/playlist_layering_test.cc'])
+            create_ardour_test_program(bld, obj.includes, 'plugins_test', 'test_plugins', ['test/plugins_test.cc'])
             create_ardour_test_program(bld, obj.includes, 'region_naming', 'test_region_naming', ['test/region_naming_test.cc'])
             create_ardour_test_program(bld, obj.includes, 'control_surface', 'test_control_surfaces', ['test/control_surfaces_test.cc'])
             create_ardour_test_program(bld, obj.includes, 'mtdm_test', 'test_mtdm', ['test/mtdm_test.cc'])
@@ -456,6 +463,7 @@ def build(bld):
             test/framepos_minus_beats_test.cc
             test/playlist_equivalent_regions_test.cc
             test/playlist_layering_test.cc
+            test/plugins_test.cc
             test/region_naming_test.cc
             test/control_surfaces_test.cc
             test/mtdm_test.cc
index c111156c82bdbfd67d66f23b1ee383ed18015d7c..819978f8c61d7c8aa01d76bbb3973226a16f8a0d 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef AUDIOGRAPHER_BROADCAST_INFO_H
 #define AUDIOGRAPHER_BROADCAST_INFO_H
 
+#include <stdint.h>
+
 #include <string>
 #include <ctime>
 
index a1dad22eaf63526ade18f56498a10c28bccb1f6d..693c50064ce266fda3b3b8e3154dc90581de17f8 100644 (file)
@@ -8,6 +8,7 @@
 
 #ifdef __GNUC__
 #include <cxxabi.h>
+#include <cstdlib>
 #endif
 
 namespace AudioGrapher
index 8655fd7191de6789ee1660ac84bd04678fbfcbe5..facb872abfe08feabeefd797a6ccaab1fb0f865b 100644 (file)
@@ -4,6 +4,9 @@
 #include <cstdio>
 #include <string>
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
 #include "sndfile_writer.h"
 #include "sndfile_reader.h"
 
@@ -18,7 +21,7 @@ class TmpFile : public SndfileWriter<T>, public SndfileReader<T>
 
        /// \a filename_template must match the requirements for mkstemp, i.e. end in "XXXXXX"
        TmpFile (char * filename_template, int format, ChannelCount channels, framecnt_t samplerate)
-               : SndfileHandle (mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
+               : SndfileHandle (g_mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
                , filename (filename_template)
        {}
 
index fe9ecc655a5cb203db7c83bd888947c2b2badf69..75e16d7863535f7ad30986d9579453b42f3d2988 100644 (file)
@@ -226,7 +226,7 @@ inline static void gdither_innner_loop(const GDitherType dt,
 
        switch (bit_depth) {
        case GDither8bit:
-           o8[i] = (u_int8_t) (clamped * post_scale);
+           o8[i] = (uint8_t) (clamped * post_scale);
            break;
        case GDither16bit:
            o16[i] = (int16_t) (clamped * post_scale);
@@ -292,7 +292,7 @@ inline static void gdither_innner_loop_fp(const GDitherType dt,
            break;
        }
 
-       clamped = rintf(tmp);
+       clamped = (double)lrintf(tmp);
        if (clamped > clamp_u) {
                clamped = clamp_u;
        } else if (clamped < clamp_l) {
index 43e5008e5212c49ffaf89e4f6997b2cbeb392645..df69ac9c79df618a07f4891f0193824b1e67b98f 100644 (file)
@@ -34,7 +34,7 @@ namespace AudioGrapher
 static void
 snprintf_bounded_null_filled (char* target, size_t target_size, char const * fmt, ...)
 {
-       char buf[target_size+1];
+       char *buf = (char*)alloca(target_size+1);
        va_list ap;
 
        va_start (ap, fmt);
index 94647cc1a688f2e2f25e9f86d8688677f229abca..9ce8af7a5c478ed63162f82ee608a87f0fbbe4ed 100644 (file)
@@ -23,7 +23,7 @@ class TmpFileTest : public CppUnit::TestFixture
 
        void testProcess()
        {
-               uint channels = 2;
+               uint32_t channels = 2;
                file.reset (new TmpFile<float>(SF_FORMAT_WAV | SF_FORMAT_FLOAT, channels, 44100));
                AllocatingProcessContext<float> c (random_data, frames, channels);
                c.set_flag (ProcessContext<float>::EndOfInput);
index 93fc3d440a75a5385d46681c40c968c3d57ee01e..a78c6491c79176f9825ddffbd4346ba44fa1f703 100644 (file)
@@ -554,7 +554,7 @@ ARDOUR::set_path_env_for_jack_autostart (const vector<std::string>& dirs)
 #ifdef __APPLE__
        // push it back into the environment so that auto-started JACK can find it.
        // XXX why can't we just expect OS X users to have PATH set correctly? we can't ...
-       setenv ("PATH", SearchPath(dirs).to_string().c_str(), 1);
+       setenv ("PATH", Searchpath(dirs).to_string().c_str(), 1);
 #else
        /* silence a compiler unused variable warning */
        (void) dirs;
@@ -577,7 +577,7 @@ ARDOUR::get_jack_server_dir_paths (vector<std::string>& server_dir_paths)
        server_dir_paths.push_back (Glib::path_get_dirname (execpath));
 #endif
 
-       SearchPath sp(string(g_getenv("PATH")));
+       Searchpath sp(string(g_getenv("PATH")));
 
 #ifdef WIN32
        gchar *install_dir = g_win32_get_package_installation_directory_of_module (NULL);
index 2903abb641c0b72ee311c969b3548713b6250cec..174f22beef209af8baaf29598489923045317af2 100644 (file)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 from waflib.extras import autowaf as autowaf
+from waflib import Options
 import os
 import sys
 import re
@@ -19,6 +20,14 @@ def options(opt):
     autowaf.set_options(opt)
 
 def configure(conf):
+    #
+    # PortAudio is currently used to get a list of audio device names.
+    # We should find a better way to do this that doesn't involve this
+    # kind of dependency.
+    #
+    if Options.options.dist_target == 'mingw':
+        autowaf.check_pkg(conf, 'portaudio-2.0', uselib_store='PORTAUDIO',
+                          atleast_version='19')
     autowaf.configure(conf)
 
 def build(bld):
@@ -34,7 +43,10 @@ def build(bld):
     obj.cxxflags = [ '-fPIC' ]
     obj.name     = 'jack_audiobackend'
     obj.target   = 'jack_audiobackend'
-    obj.uselib   = [ 'JACK' ]
+    if Options.options.dist_target == 'mingw':
+        obj.uselib   = [ 'JACK', 'PORTAUDIO' ]
+    else:
+        obj.uselib   = [ 'JACK' ]
     obj.use      = 'libardour libpbd'
     obj.vnum     = JACKBACKEND_VERSION
     obj.install_path  = os.path.join(bld.env['LIBDIR'], 'ardour3', 'backends')
index 2c6a6fdc420312336ffce220441d5c67b679c03e..8339ed7c195dceb36c92411b873a3a72f1837d8a 100644 (file)
@@ -159,11 +159,12 @@ add_animation (const GtkWidget *widget, gdouble stop_time)
 static gboolean
 update_animation_info (gpointer key, gpointer value, gpointer user_data)
 {
-       (void) user_data;
-       
-       AnimationInfo *animation_info = value;
+       AnimationInfo *animation_info;
        GtkWidget *widget = key;
        
+       animation_info = value;
+       (void) user_data;
+       
        g_assert ((widget != NULL) && (animation_info != NULL));
        
        /* remove the widget from the hash table if it is not drawable */
@@ -217,9 +218,10 @@ animation_timeout_handler (gpointer data)
 static void
 on_checkbox_toggle (GtkWidget *widget, gpointer data)
 {
+       AnimationInfo *animation_info;
        (void) data;
        
-       AnimationInfo *animation_info = lookup_animation_info (widget);
+       animation_info = lookup_animation_info (widget);
        
        if (animation_info != NULL)
        {
index e44610b4ee5e597e6c5f0d1133960a6bc0206322..1f98485ce57b57f2bbeaaf55fe8054774d7c8511 100644 (file)
@@ -945,12 +945,12 @@ clearlooks_draw_menubar0 (cairo_t *cr,
                           const MenuBarParameters *menubar,
                           int x, int y, int width, int height)
 {
-       (void) params;
-       (void) menubar;
-       
 /*     const CairoColor *light = &colors->shade[0]; */
        const CairoColor *dark = &colors->shade[3];
 
+       (void) params;
+       (void) menubar;
+
        cairo_set_line_width (cr, 1);
        cairo_translate (cr, x, y+0.5);
 
@@ -972,12 +972,12 @@ clearlooks_draw_menubar2 (cairo_t *cr,
                           const MenuBarParameters *menubar,
                           int x, int y, int width, int height)
 {
-       (void) params;
-       (void) menubar;
-       
        CairoColor lower;
        cairo_pattern_t *pattern;
 
+       (void) params;
+       (void) menubar;
+
        ge_shade_color (&colors->bg[0], 0.96, &lower);
        
        cairo_translate (cr, x, y);
@@ -1316,10 +1316,10 @@ clearlooks_draw_separator (cairo_t *cr,
                            const SeparatorParameters  *separator,
                            int x, int y, int width, int height)
 {
-       (void) widget;
-       
+       CairoColor hilight;
        CairoColor color = colors->shade[3];
-       CairoColor hilight; 
+
+       (void) widget;
        ge_shade_color (&color, 1.4, &hilight);
 
        cairo_save (cr);
@@ -1432,11 +1432,12 @@ clearlooks_draw_toolbar (cairo_t *cr,
                          const ToolbarParameters         *toolbar,
                          int x, int y, int width, int height)
 {
-       (void) widget;
-
-       const CairoColor *fill  = &colors->bg[GTK_STATE_NORMAL];
-       const CairoColor *dark  = &colors->shade[3];
        CairoColor light;
+       const CairoColor *dark;
+       const CairoColor *fill  = &colors->bg[GTK_STATE_NORMAL];
+
+       (void) widget;
+       dark  = &colors->shade[3];
        ge_shade_color (fill, 1.1, &light);
        
        cairo_set_line_width (cr, 1.0);
@@ -1575,13 +1576,13 @@ clearlooks_draw_scrollbar_trough (cairo_t *cr,
                                   const ScrollBarParameters        *scrollbar,
                                   int x, int y, int width, int height)
 {
-       (void) widget;
-
-       const CairoColor *bg     = &colors->shade[2];
-       const CairoColor *border = &colors->shade[5];
+       const CairoColor *bg;
        CairoColor        bg_shade;
-       cairo_pattern_t *pattern;
+       cairo_pattern_t  *pattern;
+       const CairoColor *border = &colors->shade[5];
        
+       (void) widget;
+       bg = &colors->shade[2];
        ge_shade_color (bg, 0.95, &bg_shade);
        
        cairo_set_line_width (cr, 1);
@@ -1809,11 +1810,11 @@ clearlooks_draw_statusbar (cairo_t *cr,
                            const WidgetParameters          *widget,
                            int x, int y, int width, int height)
 {
+       CairoColor hilight;
+       const CairoColor *dark = &colors->shade[3];
+
        (void) widget;
        (void) height;
-       
-       const CairoColor *dark = &colors->shade[3];
-       CairoColor hilight;
 
        ge_shade_color (dark, 1.4, &hilight);
 
@@ -1837,9 +1838,9 @@ clearlooks_draw_menu_frame (cairo_t *cr,
                             const WidgetParameters          *widget,
                             int x, int y, int width, int height)
 {
+       const CairoColor *border = &colors->shade[5];
        (void) widget;
 
-       const CairoColor *border = &colors->shade[5];
        cairo_translate      (cr, x, y);
        cairo_set_line_width (cr, 1);
 /*
@@ -1924,15 +1925,15 @@ clearlooks_draw_resize_grip (cairo_t *cr,
                              const ResizeGripParameters      *grip,
                              int x, int y, int width, int height)
 {
-       (void) widget;
-       
-       const CairoColor *dark   = &colors->shade[4];
        CairoColor hilight;
        int lx, ly;
        int x_down;
        int y_down;
        int dots;
-       
+       const CairoColor *dark   = &colors->shade[4];
+
+       (void) widget;
+
        ge_shade_color (dark, 1.5, &hilight);
 
        /* The number of dots fitting into the area. Just hardcoded to 4 right now. */
@@ -1996,17 +1997,18 @@ clearlooks_draw_radiobutton (cairo_t *cr,
                              const CheckboxParameters *checkbox,
                              int x, int y, int width, int height)
 {
-       (void) width;
-       (void) height;
-       
        const CairoColor *border;
        const CairoColor *dot;
        CairoColor shadow;
        CairoColor highlight;
        cairo_pattern_t *pt;
        gboolean inconsistent;
+
        gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
 
+       (void) width;
+       (void) height;
+
        inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
        draw_bullet |= inconsistent;
 
index 62f17f3f950e97e23e8033403070f524e12e8d29..0e573e1b53d809ad58a0c0208c9d36f6921b0f7d 100644 (file)
@@ -1088,13 +1088,16 @@ clearlooks_glossy_draw_toolbar (cairo_t *cr,
                          const ToolbarParameters         *toolbar,
                          int x, int y, int width, int height)
 {
+       CairoColor light;
+       const CairoColor *dark;
+       
+       const CairoColor *fill  = &colors->bg[GTK_STATE_NORMAL];
+       dark  = &colors->shade[3];
+
        (void) widget;
        (void) width;
        (void) height;
-       
-       const CairoColor *fill  = &colors->bg[GTK_STATE_NORMAL];
-       const CairoColor *dark  = &colors->shade[3];
-       CairoColor light;
+
        ge_shade_color (fill, 1.1, &light);
        
        cairo_set_line_width (cr, 1.0);
@@ -1232,9 +1235,6 @@ clearlooks_glossy_draw_radiobutton (cairo_t *cr,
                              const CheckboxParameters *checkbox,
                              int x, int y, int width, int height)
 {
-       (void) width;
-       (void) height;
-       
        const CairoColor *border;
        const CairoColor *dot;
        CairoColor shadow;
@@ -1243,6 +1243,9 @@ clearlooks_glossy_draw_radiobutton (cairo_t *cr,
        gboolean inconsistent;
        gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
 
+       (void) width;
+       (void) height;
+
        inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
        draw_bullet |= inconsistent;
 
index 0d736b5acc4c0d933604e5041022ff87e7fee4c4..ca208c2ebc2e58bfb7b58ead479fdf224743741a 100644 (file)
@@ -790,10 +790,10 @@ clearlooks_gummy_draw_separator (cairo_t                   *cr,
                                  const SeparatorParameters *separator,
                                  int x, int y, int width, int height)
 {
-       (void) widget;
-       
-       CairoColor color = colors->shade[3];
        CairoColor hilight;
+       CairoColor color = colors->shade[3];
+
+       (void) widget;
        ge_shade_color (&color, 1.3, &hilight);
 
        cairo_save (cr);
@@ -1162,11 +1162,14 @@ clearlooks_gummy_draw_toolbar (cairo_t                 *cr,
                                const ToolbarParameters *toolbar,
                                int x, int y, int width, int height)
 {
-       (void) widget;
-       
-       const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
-       const CairoColor *dark = &colors->shade[3];
        CairoColor light;
+       const CairoColor *dark;
+       const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
+
+       (void) widget;
+
+       dark = &colors->shade[3];
+
        ge_shade_color (fill, toolbar->style == 1 ? 1.1 : 1.05, &light);
 
        cairo_set_line_width (cr, 1.0);
@@ -1302,12 +1305,12 @@ clearlooks_gummy_draw_statusbar (cairo_t                *cr,
                                  const WidgetParameters *widget,
                                  int x, int y, int width, int height)
 {
+       CairoColor hilight;
+       const CairoColor *dark = &colors->shade[3];
+
        (void) widget;
        (void) height;
 
-       const CairoColor *dark = &colors->shade[3];
-       CairoColor hilight;
-
        ge_shade_color (dark, 1.3, &hilight);
 
        cairo_set_line_width  (cr, 1);
@@ -1331,9 +1334,6 @@ clearlooks_gummy_draw_radiobutton (cairo_t                  *cr,
                                    const CheckboxParameters *checkbox,
                                    int x, int y, int width, int height)
 {
-       (void) width;
-       (void) height;
-       
        const CairoColor *border;
        const CairoColor *dot;
        CairoColor shadow;
@@ -1342,6 +1342,9 @@ clearlooks_gummy_draw_radiobutton (cairo_t                  *cr,
        gboolean inconsistent;
        gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
 
+       (void) width;
+       (void) height;
+
        inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
        draw_bullet |= inconsistent;
 
index c9a30ff6b4877f9d5e9d4ba16cbc92bcc8cff589..b54abebb4de159d005907d4a347f7b8432d6d525 100644 (file)
@@ -173,9 +173,9 @@ clearlooks_gtk2_rc_parse_boolean (GtkSettings *settings,
                      GScanner     *scanner,
                      gboolean *retval)
 {
-       (void) settings;
-       
        guint token;
+
+       (void) settings;
        token = g_scanner_get_next_token(scanner);
 
        token = g_scanner_get_next_token(scanner);
@@ -198,10 +198,10 @@ clearlooks_gtk2_rc_parse_color(GtkSettings  *settings,
                  GScanner     *scanner,
                  GdkColor     *color)
 {
-       (void) settings;
-       
        guint token;
 
+       (void) settings;
+
        /* Skip 'blah_color' */
        token = g_scanner_get_next_token(scanner);
 
@@ -217,10 +217,10 @@ clearlooks_gtk2_rc_parse_double (GtkSettings  *settings,
                                  GScanner     *scanner,
                                  gdouble      *val)
 {
-       (void) settings;
-       
        guint token;
 
+       (void) settings;
+
        /* Skip 'blah' */
        token = g_scanner_get_next_token(scanner);
 
@@ -242,10 +242,10 @@ clearlooks_gtk2_rc_parse_int (GtkSettings  *settings,
                         GScanner     *scanner,
                         guint8       *progressbarstyle)
 {
-       (void) settings;
-
        guint token;
 
+       (void) settings;
+
        /* Skip 'sunkenmenubar' */
        token = g_scanner_get_next_token(scanner);
 
@@ -267,10 +267,10 @@ clearlooks_gtk2_rc_parse_style (GtkSettings      *settings,
                                 GScanner         *scanner,
                                 ClearlooksStyles *style)
 {
-       (void) settings;
-
        guint token;
 
+       (void) settings;
+
        g_assert (CL_NUM_STYLES == CL_STYLE_GUMMY + 1); /* so that people don't forget ;-) */
 
        /* Skip 'style' */
@@ -308,10 +308,10 @@ clearlooks_gtk2_rc_parse_dummy (GtkSettings      *settings,
                                 GScanner         *scanner,
                                 gchar            *name)
 {
-       (void) settings;
-
        guint token;
 
+       (void) settings;
+
        /* Skip option */
        token = g_scanner_get_next_token (scanner);
 
index f1b46a54268b34c97e00e0e6100b6d8b01748aa6..d1ac8d5d3991e88024fa1687ac6f1164d8fb08cd 100644 (file)
@@ -956,14 +956,14 @@ clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
 static void
 clearlooks_style_draw_option (DRAW_ARGS)
 {
-       (void) detail;
-               
-       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
        const ClearlooksColors *colors;
        WidgetParameters params;
        CheckboxParameters checkbox;
        cairo_t *cr;
+       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
        
+       (void) detail;
+
        CHECK_ARGS
        SANITIZE_SIZE
 
@@ -1019,14 +1019,17 @@ clearlooks_style_draw_vline (GtkStyle               *style,
                              gint                    y2,
                              gint                    x)
 {
+       const ClearlooksColors *colors;
+       SeparatorParameters separator;
+       cairo_t *cr;
+
+       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
+
        (void) state_type;
        (void) widget;
        (void) detail;
-       
-       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
-       const ClearlooksColors *colors;
-       SeparatorParameters separator = { FALSE };
-       cairo_t *cr;
+
+       separator.horizontal = FALSE;
 
        CHECK_ARGS
 
@@ -1053,13 +1056,13 @@ clearlooks_style_draw_hline (GtkStyle               *style,
                              gint                    x2,
                              gint                    y)
 {
-       (void) state_type;
-       (void) widget;
-       
-       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
        const ClearlooksColors *colors;
        cairo_t *cr;
        SeparatorParameters separator;
+       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
+
+       (void) state_type;
+       (void) widget;
 
        CHECK_ARGS
 
@@ -1136,13 +1139,14 @@ clearlooks_style_draw_resize_grip (GtkStyle       *style,
                   gint            width,
                   gint            height)
 {
-       (void) detail;
-       
-       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
-       ClearlooksColors *colors = &clearlooks_style->colors;
+       ClearlooksColors *colors;
        cairo_t *cr;
        WidgetParameters params;
        ResizeGripParameters grip;
+       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
+
+       (void) detail;
+       colors = &clearlooks_style->colors;
 
        CHECK_ARGS
        SANITIZE_SIZE
@@ -1164,14 +1168,15 @@ clearlooks_style_draw_resize_grip (GtkStyle       *style,
 static void
 clearlooks_style_draw_tab (DRAW_ARGS)
 {
-       (void) shadow_type;
-       (void) detail;
-       
-       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
-       ClearlooksColors *colors = &clearlooks_style->colors;
+       ClearlooksColors *colors;
        WidgetParameters params;
        ArrowParameters  arrow;          
        cairo_t *cr;
+       ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
+
+       (void) shadow_type;
+       (void) detail;
+       colors = &clearlooks_style->colors;
 
        CHECK_ARGS
        SANITIZE_SIZE
@@ -1202,15 +1207,18 @@ clearlooks_style_draw_arrow (GtkStyle  *style,
                        gint           width,
                        gint           height)
 {
+       ClearlooksColors *colors;
+       WidgetParameters params;
+       ArrowParameters  arrow;
+       cairo_t *cr;
+       ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
+
        (void) shadow;
        (void) detail;
        (void) fill;
-       
-       ClearlooksStyle  *clearlooks_style = CLEARLOOKS_STYLE (style);
-       ClearlooksColors *colors = &clearlooks_style->colors;
-       WidgetParameters params;
-       ArrowParameters  arrow;
-       cairo_t *cr = ge_gdk_drawable_to_cairo (window, area);
+
+       cr = ge_gdk_drawable_to_cairo (window, area);
+       colors = &clearlooks_style->colors;
 
        CHECK_ARGS
        SANITIZE_SIZE
@@ -1475,10 +1483,9 @@ clearlooks_style_draw_layout (GtkStyle * style,
             GtkWidget * widget,
             const gchar * detail, gint x, gint y, PangoLayout * layout)
 {
-       (void) detail;
-
        GdkGC *gc;
 
+       (void) detail;
        g_return_if_fail (GTK_IS_STYLE (style));
        g_return_if_fail (window != NULL);
 
@@ -1525,17 +1532,20 @@ clearlooks_style_draw_render_icon (GtkStyle            *style,
              GtkWidget           *widget,
              const char          *detail)
 {
-       (void) direction;
-       (void) detail;
-       
-       int width = 1;
-       int height = 1;
+       int width;
+       int height;
        GdkPixbuf *scaled;
        GdkPixbuf *stated;
        GdkPixbuf *base_pixbuf;
        GdkScreen *screen;
        GtkSettings *settings;
-       
+
+       width = 1;
+       height = 1;
+
+       (void) direction;
+       (void) detail;
+
        /* Oddly, style can be NULL in this function, because
         * GtkIconSet can be used without a style and if so
         * it uses this function.
index e2e92385aaf1f18446d435fe548aec22c30ef19a..dbc04d619b206ed9afc73838a0e22d19254481d0 100644 (file)
@@ -179,7 +179,7 @@ public:
        OverlapPitchResolution overlap_pitch_resolution() const { return _overlap_pitch_resolution; }
        void set_overlap_pitch_resolution(OverlapPitchResolution opr);
 
-       void set_notes (const Sequence<Time>::Notes& n);
+       void set_notes (const typename Sequence<Time>::Notes& n);
 
        typedef boost::shared_ptr< Event<Time> > SysExPtr;
        typedef boost::shared_ptr<const Event<Time> > constSysExPtr;
@@ -269,10 +269,16 @@ public:
 
        const const_iterator& end() const { return _end_iter; }
 
+       // CONST iterator implementations (x3)
        typename Notes::const_iterator note_lower_bound (Time t) const;
        typename PatchChanges::const_iterator patch_change_lower_bound (Time t) const;
        typename SysExes::const_iterator sysex_lower_bound (Time t) const;
 
+       // NON-CONST iterator implementations (x3)
+       typename Notes::iterator note_lower_bound (Time t);
+       typename PatchChanges::iterator patch_change_lower_bound (Time t);
+       typename SysExes::iterator sysex_lower_bound (Time t);
+
        bool control_to_midi_event(boost::shared_ptr< Event<Time> >& ev,
                                   const ControlIterator&            iter) const;
 
index e1ae7f46203233382ae4cca6cb072ae983d997a3..e4480b347e1395613a27d8899e29de520c06643d 100644 (file)
@@ -22,7 +22,6 @@
 #include <iostream>
 
 #include <stdint.h>
-#include <stdbool.h>
 #include <string>
 #include <sys/types.h>
 #include <assert.h>
index a095daa13527e9f25e6dbbaf3076495d39adfa63..2453574e5cab5a300f78b3d148f6895719592582 100644 (file)
@@ -812,7 +812,7 @@ ControlList::modify (iterator iter, double when, double val)
                (*iter)->when = when;
                (*iter)->value = val;
 
-               if (std::isnan (val)) {
+               if (isnan (val)) {
                        abort ();
                }
 
index 6f3532fdcb4d95cebf15ba3008c8fbfc3c2067a1..44fc48f7282c168d7f31f3d70a7fa7234089cea8 100644 (file)
@@ -22,6 +22,7 @@
 #include <climits>
 #include <cfloat>
 #include <cmath>
+#include <vector>
 
 #include <glibmm/threads.h>
 
@@ -56,8 +57,8 @@ Curve::solve ()
                   (www.korf.co.uk/spline.pdf) for more details.
                */
 
-               double x[npoints];
-               double y[npoints];
+               vector<double> x(npoints);
+               vector<double> y(npoints);
                uint32_t i;
                ControlList::EventList::const_iterator xx;
 
index 204ef58f33a19eae571d3cb56bc52f0b9dc8e670..7084a9049113043b1eb5f05b7e61238687bd60d3 100644 (file)
@@ -1201,11 +1201,13 @@ Sequence<Time>::overlaps_unlocked (const NotePtr& note, const NotePtr& without)
 
 template<typename Time>
 void
-Sequence<Time>::set_notes (const Sequence<Time>::Notes& n)
+Sequence<Time>::set_notes (const typename Sequence<Time>::Notes& n)
 {
        _notes = n;
 }
 
+// CONST iterator implementations (x3)
+
 /** Return the earliest note with time >= t */
 template<typename Time>
 typename Sequence<Time>::Notes::const_iterator
@@ -1239,6 +1241,41 @@ Sequence<Time>::sysex_lower_bound (Time t) const
        return i;
 }
 
+// NON-CONST iterator implementations (x3)
+
+/** Return the earliest note with time >= t */
+template<typename Time>
+typename Sequence<Time>::Notes::iterator
+Sequence<Time>::note_lower_bound (Time t)
+{
+       NotePtr search_note(new Note<Time>(0, t, 0, 0, 0));
+       typename Sequence<Time>::Notes::iterator i = _notes.lower_bound(search_note);
+       assert(i == _notes.end() || (*i)->time() >= t);
+       return i;
+}
+
+/** Return the earliest patch change with time >= t */
+template<typename Time>
+typename Sequence<Time>::PatchChanges::iterator
+Sequence<Time>::patch_change_lower_bound (Time t)
+{
+       PatchChangePtr search (new PatchChange<Time> (t, 0, 0, 0));
+       typename Sequence<Time>::PatchChanges::iterator i = _patch_changes.lower_bound (search);
+       assert (i == _patch_changes.end() || musical_time_greater_or_equal_to ((*i)->time(), t));
+       return i;
+}
+
+/** Return the earliest sysex with time >= t */
+template<typename Time>
+typename Sequence<Time>::SysExes::iterator
+Sequence<Time>::sysex_lower_bound (Time t)
+{
+       SysExPtr search (new Event<Time> (0, t));
+       typename Sequence<Time>::SysExes::iterator i = _sysexes.lower_bound (search);
+       assert (i == _sysexes.end() || (*i)->time() >= t);
+       return i;
+}
+
 template<typename Time>
 void
 Sequence<Time>::get_notes (Notes& n, NoteOperator op, uint8_t val, int chan_mask) const
@@ -1393,4 +1430,3 @@ Sequence<Time>::dump (ostream& str) const
 template class Sequence<Evoral::MusicalTime>;
 
 } // namespace Evoral
-
index b79d7543b639d52cf845972bc50ceb977c65b9da..ba805e0b041e563d902f9082fe6dbeb80550b5da 100644 (file)
 #include <assert.h>
 #include <math.h>
 #include <errno.h>
+#ifdef PLATFORM_WINDOWS
+#include <winsock2.h>
+#else
 #include <arpa/inet.h>
+#endif
 #include "smf.h"
 #include "smf_private.h"
 
@@ -52,7 +56,7 @@ smf_new(void)
 {
        int cantfail;
 
-       smf_t *smf = malloc(sizeof(smf_t));
+       smf_t *smf = (smf_t*)malloc(sizeof(smf_t));
        if (smf == NULL) {
                g_critical("Cannot allocate smf_t structure: %s", strerror(errno));
                return (NULL);
@@ -85,7 +89,7 @@ smf_delete(smf_t *smf)
 {
        /* Remove all the tracks, from last to first. */
        while (smf->tracks_array->len > 0)
-               smf_track_delete(g_ptr_array_index(smf->tracks_array, smf->tracks_array->len - 1));
+               smf_track_delete((smf_track_t*)g_ptr_array_index(smf->tracks_array, smf->tracks_array->len - 1));
 
        smf_fini_tempo(smf);
 
@@ -105,7 +109,7 @@ smf_delete(smf_t *smf)
 smf_track_t *
 smf_track_new(void)
 {
-       smf_track_t *track = malloc(sizeof(smf_track_t));
+       smf_track_t *track = (smf_track_t*)malloc(sizeof(smf_track_t));
        if (track == NULL) {
                g_critical("Cannot allocate smf_track_t structure: %s", strerror(errno));
                return (NULL);
@@ -131,7 +135,7 @@ smf_track_delete(smf_track_t *track)
 
        /* Remove all the events, from last to first. */
        while (track->events_array->len > 0)
-               smf_event_delete(g_ptr_array_index(track->events_array, track->events_array->len - 1));
+               smf_event_delete((smf_event_t*)g_ptr_array_index(track->events_array, track->events_array->len - 1));
 
        if (track->smf)
                smf_track_remove_from_smf(track);
@@ -213,7 +217,7 @@ smf_track_remove_from_smf(smf_track_t *track)
 smf_event_t *
 smf_event_new(void)
 {
-       smf_event_t *event = malloc(sizeof(smf_event_t));
+       smf_event_t *event = (smf_event_t*)malloc(sizeof(smf_event_t));
        if (event == NULL) {
                g_critical("Cannot allocate smf_event_t structure: %s", strerror(errno));
                return (NULL);
@@ -246,7 +250,7 @@ smf_event_new_from_pointer(const void *midi_data, size_t len)
                return (NULL);
 
        event->midi_buffer_length = len;
-       event->midi_buffer = malloc(event->midi_buffer_length);
+       event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
                g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
                smf_event_delete(event);
@@ -336,7 +340,7 @@ smf_event_new_from_bytes(int first_byte, int second_byte, int third_byte)
        }
 
        event->midi_buffer_length = len;
-       event->midi_buffer = malloc(event->midi_buffer_length);
+       event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
                g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
                smf_event_delete(event);
@@ -773,7 +777,7 @@ smf_track_get_event_by_number(const smf_track_t *track, size_t event_number)
        if (event_number > track->number_of_events)
                return (NULL);
 
-       event = g_ptr_array_index(track->events_array, event_number - 1);
+       event = (smf_event_t*)g_ptr_array_index(track->events_array, event_number - 1);
 
        assert(event);
 
index 0951a6e2f881cf86a24ed3b19e59143b5cd30dcf..7a64a15d0d5b38048a6a7b523b7d2c6c0727ffa8 100644 (file)
 #include <assert.h>
 #include <math.h>
 #include <errno.h>
+#ifdef PLATFORM_WINDOWS
+#include <winsock2.h>
+#else
 #include <arpa/inet.h>
+#endif
 #include <stdint.h>
 #include "smf.h"
 #include "smf_private.h"
@@ -114,7 +118,7 @@ smf_event_decode_textual(const smf_event_t *event, const char *name)
        int off = 0;
        char *buf, *extracted;
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode_textual: malloc failed.");
                return (NULL);
@@ -177,7 +181,7 @@ smf_event_decode_metadata(const smf_event_t *event)
                        break;
        }
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode_metadata: malloc failed.");
                return (NULL);
@@ -235,7 +239,7 @@ smf_event_decode_metadata(const smf_event_t *event)
 
                        off += snprintf(buf + off, BUFFER_SIZE - off,
                                "Time Signature: %d/%d, %d clocks per click, %d notated 32nd notes per quarter note",
-                               event->midi_buffer[3], (int)pow(2, event->midi_buffer[4]), event->midi_buffer[5],
+                               event->midi_buffer[3], (int)pow((double)2, event->midi_buffer[4]), event->midi_buffer[5],
                                event->midi_buffer[6]);
                        break;
 
@@ -302,7 +306,7 @@ smf_event_decode_system_realtime(const smf_event_t *event)
                return (NULL);
        }
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode_system_realtime: malloc failed.");
                return (NULL);
@@ -354,7 +358,7 @@ smf_event_decode_sysex(const smf_event_t *event)
                return (NULL);
        }
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode_sysex: malloc failed.");
                return (NULL);
@@ -455,7 +459,7 @@ smf_event_decode_system_common(const smf_event_t *event)
        if (smf_event_is_sysex(event))
                return (smf_event_decode_sysex(event));
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode_system_realtime: malloc failed.");
                return (NULL);
@@ -526,7 +530,7 @@ smf_event_decode(const smf_event_t *event)
                return (NULL);
        }
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode: malloc failed.");
                return (NULL);
@@ -596,7 +600,7 @@ smf_decode(const smf_t *smf)
        int off = 0;
        char *buf;
 
-       buf = malloc(BUFFER_SIZE);
+       buf = (char*)malloc(BUFFER_SIZE);
        if (buf == NULL) {
                g_critical("smf_event_decode: malloc failed.");
                return (NULL);
index 6da6036ea0e9c92a32a83f481acc58990e84ddf0..fed4d28bb7effa542f7369e8203a54a5be610047 100644 (file)
 #include <math.h>
 #include <errno.h>
 #include <ctype.h>
+#ifdef PLATFORM_WINDOWS
+#include <winsock2.h>
+#else
 #include <arpa/inet.h>
+#endif
 #include "smf.h"
 #include "smf_private.h"
 
@@ -119,7 +123,7 @@ parse_mthd_header(smf_t *smf)
                return (-1);
        }
 
-       tmp_mthd = smf->file_buffer;
+       tmp_mthd = (struct chunk_header_struct*)smf->file_buffer;
 
        if (!chunk_signature_matches(tmp_mthd, "MThd")) {
                g_critical("SMF error: MThd signature not found, is that a MIDI file?");
@@ -405,7 +409,7 @@ extract_sysex_event(const unsigned char *buf, const size_t buffer_length, smf_ev
        }
 
        event->midi_buffer_length = message_length;
-       event->midi_buffer = malloc(event->midi_buffer_length);
+       event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
                g_critical("Cannot allocate memory in extract_sysex_event(): %s", strerror(errno));
                return (-4);
@@ -448,7 +452,7 @@ extract_escaped_event(const unsigned char *buf, const size_t buffer_length, smf_
        }
 
        event->midi_buffer_length = message_length;
-       event->midi_buffer = malloc(event->midi_buffer_length);
+       event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
                g_critical("Cannot allocate memory in extract_escaped_event(): %s", strerror(errno));
                return (-4);
@@ -518,7 +522,7 @@ extract_midi_event(const unsigned char *buf, const size_t buffer_length, smf_eve
        }
 
        event->midi_buffer_length = message_length;
-       event->midi_buffer = malloc(event->midi_buffer_length);
+       event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
                g_critical("Cannot allocate memory in extract_midi_event(): %s", strerror(errno));
                return (-4);
@@ -607,7 +611,7 @@ make_string(const unsigned char *buf, const size_t buffer_length, uint32_t len)
                len = buffer_length;
        }
 
-       str = malloc(len + 1);
+       str = (char*)malloc(len + 1);
        if (str == NULL) {
                g_critical("Cannot allocate memory in make_string().");
                return (NULL);
@@ -658,14 +662,14 @@ smf_event_extract_text(const smf_event_t *event)
                return (NULL);
        }
 
-       smf_extract_vlq((void *)&(event->midi_buffer[2]), event->midi_buffer_length - 2, &string_length, &length_length);
+       smf_extract_vlq((const unsigned char*)(void *)&(event->midi_buffer[2]), event->midi_buffer_length - 2, &string_length, &length_length);
 
        if (string_length <= 0) {
                g_critical("smf_event_extract_text: truncated MIDI message.");
                return (NULL);
        }
 
-       return (make_string((void *)(&event->midi_buffer[2] + length_length), event->midi_buffer_length - 2 - length_length, string_length));
+       return (make_string((const unsigned char*)(void *)(&event->midi_buffer[2] + length_length), event->midi_buffer_length - 2 - length_length, string_length));
 }
 
 /**
index b99af75461b094207d11d3b9f967fe0aa6d1d7db..3b313cff5a5547d0f48eeb63a517b6d9d15cd075 100644 (file)
 #include <assert.h>
 #include <math.h>
 #include <errno.h>
+#ifdef PLATFORM_WINDOWS
+#include <winsock2.h>
+#else
 #include <arpa/inet.h>
+#endif
 #include "smf.h"
 #include "smf_private.h"
 
@@ -54,7 +58,7 @@ static void *
 smf_extend(smf_t *smf, const int length)
 {
        int i, previous_file_buffer_length = smf->file_buffer_length;
-       char *previous_file_buffer = smf->file_buffer;
+       char *previous_file_buffer = (char*)smf->file_buffer;
 
        /* XXX: Not terribly efficient. */
        smf->file_buffer_length += length;
@@ -201,7 +205,7 @@ smf_event_new_textual(int type, const char *text)
 
        /* "2 +" is for leading 0xFF 0xtype. */
        event->midi_buffer_length = 2 + text_length + MAX_VLQ_LENGTH;
-       event->midi_buffer = malloc(event->midi_buffer_length);
+       event->midi_buffer = (uint8_t*)malloc(event->midi_buffer_length);
        if (event->midi_buffer == NULL) {
                g_critical("Cannot allocate MIDI buffer structure: %s", strerror(errno));
                smf_event_delete(event);
@@ -541,7 +545,7 @@ assert_smf_event_is_identical(const smf_event_t *a, const smf_event_t *b)
 {
        assert(a->event_number == b->event_number);
        assert(a->delta_time_pulses == b->delta_time_pulses);
-       assert(abs(a->time_pulses - b->time_pulses) <= 2);
+       assert(abs((long)(a->time_pulses - b->time_pulses)) <= 2);
        assert(fabs(a->time_seconds - b->time_seconds) <= 0.01);
        assert(a->track_number == b->track_number);
        assert(a->midi_buffer_length == b->midi_buffer_length);
index c24e7460c1e060fb21c7bdff1231979d90d8d8e4..6620cd405c054089e3a21fc1bdba4236dc3f8544 100644 (file)
@@ -59,7 +59,7 @@ new_tempo(smf_t *smf, size_t pulses)
                        return (previous_tempo);
        }
 
-       tempo = malloc(sizeof(smf_tempo_t));
+       tempo = (smf_tempo_t*)malloc(sizeof(smf_tempo_t));
        if (tempo == NULL) {
                g_critical("Cannot allocate smf_tempo_t.");
                return (NULL);
@@ -152,7 +152,7 @@ maybe_add_to_tempo_map(smf_event_t *event)
                }
 
                numerator = event->midi_buffer[3];
-               denominator = (int)pow(2, event->midi_buffer[4]);
+               denominator = (int)pow((double)2, event->midi_buffer[4]);
                clocks_per_click = event->midi_buffer[5];
                notes_per_note = event->midi_buffer[6];
 
@@ -259,7 +259,7 @@ smf_get_tempo_by_number(const smf_t *smf, size_t number)
        if (number >= smf->tempo_array->len)
                return (NULL);
 
-       return (g_ptr_array_index(smf->tempo_array, number));
+       return ((smf_tempo_t*)g_ptr_array_index(smf->tempo_array, number));
 }
 
 /**
@@ -341,7 +341,7 @@ smf_fini_tempo(smf_t *smf)
        smf_tempo_t *tempo;
 
        while (smf->tempo_array->len > 0) {
-               tempo = g_ptr_array_index(smf->tempo_array, smf->tempo_array->len - 1);
+               tempo = (smf_tempo_t*)g_ptr_array_index(smf->tempo_array, smf->tempo_array->len - 1);
                assert(tempo);
 
                memset(tempo, 0, sizeof(smf_tempo_t));
index d4b2a28affe0419424c44dd7d3e5b45c88645978..fe9efa479f49731aa58c14730e5019ac35026e4a 100644 (file)
@@ -1,5 +1,9 @@
 #include "SMFTest.hpp"
 
+#ifdef WIN32
+#include <io.h> // for R_OK
+#endif
+
 using namespace std;
 
 CPPUNIT_TEST_SUITE_REGISTRATION( SMFTest );
index 84a738f278559a84f1a6149327d6e9a8bbaa3abf..200308a254b3bdbafae9b32ed89af930eaf3b115 100644 (file)
@@ -27,6 +27,7 @@
 #include <gtk/gtkuimanager.h>
 #include <gtk/gtkactiongroup.h>
 
+#include <gtkmm.h>
 #include <gtkmm/accelmap.h>
 #include <gtkmm/uimanager.h>
 
@@ -265,15 +266,15 @@ ActionManager::get_action (const char* path)
                path++;
        }
 
-       char copy[len+1];
-       strcpy (copy, path);
-       char* slash = strchr (copy, '/');
+       vector<char> copy(len+1);
+       strcpy (&copy[0], path);
+       char* slash = strchr (&copy[0], '/');
        if (!slash) {
                return RefPtr<Action> ();
        }
        *slash = '\0';
 
-       return get_action (copy, ++slash);
+       return get_action (&copy[0], ++slash);
        
 }
 
index f12c64cf68973a0bf39a626ee5167abdb2c60a8a..c56ab8598246e96115b0ae20a25a575d9089a0da 100644 (file)
@@ -107,7 +107,7 @@ BindingProxy::learning_finished ()
 
 
 bool
-BindingProxy::prompter_hiding (GdkEventAny */*ev*/)
+BindingProxy::prompter_hiding (GdkEventAny/*ev*/)
 {
        learning_connection.disconnect ();
        if (controllable) {
index e049cd8d57e9c5a41af18d196bc31363d27007ac..f96bd586d985ec6d7cbcb35957291885df535b08 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <iostream>
 
+#include <glib/gstdio.h>
+
 #include "pbd/xml++.h"
 #include "pbd/convert.h"
 
@@ -389,7 +391,7 @@ Bindings::save (const string& path)
         save (*root);
 
         if (!tree.write (path)) {
-                ::unlink (path.c_str());
+                ::g_unlink (path.c_str());
                 return false;
         }
 
index f20f537e1b972f2ebafadde4b55258fed6d14ef8..c449cae5920ed1d4dcc07f0221512c0795ea14cb 100644 (file)
@@ -25,6 +25,7 @@
 #include "gtkmm2ext/utils.h"
 
 using std::string;
+using std::vector;
 using std::map;
 using std::max;
 using std::cerr;
@@ -132,7 +133,7 @@ void
 CairoTextCell::set_size (Cairo::RefPtr<Cairo::Context>& context)
 {
        const uint32_t lim = (uint32_t) ceil (_width_chars);
-       char buf[lim+1];
+       vector<char> buf(lim+1);
        uint32_t n;
        double max_width = 0.0;
        double max_height = 0.0;
@@ -149,7 +150,7 @@ CairoTextCell::set_size (Cairo::RefPtr<Cairo::Context>& context)
                        buf[n] = '0' + digit; 
                }
                
-               context->get_text_extents (buf, ext);
+               context->get_text_extents (&buf[0], ext);
                
                max_width = max (ext.width + ext.x_bearing, max_width);
                max_height = max (ext.height, max_height);
index d826def7ff60fa3f3c99dd7cc22f6cab8e59385a..5a775572225b786d0330b166dd19999664fad682 100644 (file)
 
 #include <stdlib.h>
 
+#include <glibmm.h>
+#include <gdkmm.h>
 #include <gdkmm/rectangle.h>
 #include <gtkmm2ext/fastmeter.h>
 #include <gtkmm2ext/utils.h>
 
 #define UINT_TO_RGB(u,r,g,b) { (*(r)) = ((u)>>16)&0xff; (*(g)) = ((u)>>8)&0xff; (*(b)) = (u)&0xff; }
 #define UINT_TO_RGBA(u,r,g,b,a) { UINT_TO_RGB(((u)>>8),r,g,b); (*(a)) = (u)&0xff; }
+
 using namespace Gtk;
-using namespace Gdk;
 using namespace Glib;
 using namespace Gtkmm2ext;
 using namespace std;
@@ -97,7 +99,7 @@ FastMeter::FastMeter (long hold, unsigned long dimen, Orientation o, int len,
        _stp[2] = stp2;
        _stp[3] = stp3;
 
-       set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
+       set_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
 
        pixrect.x = 1;
        pixrect.y = 1;
index 6e466f5c9f587b5a120b7406254e2e37653566be..9c20da0f4c2eea27e7cfe7cca65eb181d39237f3 100644 (file)
@@ -94,7 +94,7 @@ UI::UI (string namestr, int *argc, char ***argv)
 
        /* attach our request source to the default main context */
 
-       request_channel.ios()->attach (MainContext::get_default());
+       attach_request_source ();
 
        errors = new TextViewer (800,600);
        errors->text().set_editable (false);
@@ -689,7 +689,7 @@ UI::flush_pending ()
 }
 
 bool
-UI::just_hide_it (GdkEventAny */*ev*/, Window *win)
+UI::just_hide_it (GdkEventAny/*ev*/, Window *win)
 {
        win->hide ();
        return true;
@@ -739,7 +739,7 @@ UI::color_selection_done (bool status)
 }
 
 bool
-UI::color_selection_deleted (GdkEventAny */*ev*/)
+UI::color_selection_deleted (GdkEventAny/*ev*/)
 {
        Main::quit ();
        return true;
diff --git a/libs/gtkmm2ext/gtkapplication_win32.c b/libs/gtkmm2ext/gtkapplication_win32.c
new file mode 100644 (file)
index 0000000..78d538b
--- /dev/null
@@ -0,0 +1,49 @@
+/* GTK+ Integration with platform-specific application-wide features 
+ * such as the OS X menubar and application delegate concepts (for X11)
+ *
+ * Copyright (C) 2007 Pioneer Research Center USA, Inc.
+ * Copyright (C) 2007 Imendio AB
+ * Copyright (C) 2009 Paul Davis
+ *
+ * This library 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; version 2.1
+ * of the License.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <gtkmm2ext/gtkapplication.h>
+
+int  
+gtk_application_init (void)
+{
+       return 0;
+}
+
+void gtk_application_cleanup (void)
+{
+}
+
+void                      
+gtk_application_set_menu_bar (GtkMenuShell* menushell)
+{
+}
+
+void                      
+gtk_application_add_app_menu_item (GtkApplicationMenuGroup* group, GtkMenuItem* item)
+{
+}
+
+void
+gtk_application_ready (void)
+{
+}
index b692a7ccdc2daa59b13d2d9bf5856a264a3ff8ea..4eab2dae98c7b39a0230ee1f529220f8661bc8f0 100644 (file)
 #ifndef __gtkmm2ext_auto_spin_h__
 #define __gtkmm2ext_auto_spin_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 
 namespace Gtkmm2ext {
index 8f9655e2bf187b96d462eb53d7ee94da7c699997..ea0041e5409a6a56e9122fe3bc4860bb762103bc 100644 (file)
 #ifndef __gtkmm2ext_click_box_h__
 #define __gtkmm2ext_click_box_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <string>
 #include <gtkmm.h>
 
index 6ad1f7dd949ca6dbf3f306c4427fad05dc93a4f0..f61127dd7458ea00475508257d8efec2cc6afc00 100644 (file)
 #ifndef __ardour_gtk_doi_h__
 #define __ardour_gtk_doi_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 
 /* XXX g++ 2.95 can't compile this as pair of member function templates */
index 64176232f05f4a2f36d2cba695fb64217a9e202d..a758ad78f4aee8f9a9a8073b28d414edfb61eff2 100644 (file)
 #include <setjmp.h>
 #include <pthread.h>
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <glibmm/thread.h>
 
 #include <gtkmm/widget.h>
index 1db357341dcb2f404d06693dc3fd47f33ded088f..994932e733d2851beb4d63da4a5c248d8cf1b59e 100644 (file)
 #ifndef __qui_popup_h__
 #define __qui_popup_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <string>
 #include <gtkmm.h>
 
index 841742db03230e6060d19bf6856da4da044dfba3..56e075a242443ec0bf89300610580aba1bd723b1 100644 (file)
 #ifndef __gtkselector_h__
 #define __gtkselector_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <string>
 #include <vector>
 
index 4c6a5cb41d5d33208d2596bad6cc3458a49abc06..42ed05a761e774c6a1a0f3e7df199bf25dd8f575 100644 (file)
 #ifndef __gtkmm2ext_slider_controller_h__
 #define __gtkmm2ext_slider_controller_h__
 
+#ifdef interface
+#undef interface
+#endif
+
 #include <gtkmm.h>
 #include <gtkmm2ext/popup.h>
 #include <gtkmm2ext/pixfader.h>
index 3e3a3da566a5bf2c126a3a79b62ead48df4728fc..edf5517fffc6807b49810594a09cf17c08a0bae2 100644 (file)
 #define _BSD_SOURCE
 #include <gtkmm2ext/idle_adjustment.h>
 #include <gtkmm/main.h>
+#include <glibmm/main.h>
 #include <iostream>
 
+#include "pbd/timersub.h"
+
 using namespace Gtk;
 using namespace sigc;
 using namespace Gtkmm2ext;
index ead2b268857babca2bfa41b878f4c9d1dce48522..bef934eca5693c72aa99e6c7f29a9136953d3e1e 100644 (file)
@@ -25,6 +25,8 @@
 #include <unistd.h>
 #include <stdio.h> /* for snprintf, grrr */
 
+#include <glib/gstdio.h>
+
 #include <gdk/gdkkeysyms.h>
 #include <gtkmm.h>
 
@@ -468,14 +470,18 @@ Glib::RefPtr<Gdk::Pixbuf>
 MotionFeedback::render_pixbuf (int size)
 {
         Glib::RefPtr<Gdk::Pixbuf> pixbuf;
-        char path[32];
+       char *path;
         int fd;
+       GError *error = NULL;
 
-        snprintf (path, sizeof (path), "/tmp/mfimg%dXXXXXX", size);
-        
-        if ((fd = mkstemp (path)) < 0) {
+       fd = g_file_open_tmp ("mfimgXXXXXX", &path, &error);
+       close (fd);
+
+       if(error) {
+               g_critical("failed to open a temporary file for writing: %s.", error->message);
+               g_error_free (error);
                 return pixbuf;
-        }
+       }
         
        GdkColor col2 = {0,0,0,0};
        GdkColor col3 = {0,0,0,0};
@@ -512,15 +518,17 @@ MotionFeedback::render_pixbuf (int size)
                pixbuf = Gdk::Pixbuf::create_from_file (path);
        } catch (const Gdk::PixbufError &e) {
                 std::cerr << "Caught PixbufError: " << e.what() << std::endl;
-                unlink (path);
+                ::g_unlink (path);
                 throw;
        } catch (...) {
-                unlink (path);
+                ::g_unlink (path);
                g_message("Caught ... ");
                 throw;
        }
 
-        unlink (path);
+        ::g_unlink (path);
+
+       g_free(path);
 
         return pixbuf;
 } 
index 6f4a8a5427d3372d6787098a08b92aac7103bc80..85a9d537c365859aeb185eb2c61b8182b5a8acf0 100644 (file)
@@ -111,7 +111,7 @@ PopUp::touch ()
 }
 
 gint
-PopUp::button_click (GdkEventButton */*ev*/)
+PopUp::button_click (GdkEventButton/*ev*/)
 {
        remove ();
        return TRUE;
index cdac2dbafec5a807f09b8aa04c5a649dd2bde7ed..9709db7c5aead047d9466990fec8cd76a7659621 100644 (file)
@@ -6,6 +6,11 @@
     License: LGPLv2+ 
 */
 
+#ifdef COMPILER_MSVC
+#include <algorithm>
+using std::min; using std::max;
+#endif
+
 #include "gtkmm2ext/prolooks-helpers.h"
 
 static gpointer cairo_color_parent_class = NULL;
@@ -188,7 +193,7 @@ static gchar* cairo_value_color_collect_value (GValue* value, guint n_collect_va
        (void) collect_flags;
        if (collect_values[0].v_pointer) {
                CairoColor* object;
-               object = collect_values[0].v_pointer;
+               object = (CairoColor*)collect_values[0].v_pointer;
                if (object->parent_instance.g_class == NULL) {
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
@@ -205,16 +210,16 @@ static gchar* cairo_value_color_collect_value (GValue* value, guint n_collect_va
 static gchar* cairo_value_color_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
        CairoColor** object_p;
        (void) n_collect_values;
-       object_p = collect_values[0].v_pointer;
+       object_p = (CairoColor**)collect_values[0].v_pointer;
        if (!object_p) {
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME ((GValue*)value));
        }
        if (!value->data[0].v_pointer) {
                *object_p = NULL;
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-               *object_p = value->data[0].v_pointer;
+               *object_p = (CairoColor*)value->data[0].v_pointer;
        } else {
-               *object_p = cairo_color_ref (value->data[0].v_pointer);
+               *object_p = (CairoColor*)cairo_color_ref (value->data[0].v_pointer);
        }
        return NULL;
 }
@@ -223,7 +228,7 @@ static gchar* cairo_value_color_lcopy_value (const GValue* value, guint n_collec
 GParamSpec* cairo_param_spec_color (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
        CairoParamSpecColor* spec;
        g_return_val_if_fail (g_type_is_a (object_type, CAIRO_TYPE_COLOR), NULL);
-       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       spec = (CairoParamSpecColor*)g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
        G_PARAM_SPEC (spec)->value_type = object_type;
        return G_PARAM_SPEC (spec);
 }
@@ -238,7 +243,7 @@ gpointer cairo_value_get_color (const GValue* value) {
 void cairo_value_set_color (GValue* value, gpointer v_object) {
        CairoColor* old;
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CAIRO_TYPE_COLOR));
-       old = value->data[0].v_pointer;
+       old = (CairoColor*)value->data[0].v_pointer;
        if (v_object) {
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CAIRO_TYPE_COLOR));
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
@@ -256,7 +261,7 @@ void cairo_value_set_color (GValue* value, gpointer v_object) {
 void cairo_value_take_color (GValue* value, gpointer v_object) {
        CairoColor* old;
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, CAIRO_TYPE_COLOR));
-       old = value->data[0].v_pointer;
+       old = (CairoColor*)value->data[0].v_pointer;
        if (v_object) {
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, CAIRO_TYPE_COLOR));
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
@@ -293,9 +298,9 @@ GType cairo_color_get_type (void) {
        if (g_once_init_enter (&cairo_color_type_id__volatile)) {
                static const GTypeValueTable g_define_type_value_table = { cairo_value_color_init, cairo_value_color_free_value, cairo_value_color_copy_value, cairo_value_color_peek_pointer, "p", cairo_value_color_collect_value, "p", cairo_value_color_lcopy_value };
                static const GTypeInfo g_define_type_info = { sizeof (CairoColorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) cairo_color_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (CairoColor), 0, (GInstanceInitFunc) cairo_color_instance_init, &g_define_type_value_table };
-               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (GTypeFundamentalFlags)(G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
                GType cairo_color_type_id;
-               cairo_color_type_id = g_type_register_fundamental (g_type_fundamental_next (), "CairoColor", &g_define_type_info, &g_define_type_fundamental_info, 0);
+               cairo_color_type_id = g_type_register_fundamental (g_type_fundamental_next (), "CairoColor", &g_define_type_info, &g_define_type_fundamental_info, (GTypeFlags)0);
                g_once_init_leave (&cairo_color_type_id__volatile, cairo_color_type_id);
        }
        return cairo_color_type_id__volatile;
@@ -304,7 +309,7 @@ GType cairo_color_get_type (void) {
 
 gpointer cairo_color_ref (gpointer instance) {
        CairoColor* self;
-       self = instance;
+       self = (CairoColor*)instance;
        g_atomic_int_inc (&self->ref_count);
        return instance;
 }
@@ -312,7 +317,7 @@ gpointer cairo_color_ref (gpointer instance) {
 
 void cairo_color_unref (gpointer instance) {
        CairoColor* self;
-       self = instance;
+       self = (CairoColor*)instance;
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
                CAIRO_COLOR_GET_CLASS (self)->finalize (self);
                g_type_free_instance ((GTypeInstance *) self);
@@ -774,7 +779,7 @@ static gchar* prolooks_value_hsl_collect_value (GValue* value, guint n_collect_v
        (void) collect_flags;
        if (collect_values[0].v_pointer) {
                ProlooksHSL* object;
-               object = collect_values[0].v_pointer;
+               object = (ProlooksHSL*)collect_values[0].v_pointer;
                if (object->parent_instance.g_class == NULL) {
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
@@ -791,16 +796,16 @@ static gchar* prolooks_value_hsl_collect_value (GValue* value, guint n_collect_v
 static gchar* prolooks_value_hsl_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
        ProlooksHSL** object_p;
        (void) n_collect_values;
-       object_p = collect_values[0].v_pointer;
+       object_p = (ProlooksHSL**)collect_values[0].v_pointer;
        if (!object_p) {
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME ((GValue*)value));
        }
        if (!value->data[0].v_pointer) {
                *object_p = NULL;
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-               *object_p = value->data[0].v_pointer;
+               *object_p = (ProlooksHSL*)value->data[0].v_pointer;
        } else {
-               *object_p = prolooks_hsl_ref (value->data[0].v_pointer);
+               *object_p = (ProlooksHSL*)prolooks_hsl_ref (value->data[0].v_pointer);
        }
        return NULL;
 }
@@ -809,7 +814,7 @@ static gchar* prolooks_value_hsl_lcopy_value (const GValue* value, guint n_colle
 GParamSpec* prolooks_param_spec_hsl (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
        ProlooksParamSpecHSL* spec;
        g_return_val_if_fail (g_type_is_a (object_type, PROLOOKS_TYPE_HSL), NULL);
-       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       spec = (ProlooksParamSpecHSL*)g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
        G_PARAM_SPEC (spec)->value_type = object_type;
        return G_PARAM_SPEC (spec);
 }
@@ -824,7 +829,7 @@ gpointer prolooks_value_get_hsl (const GValue* value) {
 void prolooks_value_set_hsl (GValue* value, gpointer v_object) {
        ProlooksHSL* old;
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROLOOKS_TYPE_HSL));
-       old = value->data[0].v_pointer;
+       old = (ProlooksHSL*)value->data[0].v_pointer;
        if (v_object) {
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROLOOKS_TYPE_HSL));
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
@@ -842,7 +847,7 @@ void prolooks_value_set_hsl (GValue* value, gpointer v_object) {
 void prolooks_value_take_hsl (GValue* value, gpointer v_object) {
        ProlooksHSL* old;
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROLOOKS_TYPE_HSL));
-       old = value->data[0].v_pointer;
+       old = (ProlooksHSL*)value->data[0].v_pointer;
        if (v_object) {
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROLOOKS_TYPE_HSL));
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
@@ -879,9 +884,9 @@ GType prolooks_hsl_get_type (void) {
        if (g_once_init_enter (&prolooks_hsl_type_id__volatile)) {
                static const GTypeValueTable g_define_type_value_table = { prolooks_value_hsl_init, prolooks_value_hsl_free_value, prolooks_value_hsl_copy_value, prolooks_value_hsl_peek_pointer, "p", prolooks_value_hsl_collect_value, "p", prolooks_value_hsl_lcopy_value };
                static const GTypeInfo g_define_type_info = { sizeof (ProlooksHSLClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) prolooks_hsl_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProlooksHSL), 0, (GInstanceInitFunc) prolooks_hsl_instance_init, &g_define_type_value_table };
-               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (GTypeFundamentalFlags)(G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
                GType prolooks_hsl_type_id;
-               prolooks_hsl_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ProlooksHSL", &g_define_type_info, &g_define_type_fundamental_info, 0);
+               prolooks_hsl_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ProlooksHSL", &g_define_type_info, &g_define_type_fundamental_info, (GTypeFlags)0);
                g_once_init_leave (&prolooks_hsl_type_id__volatile, prolooks_hsl_type_id);
        }
        return prolooks_hsl_type_id__volatile;
@@ -890,15 +895,15 @@ GType prolooks_hsl_get_type (void) {
 
 gpointer prolooks_hsl_ref (gpointer instance) {
        ProlooksHSL* self;
-       self = instance;
-        g_atomic_int_inc (&self->ref_count);
+       self = (ProlooksHSL*)instance;
+       g_atomic_int_inc (&self->ref_count);
        return instance;
 }
 
 
 void prolooks_hsl_unref (gpointer instance) {
        ProlooksHSL* self;
-       self = instance;
+       self = (ProlooksHSL*)instance;
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
                PROLOOKS_HSL_GET_CLASS (self)->finalize (self);
                g_type_free_instance ((GTypeInstance *) self);
@@ -1183,7 +1188,7 @@ static gchar* prolooks_value_hsv_collect_value (GValue* value, guint n_collect_v
        (void) n_collect_values;
        if (collect_values[0].v_pointer) {
                ProlooksHSV* object;
-               object = collect_values[0].v_pointer;
+               object = (ProlooksHSV*)collect_values[0].v_pointer;
                if (object->parent_instance.g_class == NULL) {
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
@@ -1200,16 +1205,16 @@ static gchar* prolooks_value_hsv_collect_value (GValue* value, guint n_collect_v
 static gchar* prolooks_value_hsv_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
        ProlooksHSV** object_p;
        (void) n_collect_values;
-       object_p = collect_values[0].v_pointer;
+       object_p = (ProlooksHSV**)collect_values[0].v_pointer;
        if (!object_p) {
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME ((GValue*)value));
        }
        if (!value->data[0].v_pointer) {
                *object_p = NULL;
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-               *object_p = value->data[0].v_pointer;
+               *object_p = (ProlooksHSV*)value->data[0].v_pointer;
        } else {
-               *object_p = prolooks_hsv_ref (value->data[0].v_pointer);
+               *object_p = (ProlooksHSV*)prolooks_hsv_ref (value->data[0].v_pointer);
        }
        return NULL;
 }
@@ -1218,7 +1223,7 @@ static gchar* prolooks_value_hsv_lcopy_value (const GValue* value, guint n_colle
 GParamSpec* prolooks_param_spec_hsv (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
        ProlooksParamSpecHSV* spec;
        g_return_val_if_fail (g_type_is_a (object_type, PROLOOKS_TYPE_HSV), NULL);
-       spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
+       spec = (ProlooksParamSpecHSV*)g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
        G_PARAM_SPEC (spec)->value_type = object_type;
        return G_PARAM_SPEC (spec);
 }
@@ -1233,7 +1238,7 @@ gpointer prolooks_value_get_hsv (const GValue* value) {
 void prolooks_value_set_hsv (GValue* value, gpointer v_object) {
        ProlooksHSV* old;
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROLOOKS_TYPE_HSV));
-       old = value->data[0].v_pointer;
+       old = (ProlooksHSV*)value->data[0].v_pointer;
        if (v_object) {
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROLOOKS_TYPE_HSV));
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
@@ -1251,7 +1256,7 @@ void prolooks_value_set_hsv (GValue* value, gpointer v_object) {
 void prolooks_value_take_hsv (GValue* value, gpointer v_object) {
        ProlooksHSV* old;
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, PROLOOKS_TYPE_HSV));
-       old = value->data[0].v_pointer;
+       old = (ProlooksHSV*)value->data[0].v_pointer;
        if (v_object) {
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, PROLOOKS_TYPE_HSV));
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
@@ -1286,9 +1291,9 @@ GType prolooks_hsv_get_type (void) {
        if (g_once_init_enter (&prolooks_hsv_type_id__volatile)) {
                static const GTypeValueTable g_define_type_value_table = { prolooks_value_hsv_init, prolooks_value_hsv_free_value, prolooks_value_hsv_copy_value, prolooks_value_hsv_peek_pointer, "p", prolooks_value_hsv_collect_value, "p", prolooks_value_hsv_lcopy_value };
                static const GTypeInfo g_define_type_info = { sizeof (ProlooksHSVClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) prolooks_hsv_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ProlooksHSV), 0, (GInstanceInitFunc) prolooks_hsv_instance_init, &g_define_type_value_table };
-               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
+               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (GTypeFundamentalFlags)(G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
                GType prolooks_hsv_type_id;
-               prolooks_hsv_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ProlooksHSV", &g_define_type_info, &g_define_type_fundamental_info, 0);
+               prolooks_hsv_type_id = g_type_register_fundamental (g_type_fundamental_next (), "ProlooksHSV", &g_define_type_info, &g_define_type_fundamental_info, (GTypeFlags)0);
                g_once_init_leave (&prolooks_hsv_type_id__volatile, prolooks_hsv_type_id);
        }
        return prolooks_hsv_type_id__volatile;
@@ -1297,7 +1302,7 @@ GType prolooks_hsv_get_type (void) {
 
 gpointer prolooks_hsv_ref (gpointer instance) {
        ProlooksHSV* self;
-       self = instance;
+       self = (ProlooksHSV*)instance;
        g_atomic_int_inc (&self->ref_count);
        return instance;
 }
@@ -1305,7 +1310,7 @@ gpointer prolooks_hsv_ref (gpointer instance) {
 
 void prolooks_hsv_unref (gpointer instance) {
        ProlooksHSV* self;
-       self = instance;
+       self = (ProlooksHSV*)instance;
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
                PROLOOKS_HSV_GET_CLASS (self)->finalize (self);
                g_type_free_instance ((GTypeInstance *) self);
index 85924e82ab728f842d0b67f218d698e00fbf6a91..e4b95d1e032b1c5fa2fea87d25110ebec8e8da2f 100644 (file)
@@ -22,6 +22,9 @@
 #include <vector>
 #include <string>
 
+#include <glibmm.h>
+#include <gdkmm.h>
+
 #include "pbd/pathscanner.h"
 
 #include "gtkmm2ext/keyboard.h"
index 66ce5ed71ca6ad99f407d7f23f01d94b0ac8cca6..ed8f4da5bc2b56c7910fd263f5aa7140a4d306ae 100644 (file)
@@ -25,7 +25,7 @@
 
 using namespace MIDI;
 
-Channel::Channel (byte channelnum, Port &p) 
+Channel::Channel (MIDI::byte channelnum, Port &p) 
        : _port (p)
 {
        _channel_number = channelnum;
@@ -182,13 +182,13 @@ Channel::process_controller (Parser & /*parser*/, EventTwoBytes *tb)
 }
 
 void
-Channel::process_program_change (Parser & /*parser*/, byte val) 
+Channel::process_program_change (Parser & /*parser*/, MIDI::byte val) 
 {
        _program_number = val;
 }
 
 void
-Channel::process_chanpress (Parser & /*parser*/, byte val) 
+Channel::process_chanpress (Parser & /*parser*/, MIDI::byte val) 
 {
        _chanpress = val;
 }
@@ -215,7 +215,7 @@ Channel::process_reset (Parser & /*parser*/)
  * \return true if success
  */
 bool
-Channel::channel_msg (byte id, byte val1, byte val2, timestamp_t timestamp)
+Channel::channel_msg (MIDI::byte id, MIDI::byte val1, MIDI::byte val2, timestamp_t timestamp)
 {
        unsigned char msg[3];
        int len = 0;
index c90a3dbe6fd133a2200c21cf4ce38fd9e92ed2e6..4c0282f1f757a40e32cca91106a43c3d11108e26 100644 (file)
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#ifdef   COMPILER_MSVC
+#undef   O_NONBLOCK
+#define  O_NONBLOCK 0
+#endif
+#if defined(PLATFORM_WINDOWS)
+#include <winsock2.h>
+#else
 #include <netdb.h>
+#endif
 
-#if defined(WIN32)
+#if defined(PLATFORM_WINDOWS)
 static WSADATA g_wsaData;
 typedef int socklen_t;
 #else
@@ -112,7 +120,7 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname )
 {
        // Get interface address from supplied name.
 
-#if !defined(WIN32)
+#if !defined(PLATFORM_WINDOWS)
        struct ifreq ifr;
        ::strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name));
 
@@ -141,12 +149,13 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname )
 
        return false;
 
-#endif // !WIN32
+#endif // !PLATFORM_WINDOWS'
 }
 
 bool
 IPMIDIPort::open_sockets (int base_port, const string& ifname)
 {
+#if !defined(PLATFORM_WINDOWS)
        int protonum = 0;
        struct protoent *proto = ::getprotobyname("IP");
 
@@ -243,10 +252,13 @@ IPMIDIPort::open_sockets (int base_port, const string& ifname)
        }
        
        return true;
+#else
+       return false;
+#endif // !PLATFORM_WINDOWS'
 }
 
 int
-IPMIDIPort::write (const byte* msg, size_t msglen, timestamp_t /* ignored */) {
+IPMIDIPort::write (const MIDI::byte* msg, size_t msglen, timestamp_t /* ignored */) {
 
        if (sockout) {
                Glib::Threads::Mutex::Lock lm (write_lock);
@@ -260,7 +272,7 @@ IPMIDIPort::write (const byte* msg, size_t msglen, timestamp_t /* ignored */) {
 }
 
 int
-IPMIDIPort::read (byte* /*buf*/, size_t /*bufsize*/)
+IPMIDIPort::read (MIDI::byte* /*buf*/, size_t /*bufsize*/)
 {
        /* nothing to do here - all handled by parse() */
        return 0;
index c077170026a8e7e8dbf0e87a988fe89008115321..a4adb14cf4bb67f3afe6d41eecfd348dadcc00e1 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <string>
 #include <iostream>
-#if defined(WIN32)
+#if defined(PLATFORM_WINDOWS)
 #include <winsock.h>
 #elif defined(__FREE_BSD__)
 #include <netinet/in.h>
index 6d778beab298ffc0c7859d1ff043359fe1614414..a915320fa366bc3c6ea199cb9a465e23e95bb949 100644 (file)
 
 #include <jack/types.h>
 
+#include <pthread.h>
+
 #include "pbd/xml++.h"
+#ifndef PLATFORM_WINDOWS
 #include "pbd/crossthread.h"
+#endif
 #include "pbd/signals.h"
 #include "pbd/ringbuffer.h"
 
index bf22792f70a1319ff49100dbfae9eb2366d7f790..0498168843ed2fd4f8cc1673eed948be7d4055ac 100644 (file)
@@ -371,7 +371,7 @@ operator<< (std::ostream& os, const ChannelNameSet& cns)
           << "List size " << cns._patch_list.size() << endl
           << "Patch list name = [" << cns._patch_list_name << ']' << endl
           << "Available channels : ";
-       for (set<uint8_t>::iterator x = cns._available_for_channels.begin(); x != cns._available_for_channels.end(); ++x) {
+       for (set<uint8_t>::const_iterator x = cns._available_for_channels.begin(); x != cns._available_for_channels.end(); ++x) {
                os << (int) (*x) << ' ';
        }
        os << endl;
index b93dc0f260503bb5e84088683caa1296ba2cdaa7..1b9481c9bf8127e1a89580ff4ebc6f78cc707c9f 100644 (file)
 #include "midi++/port.h"
 #include "midi++/parser.h"
 
+#ifndef __INT_MAX__   // 'ssize_t' won't be defined yet
+typedef long ssize_t;
+#endif
+
 using namespace std;
 using namespace MIDI;
 using namespace PBD;
@@ -218,19 +222,19 @@ MachineControl::set_ports (MIDI::Port* ip, MIDI::Port* op)
 }
 
 void
-MachineControl::set_receive_device_id (byte id)
+MachineControl::set_receive_device_id (MIDI::byte id)
 {
        _receive_device_id = id & 0x7f;
 }
 
 void
-MachineControl::set_send_device_id (byte id)
+MachineControl::set_send_device_id (MIDI::byte id)
 {
        _send_device_id = id & 0x7f;
 }
 
 bool
-MachineControl::is_mmc (byte *sysex_buf, size_t len)
+MachineControl::is_mmc (MIDI::byte *sysex_buf, size_t len)
 {
        if (len < 4 || len > 48) {
                return false;
@@ -249,7 +253,7 @@ MachineControl::is_mmc (byte *sysex_buf, size_t len)
 }
 
 void
-MachineControl::process_mmc_message (Parser &, byte *msg, size_t len)
+MachineControl::process_mmc_message (Parser &, MIDI::byte *msg, size_t len)
 {
        size_t skiplen;
        byte *mmc_msg;
@@ -456,7 +460,7 @@ MachineControl::process_mmc_message (Parser &, byte *msg, size_t len)
 }              
 
 int
-MachineControl::do_masked_write (byte *msg, size_t len)
+MachineControl::do_masked_write (MIDI::byte *msg, size_t len)
 {
        /* return the number of bytes "consumed" */
 
@@ -482,7 +486,7 @@ MachineControl::do_masked_write (byte *msg, size_t len)
 }
 
 void
-MachineControl::write_track_status (byte *msg, size_t /*len*/, byte reg)
+MachineControl::write_track_status (MIDI::byte *msg, size_t /*len*/, MIDI::byte reg)
 {
        size_t n;
        ssize_t base_track;
@@ -571,7 +575,7 @@ MachineControl::write_track_status (byte *msg, size_t /*len*/, byte reg)
 }
 
 int
-MachineControl::do_locate (byte *msg, size_t /*msglen*/)
+MachineControl::do_locate (MIDI::byte *msg, size_t /*msglen*/)
 {
        if (msg[2] == 0) {
                warning << "MIDI::MMC: locate [I/F] command not supported"
@@ -586,7 +590,7 @@ MachineControl::do_locate (byte *msg, size_t /*msglen*/)
 }
 
 int
-MachineControl::do_step (byte *msg, size_t /*msglen*/)
+MachineControl::do_step (MIDI::byte *msg, size_t /*msglen*/)
 {
        int steps = msg[2] & 0x3f;
 
@@ -599,7 +603,7 @@ MachineControl::do_step (byte *msg, size_t /*msglen*/)
 }
 
 int
-MachineControl::do_shuttle (byte *msg, size_t /*msglen*/)
+MachineControl::do_shuttle (MIDI::byte *msg, size_t /*msglen*/)
 {
        size_t forward;
        byte sh = msg[2];
index 0c2d8a41b3a3b8089d55089b0dda4e585d41ae32..1a477c3b8caaf9f1aaacfabf86d2c4aa2431ec84 100644 (file)
@@ -36,7 +36,7 @@ using namespace MIDI;
 #undef DEBUG_MTC
 
 bool
-Parser::possible_mtc (byte *sysex_buf, size_t msglen)
+Parser::possible_mtc (MIDI::byte *sysex_buf, size_t msglen)
 {
        byte fake_mtc_time[5];
 
@@ -91,7 +91,7 @@ Parser::reset_mtc_state ()
 }
 
 void
-Parser::process_mtc_quarter_frame (byte *msg)
+Parser::process_mtc_quarter_frame (MIDI::byte *msg)
 {
        int which_quarter_frame = (msg[1] & 0xf0) >> 4;
 
index 2f6b50899cc5a27a6dc7fcf6fd93ea8a0cb1e547..7d31c9978166064e983fcc6b8f07e9971ec8b360 100644 (file)
@@ -136,7 +136,7 @@ Parser::~Parser ()
 }
 
 void
-Parser::trace_event (Parser &, byte *msg, size_t len)
+Parser::trace_event (Parser &, MIDI::byte *msg, size_t len)
 {
        eventType type;
        ostream *o;
@@ -658,7 +658,7 @@ Parser::system_msg (unsigned char inbyte)
 }
 
 void 
-Parser::signal (byte *msg, size_t len)
+Parser::signal (MIDI::byte *msg, size_t len)
 {
        channel_t chan = msg[0]&0xF;
        int chan_i = chan;
@@ -761,7 +761,7 @@ Parser::signal (byte *msg, size_t len)
 }
 
 bool
-Parser::possible_mmc (byte *msg, size_t msglen)
+Parser::possible_mmc (MIDI::byte *msg, size_t msglen)
 {
        if (!MachineControl::is_mmc (msg, msglen)) {
                return false;
index 4524ed560bce98c556189af77418680bf374df50..00024768e4f8a9c2d7b527f367edaa1e72aa5b18 100644 (file)
@@ -51,6 +51,7 @@
 #include "ardour/buffer_set.h"
 #include "ardour/audio_buffer.h"
 #include "ardour/pannable.h"
+#include "ardour/visibility.h"
 
 #include "i18n.h"
 #include "panner_1in2out.h"
@@ -67,7 +68,7 @@ static PanPluginDescriptor _descriptor = {
         Panner1in2out::factory
 };
 
-extern "C" { PanPluginDescriptor* panner_descriptor () { return &_descriptor; } }
+extern "C" ARDOURPANNER_API PanPluginDescriptor*  panner_descriptor () { return &_descriptor; }
 
 Panner1in2out::Panner1in2out (boost::shared_ptr<Pannable> p)
        : Panner (p)
index 97d23495c716220cb929af7fbcf0a1af784a2d20..912072096bd282806b10714d4404b151e923f5e8 100644 (file)
@@ -33,6 +33,7 @@
 #include "ardour/types.h"
 #include "ardour/panner.h"
 
+
 namespace ARDOUR {
 
 class Panner1in2out : public Panner
@@ -41,8 +42,8 @@ class Panner1in2out : public Panner
        Panner1in2out (boost::shared_ptr<Pannable>);
        ~Panner1in2out ();
 
-        void set_position (double);
-        bool clamp_position (double&);
+    void set_position (double);
+    bool clamp_position (double&);
        std::pair<double, double> position_range () const;
 
         double position() const;
index 70c34d0779d46775fd1fba3258bf6cd039b0bbc8..31ff7e7fd15f0153672f2b5684c2777cadb4595d 100644 (file)
@@ -23,6 +23,7 @@ def build(bld):
     obj.source = [ 'panner_1in2out.cc' ]
     obj.export_includes = ['.']
     obj.cxxflags     = '-DPACKAGE="libardour_pan1in2out"'
+    obj.defines      = [ 'ARDOURPANNER_DLL_EXPORTS' ]
     obj.includes     = ['.']
     obj.name         = 'libardour_pan1in2out'
     obj.target       = 'pan1in2out'
index a316b764c77276c543939d3a148057036c4bd624..6740f56e6578eb4cf2c8b61b1bd0be5a8dc37d1b 100644 (file)
@@ -49,6 +49,7 @@
 #include "ardour/runtime_functions.h"
 #include "ardour/session.h"
 #include "ardour/utils.h"
+#include "ardour/visibility.h"
 #include "ardour/mix.h"
 
 #include "panner_2in2out.h"
@@ -67,7 +68,7 @@ static PanPluginDescriptor _descriptor = {
         Panner2in2out::factory
 };
 
-extern "C" { PanPluginDescriptor* panner_descriptor () { return &_descriptor; } }
+extern "C" ARDOURPANNER_API PanPluginDescriptor* panner_descriptor () { return &_descriptor; }
 
 Panner2in2out::Panner2in2out (boost::shared_ptr<Pannable> p)
        : Panner (p)
index 8288ef28f7a72392838cdf1477409a604cbd3a12..2aeca322d01d2b91e1b411632394311c0b391eb5 100644 (file)
@@ -23,6 +23,7 @@ def build(bld):
     obj.source = [ 'panner_2in2out.cc' ]
     obj.export_includes = ['.']
     obj.cxxflags     = '-DPACKAGE="libardour_pan2in2out"'
+    obj.defines      = [ 'ARDOURPANNER_DLL_EXPORTS' ]
     obj.includes     = ['.']
     obj.name         = 'libardour_pan2in2out'
     obj.target       = 'pan2in2out'
index 1cef98fc7d0897a17efced6646faf3b3bedce35e..6d7496729c87abf938b07e0b5dacb4b9c94f9be7 100644 (file)
 #include <iostream>
 #include <string>
 
+#ifdef COMPILER_MSVC
+#include <malloc.h>
+#endif
+
 #include "pbd/cartesian.h"
 #include "pbd/compose.h"
 
@@ -50,7 +54,7 @@ static PanPluginDescriptor _descriptor = {
         VBAPanner::factory
 };
 
-extern "C" { PanPluginDescriptor* panner_descriptor () { return &_descriptor; } }
+extern "C" ARDOURPANNER_API PanPluginDescriptor* panner_descriptor () { return &_descriptor; }
 
 VBAPanner::Signal::Signal (Session&, VBAPanner&, uint32_t, uint32_t n_speakers)
 {
@@ -62,7 +66,7 @@ VBAPanner::Signal::Signal (Session&, VBAPanner&, uint32_t, uint32_t n_speakers)
 }
 
 void
-VBAPanner::Signal::Signal::resize_gains (uint32_t n)
+VBAPanner::Signal::resize_gains (uint32_t n)
 {
         gains.assign (n, 0.0);
 }        
@@ -290,7 +294,7 @@ VBAPanner::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
 
         assert (sz == obufs.count().n_audio());
 
-        int8_t outputs[sz]; // on the stack, no malloc
+        int8_t *outputs = (int8_t*)alloca(sz); // on the stack, no malloc
         
         /* set initial state of each output "record"
          */
@@ -319,10 +323,10 @@ VBAPanner::distribute_one (AudioBuffer& srcbuf, BufferSet& obufs, gain_t gain_co
 
         /* at this point, we can test a speaker's status:
 
-           (outputs[o] & 1)      <= in use before
-           (outputs[o] & 2)      <= in use this time
-           (outputs[o] & 3) == 3 <= in use both times
-            outputs[o] == 0      <= not in use either time
+           (*outputs[o] & 1)      <= in use before
+           (*outputs[o] & 2)      <= in use this time
+           (*outputs[o] & 3) == 3 <= in use both times
+            *outputs[o] == 0      <= not in use either time
            
         */
 
index b84698bbd9420e11c4805e6a61ad0b046287e518..f2533222bd852abcc13cf9605acfb9afea16c7c8 100644 (file)
    of the software.
 */
 
+#ifdef COMPILER_MSVC
+#pragma warning ( disable : 4244 )
+#endif
+
+#include <vector>
 #include <cmath>
 #include <algorithm>
 #include <stdlib.h>
@@ -45,6 +50,13 @@ using namespace std;
 
 const double VBAPSpeakers::MIN_VOL_P_SIDE_LGTH = 0.01;
 
+typedef std::vector<double>        DoubleVector;
+typedef std::vector<float>         FloatVector;
+typedef std::vector<bool>          BoolVector;
+typedef std::vector<int>           IntVector;
+typedef std::vector<IntVector>     IntVector2D;
+typedef std::vector<DoubleVector>  DoubleVector2D;
+
 VBAPSpeakers::VBAPSpeakers (boost::shared_ptr<Speakers> s)
        : _dimension (2)
         , _parent (s)
@@ -104,17 +116,18 @@ VBAPSpeakers::choose_speaker_triplets(struct ls_triplet_chain **ls_triplets)
 
        int i,j,k,l,table_size;
        int n_speakers = _speakers.size ();
-       int connections[n_speakers][n_speakers];
-       float distance_table[((n_speakers * (n_speakers - 1)) / 2)];
-       int distance_table_i[((n_speakers * (n_speakers - 1)) / 2)];
-       int distance_table_j[((n_speakers * (n_speakers - 1)) / 2)];
-       float distance;
-       struct ls_triplet_chain *trip_ptr, *prev, *tmp_ptr;
 
-       if (n_speakers == 0) {
+       if (n_speakers < 1) {
                return;
        }
 
+       FloatVector  distance_table(((n_speakers * (n_speakers - 1)) / 2));
+       IntVector    distance_table_i(((n_speakers * (n_speakers - 1)) / 2));
+       IntVector    distance_table_j(((n_speakers * (n_speakers - 1)) / 2));
+       IntVector2D  connections(n_speakers, IntVector(n_speakers));
+       float        distance;
+       struct ls_triplet_chain *trip_ptr, *prev, *tmp_ptr;
+
        for (i = 0; i < n_speakers; i++) {
                for (j = i+1; j < n_speakers; j++) {
                        for(k=j+1;k<n_speakers;k++) {
@@ -505,25 +518,25 @@ VBAPSpeakers::choose_speaker_pairs (){
           matrices and stores the data to a global array
        */
        const int n_speakers = _speakers.size();
-       const double AZIMUTH_DELTA_THRESHOLD_DEGREES = (180.0/M_PI) * (M_PI - 0.175);
-       int sorted_speakers[n_speakers];
-       bool exists[n_speakers];
-       double inverse_matrix[n_speakers][4]; 
-       int expected_pairs = 0;
-       int pair;
-       int speaker;
-
 
-       if (n_speakers == 0) {
+       if (n_speakers < 1) {
                return;
        }
 
+       IntVector      sorted_speakers(n_speakers);
+       BoolVector     exists(n_speakers);
+       DoubleVector2D inverse_matrix(n_speakers, DoubleVector(4)); 
+       const double   AZIMUTH_DELTA_THRESHOLD_DEGREES = (180.0/M_PI) * (M_PI - 0.175);
+       int expected_pairs = 0;
+       int pair;
+       int speaker;
+
        for (speaker = 0; speaker < n_speakers; ++speaker) {
                exists[speaker] = false;
        }
 
        /* sort loudspeakers according their aximuth angle */
-       sort_2D_lss (sorted_speakers);
+       sort_2D_lss (&sorted_speakers[0]);
         
        /* adjacent loudspeakers are the loudspeaker pairs to be used.*/
        for (speaker = 0; speaker < n_speakers-1; speaker++) {
@@ -532,7 +545,7 @@ VBAPSpeakers::choose_speaker_pairs (){
                     _speakers[sorted_speakers[speaker]].angles().azi) <= AZIMUTH_DELTA_THRESHOLD_DEGREES) {
                        if (calc_2D_inv_tmatrix( _speakers[sorted_speakers[speaker]].angles().azi, 
                                                 _speakers[sorted_speakers[speaker+1]].angles().azi, 
-                                                inverse_matrix[speaker]) != 0){
+                                                &inverse_matrix[speaker][0]) != 0){
                                exists[speaker] = true;
                                expected_pairs++;
                        }
@@ -543,7 +556,7 @@ VBAPSpeakers::choose_speaker_pairs (){
             +_speakers[sorted_speakers[0]].angles().azi) <= AZIMUTH_DELTA_THRESHOLD_DEGREES) {
                if (calc_2D_inv_tmatrix(_speakers[sorted_speakers[n_speakers-1]].angles().azi, 
                                        _speakers[sorted_speakers[0]].angles().azi, 
-                                       inverse_matrix[n_speakers-1]) != 0) { 
+                                       &inverse_matrix[n_speakers-1][0]) != 0) { 
                        exists[n_speakers-1] = true;
                        expected_pairs++;
                } 
index c6ba94261f61ae613a02c09af07c691e89d3f486..9258277810cc3641d90d3665012b36ae4b2fefa2 100644 (file)
@@ -23,6 +23,7 @@ def build(bld):
     obj.source = [ 'vbap_speakers.cc', 'vbap.cc'  ]
     obj.export_includes = ['.']
     obj.cxxflags     = '-DPACKAGE="libardour_panvbap"'
+    obj.defines      = [ 'ARDOURPANNER_DLL_EXPORTS' ]
     obj.includes     = ['.']
     obj.name         = 'libardour_panvbap'
     obj.target       = 'panvbap'
index a7e148c839867cba0189508fd3631360cb3a265e..3a4257ebdd9a9ecaf9bfc1109277543588e73427 100644 (file)
 
 #include <cstring>
 #include <stdint.h>
+#ifdef COMPILER_MSVC
+#include <io.h>      // Microsoft's nearest equivalent to <unistd.h>
+#else
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <cerrno>
 #include <cstring>
@@ -33,6 +37,8 @@
 
 #include "i18n.h"
 
+#include "pbd/debug.h"
+
 using namespace std;
 using namespace PBD;
 using namespace Glib;
@@ -42,13 +48,18 @@ BaseUI::RequestType BaseUI::CallSlot = BaseUI::new_request_type();
 BaseUI::RequestType BaseUI::Quit = BaseUI::new_request_type();
 
 BaseUI::BaseUI (const string& str)
-       : request_channel (true)
+       : m_context(MainContext::get_default())
        , run_loop_thread (0)
        , _name (str)
+#ifndef PLATFORM_WINDOWS
+       , request_channel (true)
+#endif
 {
        base_ui_instance = this;
 
+#ifndef PLATFORM_WINDOWS
        request_channel.ios()->connect (sigc::mem_fun (*this, &BaseUI::request_handler));
+#endif
 
        /* derived class must set _ok */
 }
@@ -73,7 +84,7 @@ BaseUI::new_request_type ()
 void
 BaseUI::main_thread ()
 {
-       DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", name(), pthread_self()));
+       DEBUG_TRACE (DEBUG::EventLoop, string_compose ("%1: event loop running in thread %2\n", name(), pthread_name()));
        set_event_loop_for_thread (this);
        thread_init ();
        _main_loop->get_context()->signal_idle().connect (sigc::mem_fun (*this, &BaseUI::signal_running));
@@ -95,11 +106,9 @@ BaseUI::run ()
        /* to be called by UI's that need/want their own distinct, self-created event loop thread.
        */
 
-       _main_loop = MainLoop::create (MainContext::create());
-       request_channel.ios()->attach (_main_loop->get_context());
-
-       /* glibmm hack - drop the refptr to the IOSource now before it can hurt */
-       request_channel.drop_ios ();
+       m_context = MainContext::create();
+       _main_loop = MainLoop::create (m_context);
+       attach_request_source ();
 
        Glib::Threads::Mutex::Lock lm (_run_lock);
        run_loop_thread = Glib::Threads::Thread::create (mem_fun (*this, &BaseUI::main_thread));
@@ -115,6 +124,24 @@ BaseUI::quit ()
        }
 }
 
+#ifdef PLATFORM_WINDOWS
+gboolean
+BaseUI::_request_handler (gpointer data)
+{
+       BaseUI* ui = static_cast<BaseUI*>(data);
+       return ui->request_handler ();
+}
+
+bool
+BaseUI::request_handler ()
+{
+       DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::request_handler\n");
+       handle_ui_requests ();
+       // keep calling indefinitely at the timeout interval
+       return true;
+}
+
+#else
 bool
 BaseUI::request_handler (Glib::IOCondition ioc)
 {
@@ -133,9 +160,39 @@ BaseUI::request_handler (Glib::IOCondition ioc)
 
                /* handle requests */
 
+               DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::request_handler\n");
                handle_ui_requests ();
        }
 
        return true;
 }
-       
+#endif
+
+void
+BaseUI::signal_new_request ()
+{
+       DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::signal_new_request\n");
+#ifdef PLATFORM_WINDOWS
+       // handled in timeout, how to signal...?
+#else
+       request_channel.wakeup ();
+#endif
+}
+
+/**
+ * This method relies on the caller having already set m_context
+ */
+void
+BaseUI::attach_request_source ()
+{
+       DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::attach_request_source\n");
+#ifdef PLATFORM_WINDOWS
+       GSource* request_source = g_timeout_source_new(200);
+       g_source_set_callback (request_source, &BaseUI::_request_handler, this, NULL);
+       g_source_attach (request_source, m_context->gobj());
+#else
+       request_channel.ios()->attach (m_context);
+       /* glibmm hack - drop the refptr to the IOSource now before it can hurt */
+       request_channel.drop_ios ();
+#endif
+}
index 29410d41e51cbdbaab4ee7a8c5dce378ac10be7a..2f9c7b772d4f618b24c773796ba83e52cfa80af0 100644 (file)
 
 */
 
-#include <string>
+#ifdef COMPILER_MSVC
+#include <io.h>      // Microsoft's nearest equivalent to <unistd.h>
+using PBD::readdir;
+using PBD::opendir;
+using PBD::closedir;
+#else
 #include <dirent.h>
 #include <unistd.h>
+#endif
+
+#include <string>
 #include <sys/stat.h>
 #include <errno.h>
 #include <string.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 
 #include "pbd/error.h"
@@ -66,7 +75,7 @@ PBD::clear_directory (const string& dir, size_t* size, vector<string>* paths)
                         continue;
                 }
                 
-                if (::unlink (fullpath.c_str())) {
+                if (::g_unlink (fullpath.c_str())) {
                         error << string_compose (_("cannot remove file %1 (%2)"), fullpath, strerror (errno))
                               << endmsg;
                         ret = 1;
index c86afbe87e723b74205f1cef1483d3c060b9b7b7..fba457c83eeb256012b2b2f36dfae97a406c8861 100644 (file)
@@ -24,6 +24,8 @@
 #include <vector>
 #include <algorithm>
 
+#include <boost/tokenizer.hpp>
+
 #include "pbd/debug.h"
 
 #include "i18n.h"
@@ -47,6 +49,7 @@ uint64_t PBD::DEBUG::FileManager = PBD::new_debug_bit ("filemanager");
 uint64_t PBD::DEBUG::Pool = PBD::new_debug_bit ("pool");
 uint64_t PBD::DEBUG::EventLoop = PBD::new_debug_bit ("eventloop");
 uint64_t PBD::DEBUG::AbstractUI = PBD::new_debug_bit ("abstractui");
+uint64_t PBD::DEBUG::FileUtils = PBD::new_debug_bit ("fileutils");
 
 uint64_t PBD::debug_bits = 0x0;
 
@@ -75,36 +78,31 @@ PBD::set_debug_bits (uint64_t bits)
 int
 PBD::parse_debug_options (const char* str)
 {
-       char* p;
-       char* sp;
+       typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+       boost::char_separator<char> sep (",");
+       tokenizer tokens (string(str), sep);
        uint64_t bits = 0;
-       char* copy = strdup (str);
-
-       p = strtok_r (copy, ",", &sp);
 
-       while (p) {
-               if (strcasecmp (p, "list") == 0) {
+       for (tokenizer::iterator tok_iter = tokens.begin(); tok_iter != tokens.end(); ++tok_iter) {
+               if (*tok_iter == "list") {
                        list_debug_options ();
-                       free (copy);
                        return 1;
                }
 
-               if (strcasecmp (p, "all") == 0) {
+               if (*tok_iter == "all") {
                        PBD::set_debug_bits (~0ULL);
-                       free (copy);
                        return 0;
                }
 
                for (map<const char*,uint64_t>::iterator i = _debug_bit_map().begin(); i != _debug_bit_map().end(); ++i) {
-                        if (strncasecmp (p, i->first, strlen (p)) == 0) {
+                       const char* cstr = (*tok_iter).c_str();
+
+                        if (strncasecmp (cstr, i->first, strlen (cstr)) == 0) {
                                 bits |= i->second;
                         }
                 }
-
-               p = strtok_r (0, ",", &sp);
        }
        
-       free (copy);
        PBD::set_debug_bits (bits);
        return 0;
 }
index 81e640b66de2b13eb28979f2c3f76bfdd8aea26c..7e578a23679874943df8225e7e7e79c231a37e5e 100644 (file)
 #define _GNU_SOURCE
 #include <dlfcn.h>
 #include <stdio.h>
-#include <pthread.h>
 #include <stdlib.h>
 
+#include "pbd/pthread_utils.h"
+
 int (*pbd_alloc_allowed) () = 0;
 
 /** Thread-local key whose value is set to 1 if malloc checking is disabled
index 8b8a23491b0d78131a82b37c283270eefd5432c4..1a27a436a6dbad64dc6b387cc013c4da0f4d59ff 100644 (file)
 
 */
 
+#include <glib.h>
+
 #include <cstdlib>
 
 #include "pbd/epa.h"
 #include "pbd/strsplit.h"
 
+#ifdef COMPILER_MSVC
+#define environ        _environ
+_CRTIMP extern char ** _environ;
+#else
 extern char** environ;
+#endif
 
 using namespace PBD;
 using namespace std;
@@ -61,7 +68,7 @@ EnvironmentalProtectionAgency::save ()
                 /* fetch environment from named environment variable, rather than "environ"
                  */
 
-                const char* estr = getenv (_envname.c_str());
+                const char* estr = g_getenv (_envname.c_str());
 
                 if (!estr) {
                         return;
@@ -117,7 +124,7 @@ EnvironmentalProtectionAgency::restore () const
                clear ();
 
         for (map<string,string>::const_iterator i = e.begin(); i != e.end(); ++i) {
-                setenv (i->first.c_str(), i->second.c_str(), 1);
+                g_setenv (i->first.c_str(), i->second.c_str(), 1);
         }
 } 
 
@@ -137,6 +144,6 @@ EnvironmentalProtectionAgency::clear () const
                 }
                        
                 string before = estring.substr (0, equal);
-                unsetenv(before.c_str());
+                g_unsetenv(before.c_str());
         }
 }                        
diff --git a/libs/pbd/fallback_folders.cc b/libs/pbd/fallback_folders.cc
new file mode 100644 (file)
index 0000000..deecd60
--- /dev/null
@@ -0,0 +1,591 @@
+/*
+    Copyright (C) 2008 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <pbd/fallback_folders.h>
+#include <glib.h>
+#include <glibmm.h>
+#include <string.h>
+
+
+
+#ifdef PLATFORM_WINDOWS // Would not be relevant for Cygwin!!
+#include <shlobj.h>
+#include <winreg.h>
+
+//***************************************************************
+//
+//     get_win_special_folder()
+//
+//  Gets the full path name that corresponds of one of the Windows
+//  special folders, such as "My Documents" and the like. The input
+//  parameter must be one of the corresponding CSIDL values, such
+//  as CSIDL_SYSTEM etc.
+//  
+//     Returns:
+//
+//    On Success: A pointer to a newly allocated string containing
+//                the name of the special folder (must later be freed).
+//    On Failure: NULL
+//
+gchar *
+get_win_special_folder (int csidl)
+{
+wchar_t path[PATH_MAX+1];
+HRESULT hr;
+LPITEMIDLIST pidl = 0;
+gchar *retval = 0;
+
+       if (S_OK == (hr = SHGetSpecialFolderLocation (0, csidl, &pidl)))
+       {
+               if (SHGetPathFromIDListW (pidl, path))
+                       retval = g_utf16_to_utf8 ((const gunichar2*)path, -1, 0, 0, 0);
+               CoTaskMemFree (pidl);
+       }
+
+       return retval;
+}
+#endif // PLATFORM_WINDOWS
+
+namespace PBD {
+
+static  gchar **fallback_folders = 0;
+
+//***************************************************************
+//
+//     get_platform_fallback_folders()
+//
+//  Returns an array of folders to fall back to if the folders
+//  weren't named at build time and subsequently couldn't be found
+//  in the user's environment. This might not be needed any more
+//  because the function 'fixup_bundle_environment()' (in the
+//  gtk2_ardour branch) now explicitly sets up any environment
+//  paths that the program will need at run time. However, having
+//  the folders here might help us to simplify the above function
+//  which would be useful (currently, there are different versions
+//  of 'fixup_bundle_environment()' for each supported platform).
+//  Twelve fallback folders are currently catered for, corresponding to:-
+//
+//      LOCALEDIR
+//      GTK_DIR
+//      CONFIG_DIR
+//      ARDOUR_DIR
+//      MODULE_DIR
+//      DATA_DIR
+//      ICONS_DIR
+//      PIXMAPS_DIR
+//      CONTROL_SURFACES_DIR
+//      VAMP_DIR
+//      LADSPA_PATH - note that there's only one entry in the path
+//      VST_PATH - note that there may only be one entry in the path
+//
+//     Returns:
+//
+//    On Success: A pointer to an array containing the above dirs.
+//    On Failure: NULL
+//
+#ifdef PLATFORM_WINDOWS // Would not be relevant for Cygwin!!
+
+static gchar**
+get_platform_fallback_folders ()
+{
+gchar **fallback_dir_vector = 0;
+const   gchar  *pUsrHome    = 0; // Do not free !!
+
+       if (!fallback_folders)
+       {
+               GArray *pFallbackDirs;
+               gchar *pAppData   = 0;
+               gchar *pMyAppData = 0;
+               gchar *pExeRoot   = 0;
+               gchar *pPersonal  = 0;
+
+               pFallbackDirs = g_array_new (TRUE, TRUE, sizeof (char *));
+
+               if (pFallbackDirs)
+               {
+                       /* Get the path for the user's personal folder */
+                       gchar *pPersonalTemp = get_win_special_folder (CSIDL_PERSONAL);
+
+                       /* and the path for the user's personal application data */
+                       gchar *pMyAppDataTemp = get_win_special_folder (CSIDL_LOCAL_APPDATA);
+
+                       /* and the path for common application data ("Documents and Settings\All Users\Application Data") */
+                       gchar *pAppDataTemp = get_win_special_folder (CSIDL_COMMON_APPDATA);
+
+                       if (0 == pAppDataTemp)
+                               pAppData = g_build_filename("C:\\", "Documents and Settings", "All Users", "Application Data", PROGRAM_NAME, "local", 0);
+                       else
+                       {
+                               pAppData = g_build_filename(pAppDataTemp, PROGRAM_NAME, "local", 0);
+                               g_free (pAppDataTemp);
+                       }
+
+                       if (0 == pMyAppDataTemp)
+                       {
+                               pMyAppData = g_build_filename(g_get_home_dir(), "Application Data", "local", 0);
+                       }
+                       else
+                       {
+                               pMyAppData = g_build_filename(pMyAppDataTemp, 0);
+                               g_free (pMyAppDataTemp);
+                       }
+
+                       if (0 == pPersonalTemp)
+                               pPersonal = g_build_filename(g_get_home_dir(), 0);
+                       else
+                       {
+                               pPersonal = g_build_filename(pPersonalTemp, 0);
+                               g_free (pPersonalTemp);
+                       }
+
+                       /* Get the path to the running application */
+                       pExeRoot = g_win32_get_package_installation_directory_of_module (0);
+
+                       if (0 == pExeRoot)
+                       {
+                               pExeRoot = g_build_filename("C:\\", "Program Files", PROGRAM_NAME, 0);
+                       }
+
+                       if ((pExeRoot) && (pAppData) && (pMyAppData) && (pPersonal))
+                       {
+                               gchar  tmp[PATH_MAX+1];
+                               gchar* p;
+
+                               // Build our LOCALEDIR entry
+                               if (0 != (p = g_build_filename(pAppData, "share", "locale", 0)))
+                               {
+                                       g_array_append_val (pFallbackDirs, p);
+
+                                       // Build our GTK_DIR entry
+                                       if (0 != (p = g_build_filename(pPersonal, ".gtk-2.0", 0)))
+                                       {
+                                               g_array_append_val (pFallbackDirs, p);
+
+                                               // Build our CONFIG_DIR entry
+                                               if (0 != (p = g_build_filename(pAppData, "etc", 0)))
+                                               {
+                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                       // Build our ARDOUR_DIR entry
+                                                       p = g_build_filename(pMyAppData, PROGRAM_NAME, 0);
+
+                                                       if (0 != p)
+                                                       {
+                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                               // Build our MODULE_DIR entry
+                                                               strcpy(tmp, pExeRoot);
+                                                               if (0 != (p = strrchr (tmp, G_DIR_SEPARATOR)))
+                                                               {
+                                                                       *p = '\0';
+
+                                                                       if (0 != (p = g_build_filename(tmp, 0)))
+                                                                       {
+                                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                                               // Build our DATA_DIR entry
+                                                                               if (0 != (p = g_build_filename(pAppData, "share", 0)))
+                                                                               {
+                                                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                                                       // Build our ICONS_DIR entry
+                                                                                       if (0 != (p = g_build_filename(pAppData, "share", "icons", 0)))
+                                                                                       {
+                                                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                                                               // Build our PIXMAPS_DIR entry
+                                                                                               if (0 != (p = g_build_filename(pAppData, "share", "pixmaps", 0)))
+                                                                                               {
+                                                                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                                                                       // Build our CONTROL_SURFACES_DIR entry
+                                                                                                       if (0 != (p = g_build_filename(pExeRoot, "bin", "surfaces", 0)))
+                                                                                                       {
+                                                                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                                                                               // Build our VAMP_DIR entry
+                                                                                                               p = g_build_filename(pExeRoot, "bin", "vamp", 0);
+                                                                                                               if (p)
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+                                                                                                               else
+                                                                                                                       g_array_append_val (pFallbackDirs, "");
+
+                                                                                                               // Next, build our LADSPA_PATH entry
+                                                                                                               p = g_build_filename(pExeRoot, "bin", "plugins", 0);
+                                                                                                               if (p)
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+                                                                                                               else
+                                                                                                                       g_array_append_val (pFallbackDirs, "");
+
+                                                                                                               // And finally, build our VST_PATH entry
+                                                                                                               DWORD dwType = REG_SZ;  HKEY hKey;
+                                                                                                               DWORD dwSize = PATH_MAX;  p = 0;
+                                                                                                               if (ERROR_SUCCESS == RegOpenKeyExA (HKEY_CURRENT_USER, "Software\\VST", 0, KEY_READ, &hKey))
+                                                                                                               {
+                                                                                                                       // Look for the user's VST Registry entry
+                                                                                                                       if (ERROR_SUCCESS == RegQueryValueExA (hKey, "VSTPluginsPath", 0, &dwType, (LPBYTE)tmp, &dwSize))
+                                                                                                                               p = g_build_filename (Glib::locale_to_utf8(tmp).c_str(), 0);
+
+                                                                                                                       RegCloseKey (hKey);
+                                                                                                               }
+
+                                                                                                               if (p == 0)
+                                                                                                                       if (ERROR_SUCCESS == RegOpenKeyExA (HKEY_LOCAL_MACHINE, "Software\\VST", 0, KEY_READ, &hKey))
+                                                                                                                       {
+                                                                                                                               // Look for a global VST Registry entry
+                                                                                                                               if (ERROR_SUCCESS == RegQueryValueExA (hKey, "VSTPluginsPath", 0, &dwType, (LPBYTE)tmp, &dwSize))
+                                                                                                                                       p = g_build_filename (Glib::locale_to_utf8(tmp).c_str(), 0);
+
+                                                                                                                               RegCloseKey (hKey);
+                                                                                                                       }
+
+                                                                                                               if (p == 0)
+                                                                                                               {
+                                                                                                                       gchar *pVSTx86 = 0;
+                                                                                                                       gchar *pProgFilesX86 = get_win_special_folder (CSIDL_PROGRAM_FILESX86);
+
+                                                                                                                       if (pProgFilesX86)
+                                                                                                                       {
+                                                                                                                               // Look for a VST folder under C:\Program Files (x86)
+                                                                                                                               if (pVSTx86 = g_build_filename (pProgFilesX86, "Steinberg", "VSTPlugins", 0))
+                                                                                                                               {
+                                                                                                                                       if (Glib::file_test (pVSTx86, Glib::FILE_TEST_EXISTS))
+                                                                                                                                               if (Glib::file_test (pVSTx86, Glib::FILE_TEST_IS_DIR))
+                                                                                                                                                       p = g_build_filename (pVSTx86, 0);
+
+                                                                                                                                       g_free (pVSTx86);
+                                                                                                                               }
+
+                                                                                                                               g_free (pProgFilesX86);
+                                                                                                                       }
+
+                                                                                                                       if (p == 0)
+                                                                                                                       {
+                                                                                                                               // Look for a VST folder under C:\Program Files
+                                                                                                                               gchar *pVST = 0;
+                                                                                                                               gchar *pProgFiles = get_win_special_folder (CSIDL_PROGRAM_FILES);
+
+                                                                                                                               if (pProgFiles)
+                                                                                                                               {
+                                                                                                                                       if (pVST = g_build_filename (pProgFiles, "Steinberg", "VSTPlugins", 0))
+                                                                                                                                       {
+                                                                                                                                               if (Glib::file_test (pVST, Glib::FILE_TEST_EXISTS))
+                                                                                                                                                       if (Glib::file_test (pVST, Glib::FILE_TEST_IS_DIR))
+                                                                                                                                                               p = g_build_filename (pVST, 0);
+
+                                                                                                                                               g_free (pVST);
+                                                                                                                                       }
+
+                                                                                                                                       g_free (pProgFiles);
+                                                                                                                               }
+                                                                                                                       }
+                                                                                                               }
+
+                                                                                                               if (p == 0)
+                                                                                                               {
+                                                                                                                       // If all else failed, assume the plugins are under "My Documents"
+                                                                                                                       pUsrHome = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+                                                                                                                       if (pUsrHome)
+                                                                                                                               p = g_build_filename (pUsrHome, "Plugins", "VST", 0);
+                                                                                                                       else
+                                                                                                                       {
+                                                                                                                               pUsrHome = g_build_filename(g_get_home_dir(), "My Documents", 0);
+                                                                                                                               if (pUsrHome)
+                                                                                                                                       p = g_build_filename (pUsrHome, "Plugins", "VST", 0);
+                                                                                                                       }
+                                                                                                               }
+                                                                                                               else
+                                                                                                               {
+                                                                                                                       gchar* q = 0;
+
+                                                                                                                       // Concatenate the registry path with the user's personal path
+                                                                                                                       pUsrHome = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+
+                                                                                                                       if (pUsrHome)
+                                                                                                                       {
+                                                                                                                               q = p;
+                                                                                                                               p = g_build_path (";", q, g_build_filename(pUsrHome, "Plugins", "VST", 0), 0);
+                                                                                                                       }
+                                                                                                                       else
+                                                                                                                       {
+                                                                                                                               pUsrHome = g_build_filename(g_get_home_dir(), "My Documents", 0);
+                                                                                                                               if (pUsrHome)
+                                                                                                                               {
+                                                                                                                                       q = p;
+                                                                                                                                       p = g_build_path (";", q, g_build_filename (pUsrHome, "Plugins", "VST", 0), 0);
+                                                                                                                               }
+                                                                                                                       }
+                                                                                                               }
+
+                                                                                                               if (p) //VST
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+                                                                                                               else
+                                                                                                                       g_array_append_val (pFallbackDirs, "");
+
+                                                                                                               // BUNDLED_LV2
+                                                                                                               p = g_build_filename(pExeRoot, "bin", "lv2", 0);
+                                                                                                               if (p)
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+                                                                                                               else
+                                                                                                                       g_array_append_val (pFallbackDirs, "");
+                                                                                                       }
+                                                                                               }
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       
+                               g_free (pAppData);
+                               g_free (pMyAppData);
+                               g_free (pExeRoot);
+                               g_free (pPersonal);
+                       }
+
+                       fallback_dir_vector = fallback_folders = (gchar **) g_array_free (pFallbackDirs, FALSE);
+               }
+       }
+       else
+               fallback_dir_vector = fallback_folders;
+
+       return (fallback_dir_vector);
+}
+
+#else
+// Assume Linux, Cygwin or OS-X. Note that in all 3 cases we only
+// need to cater for unbundled releases (those built by a user from
+// source). Bundled releases of Ardour and Mixbus now specifically
+// write their folders and paths to the user's environment at startup.
+// See the function 'fixup_bundle_environment()'.
+
+static gchar**
+get_platform_fallback_folders ()
+{
+gchar **fallback_dir_vector = 0;
+gchar  *pUsrHome            = 0;
+
+       if (!fallback_folders)
+       {
+               GArray *pFallbackDirs;
+               gchar *pAppData  = 0;
+               gchar *pExeRoot  = 0;
+               gchar *pPersonal = 0;
+
+               pFallbackDirs = g_array_new (TRUE, TRUE, sizeof (char *));
+
+               if (pFallbackDirs)
+               {
+                       pAppData  = g_build_filename("/usr", "local", 0);
+                       pExeRoot  = g_build_filename("/usr", "local", "lib", "ardour2", 0);
+                       pPersonal = g_build_filename(g_get_home_dir(), 0);
+
+                       if ((pExeRoot) && (pAppData) && (pPersonal))
+                       {
+                               gchar  tmp[PATH_MAX+1];
+                               gchar* p;
+
+                               // Build our LOCALEDIR entry
+                               if (0 != (p = g_build_filename(pAppData, "share", "locale", 0)))
+                               {
+                                       g_array_append_val (pFallbackDirs, p);
+
+                                       // Build our GTK_DIR entry
+                                       if (0 != (p = g_build_filename(pPersonal, ".gtk-2.0", 0)))
+                                       {
+                                               g_array_append_val (pFallbackDirs, p);
+
+                                               // Build our CONFIG_DIR entry
+                                               if (0 != (p = g_build_filename(pAppData, "etc", 0)))
+                                               {
+                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                       // Build our ARDOUR_DIR entry
+                                                       p = ""; // Empty string (temporary)
+                                                       if (0 != p)
+                                                       {
+                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                               // Build our MODULE_DIR entry
+                                                               strcpy(tmp, pExeRoot);
+                                                               if (0 != (p = strrchr (tmp, G_DIR_SEPARATOR)))
+                                                               {
+                                                                       *p = '\0';
+
+                                                                       if (0 != (p = g_build_filename(tmp, 0)))
+                                                                       {
+                                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                                               // Build our DATA_DIR entry
+                                                                               if (0 != (p = g_build_filename(pAppData, "share", 0)))
+                                                                               {
+                                                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                                                       // Build our ICONS_DIR entry (re-use 'tmp')
+                                                                                       strcpy(tmp, "/usr/local/share/ardour2");
+                                                                                       if (0 != (p = g_build_filename(tmp, "icons", 0)))
+                                                                                       {
+                                                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                                                               // Build our PIXMAPS_DIR entry
+                                                                                               if (0 != (p = g_build_filename(tmp, "pixmaps", 0)))
+                                                                                               {
+                                                                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                                                                       // Build our CONTROL_SURFACES_DIR entry
+                                                                                                       if (0 != (p = g_build_filename(pExeRoot, "surfaces", 0)))
+                                                                                                       {
+                                                                                                               g_array_append_val (pFallbackDirs, p);
+
+                                                                                                               // Build our VAMP_DIR entry
+                                                                                                               p = g_build_filename(pExeRoot, "vamp", 0);
+                                                                                                               if (p)
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                                                                               // Next, build our LADSPA_PATH entry
+                                                                                                               p = g_build_filename(Glib::path_get_dirname(pExeRoot).c_str(), "plugins", 0);
+                                                                                                               if (p)
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+
+                                                                                                               // And finally, build our VST_PATH entry
+                                                                                                               if (g_getenv("HOME"))
+                                                                                                                       p = g_build_filename(g_getenv("HOME"), "VST", "plugins", 0);
+                                                                                                               else
+                                                                                                                       p = g_build_filename(g_get_home_dir(), "VST", "plugins", 0);
+
+                                                                                                               if (p)
+                                                                                                                       g_array_append_val (pFallbackDirs, p);
+                                                                                                       }
+                                                                                               }
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       
+                               g_free (pAppData);
+                               g_free (pExeRoot);
+                               g_free (pPersonal);
+                       }
+
+                       fallback_dir_vector = fallback_folders = (gchar **) g_array_free (pFallbackDirs, FALSE);
+               }
+       }
+       else
+               fallback_dir_vector = fallback_folders;
+
+       if (pUsrHome)
+               g_free (pUsrHome);
+
+       return (fallback_dir_vector);
+}
+#endif
+
+
+//***************************************************************
+//
+//     get_platform_fallback_folder()
+//
+//  Returns a const gchar* which points to a string describing
+//  the full path to the Ardour fallback folder corresponding to
+//  the supplied index. See 'get_platform_fallback_folders()' for a
+//  complete list of the supported index enumerations. Calling this
+//  function will initialize the fallback folder array if it wasn't
+//  already initiaized. The array should then (eventually) be freed
+//  using 'free_platform_fallback_folders()'.
+//
+//     Returns:
+//
+//    On Success: A pointer to the path string contained at the
+//                relevant index.
+//    On Failure: NULL
+//
+PBD_API G_CONST_RETURN gchar* PBD_APICALLTYPE
+get_platform_fallback_folder (PBD::fallback_folder_t index)
+{
+       if ((index >= 0) && (index < FALLBACK_FOLDER_MAX))
+               return ((G_CONST_RETURN gchar *)get_platform_fallback_folders ()[index]);
+       else
+               return (G_CONST_RETURN gchar *) 0;
+}
+
+
+//***************************************************************
+//
+//     alloc_platform_fallback_folders()
+//
+//  Calls 'get_platform_fallback_folders()' to ensure that memory
+//  for the fallback folder array is already allocated before the
+//  array gets used. It doesn't cause any problems if the array gets
+//  used prior to calling this function (since the memory will get
+//  allocated anyway, on fist usage). Either way however, the momory
+//  must later be freed using 'free_platform_fallback_folders()'.
+//
+//     Returns:
+//
+//    The value obtained from 'get_platform_fallback_folders()'
+//
+PBD_API G_CONST_RETURN gchar* G_CONST_RETURN * PBD_APICALLTYPE
+alloc_platform_fallback_folders ()
+{
+       return ((G_CONST_RETURN gchar* G_CONST_RETURN *)get_platform_fallback_folders ());
+}
+
+
+//***************************************************************
+//
+//     free_platform_fallback_folders()
+//
+//  Frees the memory that was previously allocated for the Ardour
+//  fallback folder array.
+//
+//     Returns:
+//
+//    NONE.
+//
+PBD_API void PBD_APICALLTYPE
+free_platform_fallback_folders ()
+{
+int index = FOLDER_LOCALE;
+
+       if (fallback_folders)
+       {
+               gchar *p = get_platform_fallback_folders()[(fallback_folder_t)index++];
+
+               while (index < (FALLBACK_FOLDER_MAX+1)) {
+                       if (p)
+                               g_free (p);
+
+                       if (index < FALLBACK_FOLDER_MAX)
+                               p = get_platform_fallback_folders()[(fallback_folder_t)index++];
+                       else
+                               break;
+               }
+
+               fallback_folders = 0;
+       }
+}
+
+}  // namespace PBD
+
diff --git a/libs/pbd/ffs.cc b/libs/pbd/ffs.cc
new file mode 100644 (file)
index 0000000..557504f
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2013 Tim Mayberry 
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "pbd/ffs.h"
+
+#ifndef COMPILER_MSVC
+#include <strings.h>
+#endif
+
+namespace PBD {
+int
+ffs (int x)
+{
+#if defined (COMPILER_MINGW)
+       return __builtin_ffs(x);
+#elif defined (COMPILER_MSVC)
+       unsigned long index;
+#ifdef WIN64   
+       if (0 != _BitScanForward64(&index, (__int64)x))
+#else
+       if (0 != _BitScanForward(&index, (unsigned long)x))
+#endif
+               index++;    // Make the result 1-based
+       else
+               index = 0;  // All bits were zero
+
+       return (int)index;
+#else
+       return ::ffs(x);
+#endif
+}
+
+}
index a71ffca190259be5c24c66706d95bd6da7694e19..2cfa63ae39c19aa387b12e79fbbfb550fcad7a61 100644 (file)
 */
 
 #include <sys/time.h>
-#include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <cassert>
 #include <cstdio>
 
+#include <glib.h>
+#include <glib/gstdio.h>
+
 #ifdef __APPLE__
 #include <mach/mach_time.h>
 #endif
 
 #include "pbd/compose.h"
 #include "pbd/file_manager.h"
+#include "pbd/resource.h"
 #include "pbd/debug.h"
 
 using namespace std;
@@ -41,12 +44,11 @@ FileManager* FileDescriptor::_manager;
 FileManager::FileManager ()
        : _open (0)
 {
-       struct rlimit rl;
-       int const r = getrlimit (RLIMIT_NOFILE, &rl);
+       struct ResourceLimit rl;
        
        /* XXX: this is a bit arbitrary */
-       if (r == 0) {
-               _max_open = rl.rlim_cur - 64;
+       if (get_resource_limit (OpenFiles, rl)) {
+               _max_open = rl.current_limit - 64;
        } else {
                _max_open = 256;
        }
@@ -116,10 +118,14 @@ FileManager::allocate (FileDescriptor* d)
 
 #ifdef __APPLE__
        d->_last_used = mach_absolute_time();
-#else
+#elif defined(_POSIX_TIMERS) && defined(_POSIX_MONOTONIC_CLOCK)
        struct timespec t;
        clock_gettime (CLOCK_MONOTONIC, &t);
        d->_last_used = t.tv_sec + (double) t.tv_nsec / 10e9;
+#else
+       struct timeval now;
+       gettimeofday (&now, NULL);
+       d->_last_used = now.tv_sec + (double) now.tv_usec / 10e6;
 #endif
 
        d->_refcount++;
@@ -222,8 +228,19 @@ bool
 FdFileDescriptor::open ()
 {
        /* we must have a lock on the FileManager's mutex */
-       
-       _fd = ::open (_path.c_str(), _writeable ? (O_RDWR | O_CREAT) : O_RDONLY, _mode);
+
+       /* files must be opened with O_BINARY flag on windows
+        * or it treats the file as a text stream and puts in
+        * line endings in etc
+        */
+#ifdef WIN32
+#define WRITE_FLAGS O_RDWR | O_CREAT | O_BINARY
+#define READ_FLAGS O_RDONLY | O_BINARY
+#else
+#define WRITE_FLAGS O_RDWR | O_CREAT
+#define READ_FLAGS O_RDONLY
+#endif
+       _fd = ::g_open (_path.c_str(), _writeable ? WRITE_FLAGS : READ_FLAGS, _mode);
        return (_fd == -1);
 }
 
index bb290fa6aaf1ae9ccdeba64e9a3941ed734b0184..44254989c1bfbd227930aa9da8e206f1143ab6aa 100644 (file)
 #include <glib.h>
 #include <glib/gstdio.h>
 
+#ifdef COMPILER_MINGW
+#include <io.h> // For W_OK
+#endif
+
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
 #include <glibmm/pattern.h>
@@ -31,6 +35,7 @@
 
 #include "pbd/compose.h"
 #include "pbd/file_utils.h"
+#include "pbd/debug.h"
 #include "pbd/error.h"
 #include "pbd/pathscanner.h"
 #include "pbd/stl_delete.h"
@@ -76,6 +81,11 @@ find_matching_files_in_directory (const std::string& directory,
                std::string full_path(directory);
                full_path = Glib::build_filename (full_path, *file_iter);
 
+               DEBUG_TRACE (
+                       DEBUG::FileUtils,
+                       string_compose("Found file %1\n", full_path)
+                       );
+
                result.push_back(full_path);
        }
 }
@@ -94,7 +104,7 @@ find_matching_files_in_directories (const vector<std::string>& paths,
 }
 
 void
-find_matching_files_in_search_path (const SearchPath& search_path,
+find_matching_files_in_search_path (const Searchpath& search_path,
                                     const Glib::PatternSpec& pattern,
                                     vector<std::string>& result)
 {
@@ -102,7 +112,7 @@ find_matching_files_in_search_path (const SearchPath& search_path,
 }
 
 bool
-find_file_in_search_path(const SearchPath& search_path,
+find_file_in_search_path(const Searchpath& search_path,
                          const string& filename,
                          std::string& result)
 {
@@ -113,24 +123,28 @@ find_file_in_search_path(const SearchPath& search_path,
 
        if (tmp.size() == 0)
        {
+               DEBUG_TRACE (
+                       DEBUG::FileUtils,
+                       string_compose("No file matching %1 found in Path: %2\n", filename, search_path.to_string())
+                           );
                return false;
        }
 
-#if 0
        if (tmp.size() != 1)
        {
-               info << string_compose
-                       (
-                        "Found more than one file matching %1 in search path %2",
-                        filename,
-                        search_path ()
-                       )
-                       << endmsg;
+               DEBUG_TRACE (
+                       DEBUG::FileUtils,
+                       string_compose("Found more that one file matching %1 in Path: %2\n", filename, search_path.to_string())
+                           );
        }
-#endif
 
        result = tmp.front();
 
+       DEBUG_TRACE (
+               DEBUG::FileUtils,
+               string_compose("Found file %1 in Path: %2\n", filename, search_path.to_string())
+                   );
+
        return true;
 }
 
@@ -188,9 +202,9 @@ get_absolute_path (const std::string & p)
 bool
 equivalent_paths (const std::string& a, const std::string& b)
 {
-       struct stat bA;
+       GStatBuf bA;
        int const rA = g_stat (a.c_str(), &bA);
-       struct stat bB;
+       GStatBuf bB;
        int const rB = g_stat (b.c_str(), &bB);
 
        return (rA == 0 && rB == 0 && bA.st_dev == bB.st_dev && bA.st_ino == bB.st_ino);
@@ -221,7 +235,7 @@ exists_and_writable (const std::string & p)
           make us unwritable.
        */
 
-       struct stat statbuf;
+       GStatBuf statbuf;
 
        if (g_stat (p.c_str(), &statbuf) != 0) {
                /* doesn't exist - not writable */
index 40f8cca9d6e9371b125d0fce45bd2df0e9bd26d2..5d81cd2fd35e52407c9177b50bacceb621a565b7 100644 (file)
@@ -16,7 +16,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 */
-
+#ifndef  COMPILER_MSVC
 #include "libpbd-config.h"
 
 #define _XOPEN_SOURCE 600
@@ -141,3 +141,7 @@ FPU::FPU ()
 FPU::~FPU ()
 {
 }
+
+#else  // COMPILER_MSVC
+       const char* pbd_fpu = "pbd/msvc/fpu.cc takes precedence over this file";
+#endif // COMPILER_MSVC
diff --git a/libs/pbd/glib_semaphore.cc b/libs/pbd/glib_semaphore.cc
new file mode 100644 (file)
index 0000000..7565e0c
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+    Copyright (C) 2010 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include "pbd/glib_semaphore.h"
+
+namespace PBD {
+
+GlibSemaphore::GlibSemaphore (gint initial_val)
+       :
+               m_counter(initial_val)
+{ }
+
+void
+GlibSemaphore::wait ()
+{
+       Glib::Threads::Mutex::Lock guard (m_mutex);
+
+       while (m_counter.get() < 1) {
+               m_cond.wait(m_mutex);
+       }
+
+       // this shouldn't need to be inside the lock
+       --m_counter;
+}
+
+bool
+GlibSemaphore::try_wait ()
+{
+       if (!m_mutex.trylock())
+       {
+               return false;
+       }
+       // lock successful
+       while (m_counter.get() < 1) {
+               m_cond.wait(m_mutex);
+       }
+
+       // the order of these should not matter
+       --m_counter;
+       m_mutex.unlock();
+       return true;
+}
+
+void
+GlibSemaphore::post ()
+{
+       // atomic, no locking required
+       ++m_counter;
+       m_cond.signal();
+}
+
+} // namespace PBD
diff --git a/libs/pbd/localeguard.cc b/libs/pbd/localeguard.cc
new file mode 100644 (file)
index 0000000..12093be
--- /dev/null
@@ -0,0 +1,34 @@
+#include <cstring>
+#include <locale.h>
+#include <stdlib.h>
+
+#include "pbd/localeguard.h"
+
+// JE - added temporarily, to reduce the delay effects when calling
+// setlocale() recursively in a Windows GUI thread (we should think
+// about moving the caller(s) into a dedicated worker thread).
+std::string PBD::LocaleGuard::current;
+
+PBD::LocaleGuard::LocaleGuard (const char* str)
+ : old(0)
+{
+       if (current != str) {
+               old = strdup (setlocale (LC_NUMERIC, NULL));
+               if (strcmp (old, str)) {
+                       if (setlocale (LC_NUMERIC, str))
+                               current = str; 
+               }
+       }
+}
+
+PBD::LocaleGuard::~LocaleGuard ()
+{
+       if (old) {
+               if (setlocale (LC_NUMERIC, old))
+                       current = old;
+
+               free ((char*)old);
+       }
+}
+
+
diff --git a/libs/pbd/localtime_r.cc b/libs/pbd/localtime_r.cc
new file mode 100644 (file)
index 0000000..c72e3eb
--- /dev/null
@@ -0,0 +1,41 @@
+#ifdef WAF_BUILD
+#include "libpbd-config.h"
+#endif
+
+#ifndef HAVE_LOCALTIME_R
+#include <time.h>
+#include <string.h>
+
+#include "pbd/pthread_utils.h"
+#include "pbd/localtime_r.h"
+
+#ifdef localtime_r
+#undef localtime_r
+#endif
+
+struct tm *
+localtime_r(const time_t *const timep, struct tm *p_tm)
+{
+       static pthread_mutex_t time_mutex;
+       static int time_mutex_inited = 0;
+       struct tm *tmp;
+
+       if (!time_mutex_inited)
+       {
+               time_mutex_inited = 1;
+               pthread_mutex_init(&time_mutex, NULL);
+       }
+
+       pthread_mutex_lock(&time_mutex);
+       tmp = localtime(timep);
+       if (tmp)
+       {
+               memcpy(p_tm, tmp, sizeof(struct tm));
+               tmp = p_tm;
+       }
+       pthread_mutex_unlock(&time_mutex);
+
+       return tmp;
+}
+
+#endif
index 46cea42e0a2d0adf4130f2981b1a5110a50585c0..65f011c745efa0de2f005366d3de4214985073ee 100644 (file)
@@ -17,7 +17,7 @@
 
     $Id$
 */
-
+#ifndef  COMPILER_MSVC
 #include <cstdio>
 #include <cstring>
 #include <string>
@@ -94,6 +94,14 @@ mountpoint (string path)
        return best;
 }
 
+#elif defined(PLATFORM_WINDOWS)
+
+string
+mountpoint (string path)
+{
+       // TODO ... if needed
+}
+
 #else // !HAVE_GETMNTENT
 
 #include <sys/param.h>
@@ -164,3 +172,7 @@ main (int argc, char *argv[])
 }
 
 #endif // TEST_MOUNTPOINT
+
+#else  // COMPILER_MSVC
+       const char* pbd_mountpoint = "pbd/msvc/mountpoint.cc takes precedence over this file";
+#endif // COMPILER_MSVC
diff --git a/libs/pbd/msvc/fpu.cc b/libs/pbd/msvc/fpu.cc
new file mode 100644 (file)
index 0000000..6997405
--- /dev/null
@@ -0,0 +1,124 @@
+#ifdef COMPILER_MSVC  // Added by JE - 05-12-2009. Inline assembler instructions
+                      // have been changed to Intel format and (in the case of
+                      // cpuid) was replaced by the equivalent VC++ system call).
+#define _XOPEN_SOURCE 600
+#include <cstdlib>
+#include <stdint.h>
+#include <intrin.h>  // Added by JE - 05-12-2009
+
+#include <pbd/fpu.h>
+#include <pbd/error.h>
+
+#include "i18n.h"
+
+using namespace PBD;
+using namespace std;
+
+FPU::FPU ()
+{
+       unsigned long cpuflags = 0;
+
+       _flags = (Flags)0;
+
+#ifndef ARCH_X86
+       return;
+
+#else
+
+#ifndef USE_X86_64_ASM
+int cpuInfo[4];
+
+       __cpuid (cpuInfo, 1);
+       cpuflags = cpuInfo[3];
+/*
+       __asm {  // This is how the original section would look if converted to Intel syntax.
+             // However, I have grave doubts about whether it's doing the right thing.
+             // It seems as if the intention was to retrieve feature information from
+             // the processor. However, feature information is returned in the ebx register
+             // (if you believe Wikipedia) or in edx (if you believe Microsoft). Unfortunately,
+             // both registers get ignored in the original code!! Confused?? Join the club!!
+               mov   eax, 1
+               push  ebx
+               cpuid
+               mov   edx, 0
+               pop   ebx
+               mov   cpuflags, ecx // This can't be right, surely???
+       }; */
+#else
+// Note that this syntax is currently still in AT&T format !
+       asm volatile (
+               "pushq %%rbx\n"
+               "movq $1, %%rax\n"
+               "cpuid\n"
+               "movq %%rdx, %0\n"
+               "popq %%rbx\n"
+               : "=r" (cpuflags)
+               :
+               : "%rax", "%rcx", "%rdx", "memory"
+               );
+
+#endif /* USE_X86_64_ASM */
+
+       if (cpuflags & (1<<25)) {
+               _flags = Flags (_flags | (HasSSE|HasFlushToZero));
+       }
+
+       if (cpuflags & (1<<26)) {
+               _flags = Flags (_flags | HasSSE2);
+       }
+
+       if (cpuflags & (1 << 24)) {
+               bool  aligned_malloc = false; // Added by JE - 05-12-2009
+               char* fxbuf = 0;
+// This section changed by JE - 05-12-2009
+#ifdef NO_POSIX_MEMALIGN
+#if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)       // All of these support '_aligned_malloc()'
+               fxbuf = (char *) _aligned_malloc(512, 16);  // (note that they all need at least MSVC runtime 7.0)
+               aligned_malloc = true;
+#else
+               fxbuf = (char *) malloc(512);
+#endif
+#else
+               fxbuf = posix_memalign ((void**)&fxbuf, 16, 512);
+#endif
+               // Verify that fxbuf is correctly aligned
+               unsigned long buf_addr = (unsigned long)(void*)fxbuf;
+               if ((0 == buf_addr) || (buf_addr % 16))
+                       error << _("cannot allocate 16 byte aligned buffer for h/w feature detection") << endmsg;
+               else
+               {
+                       memset(fxbuf, 0, 512); // Initialize the buffer !!! Added by JE - 12-12-2009
+
+                       __asm {
+                               mov eax, fxbuf
+                               fxsave   [eax]
+                       };
+
+                       uint32_t mxcsr_mask = *((uint32_t*) &fxbuf[28]);
+
+                       /* if the mask is zero, set its default value (from intel specs) */
+
+                       if (mxcsr_mask == 0) {
+                               mxcsr_mask = 0xffbf;
+                       }
+
+                       if (mxcsr_mask & (1<<6)) {
+                               _flags = Flags (_flags | HasDenormalsAreZero);
+                       }
+
+                       if (aligned_malloc)
+                               _aligned_free (fxbuf);
+                       else
+                               free (fxbuf);
+               }
+       }
+#endif  // ARCH_X86
+}
+
+FPU::~FPU ()
+{
+}
+
+#else  // !COMPILER_MSVC
+       const char* pbd_fpu = "original pbd/fpu.cc takes precedence over this file";
+#endif // COMPILER_MSVC
diff --git a/libs/pbd/msvc/getopt.c b/libs/pbd/msvc/getopt.c
new file mode 100644 (file)
index 0000000..2f539a5
--- /dev/null
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 1987, 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#ifdef COMPILER_MSVC
+#include "pbd/msvc_pbd.h"
+#endif
+#include "getopt.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define        BADCH   (int)'?'
+#define        BADARG  (int)':'
+#define        EMSG    ""
+
+__BEGIN_DECLS    // Added by JE - 31-01-2010
+// All 'GETOPT_API' declarations added by JE - 31-01-2010
+GETOPT_API int  opterr = 1;    /* if error message should be printed */
+GETOPT_API int  optind = 1;    /* index into parent argv vector */
+GETOPT_API int  optopt;                /* character checked for validity */
+GETOPT_API int  optreset;              /* reset getopt */
+GETOPT_API char *optarg;               /* argument associated with option */
+
+/*
+ * getopt --
+ *     Parse argc/argv argument vector.
+ */
+int
+getopt(int nargc, // Argument list ratified by JE - 03-01-2010
+       char * const *nargv,
+       const char *ostr)
+{
+       static char *place = EMSG;              /* option letter processing */
+       char *oli;                              /* option letter list index */
+
+       if (optreset || !*place) {              /* update scanning pointer */
+               optreset = 0;
+               if (optind >= nargc || *(place = nargv[optind]) != '-') {
+                       place = EMSG;
+                       return (-1);
+               }
+               if (place[1] && *++place == '-') {      /* found "--" */
+                       ++optind;
+                       place = EMSG;
+                       return (-1);
+               }
+       }                                       /* option letter okay? */
+       if ((optopt = (int)*place++) == (int)':' ||
+           !(oli = (char*)strchr(ostr, optopt))) {
+               /*
+                * if the user didn't specify '-' as an option,
+                * assume it means -1.
+                */
+               if (optopt == (int)'-')
+                       return (-1);
+               if (!*place)
+                       ++optind;
+               if (opterr && *ostr != ':' && optopt != BADCH)
+                       (void)fprintf(stderr, "%s: illegal option -- %c\n",
+                           "progname", optopt);
+               return (BADCH);
+       }
+       if (*++oli != ':') {                    /* don't need argument */
+               optarg = NULL;
+               if (!*place)
+                       ++optind;
+       }
+       else {                                  /* need an argument */
+               if (*place)                     /* no white space */
+                       optarg = place;
+               else if (nargc <= ++optind) {   /* no arg */
+                       place = EMSG;
+                       if (*ostr == ':')
+                               return (BADARG);
+                       if (opterr)
+                               (void)fprintf(stderr,
+                                   "%s: option requires an argument -- %c\n",
+                                   "progname", optopt);
+                       return (BADCH);
+               }
+               else                            /* white space */
+                       optarg = nargv[optind];
+               place = EMSG;
+               ++optind;
+       }
+       return (optopt);                        /* dump back option letter */
+}
+__END_DECLS    // Added by JE - 31-01-2010
diff --git a/libs/pbd/msvc/getopt.h b/libs/pbd/msvc/getopt.h
new file mode 100644 (file)
index 0000000..233a0ee
--- /dev/null
@@ -0,0 +1,110 @@
+/*      $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $    */
+/*      $FreeBSD: src/include/getopt.h,v 1.1 2002/09/29 04:14:30 eric Exp $ */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _GETOPT_H_
+#define _GETOPT_H_
+
+#ifdef PLATFORM_WINDOWS
+/* from <sys/cdefs.h> */
+# ifdef  __cplusplus
+#  define __BEGIN_DECLS  extern "C" {
+#  define __END_DECLS    }
+# else
+#  define __BEGIN_DECLS
+#  define __END_DECLS
+# endif
+# define __P(args)      args
+#endif
+
+/*#ifndef PLATFORM_WINDOWS
+#include <sys/cdefs.h>
+#include <unistd.h>
+#endif*/
+
+#ifdef PLATFORM_WINDOWS
+# if !defined(GETOPT_API)
+#  define GETOPT_API __declspec(dllimport)
+# endif
+#endif
+
+/*
+ * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
+ */
+#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
+#define no_argument        0
+#define required_argument  1
+#define optional_argument  2
+
+struct option {
+        /* name of long option */
+        const char *name;
+        /*
+         * one of no_argument, required_argument, and optional_argument:
+         * whether option takes an argument
+         */
+        int has_arg;
+        /* if not NULL, set *flag to val when option found */
+        int *flag;
+        /* if flag not NULL, value to set *flag to; else return value */
+        int val;
+};
+
+__BEGIN_DECLS
+GETOPT_API int getopt_long __P((int, char * const *, const char *,
+    const struct option *, int *));
+__END_DECLS
+#endif
+
+#ifdef PLATFORM_WINDOWS
+/* These are global getopt variables */
+__BEGIN_DECLS
+
+GETOPT_API extern int   opterr,   /* if error message should be printed */
+                        optind,   /* index into parent argv vector */
+                        optopt,   /* character checked for validity */
+                        optreset; /* reset getopt */
+GETOPT_API extern char* optarg;   /* argument associated with option */
+
+/* Original getopt */
+GETOPT_API int getopt __P((int, char * const *, const char *));
+
+__END_DECLS
+#endif
+#endif /* !_GETOPT_H_ */
diff --git a/libs/pbd/msvc/getopt_long.c b/libs/pbd/msvc/getopt_long.c
new file mode 100644 (file)
index 0000000..06c459a
--- /dev/null
@@ -0,0 +1,546 @@
+/*     $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $      */
+/*     $FreeBSD: src/lib/libc/stdlib/getopt_long.c,v 1.2 2002/10/16 22:18:42 alfred Exp $ */
+
+/*-
+ * Copyright (c) 2000 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Dieter Baron and Thomas Klausner.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *        This product includes software developed by the NetBSD
+ *        Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef PLATFORM_WINDOWS
+#ifdef COMPILER_MSVC
+#include "pbd/msvc_pbd.h"  // Defines 'GETOPT_API'
+#endif
+/* Windows needs warnx().  We change the definition though:
+ *  1. (another) global is defined, opterrmsg, which holds the error message
+ *  2. errors are always printed out on stderr w/o the program name
+ * Note that opterrmsg always gets set no matter what opterr is set to.  The
+ * error message will not be printed if opterr is 0 as usual.
+ */
+
+#include "getopt.h"
+#include <stdio.h>
+#include <stdarg.h>
+
+GETOPT_API extern char opterrmsg[128];
+char opterrmsg[128]; /* last error message is stored here */
+
+static void warnx(int print_error, const char *fmt, ...)
+{
+       va_list ap;
+       va_start(ap, fmt);
+       if (fmt != NULL)
+               _vsnprintf(opterrmsg, 128, fmt, ap);
+       else
+               opterrmsg[0]='\0';
+       va_end(ap);
+       if (print_error) {
+               fprintf(stderr, opterrmsg);
+               fprintf(stderr, "\n");
+       }
+}
+
+#endif /*PLATFORM_WINDOWS*/
+
+/* not part of the original file */
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(X)
+#endif
+
+#if HAVE_CONFIG_H && !HAVE_GETOPT_LONG && !HAVE_DECL_OPTIND
+#define REPLACE_GETOPT
+#endif
+
+#ifdef REPLACE_GETOPT
+#ifdef __weak_alias
+__weak_alias(getopt,_getopt)
+#endif
+int    opterr = 1;             /* if error message should be printed */
+int    optind = 1;             /* index into parent argv vector */
+int    optopt = '?';           /* character checked for validity */
+int    optreset;               /* reset getopt */
+char    *optarg;               /* argument associated with option */
+#elif HAVE_CONFIG_H && !HAVE_DECL_OPTRESET
+static int optreset;
+#endif
+
+#ifdef __weak_alias
+__weak_alias(getopt_long,_getopt_long)
+#endif
+
+#if !HAVE_GETOPT_LONG
+#define IGNORE_FIRST   (*options == '-' || *options == '+')
+#define PRINT_ERROR    ((opterr) && ((*options != ':') \
+                                     || (IGNORE_FIRST && options[1] != ':')))
+#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
+#define PERMUTE         (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
+/* XXX: GNU ignores PC if *options == '-' */
+#define IN_ORDER        (!IS_POSIXLY_CORRECT && *options == '-')
+
+/* return values */
+#define        BADCH   (int)'?'
+#define        BADARG          ((IGNORE_FIRST && options[1] == ':') \
+                        || (*options == ':') ? (int)':' : (int)'?')
+#define INORDER (int)1
+
+#define        EMSG    ""
+
+static int getopt_internal(int, char * const *, const char *);
+static int gcd(int, int);
+static void permute_args(int, int, int, char * const *);
+
+static char *place = EMSG; /* option letter processing */
+
+/* XXX: set optreset to 1 rather than these two */
+static int nonopt_start = -1; /* first non option argument (for permute) */
+static int nonopt_end = -1;   /* first option after non options (for permute) */
+
+/* Error messages */
+static const char recargchar[] = "option requires an argument -- %c";
+static const char recargstring[] = "option requires an argument -- %s";
+static const char ambig[] = "ambiguous option -- %.*s";
+static const char noarg[] = "option doesn't take an argument -- %.*s";
+static const char illoptchar[] = "unknown option -- %c";
+static const char illoptstring[] = "unknown option -- %s";
+
+
+/*
+ * Compute the greatest common divisor of a and b.
+ */
+static int
+gcd(int a, int b)
+{
+       int c;
+
+       c = a % b;
+       while (c != 0) {
+               a = b;
+               b = c;
+               c = a % b;
+       }
+          
+       return b;
+}
+
+/*
+ * Exchange the block from nonopt_start to nonopt_end with the block
+ * from nonopt_end to opt_end (keeping the same order of arguments
+ * in each block).
+ */
+static void
+permute_args(int panonopt_start,
+             int panonopt_end,
+             int opt_end,
+             char * const *nargv)
+{
+       int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
+       char *swap;
+
+       _DIAGASSERT(nargv != NULL);
+
+       /*
+        * compute lengths of blocks and number and size of cycles
+        */
+       nnonopts = panonopt_end - panonopt_start;
+       nopts = opt_end - panonopt_end;
+       ncycle = gcd(nnonopts, nopts);
+       cyclelen = (opt_end - panonopt_start) / ncycle;
+
+       for (i = 0; i < ncycle; i++) {
+               cstart = panonopt_end+i;
+               pos = cstart;
+               for (j = 0; j < cyclelen; j++) {
+                       if (pos >= panonopt_end)
+                               pos -= nnonopts;
+                       else
+                               pos += nopts;
+                       swap = nargv[pos];
+                       /* LINTED const cast */
+                       ((char **) nargv)[pos] = nargv[cstart];
+                       /* LINTED const cast */
+                       ((char **)nargv)[cstart] = swap;
+               }
+       }
+}
+
+/*
+ * getopt_internal --
+ *     Parse argc/argv argument vector.  Called by user level routines.
+ *  Returns -2 if -- is found (can be long option or end of options marker).
+ */
+static int
+getopt_internal(int nargc,
+                char * const *nargv,
+                const char *options)
+{
+       char *oli;                              /* option letter list index */
+       int optchar;
+
+       _DIAGASSERT(nargv != NULL);
+       _DIAGASSERT(options != NULL);
+
+       optarg = NULL;
+
+       /*
+        * XXX Some programs (like rsyncd) expect to be able to
+        * XXX re-initialize optind to 0 and have getopt_long(3)
+        * XXX properly function again.  Work around this braindamage.
+        */
+       if (optind == 0)
+               optind = 1;
+
+       if (optreset)
+               nonopt_start = nonopt_end = -1;
+start:
+       if (optreset || !*place) {              /* update scanning pointer */
+               optreset = 0;
+               if (optind >= nargc) {          /* end of argument vector */
+                       place = EMSG;
+                       if (nonopt_end != -1) {
+                               /* do permutation, if we have to */
+                               permute_args(nonopt_start, nonopt_end,
+                                   optind, nargv);
+                               optind -= nonopt_end - nonopt_start;
+                       }
+                       else if (nonopt_start != -1) {
+                               /*
+                                * If we skipped non-options, set optind
+                                * to the first of them.
+                                */
+                               optind = nonopt_start;
+                       }
+                       nonopt_start = nonopt_end = -1;
+                       return -1;
+               }
+               if ((*(place = nargv[optind]) != '-')
+                   || (place[1] == '\0')) {    /* found non-option */
+                       place = EMSG;
+                       if (IN_ORDER) {
+                               /*
+                                * GNU extension: 
+                                * return non-option as argument to option 1
+                                */
+                               optarg = nargv[optind++];
+                               return INORDER;
+                       }
+                       if (!PERMUTE) {
+                               /*
+                                * if no permutation wanted, stop parsing
+                                * at first non-option
+                                */
+                               return -1;
+                       }
+                       /* do permutation */
+                       if (nonopt_start == -1)
+                               nonopt_start = optind;
+                       else if (nonopt_end != -1) {
+                               permute_args(nonopt_start, nonopt_end,
+                                   optind, nargv);
+                               nonopt_start = optind -
+                                   (nonopt_end - nonopt_start);
+                               nonopt_end = -1;
+                       }
+                       optind++;
+                       /* process next argument */
+                       goto start;
+               }
+               if (nonopt_start != -1 && nonopt_end == -1)
+                       nonopt_end = optind;
+               if (place[1] && *++place == '-') {      /* found "--" */
+                       place++;
+                       return -2;
+               }
+       }
+       if ((optchar = (int)*place++) == (int)':' ||
+           (oli = (char*)strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
+               /* option letter unknown or ':' */
+               if (!*place)
+                       ++optind;
+#ifndef PLATFORM_WINDOWS
+               if (PRINT_ERROR)
+                       warnx(illoptchar, optchar);
+#else
+                       warnx(PRINT_ERROR, illoptchar, optchar);
+#endif
+               optopt = optchar;
+               return BADCH;
+       }
+       if (optchar == 'W' && oli[1] == ';') {          /* -W long-option */
+               /* XXX: what if no long options provided (called by getopt)? */
+               if (*place) 
+                       return -2;
+
+               if (++optind >= nargc) {        /* no arg */
+                       place = EMSG;
+#ifndef PLATFORM_WINDOWS
+                       if (PRINT_ERROR)
+                               warnx(recargchar, optchar);
+#else
+                               warnx(PRINT_ERROR, recargchar, optchar);
+#endif
+                       optopt = optchar;
+                       return BADARG;
+               } else                          /* white space */
+                       place = nargv[optind];
+               /*
+                * Handle -W arg the same as --arg (which causes getopt to
+                * stop parsing).
+                */
+               return -2;
+       }
+       if (*++oli != ':') {                    /* doesn't take argument */
+               if (!*place)
+                       ++optind;
+       } else {                                /* takes (optional) argument */
+               optarg = NULL;
+               if (*place)                     /* no white space */
+                       optarg = place;
+               /* XXX: disable test for :: if PC? (GNU doesn't) */
+               else if (oli[1] != ':') {       /* arg not optional */
+                       if (++optind >= nargc) {        /* no arg */
+                               place = EMSG;
+#ifndef PLATFORM_WINDOWS
+                               if (PRINT_ERROR)
+                                       warnx(recargchar, optchar);
+#else
+                                       warnx(PRINT_ERROR, recargchar, optchar);
+#endif
+                               optopt = optchar;
+                               return BADARG;
+                       } else
+                               optarg = nargv[optind];
+               }
+               place = EMSG;
+               ++optind;
+       }
+       /* dump back option letter */
+       return optchar;
+}
+
+__BEGIN_DECLS    // Added by JE - 31-01-2010
+#ifdef REPLACE_GETOPT
+/*
+ * getopt --
+ *     Parse argc/argv argument vector.
+ *
+ * [eventually this will replace the real getopt]
+ */
+GETOPT_API int // 'GETOPT_API' declaration added by JE - 31-01-2010
+getopt(int nargc,
+       char * const *nargv,
+       const char *options)
+{
+       int retval;
+
+       _DIAGASSERT(nargv != NULL);
+       _DIAGASSERT(options != NULL);
+
+       if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
+               ++optind;
+               /*
+                * We found an option (--), so if we skipped non-options,
+                * we have to permute.
+                */
+               if (nonopt_end != -1) {
+                       permute_args(nonopt_start, nonopt_end, optind,
+                                      nargv);
+                       optind -= nonopt_end - nonopt_start;
+               }
+               nonopt_start = nonopt_end = -1;
+               retval = -1;
+       }
+       return retval;
+}
+#endif
+
+/*
+ * getopt_long --
+ *     Parse argc/argv argument vector.
+ */
+GETOPT_API int // 'GETOPT_API' declaration added by JE - 31-01-2010
+getopt_long(int nargc,
+            char * const *nargv,
+            const char *options,
+            const struct option *long_options,
+            int *idx)
+{
+       int retval;
+
+       _DIAGASSERT(nargv != NULL);
+       _DIAGASSERT(options != NULL);
+       _DIAGASSERT(long_options != NULL);
+       /* idx may be NULL */
+
+       if ((retval = getopt_internal(nargc, nargv, options)) == -2) {
+               char *current_argv, *has_equal;
+               size_t current_argv_len;
+               int i, match;
+
+               current_argv = place;
+               match = -1;
+
+               optind++;
+               place = EMSG;
+
+               if (*current_argv == '\0') {            /* found "--" */
+                       /*
+                        * We found an option (--), so if we skipped
+                        * non-options, we have to permute.
+                        */
+                       if (nonopt_end != -1) {
+                               permute_args(nonopt_start, nonopt_end,
+                                   optind, nargv);
+                               optind -= nonopt_end - nonopt_start;
+                       }
+                       nonopt_start = nonopt_end = -1;
+                       return -1;
+               }
+               if ((has_equal = strchr(current_argv, '=')) != NULL) {
+                       /* argument found (--option=arg) */
+                       current_argv_len = has_equal - current_argv;
+                       has_equal++;
+               } else
+                       current_argv_len = strlen(current_argv);
+           
+               for (i = 0; long_options[i].name; i++) {
+                       /* find matching long option */
+                       if (strncmp(current_argv, long_options[i].name,
+                           current_argv_len))
+                               continue;
+
+                       if (strlen(long_options[i].name) ==
+                           (unsigned)current_argv_len) {
+                               /* exact match */
+                               match = i;
+                               break;
+                       }
+                       if (match == -1)                /* partial match */
+                               match = i;
+                       else {
+                               /* ambiguous abbreviation */
+#ifndef PLATFORM_WINDOWS
+                               if (PRINT_ERROR)
+                                       warnx(ambig, (int)current_argv_len,
+                                            current_argv);
+#else
+                                       warnx(PRINT_ERROR, ambig, (int)current_argv_len,
+                                            current_argv);
+#endif
+                               optopt = 0;
+                               return BADCH;
+                       }
+               }
+               if (match != -1) {                      /* option found */
+                       if (long_options[match].has_arg == no_argument
+                           && has_equal) {
+#ifndef PLATFORM_WINDOWS
+                               if (PRINT_ERROR)
+                                       warnx(noarg, (int)current_argv_len,
+                                            current_argv);
+#else
+                                       warnx(PRINT_ERROR, noarg, (int)current_argv_len,
+                                            current_argv);
+#endif
+                               /*
+                                * XXX: GNU sets optopt to val regardless of
+                                * flag
+                                */
+                               if (long_options[match].flag == NULL)
+                                       optopt = long_options[match].val;
+                               else
+                                       optopt = 0;
+                               return BADARG;
+                       }
+                       if (long_options[match].has_arg == required_argument ||
+                           long_options[match].has_arg == optional_argument) {
+                               if (has_equal)
+                                       optarg = has_equal;
+                               else if (long_options[match].has_arg ==
+                                   required_argument) {
+                                       /*
+                                        * optional argument doesn't use
+                                        * next nargv
+                                        */
+                                       optarg = nargv[optind++];
+                               }
+                       }
+                       if ((long_options[match].has_arg == required_argument)
+                           && (optarg == NULL)) {
+                               /*
+                                * Missing argument; leading ':'
+                                * indicates no error should be generated
+                                */
+#ifndef PLATFORM_WINDOWS
+                               if (PRINT_ERROR)
+                                       warnx(recargstring, current_argv);
+#else
+                                       warnx(PRINT_ERROR, recargstring, current_argv);
+#endif
+                               /*
+                                * XXX: GNU sets optopt to val regardless
+                                * of flag
+                                */
+                               if (long_options[match].flag == NULL)
+                                       optopt = long_options[match].val;
+                               else
+                                       optopt = 0;
+                               --optind;
+                               return BADARG;
+                       }
+               } else {                        /* unknown option */
+#ifndef PLATFORM_WINDOWS
+                       if (PRINT_ERROR)
+                               warnx(illoptstring, current_argv);
+#else
+                               warnx(PRINT_ERROR, illoptstring, current_argv);
+#endif
+                       optopt = 0;
+                       return BADCH;
+               }
+               if (long_options[match].flag) {
+                       *long_options[match].flag = long_options[match].val;
+                       retval = 0;
+               } else 
+                       retval = long_options[match].val;
+               if (idx)
+                       *idx = match;
+       }
+       return retval;
+}
+__END_DECLS    // Added by JE - 31-01-2010
+
+#endif /* !GETOPT_LONG */
diff --git a/libs/pbd/msvc/mountpoint.cc b/libs/pbd/msvc/mountpoint.cc
new file mode 100644 (file)
index 0000000..d30b244
--- /dev/null
@@ -0,0 +1,166 @@
+/*
+    Copyright (C) 2002 Paul Davis
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+    $Id: mountpoint.cc 3920 2008-10-11 12:34:46Z paul $
+*/
+
+#ifdef COMPILER_MSVC
+
+/* TODO - Still to be implemented */
+
+#include <cstdio>
+#include <cstring>
+#include <string>
+#include <cstring>
+#include <limits.h>
+
+#include <pbd/mountpoint.h>
+
+using std::string;
+
+#if HAVE_GETMNTENT
+#include <mntent.h>
+
+struct mntent_sorter {
+    bool operator() (const mntent *a, const mntent *b) {
+           return strcmp (a->mnt_dir, b->mnt_dir);
+    }
+};
+
+string
+mountpoint (string path)
+{
+       FILE *mntf;
+       mntent *mnt;
+       unsigned int maxmatch = 0;
+       unsigned int matchlen;
+       const char *cpath = path.c_str();
+       char best[PATH_MAX+1];
+
+       if ((mntf = setmntent ("/etc/mtab", "r")) == 0) {
+               return "";
+       }
+
+       best[0] = '\0';
+
+       while ((mnt = getmntent (mntf))) {
+               unsigned int n;
+
+               n = 0;
+               matchlen = 0;
+
+               /* note: strcmp's semantics are not
+                  strict enough to use for this.
+               */
+
+               while (cpath[n] && mnt->mnt_dir[n]) {
+                       if (cpath[n] != mnt->mnt_dir[n]) {
+                               break;
+                       }
+                       matchlen++;
+                       n++;
+               }
+
+               if (cpath[matchlen] == '\0') {
+
+                       endmntent (mntf);
+                       return mnt->mnt_dir;
+
+               } else {
+
+                       if (matchlen > maxmatch) {
+                               snprintf (best, sizeof(best), "%s", mnt->mnt_dir);
+                               maxmatch = matchlen;
+                       }
+               }
+       }
+
+       endmntent (mntf);
+
+       return best;
+}
+
+#else // !HAVE_GETMNTENT
+
+string
+mountpoint (string path)
+{
+return "";
+
+/*  // The rest is commented out temporarily by JE - 30-11-2009
+    // (I think this must be the implementation for MacOS).
+       struct statfs *mntbufp = 0;
+       int count;
+       unsigned int maxmatch = 0;
+       unsigned int matchlen;
+       const char *cpath = path.c_str();
+       char best[PATH_MAX+1];
+
+       if ((count = getmntinfo(&mntbufp, MNT_NOWAIT)) == 0) {
+               free(mntbufp);
+               return "\0";
+       }
+
+       best[0] = '\0';
+
+       for (int i = 0; i < count; ++i) {
+               unsigned int n = 0;
+               matchlen = 0;
+
+               // note: strcmp's semantics are not
+               // strict enough to use for this.
+
+               while (cpath[n] && mntbufp[i].f_mntonname[n]) {
+                       if (cpath[n] != mntbufp[i].f_mntonname[n]) {
+                               break;
+                       }
+                       matchlen++;
+                       n++;
+               }
+
+               if (cpath[matchlen] == '\0') {
+                       snprintf(best, sizeof(best), "%s", mntbufp[i].f_mntonname);
+                       free(mntbufp);
+                       return best;
+
+               } else {
+
+                       if (matchlen > maxmatch) {
+                               snprintf (best, sizeof(best), "%s", mntbufp[i].f_mntonname);
+                               maxmatch = matchlen;
+                       }
+               }
+       }
+
+       return best;
+*/
+}
+#endif // HAVE_GETMNTENT
+
+#ifdef TEST_MOUNTPOINT
+
+main (int argc, char *argv[])
+{
+       printf ("mp of %s = %s\n", argv[1], mountpoint (argv[1]).c_str());
+       exit (0);
+}
+
+#endif // TEST_MOUNTPOINT
+
+#else  // !COMPILER_MSVC
+       const char* pbd_mountpoint = "original pbd/mountpoint.cc takes precedence over this file";
+#endif // COMPILER_MSVC
diff --git a/libs/pbd/msvc/msvc_pbd.cc b/libs/pbd/msvc/msvc_pbd.cc
new file mode 100644 (file)
index 0000000..f6efe9c
--- /dev/null
@@ -0,0 +1,914 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef COMPILER_MSVC
+
+#include <WTypes.h>
+
+extern "C" WINBASEAPI BOOL WINAPI
+CreateHardLinkA( LPCSTR lpFileName,
+                                LPCSTR lpExistingFileName,
+                                LPSECURITY_ATTRIBUTES lpSecurityAttributes ); // Needs kernel32.lib on anything higher than Win2K
+
+#include <algorithm>
+#include <string>
+#include <io.h>
+#include <math.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <pbd/error.h>
+#include <ardourext/misc.h>
+#include <ardourext/pthread.h> // Should ensure that we include the right
+                               // version - but we'll check anyway, later
+
+#include <glibmm.h>
+
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
+
+struct timezone
+{
+       int  tz_minuteswest; /* minutes W of Greenwich */
+       int  tz_dsttime;     /* type of dst correction */
+};
+
+PBD_API int PBD_APICALLTYPE
+gettimeofday(struct timeval *__restrict tv, __timezone_ptr_t tz) // Does this need to be exported ?
+{
+FILETIME ft;
+unsigned __int64 tmpres = 0;
+static int tzflag = 0;
+
+       if (NULL != tv)
+       {
+               GetSystemTimeAsFileTime(&ft);
+
+               tmpres |= ft.dwHighDateTime;
+               tmpres <<= 32;
+               tmpres |= ft.dwLowDateTime;
+
+               /*converting file time to unix epoch*/
+               tmpres /= 10;  /*convert into microseconds*/
+               tmpres -= DELTA_EPOCH_IN_MICROSECS;
+               tv->tv_sec = (long)(tmpres / 1000000UL);
+               tv->tv_usec = (long)(tmpres % 1000000UL);
+       }
+
+       if (NULL != tz)
+       {
+               struct timezone *ptz = static_cast<struct timezone*> (tz);
+               if (!tzflag)
+               {
+                       _tzset();
+                       tzflag++;
+               }
+               if (ptz)
+               {
+                       ptz->tz_minuteswest = _timezone / 60;
+                       ptz->tz_dsttime = _daylight;
+               }
+       }
+
+       return 0;
+}
+
+// Define the default comparison operators for Windows (ptw32) 'pthread_t' (not used
+// by Ardour AFAIK but would be needed if an array of 'pthread_t' had to be sorted).
+#ifndef PTHREAD_H   // Defined by PTW32 (Linux and other versions define _PTHREAD_H)
+#error "An incompatible version of 'pthread.h' is #included. Use only the Windows (ptw32) version!"
+#else
+bool operator>  (const pthread_t& lhs, const pthread_t& rhs)
+{
+       return (std::greater<void*>()(lhs.p, rhs.p));
+}
+
+bool operator<  (const pthread_t& lhs, const pthread_t& rhs)
+{
+       return (std::less<void*>()(lhs.p, rhs.p));
+}
+
+bool operator!= (const pthread_t& lhs, const pthread_t& rhs)
+{
+       return (std::not_equal_to<void*>()(lhs.p, rhs.p));
+}
+
+bool operator== (const pthread_t& lhs, const pthread_t& rhs)
+{
+       return (!(lhs != rhs));
+}
+#endif
+
+// Functions supplied (later) to std::transform
+//***************************************************************
+//
+//     invert_backslash()
+//
+// Examines a supplied ASCII character and (if the character is
+// a backslash) converts it to a forward slash,
+//
+//     Returns:
+//
+//    The supplied character (converted, if it was a backslash)
+//
+char invert_backslash(char character)
+{
+       if ('\\' == character)
+               character = '/';
+
+       return (character);
+}
+
+//***************************************************************
+//
+//     invert_forwardslash()
+//
+// Examines a supplied ASCII character and (if the character is
+// a forward slash) converts it to a backslash,
+//
+//     Returns:
+//
+//    The supplied character (converted, if it was a fwd slash)
+//
+char invert_forwardslash(char character)
+{
+       if ('/' == character)
+               character = '\\';
+
+       return (character);
+}
+
+
+//***************************************************************
+//
+//     pread()
+//
+// Emulates pread() using _lseek()/_read()/_lseek().
+//
+//     Returns:
+//
+//    On Success: The number of bytes read from the file
+//    On Failure: -1
+//
+PBD_API ssize_t PBD_APICALLTYPE
+pread(int handle, void *buf, size_t nbytes, off_t offset)
+{
+int old_errno;
+ssize_t ret;
+
+       off_t old_offset = _tell(handle);
+
+       if (0 > old_offset)
+               ret = (-1);
+       else
+       {
+               _lseek(handle, offset, SEEK_SET);
+               ret = _read(handle, buf, nbytes);
+
+               old_errno = errno;
+               _lseek(handle, old_offset, SEEK_SET);
+               errno = old_errno;
+       }
+
+       return (ret);
+}
+
+
+//***************************************************************
+//
+//     pwrite()
+//
+// Emulates pwrite() using _lseek()/_write()/_lseek().
+//
+//     Returns:
+//
+//    On Success: The number of bytes written to the file
+//    On Failure: -1
+//
+PBD_API ssize_t PBD_APICALLTYPE
+pwrite(int handle, const void *buf, size_t nbytes, off_t offset)
+{
+int old_errno;
+ssize_t ret;
+
+       off_t old_offset = _lseek(handle, offset, SEEK_SET);
+
+       if (0 > old_offset)
+               ret = (-1);
+       else
+       {
+               ret = _write(handle, buf, nbytes);
+
+               old_errno = errno;
+               _lseek(handle, old_offset, SEEK_SET);
+               errno = old_errno;
+       }
+
+       return (ret);
+}
+
+//***************************************************************
+//
+//     round()
+//
+// Emulates round() using floor().
+//
+//     Returns:
+//
+//    On Success: The largest integer that is less than or
+//                equal to 'x'.
+//    On Failure: None
+//
+PBD_API double PBD_APICALLTYPE
+round(double x)
+{
+       return (floor(x));
+}
+
+namespace PBD {
+
+//***************************************************************
+//
+//     TestForMinimumSpecOS()
+//
+// Tests the user's OS to see if it is Win2K or later (could be
+// expanded quite easily to accommodate other OS's)
+//
+//     Returns:
+//
+//    On Success: TRUE (if the user's OS matches the minimum spec)
+//    On Failure: FALSE otherwise
+//
+PBD_API bool PBD_APICALLTYPE
+TestForMinimumSpecOS(char *revision /* currently ignored */)
+{
+bool bRet = true;
+#ifdef PLATFORM_WINDOWS
+       bRet = false;
+       HINSTANCE hKernelDll = (HINSTANCE)dlopen("kernel32.dll", RTLD_NOW);
+
+       if (hKernelDll)
+       {
+               // 'CreateHardLink()' is only available from Win2K onwards.
+               if (NULL != dlsym(hKernelDll, "CreateHardLinkA"))
+                       bRet = true;
+
+               dlclose(hKernelDll);
+       }
+#endif
+       // Other OS's could be accommodated here
+
+       return (bRet);
+}
+
+
+//***************************************************************
+//
+//     realpath()
+//
+// Emulates POSIX realpath() using Win32 _fullpath().
+//
+//     Returns:
+//
+//    On Success: A pointer to the resolved (absolute) path
+//    On Failure: NULL
+//
+PBD_API char* PBD_APICALLTYPE
+realpath (const char *original_path, char resolved_path[_MAX_PATH+1])
+{
+char *pRet = NULL;
+bool bIsSymLink = 0; // We'll probably need to test the incoming path
+                     // to find out if it points to a Windows shortcut
+                     // (or a hard link) and set this appropriately.
+       if (bIsSymLink)
+       {
+               // At the moment I'm not sure if Windows '_fullpath()' is directly
+               // equivalent to POSIX 'realpath()' - in as much as the latter will
+               // resolve the supplied path if it happens to point to a symbolic
+               // link ('_fullpath()' probably DOESN'T do this but I'm not really
+               // sure if Ardour needs such functionality anyway). Therefore we'll
+               // possibly need to add that functionality here at a later date.
+       }
+       else
+       {
+               char temp[(MAX_PATH+1)*6]; // Allow for maximum length of a path in UTF8 characters
+
+               // POSIX 'realpath()' requires that the buffer size is at
+               // least PATH_MAX+1, so assume that the user knew this !!
+               pRet = _fullpath(temp, Glib::locale_from_utf8(original_path).c_str(), _MAX_PATH);
+               if (NULL != pRet)
+                       strcpy(resolved_path, Glib::locale_to_utf8(temp).c_str());
+       }
+
+       return (pRet);
+}
+
+
+//***************************************************************
+//
+//     opendir()
+//
+// Creates a pointer to a DIR structure, appropriately filled in
+// and ready to begin a directory search iteration.
+//
+//     Returns:
+//
+//    On Success: Pointer to a (heap based) DIR structure
+//    On Failure: NULL
+//
+PBD_API DIR* PBD_APICALLTYPE
+opendir (const char *szPath)
+{
+wchar_t wpath[PATH_MAX+1];
+unsigned int rc;
+DIR *pDir = 0;
+
+       errno = 0;
+
+       if (!szPath)
+               errno = EFAULT;
+
+       if ((!errno) && ('\0' == szPath[0]))
+               errno = ENOTDIR;
+
+       // Determine if the given path really is a directory
+
+       if (!errno)
+               if (0 == MultiByteToWideChar (CP_UTF8, 0, (LPCSTR)szPath, -1, (LPWSTR)wpath, sizeof(wpath)))
+                       errno = EFAULT;
+
+       if ((!errno) && ((rc = GetFileAttributesW(wpath)) == -1))
+               errno = ENOENT;
+
+       if ((!errno) && (!(rc & FILE_ATTRIBUTE_DIRECTORY)))
+               // Error. Entry exists but not a directory. */
+               errno = ENOTDIR;
+
+       if (!errno)
+       {
+               // Allocate enough memory to store DIR structure, plus
+               // the complete directory path originally supplied.
+               pDir = (DIR *)malloc(sizeof(DIR) + strlen(szPath) + strlen("\\") + strlen ("*"));
+
+               if (!pDir)
+               {
+                       // Error - out of memory
+                       errno = ENOMEM;
+               }
+       }
+
+       if (!errno)
+       {
+               // Create the search expression
+               strcpy(pDir->dd_name, szPath);
+
+               // Add a backslash if the path doesn't already end with one
+               if (pDir->dd_name[0] != '\0' &&
+                       pDir->dd_name[strlen(pDir->dd_name) - 1] != '/' &&
+                       pDir->dd_name[strlen(pDir->dd_name) - 1] != '\\')
+               {
+                       strcat (pDir->dd_name, "\\");
+               }
+
+               // Add the search pattern
+               strcat(pDir->dd_name, "*");
+
+               // Initialize handle to -1 so that a premature closedir()
+               // doesn't try to call _findclose() on it.
+               pDir->dd_handle = (-1);
+
+               // Initialize the status
+               pDir->dd_stat = 0;
+
+               // Initialize the dirent structure. 'ino' and 'reclen' are invalid under Win32
+               // and 'name' simply points at the appropriate part of the findfirst_t struct.
+               pDir->dd_dir.d_ino = 0;
+               pDir->dd_dir.d_reclen = 0;
+               pDir->dd_dir.d_namlen = 0;
+               strcpy(pDir->dd_dir.d_name, pDir->dd_dta.name);
+
+               return (pDir);  // Succeeded
+       }
+
+       if (pDir)
+               free (pDir);
+       return (DIR *) 0; // Failed
+}
+
+
+//***************************************************************
+//
+//     readdir()
+//
+// Return a pointer to a dirent struct, filled with information
+// about the next entry in the directory.
+//
+//     Returns:
+//
+//    On Success: A pointer to the supplied DIR's 'dirent' struct
+//    On Failure: NULL
+//
+PBD_API struct dirent* PBD_APICALLTYPE
+readdir (DIR* pDir)
+{
+int old_errno = 0;
+errno = 0;
+
+       // Check for valid DIR struct
+       if (!pDir)
+               errno = EFAULT;
+
+       if ((strcmp(pDir->dd_dir.d_name, pDir->dd_dta.name)) && (!errno))
+               // The structure does not seem to be set up correctly
+               errno = EINVAL;
+       else
+       {
+               if (pDir->dd_stat < 0)
+               {
+                       // We have already returned all files in this directory
+                       // (or the structure has an invalid dd_stat).
+                       return (struct dirent *)0;
+               }
+               else if (pDir->dd_stat == 0)
+               {
+                       // We haven't started the search yet.
+                       // Start the search
+                       pDir->dd_handle = _findfirst (Glib::locale_from_utf8(pDir->dd_name).c_str(), &(pDir->dd_dta));
+
+                       if (pDir->dd_handle == -1)
+                               // The directory is empty
+                               pDir->dd_stat = -1;
+                       else
+                               pDir->dd_stat = 1;
+               }
+               else
+               {
+                       // Do not return ENOENT on last file in directory
+                       old_errno = errno;
+
+                       // Get the next search entry
+                       if (_findnext (pDir->dd_handle, &(pDir->dd_dta)))
+                       {
+                               // We are off the end or otherwise error
+                               errno = old_errno;
+                               _findclose (pDir->dd_handle);
+                               pDir->dd_handle = -1;
+                               pDir->dd_stat = -1;
+                       }
+                       else
+                               // Update to indicate the correct status number
+                               pDir->dd_stat++;
+               }
+
+               if (pDir->dd_stat > 0)
+               {
+                       // We successfully got an entry. Details about the file are
+                       // already appropriately filled in except for the length of
+                       // file name.
+                       strcpy(pDir->dd_dir.d_name, pDir->dd_dta.name);
+                       pDir->dd_dir.d_namlen = strlen (pDir->dd_dir.d_name);
+                       return (&pDir->dd_dir); // Succeeded
+               }
+       }
+
+       return (struct dirent *) 0; // Failed
+}
+
+
+//***************************************************************
+//
+//     closedir()
+//
+// Frees the resources allocated by opendir().
+//
+//     Returns:
+//
+//    On Success: 0
+//    On Failure: -1
+//
+PBD_API int PBD_APICALLTYPE
+closedir (DIR *pDir)
+{
+int rc = 0;
+
+       errno = 0;
+
+       if (!pDir)
+               errno = EFAULT;
+       else
+       {
+               if ((-1) != pDir->dd_handle)
+                       rc = _findclose (pDir->dd_handle);
+
+               // Free the DIR structure
+               free (pDir);
+
+               return rc; // Succeeded
+       }
+
+       return (-1); // Failed
+}
+
+//***************************************************************
+//
+//     mkstemp()
+//
+// Emulates Linux mkstemp() using Win32 _mktemp() and _open() etc.
+//
+//     Returns:
+//
+//    On Success: A file descriptor for the opened file.
+//    On Failure: (-1)
+//
+PBD_API int PBD_APICALLTYPE
+mkstemp (char *template_name)
+{
+int ret = (-1);
+char *szFileName;
+char szTempPath[PATH_MAX+100]; // Just ensure we have plenty of buffer space
+
+       if (NULL != (szFileName = _mktemp(template_name)))
+       {
+               if (0 != ::GetTempPathA(sizeof(szTempPath), szTempPath))
+               {
+                       strcat(szTempPath, szFileName);
+                       ret = _open(szTempPath, (_O_CREAT|_O_BINARY|_O_TEMPORARY|_O_RDWR|_O_TRUNC), _S_IWRITE);
+               }
+       }
+
+       return (ret);
+}
+
+
+//***************************************************************
+//
+//     ntfs_link()
+//
+// Emulates Linux link() using Win32 CreateHardLink()(NTFS only).
+//
+//     Returns:
+//
+//    On Success: Non-zero.
+//    On Failure: Zero (call 'GetLastError()' to retrieve info)
+//
+PBD_API int PBD_APICALLTYPE
+ntfs_link (const char *existing_filepath, const char *link_filepath)
+{
+int ret = 1; // 'ERROR_INVALID_FUNCTION'
+bool bValidPath = false;
+
+       // Make sure we've been sent a valid input string
+       if (existing_filepath && link_filepath)
+       {
+               std::string strRoot = existing_filepath;
+
+               if ((1 < strRoot.length()) && ('\\' == existing_filepath[0]) && ('\\' == existing_filepath[1]))
+               {
+                       int slashcnt = 0;
+
+                       // We've been sent a network path. Convert backslashes to forward slashes temporarily.
+                       std::transform(strRoot.begin(), strRoot.end(), strRoot.begin(), invert_backslash);
+
+                       // Now, if there are less than four slashes, add a fourth one or abort
+                       std::string::iterator iter = strRoot.begin();
+                       while ((slashcnt < 4) && (iter != strRoot.end()))
+                       {
+                               if ('/' == (*iter))
+                                       slashcnt++;
+
+                               ++iter;
+                       }
+
+                       if (slashcnt > 2)
+                       {
+                               // If only 3 slashes were counted, add a trailing slash
+                               if (slashcnt == 3)
+                                       strRoot += '/';
+
+                               // Now find the position of the fourth slash
+                               iter = strRoot.begin();
+                               int charcnt = 0;
+                               for (slashcnt=0; slashcnt<4;)
+                               {
+                                       charcnt++;
+
+                                       if ('/' == (*iter))
+                                               slashcnt++;
+
+                                       if (++iter == strRoot.end())
+                                               break;
+                               }
+
+                               strRoot.resize(charcnt);
+                               bValidPath = true;
+                       }
+               }
+               else
+               {
+                       // Assume a standard Windows style path
+                       if (1 < strRoot.length() && (':' == existing_filepath[1]))
+                       {
+                               // Convert backslashes to forward slashes temporarily.
+                               std::transform(strRoot.begin(), strRoot.end(), strRoot.begin(), invert_backslash);
+
+                               if (2 == strRoot.length())
+                                       strRoot += '/';
+
+                               if ('/' == strRoot[2])
+                               {
+                                       strRoot.resize(3);
+                                       bValidPath = true;
+                               }
+                       }
+               }
+
+               if (bValidPath)
+               {
+                       char szFileSystemType[_MAX_PATH+1];
+
+                       // Restore the original backslashes
+                       std::transform(strRoot.begin(), strRoot.end(), strRoot.begin(), invert_forwardslash);
+
+                       // Windows only supports hard links for the NTFS filing
+                       // system, so let's make sure that's what we're using!!
+                       if (::GetVolumeInformationA(strRoot.c_str(), NULL, 0, NULL, NULL, NULL, szFileSystemType, _MAX_PATH+1))
+                       {
+                               std::string strRootFileSystemType = szFileSystemType;
+                               std::transform(strRootFileSystemType.begin(), strRootFileSystemType.end(), strRootFileSystemType.begin(), ::toupper);
+#if (_WIN32_WINNT >= 0x0500)
+                               if (0 == strRootFileSystemType.compare("NTFS"))
+                               {
+                                       if (TestForMinimumSpecOS()) // Hard links were only available from Win2K onwards
+                                               if (0 == CreateHardLinkA(link_filepath, existing_filepath, NULL))
+                                               {       // Note that the above API call cannot create a link to a directory, so
+                                                       // should we also be checking that the supplied path was actually a file?
+                                                       ret = GetLastError();
+                                               }
+                                               else
+                                                       SetLastError(ret = 0); // 'NO_ERROR'
+                               }
+                               else
+                               {
+                                       ret = 4300; // 'ERROR_INVALID_MEDIA'
+                               }
+#endif
+                       }
+               }
+               else
+                       ret = 123; // 'ERROR_INVALID_NAME'
+       }
+       else
+               ret = 161; // 'ERROR_BAD_PATHNAME'
+
+       if (ret)
+       {
+               SetLastError(ret);
+               return (-1);
+       }
+       else
+               return (0);
+}
+
+
+//***************************************************************
+//
+//     ntfs_unlink()
+//
+// Emulates Linux unlink() using Win32 DeleteFile()(NTFS only).
+//
+//     Returns:
+//
+//    On Success: Non-zero.
+//    On Failure: Zero (call 'GetLastError()' to retrieve info)
+//
+PBD_API int PBD_APICALLTYPE
+ntfs_unlink (const char *link_filepath)
+{
+int ret = 1; // 'ERROR_INVALID_FUNCTION'
+bool bValidPath = false;
+
+       // Make sure we've been sent a valid input string
+       if (link_filepath)
+       {
+               std::string strRoot = link_filepath;
+
+               if ((1 < strRoot.length()) && ('\\' == link_filepath[0]) && ('\\' == link_filepath[1]))
+               {
+                       int slashcnt = 0;
+
+                       // We've been sent a network path. Convert backslashes to forward slashes temporarily.
+                       std::transform(strRoot.begin(), strRoot.end(), strRoot.begin(), invert_backslash);
+
+                       // Now, if there are less than four slashes, add a fourth one or abort
+                       std::string::iterator iter = strRoot.begin();
+                       while ((slashcnt < 4) && (iter != strRoot.end()))
+                       {
+                               if ('/' == (*iter))
+                                       slashcnt++;
+
+                               ++iter;
+                       }
+
+                       if (slashcnt > 2)
+                       {
+                               // If only 3 slashes were counted, add a trailing slash
+                               if (slashcnt == 3)
+                                       strRoot += '/';
+
+                               // Now find the position of the fourth slash
+                               iter = strRoot.begin();
+                               int charcnt = 0;
+                               for (slashcnt=0; slashcnt<4;)
+                               {
+                                       charcnt++;
+
+                                       if ('/' == (*iter))
+                                               slashcnt++;
+
+                                       if (++iter == strRoot.end())
+                                               break;
+                               }
+
+                               strRoot.resize(charcnt);
+                               bValidPath = true;
+                       }
+               }
+               else
+               {
+                       // Assume a standard Windows style path
+                       if (1 < strRoot.length() && (':' == link_filepath[1]))
+                       {
+                               // Convert backslashes to forward slashes temporarily.
+                               std::transform(strRoot.begin(), strRoot.end(), strRoot.begin(), invert_backslash);
+
+                               if (2 == strRoot.length())
+                                       strRoot += '/';
+
+                               if ('/' == strRoot[2])
+                               {
+                                       strRoot.resize(3);
+                                       bValidPath = true;
+                               }
+                       }
+               }
+
+               if (bValidPath)
+               {
+                       char szFileSystemType[_MAX_PATH+1];
+
+                       // Restore the original backslashes
+                       std::transform(strRoot.begin(), strRoot.end(), strRoot.begin(), invert_forwardslash);
+
+                       // Windows only supports hard links for the NTFS filing
+                       // system, so let's make sure that's what we're using!!
+                       if (::GetVolumeInformationA(strRoot.c_str(), NULL, 0, NULL, NULL, NULL, szFileSystemType, _MAX_PATH+1))
+                       {
+                               std::string strRootFileSystemType = szFileSystemType;
+                               std::transform(strRootFileSystemType.begin(), strRootFileSystemType.end(), strRootFileSystemType.begin(), ::toupper);
+#if (_WIN32_WINNT >= 0x0500)
+                               if (0 == strRootFileSystemType.compare("NTFS"))
+                                       if (TestForMinimumSpecOS()) // Hard links were only available from Win2K onwards
+                                               if (0 == DeleteFileA(link_filepath))
+                                                       ret = GetLastError();
+                                               else
+                                                       ret = 0; // 'NO_ERROR'
+#endif
+                       }
+               }
+               else
+                       ret = 123; // 'ERROR_INVALID_NAME'
+       }
+       else
+               ret = 161; // 'ERROR_BAD_PATHNAME'
+
+       if (ret)
+       {
+               SetLastError(ret);
+               return (-1);
+       }
+       else
+               return (0);
+}
+
+}  // namespace PBD
+
+
+//***************************************************************
+//
+//     dlopen()
+//
+// Emulates POSIX dlopen() using Win32 LoadLibrary().
+//
+//     Returns:
+//
+//    On Success: A handle to the opened DLL
+//    On Failure: NULL
+//
+PBD_API void* PBD_APICALLTYPE
+dlopen (const char *file_name, int mode)
+{
+       // Note that 'mode' is ignored in Win32
+       return(::LoadLibraryA(Glib::locale_from_utf8(file_name).c_str()));
+}
+
+
+//***************************************************************
+//
+//     dlclose()
+//
+// Emulates POSIX dlclose() using Win32 FreeLibrary().
+//
+//     Returns:
+//
+//    On Success: A non-zero number
+//    On Failure: 0
+//
+PBD_API int PBD_APICALLTYPE
+dlclose (void *handle)
+{
+       return (::FreeLibrary((HMODULE)handle));
+}
+
+
+//***************************************************************
+//
+//     dlsym()
+//
+// Emulates POSIX dlsym() using Win32 GetProcAddress().
+//
+//     Returns:
+//
+//    On Success: A pointer to the found function or symbol
+//    On Failure: NULL
+//
+PBD_API void* PBD_APICALLTYPE
+dlsym (void *handle, const char *symbol_name)
+{
+       // First test for RTLD_DEFAULT and RTLD_NEXT
+       if ((handle == 0/*RTLD_DEFAULT*/) || (handle == ((void *) -1L)/*RTLD_NEXT*/))
+       {
+               return 0; // Not yet supported for Win32
+       }
+       else
+               return (::GetProcAddress((HMODULE)handle, symbol_name));
+}
+
+#define LOCAL_ERROR_BUF_SIZE 1024
+static char szLastWinError[LOCAL_ERROR_BUF_SIZE];
+//***************************************************************
+//
+//     dlerror()
+//
+// Emulates POSIX dlerror() using Win32 GetLastError().
+//
+//     Returns:
+//
+//    On Success: The translated message corresponding to the
+//                last error
+//    On Failure: NULL (if the last error was ERROR_SUCCESS)
+//
+PBD_API char* PBD_APICALLTYPE
+dlerror ()
+{
+       DWORD dwLastErrorId = GetLastError();
+       if (ERROR_SUCCESS == dwLastErrorId)
+               return 0;
+       else
+       {
+               if (0 == FormatMessage(
+                                       FORMAT_MESSAGE_FROM_SYSTEM,
+                                       NULL,
+                                       dwLastErrorId,
+                                       0,
+                                       szLastWinError,
+                                       LOCAL_ERROR_BUF_SIZE,
+                                       0))
+               {
+                       sprintf(szLastWinError, "Could not decipher the previous error message");
+               }
+
+               // POSIX dlerror() seems to reset the
+               // error system, so emulate that here
+               SetLastError(ERROR_SUCCESS);
+       }
+
+       return(szLastWinError);
+}
+
+#endif  // COMPILER_MSVC
diff --git a/libs/pbd/msvc/msvc_poll.cc b/libs/pbd/msvc/msvc_poll.cc
new file mode 100644 (file)
index 0000000..e12ef2b
--- /dev/null
@@ -0,0 +1,215 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef COMPILER_MSVC
+
+//#include <glib/gtimer.h>
+#include "pbd/msvc_pbd.h"
+
+#ifndef _DWORD_DEFINED
+#define _DWORD_DEFINED
+typedef unsigned long DWORD;
+#endif  // !_DWORD_DEFINED
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *                                                                               *
+ * Note that this entire strategy failed to work, at least for pipes. It turned  *
+ * out that Windows 'tell()' always returns 0 when used on a pipe. This strategy *
+ * is now deprecated, having been replaced by a new pipe-like object, which I've *
+ * called 'PBD::pipex'. This polling functionality is included here mostly so    *
+ * that Ardour will build and launch under Windows. However, any module that     *
+ * relies on polling a pipe will eventually need to use the new pipex object.    *
+ * This code will allow it to compile and link successfully, although it won't   *
+ * poll successfully at run time. Having said that, these functions might well   *
+ * work for ports and/or other machanisms that get represented by a file handle. *
+ *                                                                               *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+int poll_input (struct pollfd *fds, nfds_t nfds, int& elapsed_time, int timeout)
+{
+DWORD dwOldTickCount,
+      dwNewTickCount = GetTickCount();
+bool  input = false,
+      error = false;
+int   ret = 0;
+
+       if (NULL != fds)
+       {
+               nfds_t loop;
+               short ev_mask = (POLLOUT|POLLWRNORM|POLLWRBAND);
+
+               errno = NO_ERROR;
+
+               do
+               {
+                       dwOldTickCount = dwNewTickCount;
+
+                       for (loop=0; loop<nfds; loop++)
+                               fds[loop].revents = 0;
+
+                       for (loop=0; (loop<nfds && !error); loop++)
+                       {
+                               if (!(fds[loop].events & ev_mask))
+                               {
+                                       long pos = _tell(fds[loop].fd);
+
+                                       if (0 > pos)
+                                       {
+                                               // An error occured ('errno' should have been set by '_tell()')
+                                               ret = (-1);
+                                               fds[loop].revents = POLLERR;
+                                               if (fds[loop].events & POLLRDNORM)
+                                                       fds[loop].revents |= POLLRDNORM;
+                                               if (fds[loop].events & POLLRDBAND)
+                                                       fds[loop].revents |= POLLRDBAND;
+                                               if (fds[loop].events & POLLPRI)
+                                                       fds[loop].revents |= POLLPRI;
+
+                                               // Do we want to abort on error?
+                                               if (fds[loop].events & POLLERR)
+                                                       error = true;
+                                       }
+                                       else if (pos > 0)
+                                       {
+                                               // Input characters were found for this fd
+                                               ret += 1;
+                                               if (fds[loop].events & POLLRDNORM)
+                                                       fds[loop].revents |= POLLRDNORM;
+                                               if (fds[loop].events & POLLRDBAND)
+                                                       fds[loop].revents |= POLLRDBAND;
+                                               if (fds[loop].events & POLLPRI)
+                                                       fds[loop].revents |= POLLPRI;
+
+                                               // Do we want to abort on input?
+                                               if ((fds[loop].events & POLLIN)     ||
+                                                   (fds[loop].events & POLLPRI)    ||
+                                                   (fds[loop].events & POLLRDNORM) ||
+                                                   (fds[loop].events & POLLRDBAND))
+                                                       input = true;
+                                       }
+                               }
+                       }
+
+                       if (input)
+                               break;
+
+                       dwNewTickCount = GetTickCount();
+                       elapsed_time += (dwNewTickCount-dwOldTickCount);
+                       // Note that the above will wrap round if the user leaves
+                       // his computer powered up for more than about 50 days!
+
+                       // Sleep briefly because GetTickCount() only has an accuracy of 10mS
+                       Sleep(10); // For some reason 'g_usleep()' craps over everything here. Different 'C' runtimes???
+
+               } while ((!error) && ((timeout == (-1)) || (elapsed_time < timeout)));
+       }
+       else
+       {
+               errno = ERROR_BAD_ARGUMENTS;
+               ret = (-1);
+       }
+
+       return (ret);
+}
+
+int poll_output (struct pollfd *fds, nfds_t nfds, int& elapsed_time, int timeout)
+{
+int ret = 0; // This functionality is not yet implemented
+
+       if (NULL != fds)
+       {
+               // Just flag whichever pollfd was specified for writing
+               short ev_mask = (POLLOUT|POLLWRNORM|POLLWRBAND);
+
+               errno = NO_ERROR;
+               elapsed_time = 0;
+
+               for (nfds_t loop=0; loop<nfds; loop++)
+               {
+                       if (fds[loop].events & ev_mask)
+                       {
+                               fds[loop].revents = POLLNVAL;
+                               errno = ERROR_INVALID_ACCESS;
+                               ret = (-1);
+                       }
+               }
+       }
+       else
+       {
+               errno = ERROR_BAD_ARGUMENTS;
+               ret = (-1);
+       }
+
+       return (ret);
+}
+
+//***************************************************************
+//
+//     poll()
+//
+// Emulates POSIX poll() using Win32 _tell().
+//
+//     Returns:
+//
+//    On Success: A positive integer indicating the total number
+//                of file descriptors that were available for
+//                writing or had data available for reading.
+//    On Failure: -1 (the actual error is saved in 'errno').
+//
+PBD_API int PBD_APICALLTYPE
+poll (struct pollfd *fds, nfds_t nfds, int timeout)
+{
+int elapsed_time = 0;
+int ret = (-1);
+
+       // Note that this functionality is not fully implemented.
+       // At the time of writing, Ardour seems only to poll on
+       // read pipes. Therefore return an error if any write
+       // pipe seems to have been specified or if too many file
+       // descriptors were passed.
+       short ev_mask = (POLLOUT|POLLWRNORM|POLLWRBAND);
+
+       if ((nfds > OPEN_MAX) || (nfds > NPOLLFILE))
+       {
+               errno = ERROR_TOO_MANY_OPEN_FILES;
+       }
+       else
+       {
+               ret = 0;
+
+               for (nfds_t loop=0; loop<nfds; loop++)
+               {
+                       if (fds[loop].events & ev_mask)
+                       {
+                               ret = poll_output(fds, nfds, elapsed_time, timeout);
+                               break;
+                       }
+               }
+
+               if (0 == ret)
+               {
+                       // Poll for input
+                       ret = poll_input(fds, nfds, elapsed_time, timeout);
+               }
+       }
+
+       return (ret);
+}
+
+#endif  //COMPILER_MSVC
index 4911f127881f6aff7f6c5dac6e6e825650009372..5784ec942855de3ece0de4e9809333efbb5278e1 100644 (file)
 */
 
 #include <vector>
-#include <climits>
 #include <iostream>
+#include <climits>
+#include <cerrno>
+#include <cstdlib>
 
 #include <regex.h>
 
 using std::string;
 using std::vector;
 
+string
+PBD::canonical_path (const std::string& path)
+{
+#ifdef COMPILER_MINGW
+       return path;
+#else
+       char buf[PATH_MAX+1];
+
+       if (!realpath (path.c_str(), buf) && (errno != ENOENT)) {
+               return path;
+       }
+
+       return string (buf);
+#endif
+}
+
 string
 PBD::path_expand (string path)
 {
@@ -97,13 +115,7 @@ PBD::path_expand (string path)
 
        /* canonicalize */
 
-       char buf[PATH_MAX+1];
-
-       if (realpath (path.c_str(), buf)) {
-               return buf;
-       } else {
-               return string();
-       }
+       return canonical_path (path);
 }
 
 string
index fac2dcfd965258debf26a13a3d65cd4839e76548..b9b501a1201766abb8e0f22a7ab23e9556bb6f74 100644 (file)
     $Id$
 */
 
+#ifdef COMPILER_MSVC
+#include <stdlib.h>
+#include <stdio.h>
+using PBD::readdir;
+using PBD::opendir;
+using PBD::closedir;
+#else
+#include <dirent.h>
 #include <cstdlib>
 #include <cstdio>
+#endif
 #include <cstring>
 #include <vector>
-#include <dirent.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
index d43bc64f6352a8e3071a6cbc525cdf89eebde418..9c405745ac3fc6f4b7d693f244c5cfc840763871 100644 (file)
 
 #include "i18n.h"
 
+#ifdef COMPILER_MSVC
+#include <ardourext/misc.h>  // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
+                             // searched and sorted. Thus, when instantiating the container, MSVC complains
+                             // if the type of object being contained has no appropriate comparison operators
+                             // defined (specifically, if operators '<' and '==' are undefined). This seems
+                             // to be the case with ptw32 'pthread_t' which is a simple struct.
+DECLARE_DEFAULT_COMPARISONS(pthread_t)
+#endif
+
 using namespace std;
 
 template<typename RequestBuffer> void 
@@ -146,7 +155,7 @@ AbstractUI<RequestObject>::get_request (RequestType rt)
                        return 0;
                }
 
-               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated per-thread request of type %2, caller %3\n", name(), rt, pthread_self()));
+               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated per-thread request of type %2, caller %3\n", name(), rt, pthread_name()));
 
                vec.buf[0]->type = rt;
                 vec.buf[0]->valid = true;
@@ -158,7 +167,7 @@ AbstractUI<RequestObject>::get_request (RequestType rt)
         * are not at work.
         */
 
-       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated normal heap request of type %2, caller %3\n", name(), rt, pthread_self()));
+       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1: allocated normal heap request of type %2, caller %3\n", name(), rt, pthread_name()));
 
        RequestObject* req = new RequestObject;
        req->type = rt;
@@ -213,7 +222,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
        for (i = request_buffers.begin(); i != request_buffers.end(); ) {
              if ((*i).second->dead) {
                     DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 deleting dead per-thread request buffer for %3 @ %4\n",
-                                                                         name(), pthread_self(), i->first, i->second));
+                                                                         name(), pthread_name(), i->second));
                      delete (*i).second;
                      RequestBufferMapIterator tmp = i;
                      ++tmp;
@@ -241,7 +250,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
 
                 request_buffer_map_lock.lock ();
                 if (!req->valid) {
-                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 handling invalid heap request, type %3, deleting\n", name(), pthread_self(), req->type));
+                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 handling invalid heap request, type %3, deleting\n", name(), pthread_name(), req->type));
                         delete req;
                         request_buffer_map_lock.unlock ();
                         continue;
@@ -253,7 +262,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
                 */
 
                 if (req->invalidation) {
-                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 remove request from its invalidation list\n", name(), pthread_self()));
+                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 remove request from its invalidation list\n", name(), pthread_name()));
                        
                        /* after this call, if the object referenced by the
                         * invalidation record is deleted, it will no longer
@@ -281,7 +290,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
 
                lm.release ();
 
-               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 execute request type %3\n", name(), pthread_self(), req->type));
+               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 execute request type %3\n", name(), pthread_name(), req->type));
 
                /* and lets do it ... this is a virtual call so that each
                 * specific type of UI can have its own set of requests without
@@ -290,7 +299,7 @@ AbstractUI<RequestObject>::handle_ui_requests ()
 
                do_request (req);
 
-               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 delete heap request type %3\n", name(), pthread_self(), req->type));
+               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 delete heap request type %3\n", name(), pthread_name(), req->type));
                delete req;
 
                /* re-acquire the list lock so that we check again */
@@ -315,7 +324,7 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
                /* the thread that runs this UI's event loop is sending itself
                   a request: we dispatch it immediately and inline.
                */
-               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of request type %3\n", name(), pthread_self(), req->type));
+               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of request type %3\n", name(), pthread_name(), req->type));
                do_request (req);
        } else {        
 
@@ -334,13 +343,13 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
                RequestBuffer* rbuf = per_thread_request_buffer.get ();
 
                if (rbuf != 0) {
-                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send per-thread request type %3\n", name(), pthread_self(), req->type));
+                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send per-thread request type %3\n", name(), pthread_name(), req->type));
                        rbuf->increment_write_ptr (1);
                } else {
                        /* no per-thread buffer, so just use a list with a lock so that it remains
                           single-reader/single-writer semantics
                        */
-                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send heap request type %3\n", name(), pthread_self(), req->type));
+                       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 send heap request type %3\n", name(), pthread_name(), req->type));
                        Glib::Threads::Mutex::Lock lm (request_list_lock);
                        request_list.push_back (req);
                }
@@ -349,7 +358,7 @@ AbstractUI<RequestObject>::send_request (RequestObject *req)
                   at the per-thread and generic request lists.
                */
 
-               request_channel.wakeup ();
+               signal_new_request ();
        }
 }
 
@@ -357,7 +366,7 @@ template<typename RequestObject> void
 AbstractUI<RequestObject>::call_slot (InvalidationRecord* invalidation, const boost::function<void()>& f)
 {
        if (caller_is_self()) {
-               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of call slot via functor @ %3, invalidation %4\n", name(), pthread_self(), &f, invalidation));
+               DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 direct dispatch of call slot via functor @ %3, invalidation %4\n", name(), pthread_name(), &f, invalidation));
                f ();
                return;
        }
@@ -368,7 +377,7 @@ AbstractUI<RequestObject>::call_slot (InvalidationRecord* invalidation, const bo
                return;
        }
 
-       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 queue call-slot using functor @ %3, invalidation %4\n", name(), pthread_self(), &f, invalidation));
+       DEBUG_TRACE (PBD::DEBUG::AbstractUI, string_compose ("%1/%2 queue call-slot using functor @ %3, invalidation %4\n", name(), pthread_name(), &f, invalidation));
 
        /* copy semantics: copy the functor into the request object */
 
index fb09dee5c26a0b1721491378c2b18861e27799ca..905074c474bba983547f076619ff3fb5543e0efc 100644 (file)
@@ -56,8 +56,22 @@ class AbstractUI : public BaseUI
                         , ui (uir) {}
         };
        typedef typename RequestBuffer::rw_vector RequestBufferVector;
+
+#if defined(__MINGW32__)
+
+       struct pthread_cmp
+       {
+               bool operator() (const ptw32_handle_t& thread1, const ptw32_handle_t& thread2)
+               {
+                       return thread1.p < thread2.p;
+               }
+       };
+       typedef typename std::map<pthread_t,RequestBuffer*, pthread_cmp>::iterator RequestBufferMapIterator;
+       typedef std::map<pthread_t,RequestBuffer*, pthread_cmp> RequestBufferMap;
+#else
        typedef typename std::map<pthread_t,RequestBuffer*>::iterator RequestBufferMapIterator;
        typedef std::map<pthread_t,RequestBuffer*> RequestBufferMap;
+#endif
 
        RequestBufferMap request_buffers;
         static Glib::Threads::Private<RequestBuffer> per_thread_request_buffer;
diff --git a/libs/pbd/pbd/atomic_counter.h b/libs/pbd/pbd/atomic_counter.h
new file mode 100644 (file)
index 0000000..1e1998e
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+    Copyright (C) 2010 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef PBD_ATOMIC_COUNTER_H
+#define PBD_ATOMIC_COUNTER_H
+
+#include <glib.h>
+
+namespace PBD {
+
+class atomic_counter
+{
+       /**
+        * Prevent copying and assignment
+        */
+       atomic_counter (const atomic_counter&);
+       atomic_counter& operator= (const atomic_counter&);
+
+public:
+
+       atomic_counter (gint value = 0)
+               :
+                       m_value(value)
+       { }
+
+       gint get() const
+       {
+               return g_atomic_int_get (&m_value);
+       }
+
+       void set (gint new_value)
+       {
+               g_atomic_int_set (&m_value, new_value);
+       }
+
+       void increment ()
+       {
+               g_atomic_int_inc (&m_value);
+       }
+
+       void operator++ ()
+       {
+               increment ();
+       }
+
+       bool decrement_and_test ()
+       {
+               return g_atomic_int_dec_and_test (&m_value);
+       }
+       
+       bool operator-- ()
+       {
+               return decrement_and_test ();
+       }
+
+       bool compare_and_exchange (gint old_value, gint new_value)
+       {
+               return g_atomic_int_compare_and_exchange
+                       (
+                        &m_value,
+                        old_value,
+                        new_value
+                       );
+       }
+
+       /**
+        * convenience method, \see compare_and_exchange
+        */
+       bool cas (gint old_value, gint new_value)
+       {
+               return compare_and_exchange (old_value, new_value);
+       }
+
+private:
+
+       // Has to be mutable when using the apple version of gcc.
+       mutable volatile gint             m_value;
+
+};
+
+} // namespace PBD
+
+#endif // PBD_ATOMIC_COUNTER_H
index 186a3c55a659e346c7e723d5a2ba4f457adf5623..d947a06b34046a93e8530d7f92ce4ffdb4d24efc 100644 (file)
@@ -71,13 +71,13 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
        void quit ();
 
   protected:
-       CrossThreadChannel request_channel;
        bool _ok; 
 
        Glib::RefPtr<Glib::MainLoop> _main_loop;
-        Glib::Threads::Thread*       run_loop_thread;
+       Glib::RefPtr<Glib::MainContext> m_context;
+       Glib::Threads::Thread*       run_loop_thread;
        Glib::Threads::Mutex        _run_lock;
-        Glib::Threads::Cond         _running;
+       Glib::Threads::Cond         _running;
 
        /* this signals _running from within the event loop,
           from an idle callback 
@@ -92,9 +92,17 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
 
        virtual void thread_init () {};
 
+#ifdef PLATFORM_WINDOWS
+       static gboolean _request_handler (gpointer);
+       bool request_handler ();
+#else
        /** Called when there input ready on the request_channel
         */
        bool request_handler (Glib::IOCondition);
+#endif
+
+       void signal_new_request ();
+       void attach_request_source ();
 
        /** Derived UI objects must implement this method,
         * which will be called whenever there are requests
@@ -105,6 +113,10 @@ class BaseUI : public sigc::trackable, public PBD::EventLoop
   private:
        std::string _name; 
        BaseUI* base_ui_instance;
+
+#ifndef PLATFORM_WINDOWS
+       CrossThreadChannel request_channel;
+#endif
        
        static uint64_t rt_bit;
 
index 989cd42dd1f59d82986a21f54856dc89a64b5de6..704c9d0dadd2c680f26a30faa7f13110b0b5e0c9 100644 (file)
@@ -43,6 +43,7 @@ namespace PBD {
                extern uint64_t Pool;
                extern uint64_t EventLoop;
                extern uint64_t AbstractUI;
+               extern uint64_t FileUtils;
        }
 }
 
diff --git a/libs/pbd/pbd/fallback_folders.h b/libs/pbd/pbd/fallback_folders.h
new file mode 100644 (file)
index 0000000..60935b4
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#ifndef __platform_fallback_folders_h__
+#define __platform_fallback_folders_h__
+
+#include <pbd/msvc_pbd.h>
+#include <glib/gtypes.h>
+
+#ifdef PLATFORM_WINDOWS // Would not be relevant for Cygwin!!
+       PBD_API gchar* PBD_APICALLTYPE get_win_special_folder (int csidl);
+#endif
+
+namespace PBD {
+
+       typedef enum fallback_folder_t {
+               FOLDER_LOCALE,
+               FOLDER_GTK,
+               FOLDER_CONFIG,
+               FOLDER_ARDOUR,
+               FOLDER_MODULE,
+               FOLDER_DATA,
+               FOLDER_ICONS,
+               FOLDER_PIXMAPS,
+               FOLDER_CONTROL_SURFACES,
+               FOLDER_VAMP,
+               FOLDER_LADSPA,
+               FOLDER_VST,
+               FOLDER_BUNDLED_LV2,
+               FALLBACK_FOLDER_MAX
+       };
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+       PBD_API G_CONST_RETURN gchar* PBD_APICALLTYPE get_platform_fallback_folder (PBD::fallback_folder_t index);
+       PBD_API G_CONST_RETURN gchar* G_CONST_RETURN * PBD_APICALLTYPE alloc_platform_fallback_folders ();
+       PBD_API void PBD_APICALLTYPE free_platform_fallback_folders ();
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+}  // namespace PBD
+
+#endif /* __platform_fallback_folders_h__ */
diff --git a/libs/pbd/pbd/ffs.h b/libs/pbd/pbd/ffs.h
new file mode 100644 (file)
index 0000000..3a2eadf
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+    Copyright (C) 2013 Tim Mayberry 
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __libpbd_ffs_h__
+#define __libpbd_ffs_h__
+
+namespace PBD {
+       int ffs(int x);
+} 
+
+#endif  /* __libpbd_ffs_h__ */
index 72696f6abdf40484d044e4235f15c4f43d960f58..4b4bdf073525e8e8dc02793093a1d1823fe8e122 100644 (file)
@@ -68,15 +68,15 @@ find_matching_files_in_directories (const std::vector<std::string>& directory_pa
                                     std::vector<std::string>& result);
 
 /**
- * Takes a SearchPath and puts a list of all the files in the search path
+ * Takes a Searchpath and puts a list of all the files in the search path
  * that match pattern into the result vector.
  *
- * @param search_path A SearchPath
+ * @param search_path A Searchpath
  * @param pattern A Glib::PatternSpec used to match the files
  * @param result A vector in which to place the resulting matches.
  */
 void
-find_matching_files_in_search_path (const SearchPath& search_path,
+find_matching_files_in_search_path (const Searchpath& search_path,
                                     const Glib::PatternSpec& pattern,
                                     std::vector<std::string>& result);
 
@@ -87,7 +87,7 @@ find_matching_files_in_search_path (const SearchPath& search_path,
  * @return true If file is found within the search path.
  */
 bool
-find_file_in_search_path (const SearchPath& search_path,
+find_file_in_search_path (const Searchpath& search_path,
                           const std::string& filename,
                           std::string& result);
 
index 105a976637d83782edc1470624df3542bf58fb06..6daef5d4aa7fc8494103c4c28654d0c92113272c 100644 (file)
@@ -26,6 +26,8 @@
 #ifndef __libpbd__floating_h__
 #define __libpbd__floating_h__
 
+#include <stdint.h>
+
 #include <cmath>
 
 namespace PBD {
diff --git a/libs/pbd/pbd/glib_semaphore.h b/libs/pbd/pbd/glib_semaphore.h
new file mode 100644 (file)
index 0000000..c78226f
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+    Copyright (C) 2010 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef PBD_GLIB_SEMAPHORE_H
+#define PBD_GLIB_SEMAPHORE_H
+
+#include <glibmm/threads.h>
+
+#include "atomic_counter.h"
+
+namespace PBD {
+
+class GlibSemaphore
+{
+
+       // prevent copying and assignment
+       GlibSemaphore(const GlibSemaphore& sema);
+       GlibSemaphore& operator= (const GlibSemaphore& sema);
+
+public:
+
+       GlibSemaphore (gint initial_val = 1);
+
+       void wait ();
+
+       bool try_wait ();
+
+       void post ();
+
+private:
+
+       atomic_counter           m_counter;
+       Glib::Threads::Cond      m_cond;
+       Glib::Threads::Mutex     m_mutex;
+
+};
+
+} // namespace PBD
+
+#endif // PBD_SEMAPHORE_H
diff --git a/libs/pbd/pbd/localeguard.h b/libs/pbd/pbd/localeguard.h
new file mode 100644 (file)
index 0000000..20899b5
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+    Copyright (C) 1999-2010 Paul Davis 
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __pbd_localeguard_h__
+#define __pbd_localeguard_h__
+
+#include <string>
+
+namespace PBD {
+
+struct LocaleGuard {
+    LocaleGuard (const char*);
+    ~LocaleGuard ();
+    const char* old;
+
+       /* JE - temporary !!!! */static std::string current;
+};
+
+}; // namespace
+
+#endif /* __pbd_localeguard_h__ */
diff --git a/libs/pbd/pbd/localtime_r.h b/libs/pbd/pbd/localtime_r.h
new file mode 100644 (file)
index 0000000..ad5b89d
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef PBD_LOCALTIME_R
+#define PBD_LOCALTIME_R
+#include <time.h>
+
+#ifdef COMPILER_MSVC
+       #define localtime_r( _clock, _result ) \
+               ( *(_result) = *localtime( (_clock) ), \
+               (_result) )
+#else
+       extern struct tm *localtime_r(const time_t *const timep, struct tm *p_tm);
+#endif
+
+#endif
diff --git a/libs/pbd/pbd/msvc_pbd.h b/libs/pbd/pbd/msvc_pbd.h
new file mode 100644 (file)
index 0000000..628ed56
--- /dev/null
@@ -0,0 +1,250 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#ifndef _msvc_pbd_h_
+#define _msvc_pbd_h_
+
+#ifdef  PBD_IS_IN_WIN_STATIC_LIB  // #define if your project uses libpbd (under Windows) as a static library
+#define PBD_IS_IN_WINDLL 0
+#endif
+
+#ifndef COMPILER_MSVC
+#include <sys/time.h>
+#else
+#include <ardourext/misc.h>
+#include <ardourext/sys/time.h>
+#endif
+
+#if !defined(PBD_IS_IN_WINDLL)
+       #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+       // If you need '__declspec' compatibility, add extra compilers to the above as necessary
+               #define PBD_IS_IN_WINDLL 1
+       #else
+               #define PBD_IS_IN_WINDLL 0
+       #endif
+#endif
+
+#if PBD_IS_IN_WINDLL && !defined(PBD_API)
+       #if defined(BUILDING_PBD)
+               #define PBD_API __declspec(dllexport)
+               #define PBD_APICALLTYPE __stdcall
+       #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+               #define PBD_API __declspec(dllimport)
+               #define PBD_APICALLTYPE __stdcall
+       #else
+               #error "Attempting to define __declspec with an incompatible compiler !"
+       #endif
+#elif !defined(PBD_API)
+       // Other compilers / platforms could be accommodated here
+       #define PBD_API
+       #define PBD_APICALLTYPE
+       #define GETOPT_API
+       #define GETOPT_APICALLTYPE
+#endif
+
+#ifndef GETOPT_API
+       #if defined(BUILDING_GETOPT)
+               #define GETOPT_API __declspec(dllexport)
+               #define GETOPT_APICALLTYPE __cdecl
+       #elif defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__) || defined(_MINGW32__)
+               #define GETOPT_API __declspec(dllimport)
+               #define GETOPT_APICALLTYPE __cdecl
+       #else
+               #error "Attempting to define __declspec with an incompatible compiler !"
+       #endif
+#endif  // GETOPT_API
+
+#ifndef _MAX_PATH
+#define _MAX_PATH  260
+#endif
+#ifndef  PATH_MAX
+#define  PATH_MAX _MAX_PATH
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// This function is (hopefully) temporary and is placed here
+// because 'g_usleep()' doesn't seem to work very well for glib-win32
+// JE -  let's see if we can do without this now! void    pbd_g_usleep (unsigned long microseconds);
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+#ifndef POLLIN
+#define POLLIN                         1
+#define POLLPRI                                2
+#define POLLOUT                                4
+#define POLLERR                                8
+#define POLLHUP                                16
+#define POLLNVAL                       32
+#define NPOLLFILE                      64
+
+#define POLLRDNORM                     POLLIN
+#define POLLRDBAND                     POLLIN
+#define POLLWRNORM                     POLLOUT
+#define POLLWRBAND                     POLLOUT
+#endif
+
+#ifdef PLATFORM_WINDOWS
+
+#ifndef PBDEXTN_API
+       #if defined(BUILDING_PBDEXTN)
+               #define PBDEXTN_API __declspec(dllexport)
+               #define PBDEXTN_APICALLTYPE __cdecl
+       #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+               #define PBDEXTN_API __declspec(dllimport)
+               #define PBDEXTN_APICALLTYPE __cdecl
+       #else
+               #error "Attempting to define __declspec with an incompatible compiler !"
+       #endif
+#endif  // PBDEXTN_API
+
+#ifndef CYGIMPORT_API
+               #define CYGIMPORT_API __declspec(dllimport)
+               #define CYGIMPORT_APICALLTYPE __cdecl
+#endif  // CYGIMPORT_API
+
+#ifndef __THROW
+#define __THROW throw()
+#endif
+
+#ifndef RTLD_DEFAULT
+#define RTLD_DEFAULT       ((void *) 0)
+#define RTLD_NEXT          ((void *) -1L)
+#define RTLD_LAZY          0x00001
+#define RTLD_NOW           0x00002
+#define RTLD_BINDING_MASK  0x00003
+#define RTLD_NOLOAD        0x00004
+#define RTLD_GLOBAL        0x00004
+#define RTLD_DEEPBIND      0x00008
+#endif
+
+#ifndef OPEN_MAX
+#define OPEN_MAX                       32
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+PBDEXTN_API int                PBDEXTN_APICALLTYPE cyginit (unsigned int result);
+PBD_API     int        PBD_APICALLTYPE     dlclose (void *handle) __THROW;
+PBD_API     void*      PBD_APICALLTYPE     dlopen  (const char *file_name, int mode) __THROW;
+PBD_API     void*      PBD_APICALLTYPE     dlsym   (void *handle, const char *symbol_name) __THROW;
+PBD_API     char*      PBD_APICALLTYPE     dlerror () __THROW;
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+#ifndef __CYGWIN__
+#include <rpc.h>
+#include <io.h>
+#include <sys/types.h>
+
+typedef int (FAR PBDEXTN_APICALLTYPE *CYGINIT_API)(unsigned int);
+
+#ifndef FILENAME_MAX
+#define FILENAME_MAX (260)
+#endif
+
+#ifndef _SSIZE_T_
+#define _SSIZE_T_
+typedef long _ssize_t;
+
+#ifndef        _NO_OLDNAMES
+typedef _ssize_t ssize_t;
+#endif
+#endif /* ! _SSIZE_T_ */
+
+struct dirent
+{
+       long                    d_ino;                            // Always zero
+       unsigned short  d_reclen;                         // Always zero
+       unsigned short  d_namlen;                         // Length of name in d_name
+       char                    d_name[FILENAME_MAX]; // File name
+};
+
+// This is an internal data structure. Do not use it
+// except as an argument to one of the functions below.
+typedef struct
+{
+       // Disk transfer area for this dir
+       struct _finddata_t      dd_dta;
+
+       // 'dirent' struct to return from dir (NOTE: this
+       // is not thread safe).
+       struct dirent           dd_dir;
+
+       // '_findnext()' handle
+       long                            dd_handle;
+
+       // Current status of search:
+       //  0 = not started yet (next entry to read is first entry)
+       // -1 = off the end
+       //  Otherwise - positive (0 based) index of next entry
+       int                                     dd_stat;
+
+       // Full path for dir with search pattern (struct will be extended)
+       char                            dd_name[1];
+} DIR;
+
+struct pollfd
+{
+       int fd;
+       short events;
+       short revents;
+};
+
+typedef unsigned int nfds_t;
+
+PBD_API int                            PBD_APICALLTYPE gettimeofday(struct timeval *__restrict tv, __timezone_ptr_t tz);
+PBD_API ssize_t                        PBD_APICALLTYPE pread(int handle, void *buf, size_t nbytes, off_t offset);
+PBD_API ssize_t                        PBD_APICALLTYPE pwrite(int handle, const void *buf, size_t nbytes, off_t offset);
+PBD_API int                            PBD_APICALLTYPE poll(struct pollfd *fds, nfds_t nfds, int timeout);
+PBD_API double                 PBD_APICALLTYPE round(double x);
+
+namespace PBD {
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+PBD_API bool                   PBD_APICALLTYPE TestForMinimumSpecOS(char *revision="currently ignored");
+PBD_API char*                  PBD_APICALLTYPE realpath    (const char *original_path, char resolved_path[_MAX_PATH+1]);
+PBD_API int                            PBD_APICALLTYPE mkstemp     (char *template_name);
+PBD_API int                            PBD_APICALLTYPE ntfs_link   (const char *existing_filepath, const char *link_filepath);
+PBD_API int                            PBD_APICALLTYPE ntfs_unlink (const char *link_filepath);
+
+// These are used to replicate 'dirent.h' functionality
+PBD_API DIR*                   PBD_APICALLTYPE opendir  (const char *szPath);
+PBD_API struct dirent* PBD_APICALLTYPE readdir  (DIR *pDir);
+PBD_API int                            PBD_APICALLTYPE closedir (DIR *pDir);
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+}  // namespace PBD
+
+#endif  // !__CYGWIN__
+#endif  // PLATFORM_WINDOWS
+#endif  // _msvc_pbd_h_
index a7b9f7557aa8c1065103a1b894533d7e73afa87e..2b2639e07eedf9976aee609e3a51f675ea419e7e 100644 (file)
@@ -22,6 +22,7 @@
 #include <string>
 
 namespace PBD {
+       std::string canonical_path (const std::string& path);
        std::string path_expand (std::string path);
        std::string search_path_expand (std::string path);
 }
index 1b7ef58655101d10676283c5ea37383b2fa2c649..796648de0fe524826ea599bf9df2aa75fa0a12cb 100644 (file)
 
 #include <vector>
 #include <string>
+#ifdef COMPILER_MSVC
+#include <ardourext/misc.h>
+#else
 #include <regex.h>
+#endif
 
 class PathScanner
 
index 0c7b5f3ac142b458b68456dacdde73cb15205956..f57833941004c7560486437be75110f96701c6f9 100644 (file)
 #ifndef __pbd_pthread_utils__
 #define __pbd_pthread_utils__
 
+#ifdef COMPILER_MSVC
+#include <ardourext/pthread.h>
+#else
 #include <pthread.h>
+#endif
 #include <signal.h>
 #include <string>
 #include <stdint.h>
diff --git a/libs/pbd/pbd/resource.h b/libs/pbd/pbd/resource.h
new file mode 100644 (file)
index 0000000..ec826e4
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+    Copyright (C) 2011 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <stdint.h>
+
+namespace PBD {
+
+typedef uint64_t rlimit_t;
+
+enum ResourceType {
+       OpenFiles
+};
+
+struct ResourceLimit
+{
+       rlimit_t current_limit;
+       rlimit_t max_limit;
+};
+
+/**
+ * @return true on success, false on error
+ */
+bool
+get_resource_limit (ResourceType resource, ResourceLimit& limit);
+
+/**
+ * @return true on success, false on error
+ */
+bool
+set_resource_limit (ResourceType resource, const ResourceLimit& limit);
+
+
+} // namespace PBD
index 652457b4937ada5ff5b39ce67e7be054f10f15c1..bb5485a8f372dce62e6dc962c600026a72c22ea7 100644 (file)
@@ -198,7 +198,7 @@ RingBuffer<T>::write (T const *src, guint cnt)
 }
 
 template<class T> void
-RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
+RingBuffer<T>::get_read_vector (typename RingBuffer<T>::rw_vector *vec)
 
 {
        guint free_cnt;
@@ -239,7 +239,7 @@ RingBuffer<T>::get_read_vector (RingBuffer<T>::rw_vector *vec)
 }
 
 template<class T> void
-RingBuffer<T>::get_write_vector (RingBuffer<T>::rw_vector *vec)
+RingBuffer<T>::get_write_vector (typename RingBuffer<T>::rw_vector *vec)
 
 {
        guint free_cnt;
index e43f9675922cca5c3fcf3a514a8ee45b9c6f0671..b3890ba81b6b7774cac17411dff811b8146cc6cc 100644 (file)
@@ -197,7 +197,7 @@ RingBufferNPT<T>::write (const T *src, size_t cnt)
 }
 
 template<class T> void
-RingBufferNPT<T>::get_read_vector (RingBufferNPT<T>::rw_vector *vec)
+RingBufferNPT<T>::get_read_vector (typename RingBufferNPT<T>::rw_vector *vec)
 {
        size_t free_cnt;
        size_t cnt2;
@@ -237,7 +237,7 @@ RingBufferNPT<T>::get_read_vector (RingBufferNPT<T>::rw_vector *vec)
 }
 
 template<class T> void
-RingBufferNPT<T>::get_write_vector (RingBufferNPT<T>::rw_vector *vec)
+RingBufferNPT<T>::get_write_vector (typename RingBufferNPT<T>::rw_vector *vec)
 {
        size_t free_cnt;
        size_t cnt2;
index 5358d6e14c6a409313eb35990dc5feeaf7991b2a..5e1bce9aa3545b5ee0fb6733ec7138687b4af7d3 100644 (file)
 namespace PBD {
 
 /**
- * @class SearchPath
+ * @class Searchpath
  *
- * The SearchPath class is a helper class for getting a
+ * The Searchpath class is a helper class for getting a
  * vector of paths contained in a search path string where a 
  * "search path string" contains absolute directory paths 
  * separated by a colon(:) or a semi-colon(;) on windows.
  *
- * The SearchPath class does not test whether the paths exist
+ * The Searchpath class does not test whether the paths exist
  * or are directories. It is basically just a container.
  */
-class SearchPath : public std::vector<std::string>
+class Searchpath : public std::vector<std::string>
 {
 public:
        /**
-        * Create an empty SearchPath.
+        * Create an empty Searchpath.
         */
-       SearchPath ();
+       Searchpath ();
 
        /**
-        * Initialize SearchPath from a string where the string contains
+        * Initialize Searchpath from a string where the string contains
         * one or more absolute paths to directories which are delimited 
         * by a path separation character. The path delimeter is a 
         * colon(:) on unix and a semi-colon(;) on windows.
@@ -55,15 +55,15 @@ public:
         * 
         * @param search_path A path string.
         */
-       SearchPath (const std::string& search_path);
+       Searchpath (const std::string& search_path);
 
        /**
-        * Initialize SearchPath from a vector of paths that may or may
+        * Initialize Searchpath from a vector of paths that may or may
         * not exist.
         *
         * @param paths A vector of paths.
         */
-       SearchPath (const std::vector<std::string>& paths);
+       Searchpath (const std::vector<std::string>& paths);
 
        /**
         * @return a search path string.
@@ -76,29 +76,29 @@ public:
        /**
         * Add all the directories in path to this.
         */
-       SearchPath& operator+= (const SearchPath& spath);
+       Searchpath& operator+= (const Searchpath& spath);
 
        /**
         * Add another directory path to the search path.
         */
-       SearchPath& operator+= (const std::string& directory_path);
+       Searchpath& operator+= (const std::string& directory_path);
        
        /**
-        * Concatenate another SearchPath onto this.
+        * Concatenate another Searchpath onto this.
         */
-       SearchPath& operator+ (const SearchPath& other);
+       Searchpath& operator+ (const Searchpath& other);
        
        /**
         * Add another path to the search path.
         */
-       SearchPath& operator+ (const std::string& directory_path);
+       Searchpath& operator+ (const std::string& directory_path);
 
        /**
         * Add a sub-directory to each path in the search path.
         * @param subdir The directory name, it should not contain 
         * any path separating tokens.
         */
-       SearchPath& add_subdirectory_to_paths (const std::string& subdir);
+       Searchpath& add_subdirectory_to_paths (const std::string& subdir);
 
 protected:
 
index e54063a15a8ff31aefc5dc03909d954c080c6d27..caa5eb68c29e983415a0ab43656209db87b2a9b2 100644 (file)
 
 #ifdef __APPLE__
 #    include <mach/mach.h>
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
 #    include <windows.h>
+#ifndef INFINITE
+#define INFINITE 0xffffffffL
+#endif
 #else
 #    include <semaphore.h>
 #    include <errno.h>
@@ -69,7 +72,7 @@ public:
 private:
 #if defined(__APPLE__)
        semaphore_t _sem;  // sem_t is a worthless broken mess on OSX
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
        HANDLE _sem;  // types are overrated anyway
 #else
        sem_t _sem;
@@ -114,7 +117,7 @@ Semaphore::try_wait()
        return semaphore_timedwait(_sem, zero) == KERN_SUCCESS;
 }
 
-#elif defined(_WIN32)
+#elif defined(PLATFORM_WINDOWS)
 
 inline
 Semaphore::Semaphore(unsigned initial)
@@ -151,7 +154,7 @@ Semaphore::try_wait()
        return WaitForSingleObject(_sem, 0) == WAIT_OBJECT_0;
 }
 
-#else  /* !defined(__APPLE__) && !defined(_WIN32) */
+#else  /* !defined(__APPLE__) && !defined(PLATFORM_WINDOWS) */
 
 Semaphore::Semaphore(unsigned initial)
 {
index 6f5f0e93316685eaed15699b025626c3dc0c0780..af5c201b8557a1617c2653ab23fe8edb554e74dd 100644 (file)
 #ifndef __pbd_semutils_h__
 #define __pbd_semutils_h__
 
+#ifdef PLATFORM_WINDOWS
+#include <windows.h>
+#else
 #include <semaphore.h>
+#endif
 
 namespace PBD {
 
 class ProcessSemaphore {
   private:
-#ifdef __APPLE__
+#ifdef PLATFORM_WINDOWS
+       HANDLE _sem;
+
+#elif __APPLE__
        sem_t* _sem;
        sem_t* ptr_to_sem() const { return _sem; }
 #else
@@ -37,8 +44,15 @@ class ProcessSemaphore {
        ProcessSemaphore (const char* name, int val);
        ~ProcessSemaphore ();
 
+#ifdef PLATFORM_WINDOWS
+
+       int signal ();
+       int wait ();
+
+#else
        int signal () { return sem_post (ptr_to_sem()); }
        int wait () { return sem_wait (ptr_to_sem()); }
+#endif
 };
 
 }
index b9d59724ddc56175fb6d9dab62ec1ea1ae352cb5..63263819ca384ba73b6881813c188a2efc80e000 100644 (file)
@@ -94,14 +94,14 @@ class SequenceProperty : public PropertyBase
                /* record the change described in our change member */
 
                if (!_changes.added.empty()) {
-                       for (typename ChangeContainer::iterator i = _changes.added.begin(); i != _changes.added.end(); ++i) {
+                       for (typename ChangeContainer::const_iterator i = _changes.added.begin(); i != _changes.added.end(); ++i) {
                                 XMLNode* add_node = new XMLNode ("Add");
                                 child->add_child_nocopy (*add_node);
                                get_content_as_xml (*i, *add_node);
                        }
                }
                if (!_changes.removed.empty()) {
-                       for (typename ChangeContainer::iterator i = _changes.removed.begin(); i != _changes.removed.end(); ++i) {
+                       for (typename ChangeContainer::const_iterator i = _changes.removed.begin(); i != _changes.removed.end(); ++i) {
                                 XMLNode* remove_node = new XMLNode ("Remove");
                                 child->add_child_nocopy (*remove_node);
                                get_content_as_xml (*i, *remove_node);
@@ -170,7 +170,7 @@ class SequenceProperty : public PropertyBase
                           with this diff().
                        */
                         
-                       for (typename ChangeContainer::iterator i = a->changes().added.begin(); i != a->changes().added.end(); ++i) {
+                       for (typename ChangeContainer::const_iterator i = a->changes().added.begin(); i != a->changes().added.end(); ++i) {
                                (*i)->DropReferences.connect_same_thread (*cmd, boost::bind (&Destructible::drop_references, cmd));
                        }
                }
diff --git a/libs/pbd/pbd/timersub.h b/libs/pbd/pbd/timersub.h
new file mode 100644 (file)
index 0000000..6cb1524
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright (C) 1991-1994,1996-2003,2005,2006,2009
+       Free Software Foundation, Inc.
+
+   The GNU C Library 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.
+
+   The GNU C Library 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 the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sys/time.h>
+
+#ifndef timersub
+# define timersub(a, b, result)                                                      \
+  do {                                                                       \
+    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                            \
+    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                         \
+    if ((result)->tv_usec < 0) {                                             \
+      --(result)->tv_sec;                                                    \
+      (result)->tv_usec += 1000000;                                          \
+    }                                                                        \
+  } while (0)
+#endif
+
index 11ff2bf321b806106001ce8a9f27d768b890c86a..e9582a1b53dd40cdc9308bbf7097fa7c2e0f69da 100644 (file)
 #include <map>
 #include <sigc++/slot.h>
 #include <sigc++/bind.h>
+#ifndef  COMPILER_MSVC
 #include <sys/time.h>
+#else
+#include <ardourext/misc.h>
+#endif
 
 #include "pbd/command.h"
 
index 16a67436b70c36bd57d040183a72d491eccc32d4..bf5abfc1acde5c9e3dea950deb8f8b2f0d267068 100644 (file)
 #define __pbd_uuid_h__
 
 #include <string>
-#include <uuid/uuid.h>
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/uuid_generators.hpp>
 
 namespace PBD {
 
-class UUID {
+class UUID : public boost::uuids::uuid {
 
   public:
-       UUID () { uuid_generate (id); }
-       UUID (UUID const & other) { uuid_copy (id, other.id); }
-       UUID (std::string const & str) { uuid_parse (str.c_str(), id); }
-       
-       UUID& operator= (std::string const & str);
-       std::string to_s () const;
-       
-       bool operator== (UUID const & other) const { return !uuid_compare (id, other.id); }
-       bool operator!= (UUID const & other) const { return uuid_compare (id, other.id); }
-       bool operator< (UUID const & other) const { return uuid_compare (id, other.id) < 0; }
-       
-       operator bool() const { return !uuid_is_null (id); }
-
-  private:
-       uuid_t id;
+    UUID ()
+            : boost::uuids::uuid (boost::uuids::random_generator()()) {}
+    UUID (std::string const & str)
+            : boost::uuids::uuid (boost::uuids::string_generator()(str)) {}
 
+    explicit UUID (boost::uuids::uuid const& u)
+            : boost::uuids::uuid(u)
+    {}
+
+    operator boost::uuids::uuid() {
+            return static_cast<boost::uuids::uuid&>(*this);
+    }
+
+    operator boost::uuids::uuid() const {
+            return static_cast<boost::uuids::uuid const&>(*this);
+    }
+
+    UUID& operator= (std::string const & str);
+    std::string to_s () const;
+
+    operator bool() const { return !is_nil(); }
 };
 
 } // namespace PBD
diff --git a/libs/pbd/pbd/uuid_boost.h b/libs/pbd/pbd/uuid_boost.h
deleted file mode 100644 (file)
index 275b726..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-    Copyright (C) 2008 Paul Davis
-    Author: Sakari Bergen
-
-    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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __pbd_uuid_h__
-#define __pbd_uuid_h__
-
-#include <string>
-#include <boost/uuid/uuid.hpp>
-#include <boost/uuid/uuid_generators.hpp>
-
-namespace PBD {
-
-class UUID : public boost::uuids::uuid {
-
-  public:
-    UUID () 
-            : boost::uuids::uuid (boost::uuids::random_generator()()) {}
-    UUID (std::string const & str)
-            : boost::uuids::uuid (boost::uuids::string_generator()(str)) {}
-    
-    explicit UUID (boost::uuids::uuid const& u)
-            : boost::uuids::uuid(u)
-    {}
-
-    operator boost::uuids::uuid() {
-            return static_cast<boost::uuids::uuid&>(*this);
-    }
-    
-    operator boost::uuids::uuid() const {
-            return static_cast<boost::uuids::uuid const&>(*this);
-    }
-
-    UUID& operator= (std::string const & str);
-    std::string to_s () const;
-    
-    operator bool() const { return !is_nil(); }
-};
-
-} // namespace PBD
-
-#endif // __pbd_uuid_h__
index 7b24625727dc1d05dff0c2554a8c6398925f544a..cdcd9abdd7a9e40d3f0d97d7fba76b44e62d8442 100644 (file)
@@ -24,6 +24,7 @@
 #include <cassert>
 
 #include "pbd/pool.h"
+#include "pbd/pthread_utils.h"
 #include "pbd/error.h"
 #include "pbd/debug.h"
 #include "pbd/compose.h"
@@ -182,7 +183,7 @@ PerThreadPool::per_thread_pool ()
 {
        CrossThreadPool* p = _key.get();
        if (!p) {
-               fatal << "programming error: no per-thread pool \"" << _name << "\" for thread " << pthread_self() << endmsg;
+               fatal << "programming error: no per-thread pool \"" << _name << "\" for thread " << pthread_name() << endmsg;
                /*NOTREACHED*/
        }
        return p;
@@ -226,9 +227,9 @@ CrossThreadPool::alloc ()
 {
        void* ptr;
 
-       DEBUG_TRACE (DEBUG::Pool, string_compose ("%1 %2 has %3 pending free entries waiting\n", pthread_self(), name(), pending.read_space()));
+       DEBUG_TRACE (DEBUG::Pool, string_compose ("%1 %2 has %3 pending free entries waiting\n", pthread_name(), name(), pending.read_space()));
        while (pending.read (&ptr, 1) == 1) {
-               DEBUG_TRACE (DEBUG::Pool, string_compose ("%1 %2 pushes back a pending free list entry before allocating\n", pthread_self(), name()));
+               DEBUG_TRACE (DEBUG::Pool, string_compose ("%1 %2 pushes back a pending free list entry before allocating\n", pthread_name(), name()));
                free_list.write (&ptr, 1);
        }
        return Pool::alloc ();
index 3d3cb96fb5cb313f31df83bda7cc3e9229e26057..b8ca8fc09346274d7dd441ae68d1e0671e7c8534 100644 (file)
 #include <fst.h>
 #endif
 
+#ifdef COMPILER_MSVC
+DECLARE_DEFAULT_COMPARISONS(pthread_t)  // Needed for 'DECLARE_DEFAULT_COMPARISONS'. Objects in an STL container can be
+                                        // searched and sorted. Thus, when instantiating the container, MSVC complains
+                                        // if the type of object being contained has no appropriate comparison operators
+                                        // defined (specifically, if operators '<' and '==' are undefined). This seems
+                                        // to be the case with ptw32 'pthread_t' which is a simple struct.
+#endif
+
 using namespace std;
 
-typedef std::set<pthread_t> ThreadMap;
+typedef std::list<pthread_t> ThreadMap;
 static ThreadMap all_threads;
 static pthread_mutex_t thread_map_lock = PTHREAD_MUTEX_INITIALIZER;
 static Glib::Threads::Private<char> thread_name (free);
@@ -116,7 +124,7 @@ pthread_create_and_store (string name, pthread_t  *thread, void * (*start_routin
 
        if ((ret = thread_creator (thread, &default_attr, fake_thread_start, ts)) == 0) {
                pthread_mutex_lock (&thread_map_lock);
-               all_threads.insert (*thread);
+               all_threads.push_back (*thread);
                pthread_mutex_unlock (&thread_map_lock);
        }
 
@@ -149,7 +157,7 @@ pthread_kill_all (int signum)
 {      
        pthread_mutex_lock (&thread_map_lock);
        for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ++i) {
-               if ((*i) != pthread_self()) {
+               if (!pthread_equal ((*i), pthread_self())) {
                        pthread_kill ((*i), signum);
                }
        }
@@ -161,6 +169,7 @@ void
 pthread_cancel_all () 
 {      
        pthread_mutex_lock (&thread_map_lock);
+
        for (ThreadMap::iterator i = all_threads.begin(); i != all_threads.end(); ) {
 
                ThreadMap::iterator nxt = i;
diff --git a/libs/pbd/resource.cc b/libs/pbd/resource.cc
new file mode 100644 (file)
index 0000000..9d6f8b1
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+    Copyright (C) 2011 Tim Mayberry
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifdef PLATFORM_WINDOWS
+#include <stdio.h>
+#else
+#include <sys/time.h>
+#include <sys/resource.h>
+#endif
+
+#include "pbd/resource.h"
+
+namespace PBD {
+
+bool
+get_resource_limit (ResourceType resource, ResourceLimit& limit)
+{
+       if (resource == OpenFiles)
+       {
+#ifdef PLATFORM_WINDOWS
+               limit.current_limit = _getmaxstdio();
+               limit.max_limit = 2048;
+               return true;
+#else
+               struct rlimit rl;
+               if (getrlimit (RLIMIT_NOFILE, &rl) == 0) {
+                       limit.current_limit = rl.rlim_cur;
+                       limit.max_limit = rl.rlim_max;
+                       return true;
+               }
+#endif
+       }
+
+       return false;
+}
+
+bool
+set_resource_limit (ResourceType resource, const ResourceLimit& limit)
+{
+       if (resource == OpenFiles)
+       {
+#ifdef PLATFORM_WINDOWS
+               // no soft and hard limits on windows
+               rlimit_t new_max = _setmaxstdio(limit.current_limit);
+
+               if (new_max == limit.current_limit) return true;
+#else
+               struct rlimit rl;
+               rl.rlim_cur = limit.current_limit;
+               rl.rlim_max = limit.max_limit;
+               if (setrlimit (RLIMIT_NOFILE, &rl) == 0) {
+                       return true;
+               }
+
+#endif
+       }
+
+       return false;
+}
+
+} // namespace PBD
index 3f7be5aa56d7c2d1aa0db51b088724f81675666a..ea08785f68ea24a5d36f4784fc6a65cbab568e64 100644 (file)
@@ -27,7 +27,7 @@ using namespace std;
 
 namespace {
 
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
 const char * const path_delimiter = ";";
 #else
 const char * const path_delimiter = ":";
@@ -37,12 +37,12 @@ const char * const path_delimiter = ":";
 
 namespace PBD {
 
-SearchPath::SearchPath ()
+Searchpath::Searchpath ()
 {
 
 }
 
-SearchPath::SearchPath (const string& path)
+Searchpath::Searchpath (const string& path)
 {
        vector<std::string> tmp;
 
@@ -51,13 +51,13 @@ SearchPath::SearchPath (const string& path)
        }
 }
 
-SearchPath::SearchPath (const vector<std::string>& paths)
+Searchpath::Searchpath (const vector<std::string>& paths)
 {
        add_directories (paths);
 }
 
 void
-SearchPath::add_directory (const std::string& directory_path)
+Searchpath::add_directory (const std::string& directory_path)
 {
        if (!directory_path.empty()) {
                push_back(directory_path);
@@ -65,7 +65,7 @@ SearchPath::add_directory (const std::string& directory_path)
 }
 
 void
-SearchPath::add_directories (const vector<std::string>& paths)
+Searchpath::add_directories (const vector<std::string>& paths)
 {
        for(vector<std::string>::const_iterator i = paths.begin(); i != paths.end(); ++i) {
                add_directory (*i);
@@ -73,7 +73,7 @@ SearchPath::add_directories (const vector<std::string>& paths)
 }
 
 const string
-SearchPath::to_string () const
+Searchpath::to_string () const
 {
        string path;
 
@@ -87,37 +87,37 @@ SearchPath::to_string () const
        return path;
 }
 
-SearchPath& 
-SearchPath::operator+= (const SearchPath& spath)
+Searchpath&
+Searchpath::operator+= (const Searchpath& spath)
 {
        insert(end(), spath.begin(), spath.end());
        return *this;
 }
 
-SearchPath& 
-SearchPath::operator+= (const std::string& directory_path)
+Searchpath&
+Searchpath::operator+= (const std::string& directory_path)
 {
        add_directory (directory_path);
        return *this;
 }
 
-SearchPath& 
-SearchPath::operator+ (const std::string& directory_path)
+Searchpath&
+Searchpath::operator+ (const std::string& directory_path)
 {
        add_directory (directory_path);
        return *this;
 }
 
-SearchPath& 
-SearchPath::operator+ (const SearchPath& spath)
+Searchpath&
+Searchpath::operator+ (const Searchpath& spath)
 {
-       // concatenate paths into new SearchPath
+       // concatenate paths into new Searchpath
        insert(end(), spath.begin(), spath.end());
        return *this;
 }
 
-SearchPath&
-SearchPath::add_subdirectory_to_paths (const string& subdir)
+Searchpath&
+Searchpath::add_subdirectory_to_paths (const string& subdir)
 {
        for (vector<std::string>::iterator i = begin(); i != end(); ++i) {
                // should these new paths just be added to the end of 
index 9ac5f60d351561f405b9852926f541c1e9118d75..e5e5898218aad97b34cf259a326b55a668f8fecb 100644 (file)
@@ -23,7 +23,12 @@ using namespace PBD;
 
 ProcessSemaphore::ProcessSemaphore (const char* name, int val)
 {
-#ifdef __APPLE__
+#ifdef PLATFORM_WINDOWS
+       if ((_sem = CreateSemaphore(NULL, val, 32767, name)) == NULL) {
+               throw failed_constructor ();
+       }
+
+#elif __APPLE__
        if ((_sem = sem_open (name, O_CREAT, 0600, val)) == (sem_t*) SEM_FAILED) {
                throw failed_constructor ();
        }
@@ -43,7 +48,28 @@ ProcessSemaphore::ProcessSemaphore (const char* name, int val)
 
 ProcessSemaphore::~ProcessSemaphore ()
 {
-#ifdef __APPLE__
+#ifdef PLATFORM_WINDOWS
+       CloseHandle(_sem);
+#elif __APPLE__
        sem_close (ptr_to_sem());
 #endif
 }
+
+#ifdef PLATFORM_WINDOWS
+
+int
+ProcessSemaphore::signal ()
+{
+       // non-zero on success, opposite to posix
+       return !ReleaseSemaphore(_sem, 1, NULL);
+}
+
+int
+ProcessSemaphore::wait ()
+{
+       DWORD result = 0;
+       result = WaitForSingleObject(_sem, INFINITE);
+       return (result == WAIT_OBJECT_0);
+}
+
+#endif
index d1dcd0525657a38b875752d0428464d450889dd6..c028bc11bacae12e47c33b413c7268f14e0dbd36 100644 (file)
@@ -22,7 +22,6 @@
  */
 
 #include <sys/time.h>
-#include <sys/resource.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index 105af75861d4e87ed4b120a78f4df4c0f1174db5..c4077f60af43e184739525b8f4b9b880275d7782 100644 (file)
     $Id: stateful.cc 629 2006-06-21 23:01:03Z paul $
 */
 
+#ifdef COMPILER_MSVC
+#include <io.h>      // Microsoft's nearest equivalent to <unistd.h>
+#else
 #include <unistd.h>
+#endif
 
 #include <glibmm/fileutils.h>
 #include <glibmm/miscutils.h>
index ce2faadc822a564b7344efc0f017b793a0821249..458105d1779286fd3364b6d2de28a19cb42b292a 100644 (file)
@@ -10,6 +10,7 @@ CPPUNIT_TEST_SUITE_REGISTRATION (FilesystemTest);
 void
 FilesystemTest::testPathIsWithin ()
 {
+#ifndef PLATFORM_WINDOWS
        system ("rm -r foo");
        CPPUNIT_ASSERT (g_mkdir_with_parents ("foo/bar/baz", 0755) == 0);
 
@@ -31,5 +32,6 @@ FilesystemTest::testPathIsWithin ()
        CPPUNIT_ASSERT (PBD::path_is_within ("foo/bar", "foo/bar"));
 
        CPPUNIT_ASSERT (PBD::path_is_within ("foo/jim/baz", "frobozz") == false);
+#endif
 }
 
diff --git a/libs/pbd/test/mutex_test.cc b/libs/pbd/test/mutex_test.cc
new file mode 100644 (file)
index 0000000..52c36c4
--- /dev/null
@@ -0,0 +1,24 @@
+#include "mutex_test.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (MutexTest);
+
+using namespace std;
+
+MutexTest::MutexTest ()
+{
+}
+
+void
+MutexTest::testBasic ()
+{
+       Glib::Threads::Mutex::Lock lm (m_mutex);
+
+       CPPUNIT_ASSERT (lm.locked());
+
+       /* This will fail on POSIX systems but not on some older versions of glib
+        * on win32 as TryEnterCriticalSection is used and it will return true
+        * as CriticalSection is reentrant and fail the assertion.
+        */
+       CPPUNIT_ASSERT (!m_mutex.trylock());
+
+}
diff --git a/libs/pbd/test/mutex_test.h b/libs/pbd/test/mutex_test.h
new file mode 100644 (file)
index 0000000..95b6ea3
--- /dev/null
@@ -0,0 +1,17 @@
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include "glibmm/threads.h"
+
+class MutexTest : public CppUnit::TestFixture
+{
+       CPPUNIT_TEST_SUITE (MutexTest);
+       CPPUNIT_TEST (testBasic);
+       CPPUNIT_TEST_SUITE_END ();
+
+public:
+       MutexTest ();
+       void testBasic ();
+
+private:
+       Glib::Threads::Mutex m_mutex;
+};
index 16da3ed2a8f6c06ab7683363f3af7c0fd426284e..6e099d2f3e7b95f727a2e8b5e104e8939e4ff647 100644 (file)
  * in an installed location on windows or by setting an environment variable
  * on unix.
  */
-PBD::SearchPath
+PBD::Searchpath
 test_search_path ()
 {
-#ifdef WIN32
+#ifdef PLATFORM_WINDOWS
        std::string wsp(g_win32_get_package_installation_directory_of_module(NULL));
        return Glib::build_filename (wsp,  "pbd_testdata");
 #else
index 0dc62f61dc8c1838350907d144defe5f1552f699..825c01fecbbcb30affe1221ec813b708b5e22afe 100644 (file)
@@ -21,6 +21,6 @@
 
 #include "pbd/search_path.h"
 
-PBD::SearchPath test_search_path ();
+PBD::Searchpath test_search_path ();
 
 #endif
index 1512ebd024cc75ffd819dc4521967b891720d5a1..ea8f0aa115a709528ec69c3e371a41774237e274 100644 (file)
@@ -4,11 +4,15 @@
 #include <cppunit/TestResultCollector.h>
 #include <cppunit/TestRunner.h>
 #include <cppunit/BriefTestProgressListener.h>
+#include <glibmm/thread.h>
 #include "scalar_properties.h"
 
+
 int
 main ()
 {
+       Glib::thread_init();
+
        ScalarPropertiesTest::make_property_quarks ();
        
        CppUnit::TestResult testresult;
index aa5c75da19b653c3aba4cca9662108d5c20fbb98..e4266d34d7d6787d8afa37c177ed94662bdfca9c 100644 (file)
@@ -84,12 +84,20 @@ Transmitter::deliver ()
        /* do the right thing if this should not return */
        
        if (does_not_return()) {
+#ifndef PLATFORM_WINDOWS
+// TODO !!!! Commented out temporarily (for Windows)
                sigset_t mask;
                
                sigemptyset (&mask);
                sigsuspend (&mask);
                /*NOTREACHED*/
                exit (1);
+/* JE - From what I can tell, the above code suspends
+ * program execution until (any) signal occurs. Not
+ * sure at the moment what this achieves, unless it
+ * provides some time for the user to see the message.
+ */
+#endif
        } 
 }
 
index 0ffeca23cba4418973a737c04ae1b4791aa58b91..8b55ab338169b3b263d0bbefaf76e03e221ea47a 100644 (file)
 
 #include "pbd/uuid.h"
 
-using namespace PBD;
-
-UUID&
-UUID::operator= (std::string const & str)
+PBD::UUID&
+PBD::UUID::operator= (std::string const & str)
 {
-       uuid_parse (str.c_str(), id);
+        boost::uuids::string_generator gen;
+        *((boost::uuids::uuid*) this) = gen (str);
        return *this;
 }
 
 std::string
-UUID::to_s () const
+PBD::UUID::to_s () const
 {
-       char buf[37];
-       uuid_unparse (id, buf);
-       return std::string (buf);
+        return std::string ((const char*) data, size());
 }
diff --git a/libs/pbd/uuid_boost.cc b/libs/pbd/uuid_boost.cc
deleted file mode 100644 (file)
index 1a988b9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-    Copyright (C) 2008 Paul Davis
-    Author: Sakari Bergen
-
-    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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#include "pbd/uuid.h"
-
-using namespace PBD;
-
-UUID&
-UUID::operator= (std::string const & str)
-{
-        boost::uuids::string_generator gen;
-        *((boost::uuids::uuid*) this) = gen (str);
-       return *this;
-}
-
-std::string
-UUID::to_s () const
-{
-        return std::string ((const char*) data, size());
-}
index ffbe0e0d19a996e16057559df6ddedbc91ee473d..59f7a3368b89492bd9fd753944bf29264559cf44 100644 (file)
@@ -38,7 +38,6 @@ libpbd_sources = [
     'controllable.cc',
     'controllable_descriptor.cc',
     'clear_dir.cc',
-    'crossthread.cc',
     'cpus.cc',
     'debug.cc',
     'enumwriter.cc',
@@ -46,11 +45,14 @@ libpbd_sources = [
     'enums.cc',
     'epa.cc',
     'error.cc',
+    'ffs.cc',
     'file_manager.cc',
     'file_utils.cc',
     'fpu.cc',
+    'glib_semaphore.cc',
     'id.cc',
     'locale_guard.cc',
+    'localtime_r.cc',
     'malign.cc',
     'mountpoint.cc',
     'openuri.cc',
@@ -61,6 +63,7 @@ libpbd_sources = [
     'property_list.cc',
     'pthread_utils.cc',
     'receiver.cc',
+    'resource.cc',
     'search_path.cc',
     'semutils.cc',
     'shortpath.cc',
@@ -90,20 +93,18 @@ def configure(conf):
     autowaf.configure(conf)
     autowaf.check_pkg(conf, 'libxml-2.0', uselib_store='XML')
     autowaf.check_pkg(conf, 'sigc++-2.0', uselib_store='SIGCPP', atleast_version='2.0')
-    if sys.platform != 'darwin':
-        autowaf.check_pkg(conf, 'uuid', uselib_store='UUID')
 
     conf.check(function_name='getmntent', header_name='mntent.h', define_name='HAVE_GETMNTENT',mandatory=False)
     conf.check(header_name='execinfo.h', define_name='HAVE_EXECINFO',mandatory=False)
     conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False)
     conf.check_cc(function_name='posix_memalign', header_name='stdlib.h', cflags='-D_XOPEN_SOURCE=600', define_name='HAVE_POSIX_MEMALIGN', mandatory=False)
+    conf.check(function_name='localtime_r', header_name='time.h', define_name='HAVE_LOCALTIME_R',mandatory=False)
 
     conf.write_config_header('libpbd-config.h', remove=False)
 
     # Boost headers
     autowaf.check_header(conf, 'cxx', 'boost/shared_ptr.hpp')
     autowaf.check_header(conf, 'cxx', 'boost/weak_ptr.hpp')
-    # autowaf.check_header(conf, 'cxx', 'boost/uuid/uuid.hpp')
 
 def build(bld):
     
@@ -122,6 +123,9 @@ def build(bld):
     if bld.is_defined('DEBUG_RT_ALLOC'):
         obj.source += 'debug_rt_alloc.c'
 
+    if bld.env['build_target'] != 'mingw':
+        obj.source += [ 'crossthread.cc' ]
+
     obj.export_includes = ['.']
     obj.includes     = ['.']
     obj.name         = 'libpbd'
@@ -145,6 +149,7 @@ def build(bld):
         testobj.source       = '''
                 test/testrunner.cc
                 test/xpath.cc
+                test/mutex_test.cc
                 test/scalar_properties.cc
                 test/signals_test.cc
                 test/convert_test.cc
@@ -156,7 +161,7 @@ def build(bld):
         testobj.uselib       = 'CPPUNIT XML SNDFILE'
         testobj.use          = 'libpbd'
         testobj.name         = 'libpbd-tests'
-        if sys.platform != 'darwin':
+        if sys.platform != 'darwin' and bld.env['build_target'] != 'mingw':
             testobj.linkflags    = ['-lrt']
 
 
index a1fa77db660b53c3ec40f1871406b863b4747a76..69187995a17fa31ca092d0e2e17990c3597ce46b 100644 (file)
@@ -167,6 +167,7 @@ XMLTree::write() const
 void
 XMLTree::debug(FILE* out) const
 {
+#ifdef LIBXML_DEBUG_ENABLED
        xmlDocPtr doc;
        XMLNodeList children;
 
@@ -176,6 +177,7 @@ XMLTree::debug(FILE* out) const
        writenode(doc, _root, doc->children, 1);
        xmlDebugDumpDocument (out, doc);
        xmlFreeDoc(doc);
+#endif
 }
 
 const string&
index 504090528c4409eab5b8942665ea7f11b8c0d014..ef792460dd74af0da02512fde47663a47a65a57a 100644 (file)
     COPYING included with this distribution for more information.
 */
 
+#ifdef COMPILER_MSVC
+#pragma warning(disable:4305)
+#endif
+
 #include "Wavelet.h"
 
 #include <cassert>
diff --git a/libs/rubberband/rubberband/msvc_rubberband.h b/libs/rubberband/rubberband/msvc_rubberband.h
new file mode 100644 (file)
index 0000000..700b110
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+#ifndef __msvc_rubberband_h__
+#define __msvc_rubberband_h__
+
+#ifdef  RUBBERBAND_IS_IN_WIN_STATIC_LIB  // #define if your project uses librubberband (under Windows) as a static library
+#define RUBBERBAND_IS_IN_WINDLL 0
+#endif
+
+#if !defined(RUBBERBAND_IS_IN_WINDLL)
+       #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+       // If you need '__declspec' compatibility, add extra compilers to the above as necessary
+               #define RUBBERBAND_IS_IN_WINDLL 1
+       #else
+               #define RUBBERBAND_IS_IN_WINDLL 0
+       #endif
+#endif
+
+#if RUBBERBAND_IS_IN_WINDLL && !defined(RUBBERBAND_API)
+       #if defined(BUILDING_RUBBERBAND)
+               #define RUBBERBAND_API __declspec(dllexport)
+               #define RUBBERBAND_APICALLTYPE __stdcall
+       #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+               #define RUBBERBAND_API __declspec(dllimport)
+               #define RUBBERBAND_APICALLTYPE __stdcall
+       #else
+               #error "Attempting to define __declspec with an incompatible compiler !"
+       #endif
+#elif !defined(RUBBERBAND_API)
+       // Other compilers / platforms could be accommodated here
+       #define RUBBERBAND_API
+       #define RUBBERBAND_APICALLTYPE
+       #define GETOPT_API
+       #define GETOPT_APICALLTYPE
+#endif
+
+#ifndef GETOPT_API
+       #if defined(BUILDING_GETOPT)
+               #define GETOPT_API __declspec(dllexport)
+               #define GETOPT_APICALLTYPE __cdecl
+       #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
+               #define GETOPT_API __declspec(dllimport)
+               #define GETOPT_APICALLTYPE __cdecl
+       #else
+               #error "Attempting to define __declspec with an incompatible compiler !"
+       #endif
+#endif  // GETOPT_API
+
+#ifdef COMPILER_MSVC
+#include <rpc.h>
+
+#ifndef __THROW
+#define __THROW throw()
+#endif
+
+namespace RubberBand {
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+// These are used to replicate 'dirent.h' functionality
+// RUBBERBAND_API int RUBBERBAND_APICALLTYPE placeholder();
+
+#ifdef __cplusplus
+}              /* extern "C" */
+#endif /* __cplusplus */
+
+}  // namespace Rubberband
+
+#endif  //     COMPILER_MSVC
+#endif  // __msvc_rubberband_h__
index 616a553ecb2d10fc8e96354044985fca277f5591..d6897b817b7f7d8631bc709789cd676285f46598 100644 (file)
@@ -31,7 +31,7 @@
 #include <time.h>
 #else
 #include "sysutils.h"
-#ifndef _WIN32
+#ifndef PLATFORM_WINDOWS
 #include <sys/time.h>
 #endif
 #endif
index 07312169a6449c514a2c9a388cc917012d6384c6..a9262c8cdc04f6d2d443c205a2bfad016dfabdaf 100644 (file)
@@ -20,7 +20,7 @@
 
 #include <cstring>
 
-#ifndef _WIN32
+#ifndef PLATFORM_WINDOWS
 #include <sys/mman.h>
 #endif
 
@@ -30,7 +30,7 @@
 
 //#define DEBUG_RINGBUFFER 1
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
 #define MLOCK(a,b) 1
 #define MUNLOCK(a,b) 1
 #else
index d1b6ca9ffac3df899c61ceb8d03bc2aefdd2fb20..a922d7ec6ef7256fd0b2bc76f386de5869fc5aa0 100644 (file)
@@ -19,7 +19,7 @@
 #include <list>
 #include <iostream>
 
-#ifndef WIN32
+#ifndef PLATFORM_WINDOWS
 #include <sys/time.h>
 #endif
 
index 15417597623ec18cef883cd7655cc98e17707eef..18ee9cc9c3a45c8aa795122a73b7fd0ddb518762 100644 (file)
@@ -12,6 +12,9 @@
     COPYING included with this distribution for more information.
 */
 
+#ifdef COMPILER_MSVC
+#include "bsd-3rdparty/float_cast/float_cast.h"
+#endif
 #include "StretchCalculator.h"
 
 #include <algorithm>
index 200c8771a89d0a716cf170a3f2c206b799166657..d15a71d68ef0db3b4ee633fee83bc3990058decb 100644 (file)
@@ -12,6 +12,9 @@
     COPYING included with this distribution for more information.
 */
 
+#ifdef COMPILER_MSVC
+#include "bsd-3rdparty/float_cast/float_cast.h"
+#endif
 #include "StretcherImpl.h"
 #include "PercussiveAudioCurve.h"
 #include "HighFrequencyAudioCurve.h"
index 49f75b5b65f8b34ee629711d7959df64cba32dcd..d5a7b2f6ff1c6e25e463816408e8b9cdcd891b8c 100644 (file)
 
 #include <cstdlib>
 #include <iostream>
-#include <cstdlib>
 
-#include <cstdlib>
+#ifndef COMPILER_MSVC
 #include <sys/time.h>
 #include <time.h>
+#endif
 
 using std::cerr;
 using std::endl;
@@ -29,7 +29,7 @@ using std::string;
 namespace RubberBand
 {
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
 
 Thread::Thread() :
     m_id(0),
@@ -289,7 +289,7 @@ Condition::signal()
     SetEvent(m_condition);
 }
 
-#else /* !_WIN32 */
+#else /* !PLATFORM_WINDOWS */
 
 
 Thread::Thread() :
@@ -562,7 +562,7 @@ Condition::signal()
     pthread_cond_signal(&m_condition);
 }
 
-#endif /* !_WIN32 */
+#endif /* !PLATFORM_WINDOWS */
 
 MutexLocker::MutexLocker(Mutex *mutex) :
     m_mutex(mutex)
index 061469297e6f8a6c76eaa4f93771a4d487feb7a0..63a5a65b67fdd94e396e00995249519b3e20801e 100644 (file)
 #ifndef _RUBBERBAND_THREAD_H_
 #define _RUBBERBAND_THREAD_H_
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
 #include <windows.h>
-#else /* !_WIN32 */
+#else /* !PLATFORM_WINDOWS */
 #include <pthread.h>
-#endif /* !_WIN32 */
+#endif /* !PLATFORM_WINDOWS */
 
 #include <string>
 
@@ -33,7 +33,7 @@ namespace RubberBand
 class Thread
 {
 public:
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
     typedef HANDLE Id;
 #else
     typedef pthread_t Id;
@@ -53,7 +53,7 @@ protected:
     virtual void run() = 0;
 
 private:
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
     HANDLE m_id;
     bool m_extant;
     static DWORD WINAPI staticRun(LPVOID lpParam);
@@ -75,7 +75,7 @@ public:
     bool trylock();
 
 private:
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
     HANDLE m_mutex;
 #ifndef NO_THREAD_CHECKS
     DWORD m_lockedBy;
@@ -123,7 +123,7 @@ public:
     
 private:
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
     HANDLE m_mutex;
     HANDLE m_condition;
     bool m_locked;
index 1ba0e03bdcc7bab1267ae64b16310ca0ddaa05ca..0e3d8a4040de5bd167692d034d373630e8e17a3b 100644 (file)
@@ -35,6 +35,9 @@
 **             long int lrint  (double x) ;
 */
 
+#ifndef __FLOAT_CAST_H__  // Added by JE - 30-11-2009
+#define __FLOAT_CAST_H__
+
 #if (defined (WIN32) || defined (_WIN32))
 
        #include        <math.h>
@@ -69,5 +72,5 @@
 
 #endif
 
-
+#endif  // __FLOAT_CAST_H__
 
index 1c806961800c74afb84ad4538acd48aaeef701c3..cdc62e8afa232c3c44f177728377fbdb9d9dff02 100644 (file)
@@ -23,7 +23,7 @@
 #include <cstring>
 #include "sysutils.h"
 
-#ifdef __MSVC__
+#ifdef COMPILER_MSVC
 #include "bsd-3rdparty/getopt/getopt.h"
 #else
 #include <getopt.h>
@@ -36,7 +36,7 @@
 using namespace std;
 using namespace RubberBand;
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
 using RubberBand::gettimeofday;
 using RubberBand::usleep;
 #endif
@@ -324,7 +324,7 @@ int main(int argc, char **argv)
     cerr << "Using time ratio " << ratio;
     cerr << " and frequency ratio " << frequencyshift << endl;
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
     RubberBand::
 #endif
     timeval tv;
@@ -495,7 +495,11 @@ int main(int argc, char **argv)
             }
             delete[] obf;
         } else {
+#ifdef PLATFORM_WINDOWS
+            RubberBand::usleep(10000);
+#else
             usleep(10000);
+#endif
         }
     }
 
@@ -506,7 +510,7 @@ int main(int argc, char **argv)
 
         cerr << "in: " << countIn << ", out: " << countOut << ", ratio: " << float(countOut)/float(countIn) << ", ideal output: " << lrint(countIn * ratio) << ", error: " << abs(lrint(countIn * ratio) - int(countOut)) << endl;
 
-#ifdef _WIN32
+#ifdef PLATFORM_WINDOWS
         RubberBand::
 #endif
         timeval etv;
index a529afde0dc9de50cf4735773d38dcd93d8dfb8d..3883c59ff55dbd82bf514c7d6b4f36f05fd75357 100644 (file)
@@ -15,7 +15,7 @@
 #ifndef _RUBBERBAND_SYSINFO_H_
 #define _RUBBERBAND_SYSINFO_H_
 
-#ifdef __MSVC__
+#ifdef COMPILER_MSVC
 #include "bsd-3rdparty/float_cast/float_cast.h"
 #define R__ __restrict
 #endif
 #define R__
 #endif
 
-#ifdef __MINGW32__
+#ifdef COMPILER_MINGW
 #include <malloc.h>
 #endif
 
-#ifdef __MSVC__
+#ifdef COMPILER_MSVC
 #define alloca _alloca
 #endif
 
index 96a12274635ba8f8e5d991ea6c5317269567e0ae..9bbfe659796f820dc77a55cdaf859bcb38a87e58 100644 (file)
 
 #include "timecode/time.h"
 
+#include "ardour/visibility.h"
+
 namespace ARDOUR {
        class Session;
        class SessionEvent;
 }
 
-class BasicUI {
+#ifdef ARDOURCP_DLL_EXPORTS // defined if we are building the ARDOUR Control Protocol DLL (instead of using it)
+    #define ARDOURCP_API LIBARDOUR_HELPER_DLL_EXPORT
+#else
+    #define ARDOURCP_API LIBARDOUR_HELPER_DLL_IMPORT
+#endif 
+#define ARDOURCP_LOCAL LIBARDOUR_HELPER_DLL_LOCAL
+
+class ARDOURCP_API BasicUI {
   public:
        BasicUI (ARDOUR::Session&);
        virtual ~BasicUI ();
index 0c849064bb56d28d37cfbfcfb296848ef36e8823..37322530e46f6fc2598c3c9cc17bd40020f0a499 100644 (file)
 #include "control_protocol/basic_ui.h"
 #include "control_protocol/types.h"
 
+#ifdef ARDOURSURFACE_DLL_EXPORTS // defined if we are building the ARDOUR surface DLLs (instead of using them)
+    #define ARDOURSURFACE_API LIBARDOUR_HELPER_DLL_EXPORT
+#else
+    #define ARDOURSURFACE_API LIBARDOUR_HELPER_DLL_IMPORT
+#endif 
+#define ARDOURSURFACE_LOCAL LIBARDOUR_HELPER_DLL_LOCAL
+
 namespace ARDOUR {
 
 class Route;
 class Session;
 class Bundle;
 
-class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
+class ARDOURCP_API ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList, public BasicUI
 {
   public:
        ControlProtocol (Session&, std::string name);
@@ -142,7 +149,7 @@ class ControlProtocol : public PBD::Stateful, public PBD::ScopedConnectionList,
        void prev_track (uint32_t initial_id);
 
   private:
-       ControlProtocol (const ControlProtocol&); /* noncopyable */
+       ARDOURSURFACE_LOCAL ControlProtocol (const ControlProtocol&); /* noncopyable */
 };
 
 extern "C" {
index e3092b56060471c6b22d55bc747a76597f663628..a4331e7b7657f6a4555272df093090ebc923045d 100644 (file)
@@ -28,6 +28,7 @@ def build(bld):
     obj.export_includes = ['.', './control_protocol' ]
     obj.cxxflags     = '-DPACKAGE="ardour_cp" -fPIC'
     obj.includes     = ['.', './control_protocol']
+    obj.defines      = [ 'ARDOURCP_DLL_EXPORTS' ]
     obj.name         = 'libardour_cp'
     obj.target       = 'ardourcp'
     obj.use          = 'libardour libtimecode'
index 6893f66921671bc3628d8bf2b919fe0e56f1343a..b7b6709d56b87466ae398f3fc58a2cf9fe1514ed 100644 (file)
@@ -445,7 +445,7 @@ static void usb_tranzport_interrupt_out_callback(struct urb *urb)
 {
        struct usb_tranzport *dev = urb->context;
 
-       /* sync/async unlink faults aren't errors */
+       /* sync/async ::g_unlink faults aren't errors */
        if (urb->status && !(urb->status == -ENOENT ||
                             urb->status == -ECONNRESET ||
                             urb->status == -ESHUTDOWN))
index ba1858a1749053eca2a988916c1cb4a9ec1210a9..e0b06a936984ead8f1c10da783f41bb77839ff32 100644 (file)
@@ -107,7 +107,7 @@ static const char * const midimap_env_variable_name = "ARDOUR_MIDIMAPS_PATH";
 static const char* const midi_map_dir_name = "midi_maps";
 static const char* const midi_map_suffix = ".map";
 
-SearchPath
+Searchpath
 system_midi_map_search_path ()
 {
        bool midimap_path_defined = false;
@@ -117,7 +117,7 @@ system_midi_map_search_path ()
                return spath_env;
        }
 
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(midi_map_dir_name);
        return spath;
 }
@@ -129,7 +129,7 @@ user_midi_map_directory ()
 }
 
 static bool
-midi_map_filter (const string &str, void */*arg*/)
+midi_map_filter (const string &str, void/*arg*/)
 {
        return (str.length() > strlen(midi_map_suffix) &&
                str.find (midi_map_suffix) == (str.length() - strlen (midi_map_suffix)));
@@ -140,7 +140,7 @@ GenericMidiControlProtocol::reload_maps ()
 {
        vector<string *> *midi_maps;
        PathScanner scanner;
-       SearchPath spath (system_midi_map_search_path());
+       Searchpath spath (system_midi_map_search_path());
        spath += user_midi_map_directory ();
 
        midi_maps = scanner (spath.to_string(), midi_map_filter, 0, false, true);
index 94edb0ba8054af7e01e1a81e81cd90438fc35e45..1f2ae7b127c5429b0943f6898faca2e741b66ba9 100644 (file)
@@ -24,7 +24,7 @@
 
 using namespace ARDOUR;
 
-ControlProtocol*
+ControlProtocol* ARDOURSURFACE_LOCAL
 new_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s)
 {
        GenericMidiControlProtocol* gmcp;
@@ -43,35 +43,30 @@ new_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s
        return gmcp;
 }
 
-void
+void ARDOURSURFACE_LOCAL
 delete_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp)
 {
        delete cp;
 }
 
-bool
+bool ARDOURSURFACE_LOCAL
 probe_generic_midi_protocol (ControlProtocolDescriptor* /*descriptor*/)
 {
        return GenericMidiControlProtocol::probe ();
 }
 
+// Field names commented out by JE - 06-01-2010
 static ControlProtocolDescriptor generic_midi_descriptor = {
-       name : "Generic MIDI",
-       id : "uri://ardour.org/surfaces/generic_midi:0",
-       ptr : 0,
-       module : 0,
-       mandatory : 0,
-       supports_feedback : true,
-       probe : probe_generic_midi_protocol,
-       initialize : new_generic_midi_protocol,
-       destroy : delete_generic_midi_protocol
+       /*name :              */   "Generic MIDI",
+       /*id :                */   "uri://ardour.org/surfaces/generic_midi:0",
+       /*ptr :               */   0,
+       /*module :            */   0,
+       /*mandatory :         */   0,
+       /*supports_feedback : */   true,
+       /*probe :             */   probe_generic_midi_protocol,
+       /*initialize :        */   new_generic_midi_protocol,
+       /*destroy :           */   delete_generic_midi_protocol
 };
        
-
-extern "C" {
-ControlProtocolDescriptor* 
-protocol_descriptor () {
-       return &generic_midi_descriptor;
-}
-}
+extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &generic_midi_descriptor; }
 
index d78dd5e644091b42c9684d946607eb58676fd6b6..a26617fd676d276d89ffdf823dcef6936b27cb7e 100644 (file)
@@ -27,6 +27,8 @@
 #include "pbd/xml++.h"
 #include "pbd/stacktrace.h"
 
+#include "midi++/types.h" // Added by JE - 06-01-2009. All instances of 'byte' changed to 'MIDI::byte' (for clarification)
+#include "midi++/port.h"
 #include "midi++/channel.h"
 
 #include "ardour/async_midi_port.h"
@@ -55,7 +57,7 @@ MIDIControllable::MIDIControllable (GenericMidiControlProtocol* s, MIDI::Parser&
        last_controllable_value = 0.0f;
        control_type = none;
        _control_description = "MIDI Control: none";
-       control_additional = (byte) -1;
+       control_additional = (MIDI::byte) -1;
        feedback = true; // for now
 }
 
@@ -73,7 +75,7 @@ MIDIControllable::MIDIControllable (GenericMidiControlProtocol* s, MIDI::Parser&
        last_controllable_value = 0.0f;
        control_type = none;
        _control_description = "MIDI Control: none";
-       control_additional = (byte) -1;
+       control_additional = (MIDI::byte) -1;
        feedback = true; // for now
 }
 
@@ -108,7 +110,7 @@ MIDIControllable::drop_external_control ()
 {
        midi_forget ();
        control_type = none;
-       control_additional = (byte) -1;
+       control_additional = (MIDI::byte) -1;
 }
 
 void
@@ -313,7 +315,7 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
 }
 
 void
-MIDIControllable::midi_sense_program_change (Parser &, byte msg)
+MIDIControllable::midi_sense_program_change (Parser &, MIDI::byte msg)
 {
        if (!controllable) { 
                if (lookup_controllable ()) {
@@ -349,7 +351,7 @@ MIDIControllable::midi_sense_pitchbend (Parser &, pitchbend_t pb)
 }
 
 void
-MIDIControllable::midi_receiver (Parser &, byte *msg, size_t /*len*/)
+MIDIControllable::midi_receiver (Parser &, MIDI::byte *msg, size_t /*len*/)
 {
        /* we only respond to channel messages */
 
index 4cdf2602fd2d560221d1f30dea6bba929c7802e4..ffd4dd3698b765bc27525f68e2fa15e6ff210904 100644 (file)
@@ -34,6 +34,7 @@ def build(bld):
     obj.includes     = ['.', './generic_midi']
     obj.name         = 'libardour_generic_midi'
     obj.target       = 'ardour_generic_midi'
+    obj.defines      = [ 'ARDOURSURFACE_DLL_EXPORTS' ]
     obj.uselib       = 'GTKMM GTK GDK'
     obj.use          = 'libardour libardour_cp libgtkmm2ext libpbd'
     obj.vnum         = LIBARDOUR_GENERIC_MIDI_LIB_VERSION
index 45fd2faebdf2f48634a5939d324c40eed87943a9..04cbfecc56d64f0c0908dc058c5108bffa70419a 100644 (file)
@@ -24,6 +24,7 @@
 #include "pbd/xml++.h"
 #include "pbd/error.h"
 #include "pbd/pathscanner.h"
+#include "pbd/convert.h"
 
 #include "ardour/filesystem_paths.h"
 
@@ -221,7 +222,7 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */)
        /* strip count is mandatory */
        if ((child = node.child ("Strips")) != 0) {
                if ((prop = child->property ("value")) != 0) {
-                       if ((_strip_cnt = atoi (prop->value())) == 0) {
+                       if ((_strip_cnt = atoi (prop->value().c_str())) == 0) {
                                _strip_cnt = 8;
                        }
                }
@@ -231,7 +232,7 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */)
 
        if ((child = node.child ("Extenders")) != 0) {
                if ((prop = child->property ("value")) != 0) {
-                       if ((_extenders = atoi (prop->value())) == 0) {
+                       if ((_extenders = atoi (prop->value().c_str())) == 0) {
                                _extenders = 0;
                        }
                }
@@ -441,7 +442,7 @@ static const char * const devinfo_env_variable_name = "ARDOUR_MCP_PATH";
 static const char* const devinfo_dir_name = "mcp";
 static const char* const devinfo_suffix = ".device";
 
-static SearchPath
+static Searchpath
 devinfo_search_path ()
 {
        bool devinfo_path_defined = false;
@@ -451,14 +452,14 @@ devinfo_search_path ()
                return spath_env;
        }
 
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(devinfo_dir_name);
 
        return spath;
 }
 
 static bool
-devinfo_filter (const string &str, void */*arg*/)
+devinfo_filter (const string &str, void/*arg*/)
 {
        return (str.length() > strlen(devinfo_suffix) &&
                str.find (devinfo_suffix) == (str.length() - strlen (devinfo_suffix)));
@@ -471,7 +472,7 @@ DeviceInfo::reload_device_info ()
        vector<string> s;
        vector<string *> *devinfos;
        PathScanner scanner;
-       SearchPath spath (devinfo_search_path());
+       Searchpath spath (devinfo_search_path());
 
        devinfos = scanner (spath.to_string(), devinfo_filter, 0, false, true);
        device_info.clear ();
index ea57458e1c9715ccf74b286e7e497a1f05d26aff..ddbb4782db779d5168a2744ad22a56683c768b93 100644 (file)
@@ -55,7 +55,7 @@ static const char * const devprofile_env_variable_name = "ARDOUR_MCP_PATH";
 static const char* const devprofile_dir_name = "mcp";
 static const char* const devprofile_suffix = ".profile";
 
-static SearchPath
+static Searchpath
 devprofile_search_path ()
 {
        bool devprofile_path_defined = false;
@@ -65,7 +65,7 @@ devprofile_search_path ()
                return spath_env;
        }
 
-       SearchPath spath (ardour_data_search_path());
+       Searchpath spath (ardour_data_search_path());
        spath.add_subdirectory_to_paths(devprofile_dir_name);
 
        return spath;
@@ -78,7 +78,7 @@ user_devprofile_directory ()
 }
 
 static bool
-devprofile_filter (const string &str, void */*arg*/)
+devprofile_filter (const string &str, void/*arg*/)
 {
        return (str.length() > strlen(devprofile_suffix) &&
                str.find (devprofile_suffix) == (str.length() - strlen (devprofile_suffix)));
@@ -91,7 +91,7 @@ DeviceProfile::reload_device_profiles ()
        vector<string> s;
        vector<string *> *devprofiles;
        PathScanner scanner;
-       SearchPath spath (devprofile_search_path());
+       Searchpath spath (devprofile_search_path());
 
        devprofiles = scanner (spath.to_string(), devprofile_filter, 0, false, true);
        device_profiles.clear ();
index 294a222a6bee8ecff3836504f5f205358ee612c7..abef84817d4cbf58e48023cd6f5bacc8044b4fd5 100644 (file)
@@ -29,7 +29,7 @@ using namespace ARDOUR;
 using namespace PBD;
 using namespace std;
 
-ControlProtocol*
+static ControlProtocol*
 new_mackie_protocol (ControlProtocolDescriptor*, Session* s)
 {
        MackieControlProtocol* mcp = 0;
@@ -47,7 +47,7 @@ new_mackie_protocol (ControlProtocolDescriptor*, Session* s)
        return mcp;
 }
 
-void
+static void
 delete_mackie_protocol (ControlProtocolDescriptor*, ControlProtocol* cp)
 {
        try
@@ -66,34 +66,28 @@ delete_mackie_protocol (ControlProtocolDescriptor*, ControlProtocol* cp)
        So anything that can be changed in the UI should not be used here to
        prevent loading of the lib.
 */
-bool
+static bool
 probe_mackie_protocol (ControlProtocolDescriptor*)
 {
        return MackieControlProtocol::probe();
 }
 
+// Field names commented out by JE - 06-01-2010
 static ControlProtocolDescriptor mackie_descriptor = {
-       name : "Mackie",
-       id : "uri://ardour.org/surfaces/mackie:0",
-       ptr : 0,
-       module : 0,
-       mandatory : 0,
+       /*name :              */   "Mackie",
+       /*id :                */   "uri://ardour.org/surfaces/mackie:0",
+       /*ptr :               */   0,
+       /*module :            */   0,
+       /*mandatory :         */   0,
        // actually, the surface does support feedback, but all this
        // flag does is show a submenu on the UI, which is useless for the mackie
        // because feedback is always on. In any case, who'd want to use the
        // mcu without the motorised sliders doing their thing?
-       supports_feedback : false,
-       probe : probe_mackie_protocol,
-       initialize : new_mackie_protocol,
-       destroy : delete_mackie_protocol
+       /*supports_feedback : */   false,
+       /*probe :             */   probe_mackie_protocol,
+       /*initialize :        */   new_mackie_protocol,
+       /*destroy :           */   delete_mackie_protocol
 };
        
 
-extern "C" {
-
-ControlProtocolDescriptor* 
-protocol_descriptor () {
-       return &mackie_descriptor;
-}
-
-}
+extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &mackie_descriptor; }
index 32be8512476eee7f4436621fd9c524d111837e7c..194e35a26ffe6439cdcd05cf797f6da1de6d96cc 100644 (file)
@@ -29,7 +29,6 @@
 #include <float.h>
 #include <sys/time.h>
 #include <errno.h>
-#include <poll.h>
 
 #include <boost/shared_array.hpp>
 
@@ -1245,7 +1244,9 @@ MackieControlProtocol::midi_input_handler (IOCondition ioc, MIDI::Port* port)
                */
 
                if (!_device_info.uses_ipmidi()) {
+#ifndef PLATFORM_WINDOWS
                        CrossThreadChannel::drain (port->selectable());
+#endif
                }
 
                DEBUG_TRACE (DEBUG::MackieControl, string_compose ("data available on %1\n", port->name()));
index fe276c4e821b3a94ebb0b1ce8d6834e23f0769f6..e097772e7a46ec3536a781aedb112a14dce5a84a 100644 (file)
@@ -46,6 +46,7 @@ def build(bld):
     # need ../libs because some GTK2 header files require stuff there
     obj.includes     = ['.', '../libs']
     obj.name         = 'libardour_mcp'
+    obj.defines      = [ 'ARDOURSURFACE_DLL_EXPORTS' ]
     obj.target       = 'ardour_mcp'
     obj.uselib       = 'GTKMM'
     obj.use          = 'libardour libardour_cp libgtkmm2ext'
index a414d4eb82fb1fc03198d468f440322ccef455ac..f20d89841809017b742cea2d68c8621dd39fa031 100644 (file)
@@ -23,7 +23,7 @@
 
 using namespace ARDOUR;
 
-ControlProtocol*
+static ControlProtocol*
 new_osc_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s)
 {
        OSC* osc = new OSC (*s, Config->get_osc_port());
@@ -33,13 +33,13 @@ new_osc_protocol (ControlProtocolDescriptor* /*descriptor*/, Session* s)
        return osc;
 }
 
-void
+static void
 delete_osc_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp)
 {
        delete cp;
 }
 
-bool
+static bool
 probe_osc_protocol (ControlProtocolDescriptor* /*descriptor*/)
 {
        return true; // we can always do OSC
@@ -57,10 +57,5 @@ static ControlProtocolDescriptor osc_descriptor = {
        destroy : delete_osc_protocol
 };
 
-extern "C" {
-ControlProtocolDescriptor* 
-protocol_descriptor () {
-       return &osc_descriptor;
-}
-}
+extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &osc_descriptor; }
 
index 0c7c8455a471c5debd5778efe3535db154e44425..8b57dc0c3e14007f8a30327fd1fcfc29a2ad76f3 100644 (file)
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
+#include <glib/gstdio.h>
 #include <glibmm/miscutils.h>
 
 #include <pbd/pthread_utils.h>
@@ -181,7 +182,7 @@ OSC::start ()
        int fd = mkstemp(tmpstr);
        
        if (fd >= 0 ) {
-               unlink (tmpstr);
+               ::g_unlink (tmpstr);
                close (fd);
                
                _osc_unix_server = lo_server_new (tmpstr, error_callback);
@@ -284,11 +285,11 @@ OSC::stop ()
        }
        
        if (!_osc_unix_socket_path.empty()) {
-               unlink (_osc_unix_socket_path.c_str());
+               ::g_unlink (_osc_unix_socket_path.c_str());
        }
        
        if (!_osc_url_file.empty() ) {
-               unlink (_osc_url_file.c_str() );
+               ::g_unlink (_osc_url_file.c_str() );
        }
 
        // Delete any active route observers
index c2c12616c145fadab49112b5d1f31228192abba5..f3046658ec184e8861b1ecf57470fe7dfad9b827 100644 (file)
@@ -30,6 +30,7 @@ def build(bld):
     obj.cxxflags     = '-DPACKAGE="ardour_cp"'
     obj.includes     = ['.', './osc']
     obj.name         = 'libardour_osc'
+    obj.defines      = [ 'ARDOURSURFACE_DLL_EXPORTS' ]
     obj.target       = 'ardour_osc'
     obj.uselib       = ' LO '
     obj.use          = 'libardour libardour_cp libpbd'
index 16ff22687a4b35682b6089fe211102f3efbc61ae..3cf709078358a9900c3599800e7071cbc207b708 100644 (file)
@@ -23,7 +23,7 @@
 
 using namespace ARDOUR;
 
-ControlProtocol*
+static ControlProtocol*
 new_tranzport_protocol (ControlProtocolDescriptor* descriptor, Session* s)
 {
        TranzportControlProtocol* tcp = new TranzportControlProtocol (*s);
@@ -37,13 +37,13 @@ new_tranzport_protocol (ControlProtocolDescriptor* descriptor, Session* s)
        
 }
 
-void
+static void
 delete_tranzport_protocol (ControlProtocolDescriptor* descriptor, ControlProtocol* cp)
 {
        delete cp;
 }
 
-bool
+static bool
 probe_tranzport_protocol (ControlProtocolDescriptor* descriptor)
 {
        return TranzportControlProtocol::probe();
@@ -62,10 +62,6 @@ static ControlProtocolDescriptor tranzport_descriptor = {
 };
        
 
-extern "C" {
-ControlProtocolDescriptor* 
-protocol_descriptor () {
-       return &tranzport_descriptor;
-}
-}
+extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &tranzport_descriptor; }
+
 
index 311a9a204506a21ef8afb7b4fdcc003159a7c07d..3c479e72d868f99329fdbd52eb609cc5410f97df 100644 (file)
@@ -42,6 +42,7 @@ def build(bld):
     obj.cxxflags     = '-DPACKAGE="ardour_tranzport"'
     obj.includes     = ['.', './tranzport']
     obj.name         = 'libardour_tranzport'
+    obj.defines      = [ 'ARDOURSURFACE_DLL_EXPORTS' ]
     obj.target       = 'ardour_tranzport'
     obj.use          = 'libardour libardour_cp'
     obj.vnum         = LIBARDOUR_TRANZPORT_LIB_VERSION
index 318bc40adf2b967d031d6c07954593e7444e1632..9a704e445e87f46773c59c88ba7e58a18eeb8ff3 100644 (file)
@@ -29,7 +29,7 @@
 using namespace ARDOUR;
 using namespace PBD;
 
-ControlProtocol*
+static ControlProtocol*
 new_wiimote_protocol (ControlProtocolDescriptor*, Session* s)
 {
        WiimoteControlProtocol* wmcp = new WiimoteControlProtocol (*s);
@@ -37,13 +37,13 @@ new_wiimote_protocol (ControlProtocolDescriptor*, Session* s)
        return wmcp;
 }
 
-void
+static void
 delete_wiimote_protocol (ControlProtocolDescriptor* /*descriptor*/, ControlProtocol* cp)
 {
        delete cp;
 }
 
-bool
+static bool
 probe_wiimote_protocol (ControlProtocolDescriptor*)
 {
        return WiimoteControlProtocol::probe ();
@@ -61,13 +61,5 @@ static ControlProtocolDescriptor wiimote_descriptor = {
        destroy : delete_wiimote_protocol
 };
 
-
-extern "C" {
-
-ControlProtocolDescriptor*
-protocol_descriptor () {
-       return &wiimote_descriptor;
-}
-
-}
+extern "C" ARDOURSURFACE_API ControlProtocolDescriptor* protocol_descriptor () { return &wiimote_descriptor; }
 
index 3a4bd109c27891ee8055eaa91e4af865d93039a3..f565927360100221321d26839f97cfab4e6a1c4d 100644 (file)
@@ -28,6 +28,7 @@ def build(bld):
     obj.cxxflags     = '-DPACKAGE="ardour_wiimote"'
     obj.includes     = ['.', '../libs']
     obj.name         = 'libardour_wiimote'
+    obj.defines      = [ 'ARDOURSURFACE_DLL_EXPORTS' ]
     obj.target       = 'ardour_wiimote'
     obj.uselib       = 'GTKMM CWIID'
     obj.use          = 'libardour libardour_cp libgtkmm2ext'
index d9009bee253a1ad8e0b02051a8fb377406410099..29edc427b26628ef7094e2ed9debc8d66c8a7988 100644 (file)
@@ -23,10 +23,6 @@ children = [
         'control_protocol',
         'frontier',
         'generic_midi',
-        'mackie',
-        'osc',
-        'tranzport',
-        'wiimote'
 ]
 
 def options(opt):
@@ -39,16 +35,22 @@ def sub_config_and_use(conf, name, has_objects = True):
 def configure(conf):
     autowaf.set_recursive()
     autowaf.configure(conf)
-
+    
     for i in children:
         sub_config_and_use(conf, i)
 
+    if (conf.env['build_target'] == 'mingw'): return
+
     #autowaf.check_pkg(conf, 'libusb-1.0', uselib_store='USB', mandatory=False)
     #if Options.options.tranzport and conf.is_defined('HAVE_USB'):
     #    conf.define('BUILD_TRANZPORT', 1)
 
-    autowaf.check_pkg (conf, 'liblo', mandatory=False, uselib_store="LO", atleast_version="0.24")
-
+    if conf.check_cc (header_name='poll.h', define_name='BUILD_MACKIE', mandatory=False):
+        sub_config_and_use(conf, 'mackie')
+            
+    if autowaf.check_pkg (conf, 'liblo', mandatory=False, uselib_store="LO", atleast_version="0.24"):
+        sub_config_and_use(conf, 'osc')
     conf.check_cc (header_name='cwiid.h', define_name='HAVE_CWIID_H',mandatory=False)
     if conf.is_defined('HAVE_CWIID_H'):
         conf.check_cc (header_name='bluetooth/bluetooth.h', define_name='HAVE_BLUETOOTH_H',mandatory=False)
@@ -56,6 +58,7 @@ def configure(conf):
             autowaf.check_pkg(conf, 'cwiid', uselib_store='CWIID', atleast_version='0.6.00',mandatory=False)
             if conf.is_defined ('HAVE_CWIID'):
                 conf.define ('BUILD_WIIMOTE', 1)
+                sub_config_and_use(conf, 'wiimote')
             else:
                 print('You have the cwiid headers needed to compile wiimote support BUT you are missing the pkg-config file for cwiid')
         else:
@@ -65,8 +68,9 @@ def configure(conf):
 
 def build(bld):
     bld.recurse('control_protocol')
-    bld.recurse('generic_midi')
-    bld.recurse('mackie')
+    if (bld.env['build_target'] == 'mingw'): return
+    if bld.is_defined ('BUILD_MACKIE'):
+        bld.recurse('mackie')
     if bld.is_defined ('HAVE_LO'):
         bld.recurse('osc')
     if bld.is_defined('BUILD_WIIMOTE'):
diff --git a/libs/taglib/taglib/apefooter.h b/libs/taglib/taglib/apefooter.h
deleted file mode 120000 (symlink)
index 4478ae1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ape/apefooter.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/apeitem.h b/libs/taglib/taglib/apeitem.h
deleted file mode 120000 (symlink)
index 4b5757c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ape/apeitem.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/apetag.h b/libs/taglib/taglib/apetag.h
deleted file mode 120000 (symlink)
index 6e08d87..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ape/apetag.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/attachedpictureframe.h b/libs/taglib/taglib/attachedpictureframe.h
deleted file mode 120000 (symlink)
index f48f568..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/attachedpictureframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/commentsframe.h b/libs/taglib/taglib/commentsframe.h
deleted file mode 120000 (symlink)
index 54c9c1d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/commentsframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/flacfile.h b/libs/taglib/taglib/flacfile.h
deleted file mode 120000 (symlink)
index 163f8fe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./flac/flacfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/flacproperties.h b/libs/taglib/taglib/flacproperties.h
deleted file mode 120000 (symlink)
index 3f25242..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./flac/flacproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/generalencapsulatedobjectframe.h b/libs/taglib/taglib/generalencapsulatedobjectframe.h
deleted file mode 120000 (symlink)
index dbb35ac..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/generalencapsulatedobjectframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v1genres.h b/libs/taglib/taglib/id3v1genres.h
deleted file mode 120000 (symlink)
index a6e5fa2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v1/id3v1genres.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v1tag.h b/libs/taglib/taglib/id3v1tag.h
deleted file mode 120000 (symlink)
index 0843ca4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v1/id3v1tag.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2extendedheader.h b/libs/taglib/taglib/id3v2extendedheader.h
deleted file mode 120000 (symlink)
index ce49505..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2extendedheader.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2footer.h b/libs/taglib/taglib/id3v2footer.h
deleted file mode 120000 (symlink)
index ad6745f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2footer.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2frame.h b/libs/taglib/taglib/id3v2frame.h
deleted file mode 120000 (symlink)
index cbb258b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2frame.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2framefactory.h b/libs/taglib/taglib/id3v2framefactory.h
deleted file mode 120000 (symlink)
index 32fcfab..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2framefactory.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2header.h b/libs/taglib/taglib/id3v2header.h
deleted file mode 120000 (symlink)
index 9063942..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2header.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2synchdata.h b/libs/taglib/taglib/id3v2synchdata.h
deleted file mode 120000 (symlink)
index 4537498..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2synchdata.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/id3v2tag.h b/libs/taglib/taglib/id3v2tag.h
deleted file mode 120000 (symlink)
index e9b6219..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/id3v2tag.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/mpcfile.h b/libs/taglib/taglib/mpcfile.h
deleted file mode 120000 (symlink)
index 3f31e3d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpc/mpcfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/mpcproperties.h b/libs/taglib/taglib/mpcproperties.h
deleted file mode 120000 (symlink)
index 81f0916..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpc/mpcproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/mpegfile.h b/libs/taglib/taglib/mpegfile.h
deleted file mode 120000 (symlink)
index 9906423..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/mpegfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/mpegheader.h b/libs/taglib/taglib/mpegheader.h
deleted file mode 120000 (symlink)
index beb79d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/mpegheader.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/mpegproperties.h b/libs/taglib/taglib/mpegproperties.h
deleted file mode 120000 (symlink)
index ca2391c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/mpegproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/oggfile.h b/libs/taglib/taglib/oggfile.h
deleted file mode 120000 (symlink)
index 629411e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/oggfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/oggflacfile.h b/libs/taglib/taglib/oggflacfile.h
deleted file mode 120000 (symlink)
index a637866..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/flac/oggflacfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/oggpage.h b/libs/taglib/taglib/oggpage.h
deleted file mode 120000 (symlink)
index c1d996b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/oggpage.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/oggpageheader.h b/libs/taglib/taglib/oggpageheader.h
deleted file mode 120000 (symlink)
index 1bb4035..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/oggpageheader.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/relativevolumeframe.h b/libs/taglib/taglib/relativevolumeframe.h
deleted file mode 120000 (symlink)
index 98cbd6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/relativevolumeframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/speexfile.h b/libs/taglib/taglib/speexfile.h
deleted file mode 120000 (symlink)
index 69b8223..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/speex/speexfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/speexproperties.h b/libs/taglib/taglib/speexproperties.h
deleted file mode 120000 (symlink)
index 28b883c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/speex/speexproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/taglib.h b/libs/taglib/taglib/taglib.h
deleted file mode 120000 (symlink)
index 8a9f286..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/taglib.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tbytevector.h b/libs/taglib/taglib/tbytevector.h
deleted file mode 120000 (symlink)
index 2aba448..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tbytevector.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tbytevectorlist.h b/libs/taglib/taglib/tbytevectorlist.h
deleted file mode 120000 (symlink)
index e2308fa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tbytevectorlist.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tdebug.h b/libs/taglib/taglib/tdebug.h
deleted file mode 120000 (symlink)
index a27b5c3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tdebug.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/textidentificationframe.h b/libs/taglib/taglib/textidentificationframe.h
deleted file mode 120000 (symlink)
index 4b775ee..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/textidentificationframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tfile.h b/libs/taglib/taglib/tfile.h
deleted file mode 120000 (symlink)
index 09d3e52..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tlist.h b/libs/taglib/taglib/tlist.h
deleted file mode 120000 (symlink)
index ce60095..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tlist.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tlist.tcc b/libs/taglib/taglib/tlist.tcc
deleted file mode 120000 (symlink)
index 03b9a96..0000000
+++ /dev/null
@@ -1 +0,0 @@
-toolkit/tlist.tcc
\ No newline at end of file
diff --git a/libs/taglib/taglib/tmap.h b/libs/taglib/taglib/tmap.h
deleted file mode 120000 (symlink)
index 7a59378..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tmap.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tmap.tcc b/libs/taglib/taglib/tmap.tcc
deleted file mode 120000 (symlink)
index c9d4591..0000000
+++ /dev/null
@@ -1 +0,0 @@
-toolkit/tmap.tcc
\ No newline at end of file
diff --git a/libs/taglib/taglib/trueaudiofile.h b/libs/taglib/taglib/trueaudiofile.h
deleted file mode 120000 (symlink)
index 7a677f1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./trueaudio/trueaudiofile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/trueaudioproperties.h b/libs/taglib/taglib/trueaudioproperties.h
deleted file mode 120000 (symlink)
index 5e7f7d6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./trueaudio/trueaudioproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tstring.h b/libs/taglib/taglib/tstring.h
deleted file mode 120000 (symlink)
index acbe0c8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tstring.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/tstringlist.h b/libs/taglib/taglib/tstringlist.h
deleted file mode 120000 (symlink)
index 918658c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/tstringlist.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/unicode.h b/libs/taglib/taglib/unicode.h
deleted file mode 120000 (symlink)
index 3000929..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./toolkit/unicode.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/uniquefileidentifierframe.h b/libs/taglib/taglib/uniquefileidentifierframe.h
deleted file mode 120000 (symlink)
index 55b9305..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/uniquefileidentifierframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/unknownframe.h b/libs/taglib/taglib/unknownframe.h
deleted file mode 120000 (symlink)
index e46996a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/unknownframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/unsynchronizedlyricsframe.h b/libs/taglib/taglib/unsynchronizedlyricsframe.h
deleted file mode 120000 (symlink)
index 162a88d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/unsynchronizedlyricsframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/urllinkframe.h b/libs/taglib/taglib/urllinkframe.h
deleted file mode 120000 (symlink)
index 1e1aa15..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/id3v2/frames/urllinkframe.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/vorbisfile.h b/libs/taglib/taglib/vorbisfile.h
deleted file mode 120000 (symlink)
index d5d372b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/vorbis/vorbisfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/vorbisproperties.h b/libs/taglib/taglib/vorbisproperties.h
deleted file mode 120000 (symlink)
index e1d36a3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/vorbis/vorbisproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/wavpackfile.h b/libs/taglib/taglib/wavpackfile.h
deleted file mode 120000 (symlink)
index c88dd7c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wavpack/wavpackfile.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/wavpackproperties.h b/libs/taglib/taglib/wavpackproperties.h
deleted file mode 120000 (symlink)
index 089b5b7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./wavpack/wavpackproperties.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/xingheader.h b/libs/taglib/taglib/xingheader.h
deleted file mode 120000 (symlink)
index a271103..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./mpeg/xingheader.h
\ No newline at end of file
diff --git a/libs/taglib/taglib/xiphcomment.h b/libs/taglib/taglib/xiphcomment.h
deleted file mode 120000 (symlink)
index 96e9483..0000000
+++ /dev/null
@@ -1 +0,0 @@
-./ogg/xiphcomment.h
\ No newline at end of file
index a6994d63911f76d46dacb532453573bf1e868579..8e6fbbbe484a88e6b9a5c25178b13ea42b282ceb 100644 (file)
@@ -65,6 +65,7 @@ def build(bld):
     '''.split()
     obj.export_includes = ['.', 'taglib', 'taglib/toolkit']
     obj.includes     = include_dirs
+    obj.defines      = ['MAKE_TAGLIB_LIB']
     obj.name         = 'libtaglib'
     obj.target       = 'taglib'
     obj.vnum         = LIBTAGLIB_LIB_VERSION
index d475b11be93af1ef989da64bda702a9b5f45a2ba..4a58bf9fa52582a1f7d0f7376238adbced0a4a81 100644 (file)
@@ -14,6 +14,9 @@
 
 */
 
+#ifdef COMPILER_MSVC
+#include <ardourext/float_cast.h>
+#endif
 #include <math.h>
 #include "Onset.h"
 
index 614eb4c94388f9354968eac12d8d3e0efb8d442b..714eee3647fa69638b66c4d47088a9bf430c0832 100644 (file)
@@ -12,6 +12,9 @@
     COPYING included with this distribution for more information.
 */
 
+#ifdef COMPILER_MSVC
+#include <ardourext/float_cast.h>
+#endif
 #include "OnsetDetect.h"
 
 #include "dsp/onsets/DetectionFunction.h"
index 447eb19a280e373b3b5f7de4456c1bc854c004c7..623b89b6a0654b25e08813488327d7ef2c013d43 100644 (file)
@@ -34,6 +34,9 @@
     authorization.
 */
 
+#ifdef COMPILER_MSVC
+#include <ardourext/float_cast.h>
+#endif
 #include "PercussionOnsetDetector.h"
 
 using std::string;
index 82d80b81000532bc518c31f2b4bfb76a34e096b9..f93fdcaa32e4eb2b763e82cd32d64da9d4f21676 100644 (file)
     authorization.
 */
 
+#include <cmath>
+
+#ifdef COMPILER_MSVC
+#include <float.h>
+
+// 'std::isinf()' and 'std::isnan()' are not available in MSVC.
+#define isinf(val) !((bool)_finite((double)val))
+#define isnan(val) (bool)_isnan((double)val)
+#else
+using std::isnan;
+using std::isinf;
+#endif
+
 #include "SpectralCentroid.h"
 
 using std::string;
@@ -41,8 +54,6 @@ using std::vector;
 using std::cerr;
 using std::endl;
 
-#include <cmath>
-
 
 SpectralCentroid::SpectralCentroid(float inputSampleRate) :
     Plugin(inputSampleRate),
@@ -165,13 +176,13 @@ SpectralCentroid::process(const float *const *inputBuffers, Vamp::RealTime)
 
        Feature feature;
        feature.hasTimestamp = false;
-        if (!std::isnan(centroidLog) && !std::isinf(centroidLog)) {
+        if (!isnan(centroidLog) && !isinf(centroidLog)) {
             feature.values.push_back(centroidLog);
         }
        returnFeatures[0].push_back(feature);
 
         feature.values.clear();
-        if (!std::isnan(centroidLin) && !std::isinf(centroidLin)) {
+        if (!isnan(centroidLin) && !isinf(centroidLin)) {
             feature.values.push_back(centroidLin);
         }
        returnFeatures[1].push_back(feature);
diff --git a/msvc_extra_headers/ardourext/float_cast.h.input b/msvc_extra_headers/ardourext/float_cast.h.input
new file mode 100644 (file)
index 0000000..2ba3bbb
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+** Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+**
+** Permission to use, copy, modify, distribute, and sell this file for any
+** purpose is hereby granted without fee, provided that the above copyright
+** and this permission notice appear in all copies.  No representations are
+** made about the suitability of this software for any purpose.  It is
+** provided "as is" without express or implied warranty.
+*/
+
+/* Version 1.1 */
+
+
+/*============================================================================
+**     On Intel Pentium processors (especially PIII and probably P4), converting
+**     from float to int is very slow. To meet the C specs, the code produced by
+**     most C compilers targeting Pentium needs to change the FPU rounding mode
+**     before the float to int conversion is performed.
+**
+**     Changing the FPU rounding mode causes the FPU pipeline to be flushed. It
+**     is this flushing of the pipeline which is so slow.
+**
+**     Fortunately the ISO C99 specifications define the functions lrint, lrintf,
+**     llrint and llrintf which fix this problem as a side effect.
+**
+**     On Unix-like systems, the configure process should have detected the
+**     presence of these functions. If they weren't found we have to replace them
+**     here with a standard C cast.
+*/
+
+/*
+**     The C99 prototypes for lrint and lrintf are as follows:
+**
+**             long int lrintf (float x) ;
+**             long int lrint  (double x) ;
+*/
+#ifndef __FLOAT_CAST_H__  // Added by JE - 30-11-2009
+#define __FLOAT_CAST_H__
+#if (defined (WIN32) || defined (_WIN32))
+
+       #include        <math.h>
+
+       /*      Win32 doesn't seem to have these functions.
+       **      Therefore implement inline versions of these functions here.
+       */
+
+       __inline long int
+       lrint (double flt)
+       {       int intgr;
+
+               _asm
+               {       fld flt
+                       fistp intgr
+                       } ;
+
+               return intgr ;
+       }
+
+       __inline long int
+       lrintf (float flt)
+       {       int intgr;
+
+               _asm
+               {       fld flt
+                       fistp intgr
+                       } ;
+
+               return intgr ;
+       }
+
+       __inline long long int 
+       llrint (double flt)
+       {       long long int intgr;
+
+               _asm
+               {       fld flt
+                       fistp intgr
+                       } ;
+                       
+               return intgr ;
+       } 
+       
+       __inline long long int 
+       llrintf (float flt)
+       {       long long int intgr;
+
+               _asm
+               {       fld flt
+                       fistp intgr
+                       } ;
+                       
+               return intgr ;
+       }
+#endif
+
+#endif  // __FLOAT_CAST_H__
diff --git a/msvc_extra_headers/ardourext/libcharset.h.input b/msvc_extra_headers/ardourext/libcharset.h.input
new file mode 100644 (file)
index 0000000..2baf24c
--- /dev/null
@@ -0,0 +1,46 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU CHARSET Library.
+
+   The GNU CHARSET Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU CHARSET Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with the GNU CHARSET Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 51 Franklin Street,
+   Fifth Floor, Boston, MA 02110-1301, USA.  */
+
+#ifndef _LIBCHARSET_H
+#define _LIBCHARSET_H
+
+#include <ardourext/localcharset.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Support for relocatable packages.  */
+
+/* Sets the original and the current installation prefix of the package.
+   Relocation simply replaces a pathname starting with the original prefix
+   by the corresponding pathname with the current prefix instead.  Both
+   prefixes should be directory names without trailing slash (i.e. use ""
+   instead of "/").  */
+extern void libcharset_set_relocation_prefix (const char *orig_prefix,
+                                             const char *curr_prefix);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LIBCHARSET_H */
diff --git a/msvc_extra_headers/ardourext/localcharset.h.input b/msvc_extra_headers/ardourext/localcharset.h.input
new file mode 100644 (file)
index 0000000..129e4a4
--- /dev/null
@@ -0,0 +1,42 @@
+/* Determine a canonical name for the current locale's character encoding.
+   Copyright (C) 2000-2003 Free Software Foundation, Inc.
+   This file is part of the GNU CHARSET Library.
+
+   This program is free software; you can redistribute it and/or modify it
+   under the terms of the GNU Library 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
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+   USA.  */
+
+#ifndef _LOCALCHARSET_H
+#define _LOCALCHARSET_H
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Determine the current locale's character encoding, and canonicalize it
+   into one of the canonical names listed in config.charset.
+   The result must not be freed; it is statically allocated.
+   If the canonical name cannot be determined, the result is a non-canonical
+   name.  */
+extern const char * locale_charset (void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _LOCALCHARSET_H */
diff --git a/msvc_extra_headers/ardourext/misc.h.input b/msvc_extra_headers/ardourext/misc.h.input
new file mode 100644 (file)
index 0000000..63ce6c5
--- /dev/null
@@ -0,0 +1,245 @@
+/*
+    Copyright (C) 2009 John Emmas
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#ifndef __ardour_msvc_extensions_h__
+#define __ardour_msvc_extensions_h__
+
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0500
+#endif
+#ifndef _CPP_VECTOR
+#define _CPP_VECTOR  1
+#endif
+
+#ifdef __cplusplus
+#include <vector>
+#endif
+
+#include <math.h>
+#include <float.h>
+#include <direct.h>
+#include <boost/regex.h>
+#include <glib.h>
+#include <ardourext/float_cast.h>
+
+// 'std::isnan()' is not available in MSVC. Assume '_isnan(double)'
+#define isnan(val)  _isnan((double)val)
+
+// 'std::isinf()' is not available in MSVC. Assume '!_finite(double)'
+#define isinf(val) !_finite((double)val)
+
+// 'INFINITY' is not defined in MSVC. Assume 'HUGE_VAL'
+#ifndef INFINITY
+#define INFINITY    HUGE_VAL
+#endif
+
+// File access modes copied from unistd.h
+#define F_OK 0
+#define R_OK 4
+#define W_OK 2
+#define X_OK 1
+
+// Miscellaneous #defines
+#define __attribute__(x)
+#define llabs      _abs64
+#define atoll      _atoi64
+#define access     _access
+#define getcwd     _getcwd
+#define getpid     _getpid
+#define snprintf   _snprintf
+#define link        ntfs_link
+#define unlink      ntfs_unlink
+#define strcasecmp  stricmp
+#define strncasecmp strnicmp
+#define strtok_r( _s, _sep, _lasts ) \
+        ( *(_lasts) = strtok( (_s), (_sep) ) )
+
+#ifndef PATH_MAX
+#define PATH_MAX _MAX_PATH
+#endif
+#define DECLARE_DEFAULT_COMPARISONS(Type) \
+       extern bool operator >  (const Type& lhs, const Type& rhs); \
+       extern bool operator <  (const Type& lhs, const Type& rhs); \
+       extern bool operator != (const Type& lhs, const Type& rhs); \
+       extern bool operator == (const Type& lhs, const Type& rhs);
+
+// Types missing from Win32 'stat.h' (hopefully Windows
+// will either act sensibly or ignore most of them).
+#define        _S_IFBLK                0x3000
+#define        S_IRWXU                 _S_IRWXU
+#define        S_IXUSR                 _S_IXUSR
+#define        S_IWUSR                 _S_IWUSR
+#define        S_IRUSR                 _S_IRUSR
+#define        S_IXGRP                 _S_IXGRP
+#define        S_IWGRP                 _S_IWGRP
+#define        S_IRGRP                 _S_IRGRP
+#define        S_IXOTH                 _S_IXOTH
+#define        S_IWOTH                 _S_IWOTH
+#define        S_IROTH                 _S_IROTH
+
+#define        _S_IRWXU                (_S_IREAD | _S_IWRITE | _S_IEXEC)
+#define        _S_IXUSR                _S_IEXEC
+#define        _S_IWUSR                _S_IWRITE
+#define        _S_IRUSR                _S_IREAD
+#define        _S_IXGRP                _S_IEXEC
+#define        _S_IWGRP                _S_IWRITE
+#define        _S_IRGRP                _S_IREAD
+#define        _S_IXOTH                _S_IEXEC
+#define        _S_IWOTH                _S_IWRITE
+#define        _S_IROTH                _S_IREAD
+
+#define        S_ISFIFO(m)             _S_ISFIFO(m)
+#define        S_ISDIR(m)              _S_ISDIR(m)
+#define        S_ISCHR(m)              _S_ISCHR(m)
+#define        S_ISBLK(m)              _S_ISBLK(m)
+#define        S_ISREG(m)              _S_ISREG(m)
+
+#define        _S_ISFIFO(m)    (((m) & _S_IFMT) == _S_IFIFO)
+#define        _S_ISDIR(m)             (((m) & _S_IFMT) == _S_IFDIR)
+#define        _S_ISCHR(m)             (((m) & _S_IFMT) == _S_IFCHR)
+#define        _S_ISBLK(m)             (((m) & _S_IFMT) == _S_IFBLK)
+#define        _S_ISREG(m)             (((m) & _S_IFMT) == _S_IFREG)
+
+
+#if defined(__USE_BSD) || defined(_BSD_SOURCE)
+/* Convenience macros for operations on timevals.
+   NOTE: `timercmp' does not work for >= or <=.
+   Note also that 'timerset', 'timerclear' and
+   'timercmp' are (perhaps strangely) already
+   defined, along with various other 'time'
+   functions in WinSock.h  */
+# define timeradd(a, b, result)                                                      \
+  do {                                                                       \
+    (result)->tv_sec = (a)->tv_sec + (b)->tv_sec;                            \
+    (result)->tv_usec = (a)->tv_usec + (b)->tv_usec;                         \
+    if ((result)->tv_usec >= 1000000)                                        \
+      {                                                                              \
+    ++(result)->tv_sec;                                                      \
+    (result)->tv_usec -= 1000000;                                            \
+      }                                                                              \
+  } while (0)
+# define timersub(a, b, result)                                                      \
+  do {                                                                       \
+    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec;                            \
+    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec;                         \
+    if ((result)->tv_usec < 0) {                                             \
+      --(result)->tv_sec;                                                    \
+      (result)->tv_usec += 1000000;                                          \
+    }                                                                        \
+  } while (0)
+#endif /* BSD */
+
+#if !defined(__BIT_TYPES_DEFINED) || !defined(__BIT_TYPES_DEFINED__)
+#define __BIT_TYPES_DEFINED__ 1
+// Doesn't yet define all 'bit types'. Only those
+// needed by Ardour. More can be added as needed.
+#ifndef __int8_t_defined
+#define __int8_t_defined
+typedef        unsigned char      u_int8_t;
+typedef        unsigned short int u_int16_t;
+typedef        unsigned int       u_int32_t;
+typedef        unsigned __int64   u_int64_t;
+
+typedef signed char        int8_t;
+typedef unsigned char      uint8_t;
+typedef short              int16_t;
+typedef unsigned short     uint16_t;
+typedef int                int32_t;
+typedef unsigned           uint32_t;
+typedef long long          int64_t;
+typedef unsigned long long uint64_t;
+#endif  // __int8_t
+
+#ifndef __register_t_defined
+#define __register_t_defined
+typedef int register_t;
+#endif  // __register_t
+#endif  // __BIT_TYPESD
+
+// throw()
+#ifndef __THROW
+#ifdef __cplusplus
+#define __THROW  throw()
+#else
+#define __THROW
+#endif
+#endif
+
+// round().... Unlike Linux, Windows doesn't seem to support the
+// concept of a system-wide (or programmable) rounding direction.
+// Fortunately, 'round to nearest' seems to be the default action
+// under Linux, so let's copy that until we find out otherwise.
+#define rint(value)  round(value)
+#if !defined(PBD_API) || defined(PBD_IS_IN_WIN_STATIC_LIB)
+extern  double round(double x);
+#endif
+
+// System V compatibility
+typedef unsigned short ushort;
+typedef unsigned int   uint;
+
+// mode_t
+#ifndef _MODE_T_
+#define _MODE_T_
+typedef unsigned short _mode_t;
+
+#ifndef NO_OLDNAMES
+typedef _mode_t mode_t;
+#endif /* NO_OLDNAMES */
+#endif /* _MODE_T_ */
+
+// int64 abs()
+#ifdef __cplusplus // Normal 'C' doesn't permit over-ridden functions !!
+inline uint64_t abs(int64_t val)
+{
+       if (val < 0)
+               return val * (-1);
+       else
+               return val;
+}
+#endif
+
+// fmin() and fmax()
+#define fmin(a, b) min((double)a, (double)b)
+#define fmax(a, b) max((double)a, (double)b)
+
+// approximate POSIX pipe()
+#define pipe(handles) _pipe(handles, 4096, _O_BINARY)
+
+// Windows mkdir() doesn't care about access privileges
+#define mkdir(path, mode) _mkdir(path)
+
+// Redefine 'ftruncate()' to use the glib-win32 version
+#define ftruncate(fd, len) g_win32_ftruncate((gint)fd, (guint)len)
+
+
+// #include the main headers for Ardour MSVC
+#ifdef __cplusplus
+#if defined(BUILDING_PBD) || defined(PBD_IS_IN_WIN_STATIC_LIB)
+#include <pbd/msvc_pbd.h>
+#endif
+#if defined(BUILDING_LIBARDOUR) || defined(LIBARDOUR_IS_IN_WIN_STATIC_LIB)
+#include <ardour/msvc_libardour.h>
+#endif
+#if defined(BUILDING_RUBBERBAND) || defined(RUBBERBAND_IS_IN_WIN_STATIC_LIB)
+#include <rubberband/msvc_rubberband.h>
+#endif
+#endif // __cplusplus
+
+#endif /* __ardour_msvc_extensions_h__ */
diff --git a/msvc_extra_headers/ardourext/pthread.h.input b/msvc_extra_headers/ardourext/pthread.h.input
new file mode 100644 (file)
index 0000000..9699ef9
--- /dev/null
@@ -0,0 +1,7 @@
+#if !defined( PTHREAD_H )
+#ifdef  _PTHREAD_H  // Test added by JE - 12-12-2009
+#error  "ardourext/pthread.h conflicts with an existing pthread library"
+#else
+#include <ardourext/ptw32/pthread.h>
+#endif /* _PTHREAD_H */
+#endif /* PTHREAD_H */
diff --git a/msvc_extra_headers/ardourext/ptw32/pthread.h.input b/msvc_extra_headers/ardourext/ptw32/pthread.h.input
new file mode 100644 (file)
index 0000000..0aa4522
--- /dev/null
@@ -0,0 +1,1373 @@
+/* This is an implementation of the threads API of POSIX 1003.1-2001.
+ *
+ * --------------------------------------------------------------------------
+ *
+ *      Pthreads-win32 - POSIX Threads Library for Win32
+ *      Copyright(C) 1998 John E. Bossom
+ *      Copyright(C) 1999,2005 Pthreads-win32 contributors
+ * 
+ *      Contact Email: rpj@callisto.canberra.edu.au
+ * 
+ *      The current list of contributors is contained
+ *      in the file CONTRIBUTORS included with the source
+ *      code distribution. The list can also be seen at the
+ *      following World Wide Web location:
+ *      http://sources.redhat.com/pthreads-win32/contributors.html
+ * 
+ *      This library 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 of the License, or (at your option) any later version.
+ * 
+ *      This library 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 library in the file COPYING.LIB;
+ *      if not, write to the Free Software Foundation, Inc.,
+ *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+
+#if !defined( PTHREAD_H )
+#ifdef  _PTHREAD_H  // Test added by JE - 12-12-2009
+#error  "ptw32/pthread.h conflicts with an existing pthread library"
+#endif
+// Now make sure we can't accidentally include a conflicting library !!
+#define _PTHREAD_H
+#define PTHREAD_H
+
+/*
+ * See the README file for an explanation of the pthreads-win32 version
+ * numbering scheme and how the DLL is named etc.
+ */
+#define PTW32_VERSION 2,8,0,0
+#define PTW32_VERSION_STRING "2, 8, 0, 0\0"
+
+/* There are three implementations of cancel cleanup.
+ * Note that pthread.h is included in both application
+ * compilation units and also internally for the library.
+ * The code here and within the library aims to work
+ * for all reasonable combinations of environments.
+ *
+ * The three implementations are:
+ *
+ *   WIN32 SEH
+ *   C
+ *   C++
+ *
+ * Please note that exiting a push/pop block via
+ * "return", "exit", "break", or "continue" will
+ * lead to different behaviour amongst applications
+ * depending upon whether the library was built
+ * using SEH, C++, or C. For example, a library built
+ * with SEH will call the cleanup routine, while both
+ * C++ and C built versions will not.
+ */
+
+/*
+ * Define defaults for cleanup code.
+ * Note: Unless the build explicitly defines one of the following, then
+ * we default to standard C style cleanup. This style uses setjmp/longjmp
+ * in the cancelation and thread exit implementations and therefore won't
+ * do stack unwinding if linked to applications that have it (e.g.
+ * C++ apps). This is currently consistent with most/all commercial Unix
+ * POSIX threads implementations.
+ */
+#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C )
+# define __CLEANUP_C
+#endif
+
+#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC))
+#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler.
+#endif
+
+/*
+ * Stop here if we are being included by the resource compiler.
+ */
+#ifndef RC_INVOKED
+
+#undef PTW32_LEVEL
+
+#if defined(_POSIX_SOURCE)
+#define PTW32_LEVEL 0
+/* Early POSIX */
+#endif
+
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
+#undef PTW32_LEVEL
+#define PTW32_LEVEL 1
+/* Include 1b, 1c and 1d */
+#endif
+
+#if defined(INCLUDE_NP)
+#undef PTW32_LEVEL
+#define PTW32_LEVEL 2
+/* Include Non-Portable extensions */
+#endif
+
+#define PTW32_LEVEL_MAX 3
+
+#if !defined(PTW32_LEVEL)
+#define PTW32_LEVEL PTW32_LEVEL_MAX
+/* Include everything */
+#endif
+
+#ifdef _UWIN
+#   define HAVE_STRUCT_TIMESPEC 1
+#   define HAVE_SIGNAL_H        1
+#   undef HAVE_CONFIG_H
+#   pragma comment(lib, "pthread")
+#endif
+
+/*
+ * -------------------------------------------------------------
+ *
+ *
+ * Module: pthread.h
+ *
+ * Purpose:
+ *      Provides an implementation of PThreads based upon the
+ *      standard:
+ *
+ *              POSIX 1003.1-2001
+ *  and
+ *    The Single Unix Specification version 3
+ *
+ *    (these two are equivalent)
+ *
+ *      in order to enhance code portability between Windows,
+ *  various commercial Unix implementations, and Linux.
+ *
+ *      See the ANNOUNCE file for a full list of conforming
+ *      routines and defined constants, and a list of missing
+ *      routines and constants not defined in this implementation.
+ *
+ * Authors:
+ *      There have been many contributors to this library.
+ *      The initial implementation was contributed by
+ *      John Bossom, and several others have provided major
+ *      sections or revisions of parts of the implementation.
+ *      Often significant effort has been contributed to
+ *      find and fix important bugs and other problems to
+ *      improve the reliability of the library, which sometimes
+ *      is not reflected in the amount of code which changed as
+ *      result.
+ *      As much as possible, the contributors are acknowledged
+ *      in the ChangeLog file in the source code distribution
+ *      where their changes are noted in detail.
+ *
+ *      Contributors are listed in the CONTRIBUTORS file.
+ *
+ *      As usual, all bouquets go to the contributors, and all
+ *      brickbats go to the project maintainer.
+ *
+ * Maintainer:
+ *      The code base for this project is coordinated and
+ *      eventually pre-tested, packaged, and made available by
+ *
+ *              Ross Johnson <rpj@callisto.canberra.edu.au>
+ *
+ * QA Testers:
+ *      Ultimately, the library is tested in the real world by
+ *      a host of competent and demanding scientists and
+ *      engineers who report bugs and/or provide solutions
+ *      which are then fixed or incorporated into subsequent
+ *      versions of the library. Each time a bug is fixed, a
+ *      test case is written to prove the fix and ensure
+ *      that later changes to the code don't reintroduce the
+ *      same error. The number of test cases is slowly growing
+ *      and therefore so is the code reliability.
+ *
+ * Compliance:
+ *      See the file ANNOUNCE for the list of implemented
+ *      and not-implemented routines and defined options.
+ *      Of course, these are all defined is this file as well.
+ *
+ * Web site:
+ *      The source code and other information about this library
+ *      are available from
+ *
+ *              http://sources.redhat.com/pthreads-win32/
+ *
+ * -------------------------------------------------------------
+ */
+
+/* Try to avoid including windows.h */
+#if defined(__MINGW32__) && defined(__cplusplus)
+#define PTW32_INCLUDE_WINDOWS_H
+#endif
+
+#ifdef PTW32_INCLUDE_WINDOWS_H
+#include <windows.h>
+#endif
+
+#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__)
+/*
+ * VC++6.0 or early compiler's header has no DWORD_PTR type.
+ */
+typedef unsigned long DWORD_PTR;
+#endif
+/*
+ * -----------------
+ * autoconf switches
+ * -----------------
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
+#ifndef NEED_FTIME
+#include <time.h>
+#else /* NEED_FTIME */
+/* use native WIN32 time API */
+#endif /* NEED_FTIME */
+
+#if HAVE_SIGNAL_H
+#include <signal.h>
+#endif /* HAVE_SIGNAL_H */
+
+#include <setjmp.h>
+#include <limits.h>
+
+/*
+ * Boolean values to make us independent of system includes.
+ */
+enum {
+  PTW32_FALSE = 0,
+  PTW32_TRUE = (! PTW32_FALSE)
+};
+
+/*
+ * This is a duplicate of what is in the autoconf config.h,
+ * which is only used when building the pthread-win32 libraries.
+ */
+
+#ifndef PTW32_CONFIG_H
+#  if defined(WINCE)
+#    define NEED_ERRNO
+#    define NEED_SEM
+#  endif
+#  if defined(_UWIN) || defined(__MINGW32__)
+#    define HAVE_MODE_T
+#  endif
+#endif
+
+/*
+ *
+ */
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#ifdef NEED_ERRNO
+#include "need_errno.h"
+#else
+#include <errno.h>
+#endif
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
+/*
+ * Several systems don't define some error numbers.
+ */
+#ifndef ENOTSUP
+#  define ENOTSUP 48   /* This is the value in Solaris. */
+#endif
+
+#ifndef ETIMEDOUT
+#  define ETIMEDOUT 10060     /* This is the value in winsock.h. */
+#endif
+
+#ifndef ENOSYS
+#  define ENOSYS 140     /* Semi-arbitrary value */
+#endif
+
+#ifndef EDEADLK
+#  ifdef EDEADLOCK
+#    define EDEADLK EDEADLOCK
+#  else
+#    define EDEADLK 36     /* This is the value in MSVC. */
+#  endif
+#endif
+
+#include <ardourext/sched.h>
+
+/*
+ * To avoid including windows.h we define only those things that we
+ * actually need from it.
+ */
+#ifndef PTW32_INCLUDE_WINDOWS_H
+#ifndef HANDLE
+# define PTW32__HANDLE_DEF
+# define HANDLE void *
+#endif
+#ifndef DWORD
+# define PTW32__DWORD_DEF
+# define DWORD unsigned long
+#endif
+#endif
+
+#ifndef HAVE_STRUCT_TIMESPEC
+#define HAVE_STRUCT_TIMESPEC 1
+struct timespec {
+        long tv_sec;
+        long tv_nsec;
+};
+#endif /* HAVE_STRUCT_TIMESPEC */
+
+#ifndef SIG_BLOCK
+#define SIG_BLOCK 0
+#endif /* SIG_BLOCK */
+
+#ifndef SIG_UNBLOCK 
+#define SIG_UNBLOCK 1
+#endif /* SIG_UNBLOCK */
+
+#ifndef SIG_SETMASK
+#define SIG_SETMASK 2
+#endif /* SIG_SETMASK */
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif                          /* __cplusplus */
+
+/*
+ * -------------------------------------------------------------
+ *
+ * POSIX 1003.1-2001 Options
+ * =========================
+ *
+ * Options are normally set in <unistd.h>, which is not provided
+ * with pthreads-win32.
+ *
+ * For conformance with the Single Unix Specification (version 3), all of the
+ * options below are defined, and have a value of either -1 (not supported)
+ * or 200112L (supported).
+ *
+ * These options can neither be left undefined nor have a value of 0, because
+ * either indicates that sysconf(), which is not implemented, may be used at
+ * runtime to check the status of the option.
+ *
+ * _POSIX_THREADS (== 200112L)
+ *                      If == 200112L, you can use threads
+ *
+ * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L)
+ *                      If == 200112L, you can control the size of a thread's
+ *                      stack
+ *                              pthread_attr_getstacksize
+ *                              pthread_attr_setstacksize
+ *
+ * _POSIX_THREAD_ATTR_STACKADDR (== -1)
+ *                      If == 200112L, you can allocate and control a thread's
+ *                      stack. If not supported, the following functions
+ *                      will return ENOSYS, indicating they are not
+ *                      supported:
+ *                              pthread_attr_getstackaddr
+ *                              pthread_attr_setstackaddr
+ *
+ * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1)
+ *                      If == 200112L, you can use realtime scheduling.
+ *                      This option indicates that the behaviour of some
+ *                      implemented functions conforms to the additional TPS
+ *                      requirements in the standard. E.g. rwlocks favour
+ *                      writers over readers when threads have equal priority.
+ *
+ * _POSIX_THREAD_PRIO_INHERIT (== -1)
+ *                      If == 200112L, you can create priority inheritance
+ *                      mutexes.
+ *                              pthread_mutexattr_getprotocol +
+ *                              pthread_mutexattr_setprotocol +
+ *
+ * _POSIX_THREAD_PRIO_PROTECT (== -1)
+ *                      If == 200112L, you can create priority ceiling mutexes
+ *                      Indicates the availability of:
+ *                              pthread_mutex_getprioceiling
+ *                              pthread_mutex_setprioceiling
+ *                              pthread_mutexattr_getprioceiling
+ *                              pthread_mutexattr_getprotocol     +
+ *                              pthread_mutexattr_setprioceiling
+ *                              pthread_mutexattr_setprotocol     +
+ *
+ * _POSIX_THREAD_PROCESS_SHARED (== -1)
+ *                      If set, you can create mutexes and condition
+ *                      variables that can be shared with another
+ *                      process.If set, indicates the availability
+ *                      of:
+ *                              pthread_mutexattr_getpshared
+ *                              pthread_mutexattr_setpshared
+ *                              pthread_condattr_getpshared
+ *                              pthread_condattr_setpshared
+ *
+ * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L)
+ *                      If == 200112L you can use the special *_r library
+ *                      functions that provide thread-safe behaviour
+ *
+ * _POSIX_READER_WRITER_LOCKS (== 200112L)
+ *                      If == 200112L, you can use read/write locks
+ *
+ * _POSIX_SPIN_LOCKS (== 200112L)
+ *                      If == 200112L, you can use spin locks
+ *
+ * _POSIX_BARRIERS (== 200112L)
+ *                      If == 200112L, you can use barriers
+ *
+ *      + These functions provide both 'inherit' and/or
+ *        'protect' protocol, based upon these macro
+ *        settings.
+ *
+ * -------------------------------------------------------------
+ */
+
+/*
+ * POSIX Options
+ */
+#undef _POSIX_THREADS
+#define _POSIX_THREADS 200112L
+
+#undef _POSIX_READER_WRITER_LOCKS
+#define _POSIX_READER_WRITER_LOCKS 200112L
+
+#undef _POSIX_SPIN_LOCKS
+#define _POSIX_SPIN_LOCKS 200112L
+
+#undef _POSIX_BARRIERS
+#define _POSIX_BARRIERS 200112L
+
+#undef _POSIX_THREAD_SAFE_FUNCTIONS
+#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
+
+#undef _POSIX_THREAD_ATTR_STACKSIZE
+#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
+
+/*
+ * The following options are not supported
+ */
+#undef _POSIX_THREAD_ATTR_STACKADDR
+#define _POSIX_THREAD_ATTR_STACKADDR -1
+
+#undef _POSIX_THREAD_PRIO_INHERIT
+#define _POSIX_THREAD_PRIO_INHERIT -1
+
+#undef _POSIX_THREAD_PRIO_PROTECT
+#define _POSIX_THREAD_PRIO_PROTECT -1
+
+/* TPS is not fully supported.  */
+#undef _POSIX_THREAD_PRIORITY_SCHEDULING
+#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
+
+#undef _POSIX_THREAD_PROCESS_SHARED
+#define _POSIX_THREAD_PROCESS_SHARED -1
+
+
+/*
+ * POSIX 1003.1-2001 Limits
+ * ===========================
+ *
+ * These limits are normally set in <limits.h>, which is not provided with
+ * pthreads-win32.
+ *
+ * PTHREAD_DESTRUCTOR_ITERATIONS
+ *                      Maximum number of attempts to destroy
+ *                      a thread's thread-specific data on
+ *                      termination (must be at least 4)
+ *
+ * PTHREAD_KEYS_MAX
+ *                      Maximum number of thread-specific data keys
+ *                      available per process (must be at least 128)
+ *
+ * PTHREAD_STACK_MIN
+ *                      Minimum supported stack size for a thread
+ *
+ * PTHREAD_THREADS_MAX
+ *                      Maximum number of threads supported per
+ *                      process (must be at least 64).
+ *
+ * SEM_NSEMS_MAX
+ *                      The maximum number of semaphores a process can have.
+ *                      (must be at least 256)
+ *
+ * SEM_VALUE_MAX
+ *                      The maximum value a semaphore can have.
+ *                      (must be at least 32767)
+ *
+ */
+#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS     4
+
+#undef PTHREAD_DESTRUCTOR_ITERATIONS
+#define PTHREAD_DESTRUCTOR_ITERATIONS           _POSIX_THREAD_DESTRUCTOR_ITERATIONS
+
+#undef _POSIX_THREAD_KEYS_MAX
+#define _POSIX_THREAD_KEYS_MAX                  128
+
+#undef PTHREAD_KEYS_MAX
+#define PTHREAD_KEYS_MAX                        _POSIX_THREAD_KEYS_MAX
+
+#undef PTHREAD_STACK_MIN
+#define PTHREAD_STACK_MIN                       0
+
+#undef _POSIX_THREAD_THREADS_MAX
+#define _POSIX_THREAD_THREADS_MAX               64
+
+  /* Arbitrary value */
+#undef PTHREAD_THREADS_MAX
+#define PTHREAD_THREADS_MAX                     2019
+
+#undef _POSIX_SEM_NSEMS_MAX
+#define _POSIX_SEM_NSEMS_MAX                    256
+
+  /* Arbitrary value */
+#undef SEM_NSEMS_MAX
+#define SEM_NSEMS_MAX                           1024
+
+#undef _POSIX_SEM_VALUE_MAX
+#define _POSIX_SEM_VALUE_MAX                    32767
+
+#undef SEM_VALUE_MAX
+#define SEM_VALUE_MAX                           INT_MAX
+
+
+#if __GNUC__ && ! defined (__declspec)
+# error Please upgrade your GNU compiler to one that supports __declspec.
+#endif
+
+/*
+ * When building the DLL code, you should define PTW32_BUILD so that
+ * the variables/functions are exported correctly. When using the DLL,
+ * do NOT define PTW32_BUILD, and then the variables/functions will
+ * be imported correctly.
+ */
+#ifndef PTW32_STATIC_LIB
+#  ifdef PTW32_BUILD
+#    define PTW32_DLLPORT __declspec (dllexport)
+#  else
+#    define PTW32_DLLPORT __declspec (dllimport)
+#  endif
+#else
+#  define PTW32_DLLPORT
+#endif
+
+/*
+ * The Open Watcom C/C++ compiler uses a non-standard calling convention
+ * that passes function args in registers unless __cdecl is explicitly specified
+ * in exposed function prototypes.
+ *
+ * We force all calls to cdecl even though this could slow Watcom code down
+ * slightly. If you know that the Watcom compiler will be used to build both
+ * the DLL and application, then you can probably define this as a null string.
+ * Remember that pthread.h (this file) is used for both the DLL and application builds.
+ */
+#define PTW32_CDECL __cdecl
+
+#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
+#   include     <sys/types.h>
+#else
+/*
+ * Generic handle type - intended to extend uniqueness beyond
+ * that available with a simple pointer. It should scale for either
+ * IA-32 or IA-64.
+ */
+typedef struct {
+    void * p;                   /* Pointer to actual object */
+    unsigned int x;             /* Extra information - reuse count etc */
+} ptw32_handle_t;
+
+typedef ptw32_handle_t pthread_t;
+typedef struct pthread_attr_t_ * pthread_attr_t;
+typedef struct pthread_once_t_ pthread_once_t;
+typedef struct pthread_key_t_ * pthread_key_t;
+typedef struct pthread_mutex_t_ * pthread_mutex_t;
+typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
+typedef struct pthread_cond_t_ * pthread_cond_t;
+typedef struct pthread_condattr_t_ * pthread_condattr_t;
+#endif
+typedef struct pthread_rwlock_t_ * pthread_rwlock_t;
+typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t;
+typedef struct pthread_spinlock_t_ * pthread_spinlock_t;
+typedef struct pthread_barrier_t_ * pthread_barrier_t;
+typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t;
+
+/*
+ * ====================
+ * ====================
+ * POSIX Threads
+ * ====================
+ * ====================
+ */
+
+enum {
+/*
+ * pthread_attr_{get,set}detachstate
+ */
+  PTHREAD_CREATE_JOINABLE       = 0,  /* Default */
+  PTHREAD_CREATE_DETACHED       = 1,
+
+/*
+ * pthread_attr_{get,set}inheritsched
+ */
+  PTHREAD_INHERIT_SCHED         = 0,
+  PTHREAD_EXPLICIT_SCHED        = 1,  /* Default */
+
+/*
+ * pthread_{get,set}scope
+ */
+  PTHREAD_SCOPE_PROCESS         = 0,
+  PTHREAD_SCOPE_SYSTEM          = 1,  /* Default */
+
+/*
+ * pthread_setcancelstate paramters
+ */
+  PTHREAD_CANCEL_ENABLE         = 0,  /* Default */
+  PTHREAD_CANCEL_DISABLE        = 1,
+
+/*
+ * pthread_setcanceltype parameters
+ */
+  PTHREAD_CANCEL_ASYNCHRONOUS   = 0,
+  PTHREAD_CANCEL_DEFERRED       = 1,  /* Default */
+
+/*
+ * pthread_mutexattr_{get,set}pshared
+ * pthread_condattr_{get,set}pshared
+ */
+  PTHREAD_PROCESS_PRIVATE       = 0,
+  PTHREAD_PROCESS_SHARED        = 1,
+
+/*
+ * pthread_barrier_wait
+ */
+  PTHREAD_BARRIER_SERIAL_THREAD = -1
+};
+
+/*
+ * ====================
+ * ====================
+ * Cancelation
+ * ====================
+ * ====================
+ */
+#define PTHREAD_CANCELED       ((void *) -1)
+
+
+/*
+ * ====================
+ * ====================
+ * Once Key
+ * ====================
+ * ====================
+ */
+#define PTHREAD_ONCE_INIT       { PTW32_FALSE, 0, 0, 0}
+
+struct pthread_once_t_
+{
+  int          done;        /* indicates if user function has been executed */
+  void *       lock;
+  int          reserved1;
+  int          reserved2;
+};
+
+
+/*
+ * ====================
+ * ====================
+ * Object initialisers
+ * ====================
+ * ====================
+ */
+#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1)
+#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2)
+#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3)
+
+/*
+ * Compatibility with LinuxThreads
+ */
+#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
+#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
+
+#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1)
+
+#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1)
+
+#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1)
+
+
+/*
+ * Mutex types.
+ */
+enum
+{
+  /* Compatibility with LinuxThreads */
+  PTHREAD_MUTEX_FAST_NP,
+  PTHREAD_MUTEX_RECURSIVE_NP,
+  PTHREAD_MUTEX_ERRORCHECK_NP,
+  PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP,
+  PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP,
+  /* For compatibility with POSIX */
+  PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
+  PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
+  PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
+  PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
+};
+
+
+typedef struct ptw32_cleanup_t ptw32_cleanup_t;
+
+#if defined(_MSC_VER)
+/* Disable MSVC 'anachronism used' warning */
+#pragma warning( disable : 4229 )
+#endif
+
+typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *);
+
+#if defined(_MSC_VER)
+#pragma warning( default : 4229 )
+#endif
+
+struct ptw32_cleanup_t
+{
+  ptw32_cleanup_callback_t routine;
+  void *arg;
+  struct ptw32_cleanup_t *prev;
+};
+
+#ifdef __CLEANUP_SEH
+        /*
+         * WIN32 SEH version of cancel cleanup.
+         */
+
+#define pthread_cleanup_push( _rout, _arg ) \
+        { \
+            ptw32_cleanup_t     _cleanup; \
+            \
+        _cleanup.routine        = (ptw32_cleanup_callback_t)(_rout); \
+            _cleanup.arg        = (_arg); \
+            __try \
+              { \
+
+#define pthread_cleanup_pop( _execute ) \
+              } \
+            __finally \
+                { \
+                    if( _execute || AbnormalTermination()) \
+                      { \
+                          (*(_cleanup.routine))( _cleanup.arg ); \
+                      } \
+                } \
+        }
+
+#else /* __CLEANUP_SEH */
+
+#ifdef __CLEANUP_C
+
+        /*
+         * C implementation of PThreads cancel cleanup
+         */
+
+#define pthread_cleanup_push( _rout, _arg ) \
+        { \
+            ptw32_cleanup_t     _cleanup; \
+            \
+            ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \
+
+#define pthread_cleanup_pop( _execute ) \
+            (void) ptw32_pop_cleanup( _execute ); \
+        }
+
+#else /* __CLEANUP_C */
+
+#ifdef __CLEANUP_CXX
+
+        /*
+         * C++ version of cancel cleanup.
+         * - John E. Bossom.
+         */
+
+        class PThreadCleanup {
+          /*
+           * PThreadCleanup
+           *
+           * Purpose
+           *      This class is a C++ helper class that is
+           *      used to implement pthread_cleanup_push/
+           *      pthread_cleanup_pop.
+           *      The destructor of this class automatically
+           *      pops the pushed cleanup routine regardless
+           *      of how the code exits the scope
+           *      (i.e. such as by an exception)
+           */
+      ptw32_cleanup_callback_t cleanUpRout;
+          void    *       obj;
+          int             executeIt;
+
+        public:
+          PThreadCleanup() :
+            cleanUpRout( 0 ),
+            obj( 0 ),
+            executeIt( 0 )
+            /*
+             * No cleanup performed
+             */
+            {
+            }
+
+          PThreadCleanup(
+             ptw32_cleanup_callback_t routine,
+                         void    *       arg ) :
+            cleanUpRout( routine ),
+            obj( arg ),
+            executeIt( 1 )
+            /*
+             * Registers a cleanup routine for 'arg'
+             */
+            {
+            }
+
+          ~PThreadCleanup()
+            {
+              if ( executeIt && ((void *) cleanUpRout != (void *) 0) )
+                {
+                  (void) (*cleanUpRout)( obj );
+                }
+            }
+
+          void execute( int exec )
+            {
+              executeIt = exec;
+            }
+        };
+
+        /*
+         * C++ implementation of PThreads cancel cleanup;
+         * This implementation takes advantage of a helper
+         * class who's destructor automatically calls the
+         * cleanup routine if we exit our scope weirdly
+         */
+#define pthread_cleanup_push( _rout, _arg ) \
+        { \
+            PThreadCleanup  cleanup((ptw32_cleanup_callback_t)(_rout), \
+                                    (void *) (_arg) );
+
+#define pthread_cleanup_pop( _execute ) \
+            cleanup.execute( _execute ); \
+        }
+
+#else
+
+#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
+
+#endif /* __CLEANUP_CXX */
+
+#endif /* __CLEANUP_C */
+
+#endif /* __CLEANUP_SEH */
+
+/*
+ * ===============
+ * ===============
+ * Methods
+ * ===============
+ * ===============
+ */
+
+/*
+ * PThread Attribute Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
+                                         int *detachstate);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr,
+                                       void **stackaddr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
+                                       size_t * stacksize);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
+                                         int detachstate);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr,
+                                       void *stackaddr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr,
+                                       size_t stacksize);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr,
+                                        struct sched_param *param);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
+                                        const struct sched_param *param);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
+                                         int);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *,
+                                         int *);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
+                                         int inheritsched);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr,
+                                         int * inheritsched);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
+                                   int);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *,
+                                   int *);
+
+/*
+ * PThread Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid,
+                            const pthread_attr_t * attr,
+                            void *(*start) (void *),
+                            void *arg);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1,
+                           pthread_t t2);
+
+PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread,
+                          void **value_ptr);
+
+PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state,
+                                    int *oldstate);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type,
+                                   int *oldtype);
+
+PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
+                          void (*init_routine) (void));
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
+
+PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
+                                 void (*routine) (void *),
+                                 void *arg);
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
+/*
+ * Thread Specific Data Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key,
+                                void (*destructor) (void *));
+
+PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key,
+                                 const void *value);
+
+PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key);
+
+
+/*
+ * Mutex Attribute Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t
+                                          * attr,
+                                          int *pshared);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
+                                          int pshared);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
+
+/*
+ * Barrier Attribute Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t
+                                            * attr,
+                                            int *pshared);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
+                                            int pshared);
+
+/*
+ * Mutex Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex,
+                                const pthread_mutexattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex,
+                                    const struct timespec *abstime);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex);
+
+/*
+ * Spinlock Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock);
+
+/*
+ * Barrier Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier,
+                                  const pthread_barrierattr_t * attr,
+                                  unsigned int count);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier);
+
+/*
+ * Condition Variable Attribute Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr,
+                                         int *pshared);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr,
+                                         int pshared);
+
+/*
+ * Condition Variable Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond,
+                               const pthread_condattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond,
+                               pthread_mutex_t * mutex);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond,
+                                    pthread_mutex_t * mutex,
+                                    const struct timespec *abstime);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond);
+
+/*
+ * Scheduling
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread,
+                                   int policy,
+                                   const struct sched_param *param);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread,
+                                   int *policy,
+                                   struct sched_param *param);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int);
+PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void);
+
+/*
+ * Read-Write Lock Functions
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock,
+                                const pthread_rwlockattr_t *attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
+                                       const struct timespec *abstime);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
+                                       const struct timespec *abstime);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
+                                           int *pshared);
+
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
+                                           int pshared);
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1
+
+/*
+ * Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
+ * already have signal.h that don't define these.
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig);
+
+/*
+ * Non-portable functions
+ */
+
+/*
+ * Compatibility with Linux.
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr,
+                                         int kind);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
+                                         int *kind);
+
+/*
+ * Possibly supported by other POSIX threads implementations
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval);
+PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void);
+
+/*
+ * Useful if an application wants to statically link
+ * the lib rather than load the DLL at run-time.
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void);
+PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void);
+PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void);
+PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void);
+
+/*
+ * Features that are auto-detected at load/run time.
+ */
+PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int);
+enum ptw32_features {
+  PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */
+  PTW32_ALERTABLE_ASYNC_CANCEL              = 0x0002  /* Can cancel blocked threads. */
+};
+
+/*
+ * Register a system time change with the library.
+ * Causes the library to perform various functions
+ * in response to the change. Should be called whenever
+ * the application's top level window receives a
+ * WM_TIMECHANGE message. It can be passed directly to
+ * pthread_create() as a new thread if desired.
+ */
+PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
+
+#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+
+/*
+ * Returns the Win32 HANDLE for the POSIX thread.
+ */
+PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
+
+
+/*
+ * Protected Methods
+ *
+ * This function blocks until the given WIN32 handle
+ * is signaled or pthread_cancel had been called.
+ * This function allows the caller to hook into the
+ * PThreads cancel mechanism. It is implemented using
+ *
+ *              WaitForMultipleObjects
+ *
+ * on 'waitHandle' and a manually reset WIN32 Event
+ * used to implement pthread_cancel. The 'timeout'
+ * argument to TimedWait is simply passed to
+ * WaitForMultipleObjects.
+ */
+PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle);
+PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
+                                        DWORD timeout);
+
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
+/*
+ * Thread-Safe C Runtime Library Mappings.
+ */
+#ifndef _UWIN
+#  if defined(NEED_ERRNO)
+     PTW32_DLLPORT int * PTW32_CDECL _errno( void );
+#  else
+#    ifndef errno
+#      if (defined(_MT) || defined(_DLL))
+         __declspec(dllimport) extern int * __cdecl _errno(void);
+#        define errno   (*_errno())
+#      endif
+#    endif
+#  endif
+#endif
+
+/*
+ * WIN32 C runtime library had been made thread-safe
+ * without affecting the user interface. Provide
+ * mappings from the UNIX thread-safe versions to
+ * the standard C runtime library calls.
+ * Only provide function mappings for functions that
+ * actually exist on WIN32.
+ */
+
+#if !defined(__MINGW32__)
+#define strtok_r( _s, _sep, _lasts ) \
+        ( *(_lasts) = strtok( (_s), (_sep) ) )
+#endif /* !__MINGW32__ */
+
+#define asctime_r( _tm, _buf ) \
+        ( strcpy( (_buf), asctime( (_tm) ) ), \
+          (_buf) )
+
+#define ctime_r( _clock, _buf ) \
+        ( strcpy( (_buf), ctime( (_clock) ) ),  \
+          (_buf) )
+
+#define gmtime_r( _clock, _result ) \
+        ( *(_result) = *gmtime( (_clock) ), \
+          (_result) )
+
+#define localtime_r( _clock, _result ) \
+        ( *(_result) = *localtime( (_clock) ), \
+          (_result) )
+
+#define rand_r( _seed ) \
+        ( _seed == _seed? rand() : rand() )
+
+
+/*
+ * Some compiler environments don't define some things.
+ */
+#if defined(__BORLANDC__)
+#  define _ftime ftime
+#  define _timeb timeb
+#endif
+
+#ifdef __cplusplus
+
+/*
+ * Internal exceptions
+ */
+class ptw32_exception {};
+class ptw32_exception_cancel : public ptw32_exception {};
+class ptw32_exception_exit   : public ptw32_exception {};
+
+#endif
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+
+/* FIXME: This is only required if the library was built using SEH */
+/*
+ * Get internal SEH tag
+ */
+PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
+
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
+#ifndef PTW32_BUILD
+
+#ifdef __CLEANUP_SEH
+
+/*
+ * Redefine the SEH __except keyword to ensure that applications
+ * propagate our internal exceptions up to the library's internal handlers.
+ */
+#define __except( E ) \
+        __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
+                 ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
+
+#endif /* __CLEANUP_SEH */
+
+#ifdef __CLEANUP_CXX
+
+/*
+ * Redefine the C++ catch keyword to ensure that applications
+ * propagate our internal exceptions up to the library's internal handlers.
+ */
+#ifdef _MSC_VER
+        /*
+         * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
+         * if you want Pthread-Win32 cancelation and pthread_exit to work.
+         */
+
+#ifndef PtW32NoCatchWarn
+
+#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.")
+#pragma message("------------------------------------------------------------------")
+#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
+#pragma message("  Replace any 'catch( ... )' in routines called from POSIX threads")
+#pragma message("  with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread")
+#pragma message("  cancelation and pthread_exit to work. For example:")
+#pragma message("")
+#pragma message("    #ifdef PtW32CatchAll")
+#pragma message("      PtW32CatchAll")
+#pragma message("    #else")
+#pragma message("      catch(...)")
+#pragma message("    #endif")
+#pragma message("        {")
+#pragma message("          /* Catchall block processing */")
+#pragma message("        }")
+#pragma message("------------------------------------------------------------------")
+
+#endif
+
+#define PtW32CatchAll \
+        catch( ptw32_exception & ) { throw; } \
+        catch( ... )
+
+#else /* _MSC_VER */
+
+#define catch( E ) \
+        catch( ptw32_exception & ) { throw; } \
+        catch( E )
+
+#endif /* _MSC_VER */
+
+#endif /* __CLEANUP_CXX */
+
+#endif /* ! PTW32_BUILD */
+
+#ifdef __cplusplus
+}                               /* End of extern "C" */
+#endif                          /* __cplusplus */
+
+#ifdef PTW32__HANDLE_DEF
+# undef HANDLE
+#endif
+#ifdef PTW32__DWORD_DEF
+# undef DWORD
+#endif
+
+#undef PTW32_LEVEL
+#undef PTW32_LEVEL_MAX
+
+#endif /* ! RC_INVOKED */
+
+#endif /* PTHREAD_H */
diff --git a/msvc_extra_headers/ardourext/sched.h.input b/msvc_extra_headers/ardourext/sched.h.input
new file mode 100644 (file)
index 0000000..e7f4ab0
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Module: sched.h
+ *
+ * Purpose:
+ *      Provides an implementation of POSIX realtime extensions
+ *      as defined in 
+ *
+ *              POSIX 1003.1b-1993      (POSIX.1b)
+ *
+ * --------------------------------------------------------------------------
+ *
+ *      Pthreads-win32 - POSIX Threads Library for Win32
+ *      Copyright(C) 1998 John E. Bossom
+ *      Copyright(C) 1999,2005 Pthreads-win32 contributors
+ * 
+ *      Contact Email: rpj@callisto.canberra.edu.au
+ * 
+ *      The current list of contributors is contained
+ *      in the file CONTRIBUTORS included with the source
+ *      code distribution. The list can also be seen at the
+ *      following World Wide Web location:
+ *      http://sources.redhat.com/pthreads-win32/contributors.html
+ * 
+ *      This library 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 of the License, or (at your option) any later version.
+ * 
+ *      This library 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 library in the file COPYING.LIB;
+ *      if not, write to the Free Software Foundation, Inc.,
+ *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+#ifndef SCHED_H
+#ifdef  _SCHED_H  // Test added by JE - 12-12-2009
+#error  "ardourext/sched.h conflicts with an existing pthread library"
+#endif
+// Now make sure we can't accidentally include a conflicting library !!
+#define _SCHED_H
+#define SCHED_H
+
+#undef PTW32_LEVEL
+
+#if defined(_POSIX_SOURCE)
+#define PTW32_LEVEL 0
+/* Early POSIX */
+#endif
+
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
+#undef PTW32_LEVEL
+#define PTW32_LEVEL 1
+/* Include 1b, 1c and 1d */
+#endif
+
+#if defined(INCLUDE_NP)
+#undef PTW32_LEVEL
+#define PTW32_LEVEL 2
+/* Include Non-Portable extensions */
+#endif
+
+#define PTW32_LEVEL_MAX 3
+
+#if !defined(PTW32_LEVEL)
+#define PTW32_LEVEL PTW32_LEVEL_MAX
+/* Include everything */
+#endif
+
+
+#if __GNUC__ && ! defined (__declspec)
+# error Please upgrade your GNU compiler to one that supports __declspec.
+#endif
+
+/*
+ * When building the DLL code, you should define PTW32_BUILD so that
+ * the variables/functions are exported correctly. When using the DLL,
+ * do NOT define PTW32_BUILD, and then the variables/functions will
+ * be imported correctly.
+ */
+#ifndef PTW32_STATIC_LIB
+#  ifdef PTW32_BUILD
+#    define PTW32_DLLPORT __declspec (dllexport)
+#  else
+#    define PTW32_DLLPORT __declspec (dllimport)
+#  endif
+#else
+#  define PTW32_DLLPORT
+#endif
+
+/*
+ * This is a duplicate of what is in the autoconf config.h,
+ * which is only used when building the pthread-win32 libraries.
+ */
+
+#ifndef PTW32_CONFIG_H
+#  if defined(WINCE)
+#    define NEED_ERRNO
+#    define NEED_SEM
+#  endif
+#  if defined(_UWIN) || defined(__MINGW32__)
+#    define HAVE_MODE_T
+#  endif
+#endif
+
+/*
+ *
+ */
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#ifdef NEED_ERRNO
+#include "need_errno.h"
+#else
+#include <errno.h>
+#endif
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
+#if defined(__MINGW32__) || defined(_UWIN)
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+/* For pid_t */
+#  include <sys/types.h>
+/* Required by Unix 98 */
+#  include <time.h>
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+#else
+typedef int pid_t;
+#endif
+
+/* Thread scheduling policies */
+
+enum {
+  SCHED_OTHER = 0,
+  SCHED_FIFO,
+  SCHED_RR,
+  SCHED_MIN   = SCHED_OTHER,
+  SCHED_MAX   = SCHED_RR
+};
+
+struct sched_param {
+  int sched_priority;
+};
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif                          /* __cplusplus */
+
+PTW32_DLLPORT int __cdecl sched_yield (void);
+
+PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy);
+
+PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy);
+
+PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy);
+
+PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid);
+
+/*
+ * Note that this macro returns ENOTSUP rather than
+ * ENOSYS as might be expected. However, returning ENOSYS
+ * should mean that sched_get_priority_{min,max} are
+ * not implemented as well as sched_rr_get_interval.
+ * This is not the case, since we just don't support
+ * round-robin scheduling. Therefore I have chosen to
+ * return the same value as sched_setscheduler when
+ * SCHED_RR is passed to it.
+ */
+#define sched_rr_get_interval(_pid, _interval) \
+  ( errno = ENOTSUP, (int) -1 )
+
+
+#ifdef __cplusplus
+}                               /* End of extern "C" */
+#endif                          /* __cplusplus */
+
+#undef PTW32_LEVEL
+#undef PTW32_LEVEL_MAX
+
+#endif                          /* !SCHED_H */
+
diff --git a/msvc_extra_headers/ardourext/semaphore.h.input b/msvc_extra_headers/ardourext/semaphore.h.input
new file mode 100644 (file)
index 0000000..c06373f
--- /dev/null
@@ -0,0 +1,171 @@
+/*
+ * Module: semaphore.h
+ *
+ * Purpose:
+ *     Semaphores aren't actually part of the PThreads standard.
+ *     They are defined by the POSIX Standard:
+ *
+ *             POSIX 1003.1b-1993      (POSIX.1b)
+ *
+ * --------------------------------------------------------------------------
+ *
+ *      Pthreads-win32 - POSIX Threads Library for Win32
+ *      Copyright(C) 1998 John E. Bossom
+ *      Copyright(C) 1999,2005 Pthreads-win32 contributors
+ * 
+ *      Contact Email: rpj@callisto.canberra.edu.au
+ * 
+ *      The current list of contributors is contained
+ *      in the file CONTRIBUTORS included with the source
+ *      code distribution. The list can also be seen at the
+ *      following World Wide Web location:
+ *      http://sources.redhat.com/pthreads-win32/contributors.html
+ * 
+ *      This library 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 of the License, or (at your option) any later version.
+ * 
+ *      This library 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 library in the file COPYING.LIB;
+ *      if not, write to the Free Software Foundation, Inc.,
+ *      59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ */
+#if !defined( SEMAPHORE_H )
+#ifdef  _SEMAPHORE_H  // Test added by JE - 12-12-2009
+#error  "ardourext/semaphore.h conflicts with an existing pthread library"
+#endif
+// Now make sure we can't accidentally include a conflicting library !!
+#define _SEMAPHORE_H
+#define SEMAPHORE_H
+
+#undef PTW32_LEVEL
+
+#if defined(_POSIX_SOURCE)
+#define PTW32_LEVEL 0
+/* Early POSIX */
+#endif
+
+#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309
+#undef PTW32_LEVEL
+#define PTW32_LEVEL 1
+/* Include 1b, 1c and 1d */
+#endif
+
+#if defined(INCLUDE_NP)
+#undef PTW32_LEVEL
+#define PTW32_LEVEL 2
+/* Include Non-Portable extensions */
+#endif
+
+#define PTW32_LEVEL_MAX 3
+
+#if !defined(PTW32_LEVEL)
+#define PTW32_LEVEL PTW32_LEVEL_MAX
+/* Include everything */
+#endif
+
+#if __GNUC__ && ! defined (__declspec)
+# error Please upgrade your GNU compiler to one that supports __declspec.
+#endif
+
+/*
+ * When building the DLL code, you should define PTW32_BUILD so that
+ * the variables/functions are exported correctly. When using the DLL,
+ * do NOT define PTW32_BUILD, and then the variables/functions will
+ * be imported correctly.
+ */
+#ifndef PTW32_STATIC_LIB
+#  ifdef PTW32_BUILD
+#    define PTW32_DLLPORT __declspec (dllexport)
+#  else
+#    define PTW32_DLLPORT __declspec (dllimport)
+#  endif
+#else
+#  define PTW32_DLLPORT
+#endif
+
+/*
+ * This is a duplicate of what is in the autoconf config.h,
+ * which is only used when building the pthread-win32 libraries.
+ */
+
+#ifndef PTW32_CONFIG_H
+#  if defined(WINCE)
+#    define NEED_ERRNO
+#    define NEED_SEM
+#  endif
+#  if defined(_UWIN) || defined(__MINGW32__)
+#    define HAVE_MODE_T
+#  endif
+#endif
+
+/*
+ *
+ */
+
+#if PTW32_LEVEL >= PTW32_LEVEL_MAX
+#ifdef NEED_ERRNO
+#include "need_errno.h"
+#else
+#include <errno.h>
+#endif
+#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
+
+#define _POSIX_SEMAPHORES
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif                         /* __cplusplus */
+
+#ifndef HAVE_MODE_T
+typedef unsigned int mode_t;
+#endif
+
+
+typedef struct sem_t_ * sem_t;
+
+PTW32_DLLPORT int __cdecl sem_init (sem_t * sem,
+                           int pshared,
+                           unsigned int value);
+
+PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem);
+
+PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem);
+
+PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem);
+
+PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem,
+                                const struct timespec * abstime);
+
+PTW32_DLLPORT int __cdecl sem_post (sem_t * sem);
+
+PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem,
+                                    int count);
+
+PTW32_DLLPORT int __cdecl sem_open (const char * name,
+                           int oflag,
+                           mode_t mode,
+                           unsigned int value);
+
+PTW32_DLLPORT int __cdecl sem_close (sem_t * sem);
+
+PTW32_DLLPORT int __cdecl sem_unlink (const char * name);
+
+PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem,
+                               int * sval);
+
+#ifdef __cplusplus
+}                              /* End of extern "C" */
+#endif                         /* __cplusplus */
+
+#undef PTW32_LEVEL
+#undef PTW32_LEVEL_MAX
+
+#endif                         /* !SEMAPHORE_H */
diff --git a/msvc_extra_headers/ardourext/sys/targetsxs.h.input b/msvc_extra_headers/ardourext/sys/targetsxs.h.input
new file mode 100644 (file)
index 0000000..c81c8a3
--- /dev/null
@@ -0,0 +1,68 @@
+#ifndef _TARGETSXS_H_
+#define _TARGETSXS_H_
+
+#pragma warning( disable : 4996 )
+
+#ifndef LV2_SUPPORT
+#define LV2_SUPPORT   1
+#define HAVE_SUIL     1
+#define HAVE_LV2      1
+//#define HAVE_NEW_LV2  1
+/* Comment out the above lines to build Mixbus without LV2 support */
+#endif
+
+#ifndef VST_SUPPORT
+#define VST_SUPPORT
+/* Comment out the above line to build Mixbus without VST support */
+#endif
+
+#ifndef JACK_32_64
+#define JACK_32_64
+/* Shouldn't really be needed but make sure that any structs we
+   obtain from libjack will have 1-byte packing alignment where
+   necessary (belt & braces approach to be on the safe side) */
+#endif
+
+#ifdef _DEBUG
+#define _SECURE_SCL 1
+#define _HAS_ITERATOR_DEBUGGING 1
+/* #define to zero for a more conventional Debug build */
+#endif
+
+#ifndef __midl
+#if defined(_DEBUG) || defined (DEBUG)
+/* Experimental - link to the lowest DebugCRT so we can run on another system */
+#define _SXS_ASSEMBLY_VERSION "8.0.50727.42"
+#else
+#define _SXS_ASSEMBLY_VERSION "8.0.50727.6195"
+#endif
+#define _CRT_ASSEMBLY_VERSION _SXS_ASSEMBLY_VERSION
+#define _MFC_ASSEMBLY_VERSION _SXS_ASSEMBLY_VERSION
+#define _ATL_ASSEMBLY_VERSION _SXS_ASSEMBLY_VERSION
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+__declspec(selectany) int _forceCRTManifest;
+__declspec(selectany) int _forceMFCManifest;
+__declspec(selectany) int _forceAtlDllManifest;
+__declspec(selectany) int _forceCRTManifestRTM;
+__declspec(selectany) int _forceMFCManifestRTM;
+__declspec(selectany) int _forceAtlDllManifestRTM;
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+/* 'stdint.h' conflicts with various other libraries so
+   let's #include stdint.h first to ensure one consistent
+   implementation for commonly used integer types. */
+#include <stdint.h>
+
+#if defined(_MSC_VER) && !defined(__MINGW__) && !defined(__MINGW32__)
+#if (INCLUDE_ARDOUR_MISCELLANEOUS)
+#include <ardourext/misc.h>
+#endif
+#endif
+
+#endif /*_TARGETSXS_H_*/
diff --git a/msvc_extra_headers/ardourext/sys/time.h.input b/msvc_extra_headers/ardourext/sys/time.h.input
new file mode 100644 (file)
index 0000000..a18ae94
--- /dev/null
@@ -0,0 +1,110 @@
+#ifndef _WINX_SYS_TIME_H_
+#define _WINX_SYS_TIME_H_
+
+#define WIN32_LEAN_AND_MEAN /* This line found to be needed by JE - 18-08-2013. Line was formerly. . . #include <features.h> */
+#include <WinSock2.h> /* gets 'struct timeval' - Changed by JE - 23-07-2013. Was formerly. . . #include <WinSock.h> */
+
+#ifdef _TIMEVAL_DEFINED
+# define _STRUCT_TIMEVAL     1
+#endif /* _TIMEVAL_DEFINED */
+//#include <bits/types.h>
+#define __need_time_t
+#include <time.h>
+#define __need_timeval
+//#include <bits/time.h>
+
+#ifdef _TIMEVAL_DEFINED /* also in winsock[2].h */
+# undef __TIMEVAL__
+# define __TIMEVAL__ 1
+# undef _STRUCT_TIMEVAL
+# define _STRUCT_TIMEVAL     1
+#endif /* _TIMEVAL_DEFINED */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __USE_GNU
+/* Macros for converting between `struct timeval' and `struct timespec'.  */
+# define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
+        (ts)->tv_sec = (tv)->tv_sec;                                    \
+        (ts)->tv_nsec = (tv)->tv_usec * 1000;                           \
+}
+# define TIMESPEC_TO_TIMEVAL(tv, ts) {                                   \
+        (tv)->tv_sec = (ts)->tv_sec;                                    \
+        (tv)->tv_usec = (ts)->tv_nsec / 1000;                           \
+}
+#endif
+
+#ifdef __USE_BSD
+/* Structure crudely representing a timezone.
+   This is obsolete and should never be used.  */
+struct timezone
+  {
+    int tz_minuteswest;       /* Minutes west of GMT.  */
+    int tz_dsttime;      /* Nonzero if DST is ever in effect.  */
+  };
+
+typedef struct timezone *__restrict __timezone_ptr_t;
+#else
+typedef void *__restrict __timezone_ptr_t;
+#endif
+
+/* Get the current time of day and timezone information,
+   putting it into *TV and *TZ.  If TZ is NULL, *TZ is not filled.
+   Returns 0 on success, -1 on errors.
+   NOTE: This form of timezone information is obsolete.
+   Use the functions and variables declared in <time.h> instead.  */
+extern int gettimeofday (struct timeval *__restrict __tv,
+                __timezone_ptr_t __tz) __THROW;
+
+extern int getntptimeofday (struct timespec *__restrict __tp,
+                __timezone_ptr_t __tz) __THROW;
+
+#ifdef __USE_BSD
+/* Set the current time of day and timezone information.
+   This call is restricted to the super-user.  */
+extern int settimeofday (__const struct timeval *__tv,
+                __const struct timezone *__tz) __THROW;
+extern int setntptimeofday (__const struct timespec *__tp,
+                __const struct timezone *__tz) __THROW;
+#endif
+
+///* Values for the first argument to `getitimer' and `setitimer'.  */
+//enum __itimer_which
+//  {
+//    /* Timers run in real time.  */
+//    ITIMER_REAL = 0,
+//#define ITIMER_REAL ITIMER_REAL
+//    /* Timers run only when the process is executing.  */
+//    ITIMER_VIRTUAL = 1,
+//#define ITIMER_VIRTUAL ITIMER_VIRTUAL
+//    /* Timers run when the process is executing and when
+//       the system is executing on behalf of the process.  */
+//    ITIMER_PROF = 2
+//#define ITIMER_PROF ITIMER_PROF
+//  };
+
+/* Type of the second argument to `getitimer' and
+   the second and third arguments `setitimer'.  */
+struct itimerval
+  {
+    /* Value to put into `it_value' when the timer expires.  */
+    struct timeval it_interval;
+    /* Time to the next timer expiration.  */
+    struct timeval it_value;
+  };
+
+#if defined __USE_GNU && !defined __cplusplus
+/* Use the nicer parameter type only in GNU mode and not for C++ since the
+   strict C++ rules prevent the automatic promotion.  */
+typedef enum __itimer_which __itimer_which_t;
+#else
+typedef int __itimer_which_t;
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_WINX_SYS_TIMEX_H_*/
diff --git a/msvc_extra_headers/unistd.h.input b/msvc_extra_headers/unistd.h.input
new file mode 100644 (file)
index 0000000..0f8743b
--- /dev/null
@@ -0,0 +1,4 @@
+/*
+** Emtpy file to prevent Win32 compiler from complaining that the
+** file doesn't exist.
+*/
diff --git a/tools/windows_packaging/Fedora-16-mingw.txt b/tools/windows_packaging/Fedora-16-mingw.txt
new file mode 100644 (file)
index 0000000..23c9a74
--- /dev/null
@@ -0,0 +1,41 @@
+
+Fedora Packages are installed via $ yum install foobar
+
+wine, needed to run some tests during the configure process
+
+mingw32-gcc
+
+mingw32-libogg
+
+mingw32-flac not in repo <- requires libogg
+
+mingw32-libvorbis
+
+mingw32-libsndfile not in repo <- requires flac, vorbis
+mingw32-libsamplerate not in repo <- requires sndfile for examples?
+
+mingw32-gtkmm24, this will pull in all the gtk+ deps etc
+
+mingw32-gtk2-engines not in repo <- provides clearlooks
+
+mingw32-libglade2, required for gnomecanvas 
+
+mingw32-libart_lgpl not in repo
+mingw32-libgnomecanvas not in repo <- requires libart, libglade2
+mingw32-libgnomecanvasmm not in repo <- requires
+
+mingw32-portaudio not in repo
+
+mingw32-jack-audio-connection-kit not in repo
+
+mingw32-fftw not in repo
+
+mingw32-curl
+
+Optional
+
+mingw32-cppunit, if tests enabled
+mingw32-gdb, for debugging
+
+qemu-kvm to run virt images
+
diff --git a/tools/windows_packaging/README b/tools/windows_packaging/README
new file mode 100644 (file)
index 0000000..cb01c56
--- /dev/null
@@ -0,0 +1,112 @@
+Building Ardour for Windows
+
+The windows build is compiled and tested with the MinGW compiler that is
+packaged in Fedora, Currently using Fedora 16. There are many cross compiled
+"mingw" libraries that Ardour requires that are also available on Fedora but
+not all are yet.
+
+
+Prerequisites
+
+Follow instructions in Fedora-16.txt to build and/or install the required
+packages.
+
+
+Configuring
+
+After all the necessary packages are installed the next step is to call
+one of the configure scripts configure-debug.sh or configure-release.sh.
+
+The configure-debug.sh script will enable debugging support and install
+the tests to the package directory. It will also mean the GDB debugger
+is packaged.
+
+The configure-release.sh is intended for releases only, none of the tests
+will be built and all the binaries will be optimized and stripped.
+
+These scripts both source the mingw-env.sh script to setup the appropriate 
+environment variables and then call waf with a specific set of parameters
+that are appropriate to configure for the windows build.
+
+
+Building
+
+After the build is configured the waf.sh script is used to build the Ardour
+application and all necessary libraries. The waf.sh script is not strictly
+needed, it just saves having to change working directories.
+
+
+Packaging
+
+When the build is successful the package.sh script will call waf install
+and then move some of the installed files to appropriate locations for a
+windows executable. This could probably be done in the waf scripts specifically
+for the windows build but I felt it simpler to do it in the packaging script
+for now.
+
+The packaging script then copies the JACK deamon and all the required mingw
+shared libraries from the host system into the packaging directory. The 
+shared libraries or dll's are placed in the same directory as the Ardour
+executable so they are found at runtime.
+
+Once the package.sh script has been run then the package directory located 
+in the Ardour source root directory will contain everything necessary to run
+the Ardour executable.
+
+The make-installer.sh script is only really relevant when configure-release.sh
+has been used to configure the build. The script creates a basic and little
+tested windows installer for Ardour using the Nullsoft Scriptable Installer
+System(NSIS). 
+
+
+Running
+
+The Ardour windows binary is intended to be run and tested on windows. Testing
+is mainly performed using Windows XP, but should work on Vista/7. It is only
+a 32bit binary at the moment but that may change with mingw64.
+
+The binary does not run successfully under WINE but that may change with updates
+and or bug fixes.
+
+When running Ardour for debugging purposes it is best to start the jack server
+in a separate terminal(Command Prompt) before starting Ardour so that they are
+not both writing to the same terminal. This will probably be fixed at some point
+so when jackd is started by Ardour the output is redirected etc.
+
+The cptovm.sh and startvm.sh scripts are intended for testing Ardour in a 
+Windows XP virt image and may need to be altered to be used successfully.
+
+
+Testing
+
+When configured for debugging there are a number of test programs(prefixed with
+test_) included in the package.
+
+
+Debugging
+
+Ardour has some verbose logging/debugging output that can be useful that is used
+with the -D option. 
+
+When configured for debugging the package contains gdb along with a .gdbinit 
+file to automatically set the source directory so that the "list" gdb command
+will show the source code corresponding to the current stack frame.
+
+Use break `Somenamespace::somepartialsymbolname + tab to list symbols, then remove 
+` to set break. If you press tab with when there are thousands of possible
+matching symbols be prepared to wait a long time(this can also cause gdb to use a
+lot of memory).
+
+For reasons I've yet to determine many symbols are not accessible so the best way
+to set a breakpoint is by using filename and line number.
+
+e.g (gdb) break audiosource.cc:976
+
+but this seems to only work after running Ardour at least once.
+
+They are a number of glib debugging options see
+
+http://developer.gnome.org/glib/2.30/glib-running.html
+
+use $ set G_DEBUG=fatal_warnings to get backtrace
+
diff --git a/tools/windows_packaging/ardour.nsi b/tools/windows_packaging/ardour.nsi
new file mode 100644 (file)
index 0000000..3bfcc05
--- /dev/null
@@ -0,0 +1,123 @@
+#!Nsis Installer Command Script
+#
+# This is an NSIS Installer Command Script generated automatically
+# by the Fedora nsiswrapper program.  For more information see:
+#
+#   http://fedoraproject.org/wiki/MinGW
+#
+# To build an installer from the script you would normally do:
+#
+#   makensis this_script
+#
+# which will generate the output file 'installer.exe' which is a Windows
+# installer containing your program.
+
+SetCompressor /SOLID lzma
+SetCompressorDictSize 32
+
+!include MUI.nsh
+
+!define MUI_ABORTWARNING
+!define MUI_ICON ..\icons\icon\ardour.ico
+!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
+;!define MUI_HEADERIMAGE
+;!define MUI_HEADERIMAGE_BITMAP header.bmp
+;!define MUI_WELCOMEFINISHPAGE_BITMAP welcomefinish.bmp
+;!define MUI_COMPONENTSPAGE_SMALLDESC
+
+; Installer pages
+!insertmacro MUI_PAGE_WELCOME
+
+LicenseForceSelection off
+
+!define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
+!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LICENSE_BOTTOM_TEXT)"
+!insertmacro MUI_PAGE_LICENSE ..\COPYING
+
+!insertmacro MUI_PAGE_DIRECTORY
+
+!insertmacro MUI_PAGE_INSTFILES
+
+!define MUI_FINISHPAGE_RUN "$INSTDIR\Ardour-3.0.exe"
+!insertmacro MUI_PAGE_FINISH
+
+; Uninstaller pages
+!insertmacro MUI_UNPAGE_CONFIRM
+
+!insertmacro MUI_UNPAGE_INSTFILES
+ShowUninstDetails hide
+!insertmacro MUI_UNPAGE_FINISH
+
+!insertmacro MUI_LANGUAGE "English"
+
+; Product definitions
+;!define DUMMYINSTALL ; Define this to make it build quickly, not including any of the files or code in the sections, for quick testing of features of the installer and development thereof.
+!define INSTDIR_KEY "SOFTWARE\Ardour-3.0"
+
+; Product Information
+Name "Ardour-3.0"
+OutFile "Ardour-3.0-Setup.exe"
+InstallDir "$PROGRAMFILES\Ardour"
+InstallDirRegKey HKLM "${INSTDIR_KEY}" "Install_Dir"
+
+
+ComponentText "Select which optional components you want to install."
+
+DirText "Please select the installation folder."
+
+Section "Ardour-3.0"
+!ifndef DUMMYINSTALL
+  SectionIn RO
+
+  SetOutPath $INSTDIR
+  File ardour-3.0.exe
+  File *.dll
+  File jack*.exe
+  File ardour.ico
+  File /r etc
+  File /r jack
+  File /r lib
+  File /r share
+
+!endif
+SectionEnd
+
+Section "Start Menu Shortcuts"
+!ifndef DUMMY_INSTALL
+  CreateDirectory "$SMPROGRAMS\Ardour-3.0"
+  CreateShortCut "$SMPROGRAMS\Ardour-3.0\Uninstall Ardour-3.0.lnk" "$INSTDIR\Uninstall Ardour-3.0.exe" "" "$INSTDIR\Uninstall Ardour-3.0.exe" 0
+  CreateShortCut "$SMPROGRAMS\Ardour-3.0\ardour-3.0.exe.lnk" "$INSTDIR\.\ardour-3.0.exe" "" "$INSTDIR\ardour.ico" 0
+!endif
+SectionEnd
+
+Section "Desktop Icons"
+!ifndef DUMMY_INSTALL
+  CreateShortCut "$DESKTOP\Ardour-3.0.exe.lnk" "$INSTDIR\ardour-3.0.exe" "" "$INSTDIR\ardour.ico"
+!endif
+SectionEnd
+
+Section "Uninstall"
+!ifndef DUMMY_INSTALL
+  Delete /rebootok "$DESKTOP\ardour-3.0.exe.lnk"
+  Delete /rebootok "$SMPROGRAMS\Ardour-3.0\ardour-3.0.exe.lnk"
+  Delete /rebootok "$SMPROGRAMS\Ardour-3.0\Uninstall Ardour-3.0.lnk"
+  RMDir "$SMPROGRAMS\Ardour-3.0"
+
+  ;RMDir "$INSTDIR\."
+  Delete /rebootok "$INSTDIR\ardour-3.0.exe"
+  Delete /rebootok "$INSTDIR\jack*.exe"
+  Delete /rebootok "$INSTDIR\*.dll"
+  Delete /rebootok "$INSTDIR\ardour.ico"
+  RMDir /r "$INSTDIR\etc"
+  RMDir /r "$INSTDIR\jack"
+  RMDir /r "$INSTDIR\lib"
+  RMDir /r "$INSTDIR\share"
+  RMDir "$INSTDIR"
+!endif
+SectionEnd
+
+Section -post
+!ifndef DUMMY_INSTALL
+  WriteUninstaller "$INSTDIR\Uninstall Ardour-3.0.exe"
+!endif
+SectionEnd
diff --git a/tools/windows_packaging/clean.sh b/tools/windows_packaging/clean.sh
new file mode 100755 (executable)
index 0000000..9577612
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+. mingw-env.sh
+
+rm -rf $BUILD_DIR
diff --git a/tools/windows_packaging/configure-debug.sh b/tools/windows_packaging/configure-debug.sh
new file mode 100755 (executable)
index 0000000..bcee29d
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+. ./print-env.sh
+
+cd $BASE || exit 1
+./waf configure --prefix="/" --bindir="/" --configdir="/share" --noconfirm --no-lv2 --test --single-tests --dist-target=mingw "$@"
diff --git a/tools/windows_packaging/configure-release.sh b/tools/windows_packaging/configure-release.sh
new file mode 100755 (executable)
index 0000000..2e943e0
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+. ./print-env.sh
+
+cd $BASE || exit 1
+./waf configure --prefix="/" --bindir="/" --configdir="/share" --optimize --noconfirm --no-lv2 --dist-target=mingw "$@"
diff --git a/tools/windows_packaging/cptovm.sh b/tools/windows_packaging/cptovm.sh
new file mode 100755 (executable)
index 0000000..62e6fd6
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+TMP_DIR=tmp
+LOOP_DEV=/dev/loop4
+
+cd $BASE || exit 1
+
+if [ ! -d $TMP_DIR ]; then
+       echo "Creating temp directory to mount vm image ..."
+       mkdir $TMP_DIR || exit 1
+fi
+
+echo "mounting vm image as loopback device ..."
+
+sudo mount -o loop=$LOOP_DEV,offset=32256 $VIRT_IMAGE_PATH $TMP_DIR || exit 1
+
+if [ -d $TMP_DIR/$PACKAGE_DIR ]; then
+       echo "Removing old copy of $PACKAGE_DIR from vm image ..."
+       rm -rf $TMP_DIR/$PACKAGE_DIR || exit 1
+fi
+
+echo "Copying $PACKAGE_DIR to vm image ..."
+cp -r $PACKAGE_DIR $TMP_DIR || exit 1
+
+if [ "$1" == "--data" ]; then
+       DATA_DIR=data
+
+       if [ -d $TMP_DIR/$DATA_DIR ]; then
+               echo "Removing old copy of $DATA_DIR from vm image ..."
+               rm -rf $TMP_DIR/$DATA_DIR || exit 1
+       fi
+
+       echo "Copying $DATA_DIR to vm image ..."
+       cp -r $DATA_DIR $TMP_DIR || exit 1
+fi
+
+
+# in case mount is busy
+sleep 2
+
+echo "Unmounting vm image ..."
+
+sudo umount -d tmp
+
+echo "Removing temp directory used to mount vm image ..."
+rm -rf $TMP_DIR || exit 1
+
+if sudo losetup $LOOP_DEV; then
+       echo "sleeping for 10 seconds and trying again ..."
+       sleep 10
+       if sudo losetup -d $LOOP_DEV; then
+               echo "Unmounted loopback device successfully"
+               exit 0
+       else:
+               echo "Unmounting loopback device unsuccessful, you will need to use losetup -d to unmount device"
+               exit 1
+       fi
+fi
+
+exit 0
diff --git a/tools/windows_packaging/gdbinit b/tools/windows_packaging/gdbinit
new file mode 100644 (file)
index 0000000..b170cca
--- /dev/null
@@ -0,0 +1,2 @@
+echo   dir src/gtk2_ardour \n
+       dir src/gtk2_ardour     
diff --git a/tools/windows_packaging/loaders.cache b/tools/windows_packaging/loaders.cache
new file mode 100644 (file)
index 0000000..8293cd8
--- /dev/null
@@ -0,0 +1,144 @@
+# GdkPixbuf Image Loader Modules file
+# Automatically generated file, do not edit
+# Created by gdk-pixbuf-query-loaders.exe from gdk-pixbuf-2.21.7
+#
+# LoaderDir = Z:\usr\i686-pc-mingw32\sys-root\mingw/lib/gdk-pixbuf-2.0/2.10.0/loaders
+#
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.dll"
+"png" 5 "gdk-pixbuf" "The PNG image format" "LGPL"
+"image/png" ""
+"png" ""
+"\211PNG\r\n\032\n" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xpm.dll"
+"xpm" 4 "gdk-pixbuf" "The XPM image format" "LGPL"
+"image/x-xpixmap" ""
+"xpm" ""
+"/* XPM */" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-bmp.dll"
+"bmp" 5 "gdk-pixbuf" "Het BMP-bestandsformaat" "LGPL"
+"image/bmp" "image/x-bmp" "image/x-MS-bmp" ""
+"bmp" ""
+"BM" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-tiff.dll"
+"tiff" 5 "gdk-pixbuf" "The TIFF image format" "LGPL"
+"image/tiff" ""
+"tiff" "tif" ""
+"MM *" "  z " 100
+"II* " "   z" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pcx.dll"
+"pcx" 4 "gdk-pixbuf" "The PCX image format" "LGPL"
+"image/x-pcx" ""
+"pcx" ""
+"\n \001" "" 100
+"\n\002\001" "" 100
+"\n\003\001" "" 100
+"\n\004\001" "" 100
+"\n\005\001" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-wmf.dll"
+"wmf" 4 "gdk-pixbuf" "Het WMF-bestandsformaat" "LGPL"
+"image/x-wmf" ""
+"wmf" "apm" ""
+"\327\315\306\232" "" 100
+"\001" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ras.dll"
+"ras" 4 "gdk-pixbuf" "The Sun raster image format" "LGPL"
+"image/x-cmu-raster" "image/x-sun-raster" ""
+"ras" ""
+"Y\246j\225" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-ico.dll"
+"ico" 4 "gdk-pixbuf" "Het ICO-bestandsformaat" "LGPL"
+"image/x-icon" "image/x-ico" ""
+"ico" "cur" ""
+"  \001   " "zz znz" 100
+"  \002   " "zz znz" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-wbmp.dll"
+"wbmp" 4 "gdk-pixbuf" "The WBMP image format" "LGPL"
+"image/vnd.wap.wbmp" ""
+"wbmp" ""
+"  " "zz" 1
+" `" "z " 1
+" @" "z " 1
+"  " "z " 1
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-pnm.dll"
+"pnm" 4 "gdk-pixbuf" "The PNM/PBM/PGM/PPM image format family" "LGPL"
+"image/x-portable-anymap" "image/x-portable-bitmap" "image/x-portable-graymap" "image/x-portable-pixmap" ""
+"pnm" "pbm" "pgm" "ppm" ""
+"P1" "" 100
+"P2" "" 100
+"P3" "" 100
+"P4" "" 100
+"P5" "" 100
+"P6" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-ani.dll"
+"ani" 4 "gdk-pixbuf" "The ANI image format" "LGPL"
+"application/x-navi-animation" ""
+"ani" ""
+"RIFF    ACON" "    xxxx    " 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-qtif.dll"
+"qtif" 4 "gdk-pixbuf" "The QTIF image format" "LGPL"
+"image/x-quicktime" "image/qtif" ""
+"qtif" "qif" ""
+"abcdidsc" "xxxx    " 100
+"abcdidat" "xxxx    " 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-xbm.dll"
+"xbm" 4 "gdk-pixbuf" "The XBM image format" "LGPL"
+"image/x-xbitmap" ""
+"xbm" ""
+"#define " "" 100
+"/*" "" 50
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-icns.dll"
+"icns" 4 "gdk-pixbuf" "The ICNS image format" "GPL"
+"image/x-icns" ""
+"icns" ""
+"icns" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-jasper.dll"
+"jpeg2000" 4 "gdk-pixbuf" "The JPEG 2000 image format" "LGPL"
+"image/jp2" "image/jpeg2000" "image/jpx" ""
+"jp2" "jpc" "jpx" "j2k" "jpf" ""
+"    jP" "!!!!  " 100
+"\377O\377Q" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-jpeg.dll"
+"jpeg" 5 "gdk-pixbuf" "Het JPEG-bestandsformaat" "LGPL"
+"image/jpeg" ""
+"jpeg" "jpe" "jpg" ""
+"\377\330" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-gif.dll"
+"gif" 5 "gdk-pixbuf" "Het GIF-bestandsformaat" "LGPL"
+"image/gif" ""
+"gif" ""
+"GIF8" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-gdip-emf.dll"
+"emf" 4 "gdk-pixbuf" "Het EMF-bestandsformaat" "LGPL"
+"application/emf" "application/x-emf" "image/x-emf" "image/x-mgx-emf" ""
+"emf" ""
+"\001" "" 100
+
+"lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-tga.dll"
+"tga" 4 "gdk-pixbuf" "The Targa image format" "LGPL"
+"image/x-tga" ""
+"tga" "targa" ""
+" \001\001" "x  " 100
+" \001\t" "x  " 100
+"  \002" "xz " 99
+"  \003" "xz " 100
+"  \n" "xz " 100
+"  \013" "xz " 100
+
+
diff --git a/tools/windows_packaging/make-installer.sh b/tools/windows_packaging/make-installer.sh
new file mode 100755 (executable)
index 0000000..621f271
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+cd $BASE || exit 1
+
+if test ! -d $PACKAGE_DIR; then
+       echo "Win32 package directory does not exist"
+       exit 1
+fi
+
+cp $TOOLS_DIR/ardour.nsi $PACKAGE_DIR || exit 1
+cp $BASE/icons/icon/ardour.ico $PACKAGE_DIR || exit 1
+
+cd $PACKAGE_DIR && makensis ardour.nsi
diff --git a/tools/windows_packaging/mingw-env.sh b/tools/windows_packaging/mingw-env.sh
new file mode 100755 (executable)
index 0000000..616f89a
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+BASE=$(readlink -f $0)
+BASE=$(dirname $BASE) # up one
+BASE=$(dirname $BASE) # up one more
+BASE=$(dirname $BASE) # up one more
+
+HOST=i686-w64-mingw32
+MINGW_ROOT=/usr/$HOST/sys-root/mingw
+
+export PKG_CONFIG_PREFIX=$MINGW_ROOT
+export PKG_CONFIG_LIBDIR=$MINGW_ROOT/lib/pkgconfig
+export PKGCONFIG=pkg-config
+export AR=$HOST-ar
+export RANLIB=$HOST-ranlib
+export CC=$HOST-gcc
+export CPP=$HOST-g++
+export CXX=$HOST-g++
+export AS=$HOST-as
+export LINK_CC=$HOST-gcc
+export LINK_CXX=$HOST-g++
+export WINRC=$HOST-windres
+export STRIP=$HOST-strip
+
+BUILD_DIR=$BASE/build
+BUILD_CACHE_FILE=$BUILD_DIR/c4che/_cache.py
+TOOLS_DIR=$BASE/tools/windows_packaging
+
+. ../define_versions.sh
+
+APPNAME=`grep -m 1 '^APPNAME' $BASE/wscript | awk '{print $3}' | sed "s/'//g"`
+
+# These are only relevant after a build
+if test -f $BUILD_CACHE_FILE
+then
+       # Figure out the Build Type
+       if grep -q "DEBUG = True" $BUILD_CACHE_FILE; then
+               DEBUG=1
+               PACKAGE_DIR="$APPNAME-${version}-win32-dbg"
+       else
+               PACKAGE_DIR="$APPNAME-${version}-win32"
+       fi
+
+       if grep -q "BUILD_TESTS = True" $BUILD_CACHE_FILE; then
+               WITH_TESTS=1
+       fi
+
+       ARDOUR_DATA_DIR=$PACKAGE_DIR/share/ardour3
+fi
+
+# put this somewhere better...
+VIRT_IMAGE_PATH=$HOME/Data/virt-images/winxp.raw
diff --git a/tools/windows_packaging/package.sh b/tools/windows_packaging/package.sh
new file mode 100755 (executable)
index 0000000..92f55e8
--- /dev/null
@@ -0,0 +1,189 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+. ./print-env.sh
+
+cd $BASE || exit 1
+
+if ! test -f $BUILD_CACHE_FILE; then
+       echo "ERROR: $APPNAME is not configured and built yet..."
+       exit 1
+fi
+
+if [ -d $PACKAGE_DIR ]; then
+       echo "Removing old package directory structure ..."
+       rm -rf $PACKAGE_DIR || exit 1
+fi
+
+./waf --destdir=$PACKAGE_DIR install || exit 1
+
+echo "Moving Ardour dll's and executable to $PACKAGE_DIR ..."
+
+mv $PACKAGE_DIR/lib/ardour3/*.dll $PACKAGE_DIR || exit 1
+mv $PACKAGE_DIR/lib/ardour3/*.exe $PACKAGE_DIR || exit 1
+
+echo "Deleting import libs ..."
+
+rm $PACKAGE_DIR/lib/*dll.a
+
+# delete sh script
+rm $PACKAGE_DIR/ardour3
+
+if test x$WITH_TESTS != x ; then
+       echo "Copying tests and test data to $PACKAGE_DIR ..."
+       cp $BUILD_DIR/libs/pbd/run-tests.exe $PACKAGE_DIR/pbd-run-tests.exe
+       cp -r $BASE/libs/pbd/test $PACKAGE_DIR/pbd_testdata
+
+       cp $BUILD_DIR/libs/evoral/run-tests.exe $PACKAGE_DIR/evoral-run-tests.exe
+       mkdir -p $PACKAGE_DIR/test/testdata
+       cp -r $BASE/libs/evoral/test/testdata/TakeFive.mid $PACKAGE_DIR/test/testdata
+
+       cp -r $BASE/libs/ardour/test/data $PACKAGE_DIR/ardour_testdata
+fi
+
+echo "Copying mingw config files to $PACKAGE_DIR ..."
+# just copy it all for now
+cp -r $MINGW_ROOT/etc $PACKAGE_DIR
+
+cp -r $MINGW_ROOT/lib/gtk-2.0 $PACKAGE_DIR/lib
+cp -r $MINGW_ROOT/lib/gdk-pixbuf-2.0 $PACKAGE_DIR/lib
+cp $TOOLS_DIR/loaders.cache $PACKAGE_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
+
+mkdir -p $PACKAGE_DIR/lib/pango/1.6.0/modules
+cp -r $MINGW_ROOT/lib/pango/1.6.0/modules/*.dll $PACKAGE_DIR/lib/pango/1.6.0/modules
+cp $TOOLS_DIR/pango.modules $PACKAGE_DIR/etc/pango
+
+DLLS='
+jack-0.dll
+jackserver-0.dll
+libart_lgpl_2-2.dll
+libatk-1.0-0.dll
+libatkmm-1.6-1.dll
+libbz2-1.dll
+libcairo-2.dll
+libcairo-gobject-2.dll
+libcairomm-1.0-1.dll
+libcairo-script-interpreter-2.dll
+libcppunit-1-12-1.dll
+libcrypto-10.dll
+libcurl-4.dll
+libexpat-1.dll
+libfftw3-3.dll
+libfftw3f-3.dll
+libfontconfig-1.dll
+libfreetype-6.dll
+libgailutil-18.dll
+libgcc_s_sjlj-1.dll
+libgdkmm-2.4-1.dll
+libgdk_pixbuf-2.0-0.dll
+libgdk-win32-2.0-0.dll
+libgio-2.0-0.dll
+libgiomm-2.4-1.dll
+libglib-2.0-0.dll
+libglibmm-2.4-1.dll
+libglibmm_generate_extra_defs-2.4-1.dll
+libgmodule-2.0-0.dll
+libgnomecanvas-2-0.dll
+libgnomecanvasmm-2.6-1.dll
+libgnurx-0.dll
+libgobject-2.0-0.dll
+libgthread-2.0-0.dll
+libgtkmm-2.4-1.dll
+libgtk-win32-2.0-0.dll
+libharfbuzz-0.dll
+libiconv-2.dll
+iconv.dll
+libFLAC-8.dll
+libogg-0.dll
+libvorbis-0.dll
+libvorbisenc-2.dll
+libffi-6.dll
+libidn-11.dll
+libintl-8.dll
+liblo-7.dll
+libpango-1.0-0.dll
+libpangocairo-1.0-0.dll
+libpangoft2-1.0-0.dll
+libpangomm-1.4-1.dll
+libpangowin32-1.0-0.dll
+libpixman-1-0.dll
+libpng15-15.dll
+libsamplerate-0.dll
+libsigc-2.0-0.dll
+libsndfile-1.dll
+libssh2-1.dll
+libssl-10.dll
+libstdc++-6.dll
+libxml2-2.dll
+pthreadGC2.dll
+zlib1.dll
+'
+
+echo "Copying mingw shared libraries to $PACKAGE_DIR ..."
+
+for i in $DLLS;
+do
+cp $MINGW_ROOT/bin/$i $PACKAGE_DIR
+done
+
+echo "Copying JACK server and drivers to $PACKAGE_DIR ..."
+
+cp $MINGW_ROOT/bin/jackd.exe $PACKAGE_DIR
+cp -r $MINGW_ROOT/bin/jack $PACKAGE_DIR
+cp $MINGW_ROOT/bin/libportaudio-2.dll $PACKAGE_DIR
+
+SRC_DIRS='
+libs/ardour
+libs/pbd
+libs/gtkmm2ext
+libs/midi++2
+libs/evoral
+libs/panners
+libs/timecode
+libs/audiographer
+'
+
+if test x$DEBUG != x ; then
+
+       PACKAGE_SRC_DIR=$PACKAGE_DIR/src
+       echo "Copying source files to $PACKAGE_SRC_DIR ..."
+       mkdir -p $PACKAGE_SRC_DIR/libs
+       cp -r $BASE/gtk2_ardour $PACKAGE_SRC_DIR
+       for i in $SRC_DIRS;
+       do
+       cp -r -p $BASE/$i $PACKAGE_SRC_DIR/libs
+       done
+       
+       echo "Copying JACK utility programs to $PACKAGE_DIR ..."
+       cp $MINGW_ROOT/bin/jack_*.exe $PACKAGE_DIR
+
+       echo "Copying any debug files to $PACKAGE_DIR ..."
+       cp $MINGW_ROOT/bin/*.debug $PACKAGE_DIR
+
+       echo "Copying gdb to $PACKAGE_DIR ..."
+       cp $MINGW_ROOT/bin/gdb.exe $PACKAGE_DIR
+
+       echo "Copying .gdbinit to $PACKAGE_DIR ..."
+       cp $TOOLS_DIR/gdbinit $PACKAGE_DIR/.gdbinit
+
+       echo "Copying Gtk demo to $PACKAGE_DIR ..."
+       cp $MINGW_ROOT/bin/gtk-demo.exe $PACKAGE_DIR
+else
+       echo "Optimized build Stripping executable ..."
+       $STRIP $PACKAGE_DIR/ardour-3.0.exe
+       echo "Stripping libraries ..."
+       find $PACKAGE_DIR -type f -name "*.dll*" | xargs $STRIP
+fi
+
+if [ "$1" == "--tarball" ]; then
+       echo "Creating tarball from $PACKAGE_DIR ..."
+       cd $BASE || exit 1
+       tar -cvJf $PACKAGE_DIR.tar.xz $PACKAGE_DIR
+fi
+
+if [ "$1" == "--zip" ]; then
+       echo "Creating zip file from $PACKAGE_DIR ..."
+       cd $BASE || exit 1
+       zip -r $PACKAGE_DIR.zip $PACKAGE_DIR
+fi
diff --git a/tools/windows_packaging/pango.modules b/tools/windows_packaging/pango.modules
new file mode 100644 (file)
index 0000000..115c6a5
--- /dev/null
@@ -0,0 +1,35 @@
+# Pango Modules file
+# Automatically generated file, do not edit
+#
+# ModulesPath = Z:\usr\i686-pc-mingw32\sys-root\mingw\lib\pango\1.6.0\modules
+#
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-thai-fc.dll" ThaiScriptEngineFc PangoEngineShape PangoRenderFc thai:* lao:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-basic-win32.dll" BasicScriptEngineWin32 PangoEngineShape PangoRenderWin32 common:
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" devaScriptEngineFc PangoEngineShape PangoRenderFc devanagari:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" bengScriptEngineFc PangoEngineShape PangoRenderFc bengali:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" guruScriptEngineFc PangoEngineShape PangoRenderFc gurmukhi:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" gujrScriptEngineFc PangoEngineShape PangoRenderFc gujarati:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" oryaScriptEngineFc PangoEngineShape PangoRenderFc oriya:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" tamlScriptEngineFc PangoEngineShape PangoRenderFc tamil:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" teluScriptEngineFc PangoEngineShape PangoRenderFc telugu:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" kndaScriptEngineFc PangoEngineShape PangoRenderFc kannada:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" mlymScriptEngineFc PangoEngineShape PangoRenderFc malayalam:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-fc.dll" sinhScriptEngineFc PangoEngineShape PangoRenderFc sinhala:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-syriac-fc.dll" SyriacScriptEngineFc PangoEngineShape PangoRenderFc syriac:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-khmer-fc.dll" KhmerScriptEngineFc PangoEngineShape PangoRenderFc khmer:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-arabic-lang.dll" ArabicScriptEngineLang PangoEngineLang PangoRenderNone arabic:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-basic-fc.dll" BasicScriptEngineFc PangoEngineShape PangoRenderFc latin:* cyrillic:* greek:* armenian:* georgian:* runic:* ogham:* bopomofo:* cherokee:* coptic:* deseret:* ethiopic:* gothic:* han:* hiragana:* katakana:* old-italic:* canadian-aboriginal:* yi:* braille:* cypriot:* limbu:* osmanya:* shavian:* linear-b:* ugaritic:* glagolitic:* cuneiform:* phoenician:* common:
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-arabic-fc.dll" ArabicScriptEngineFc PangoEngineShape PangoRenderFc arabic:* nko:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" devaIndicScriptEngineLang PangoEngineLang PangoRenderNone devanagari:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" bengIndicScriptEngineLang PangoEngineLang PangoRenderNone bengali:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" guruIndicScriptEngineLang PangoEngineLang PangoRenderNone gurmukhi:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" gujrIndicScriptEngineLang PangoEngineLang PangoRenderNone gujarati:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" oryaIndicScriptEngineLang PangoEngineLang PangoRenderNone oriya:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" tamlIndicScriptEngineLang PangoEngineLang PangoRenderNone tamil:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" teluIndicScriptEngineLang PangoEngineLang PangoRenderNone telugu:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" kndaIndicScriptEngineLang PangoEngineLang PangoRenderNone kannada:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" mlymIndicScriptEngineLang PangoEngineLang PangoRenderNone malayalam:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-indic-lang.dll" sinhIndicScriptEngineLang PangoEngineLang PangoRenderNone sinhala:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-hebrew-fc.dll" HebrewScriptEngineFc PangoEngineShape PangoRenderFc hebrew:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-tibetan-fc.dll" TibetanScriptEngineFc PangoEngineShape PangoRenderFc tibetan:*
+"..\\..\\lib\\pango\\1.6.0\\modules\\pango-hangul-fc.dll" HangulScriptEngineFc PangoEngineShape PangoRenderFc hangul:*
diff --git a/tools/windows_packaging/print-env.sh b/tools/windows_packaging/print-env.sh
new file mode 100755 (executable)
index 0000000..d6f63a2
--- /dev/null
@@ -0,0 +1,40 @@
+echo "Build Environment Settings...."
+echo " "
+echo " "
+echo "HOST                : $HOST"
+echo "MINGW_ROOT          : $MINGW_ROOT"
+echo "PKG_CONFIG_PREFIX   : $PKG_CONFIG_PREFIX"
+echo "PKG_CONFIG_LIBDIR   : $PKG_CONFIG_LIBDIR"
+echo "PKGCONFIG           : $PKGCONFIG"
+echo "AR                  : $AR" 
+echo "RANLIB              : $RANLIB"
+echo "CC                  : $CC"
+echo "CPP                 : $CPP"
+echo "CXX                 : $CXX"
+echo "AS                  : $AS"
+echo "LINK_CC             : $LINK_CC"
+echo "LINK_CXX            : $LINK_CXX"
+echo "WINRC               : $WINRC"
+echo "STRIP               : $STRIP"
+echo " "
+echo " "
+echo "Path Environment Settings...."
+echo " "
+echo " "
+echo "BASE                : $BASE"
+echo "BUILD_DIR           : $BUILD_DIR"
+echo "BUILD_CACHE_FILE    : $BUILD_CACHE_FILE"
+echo "TOOLS_DIR           : $TOOLS_DIR"
+echo "PACKAGE_DIR         : $PACKAGE_DIR"
+echo " "
+echo " "
+echo "Config Environment Settings...."
+echo " "
+echo " "
+echo "APPNAME             : $APPNAME" 
+echo "VERSION             : $VERSION" 
+echo "DEBUG               : $DEBUG" 
+echo "WITH_TESTS          : $WITH_TESTS"
+echo "ARDOUR_DATA_DIR     : $ARDOUR_DATA_DIR"
+echo " "
+echo " "
diff --git a/tools/windows_packaging/run-wine.sh b/tools/windows_packaging/run-wine.sh
new file mode 100755 (executable)
index 0000000..8641520
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+cd $BASE
+
+LIBS=$BUILD_DIR/libs
+
+export ARDOUR_PATH=$BASE/gtk2_ardour/icons:$BASE/gtk2_ardour/pixmaps:$BASE/build/default/gtk2_ardour:$BASE/gtk2_ardour:.
+export ARDOUR_SURFACES_PATH=$LIBS/surfaces/osc:$LIBS/surfaces/generic_midi:$LIBS/surfaces/tranzport:$LIBS/surfaces/powermate:$LIBS/surfaces/mackie
+export ARDOUR_PANNER_PATH=$LIBS/panners/2in2out:$LIBS/panners/1in2out:$LIBS/panners/vbap
+export ARDOUR_DATA_PATH=$BASE/gtk2_ardour:build/default/gtk2_ardour:.
+
+export VAMP_PATH=$LIBS/vamp-plugins${VAMP_PATH:+:$VAMP_PATH}
+
+export PBD_TEST_PATH=$BASE/libs/pbd/test/
+
+if test ! -d $PACKAGE_DIR; then
+       echo "Win32 package directory does not exist"
+       exit 1
+fi
+
+cd $PACKAGE_DIR 
+
+
+if [ "$1" == "--run-tests" ]; then
+       if test x$WITH_TESTS != x ; then
+               echo "<<<<<<<<<<<<<<<<<<  RUNNING LIBPBD TESTS >>>>>>>>>>>>>>>>>>>"
+               wine pbd-run-tests.exe
+               echo "<<<<<<<<<<<<<<<<<<  RUNNING EVORAL TESTS >>>>>>>>>>>>>>>>>>>"
+               wine evoral-run-tests.exe
+               echo "<<<<<<<<<<<<<<<<<<  RUNNING ARDOUR TESTS >>>>>>>>>>>>>>>>>>>"
+               wine ardour-run-tests.exe
+       else
+               echo "No tests to run ..."
+       fi
+else
+        wine ardour-3.0.exe
+fi
diff --git a/tools/windows_packaging/startvm.sh b/tools/windows_packaging/startvm.sh
new file mode 100755 (executable)
index 0000000..de65be9
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+. mingw-env.sh
+
+qemu-kvm -smp 2 -m 1536 -hda $VIRT_IMAGE_PATH -net nic -net user -vga std -soundhw all
diff --git a/tools/windows_packaging/waf.sh b/tools/windows_packaging/waf.sh
new file mode 100755 (executable)
index 0000000..5b581ba
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+. ./mingw-env.sh
+
+cd $BASE || exit 1
+./waf "$@"
diff --git a/wscript b/wscript
index 2c63cab19c2cf1808d91df9218ec58ab6f9d1c8d..2840d454b4d370dea63236de3f21613db19bdc78 100644 (file)
--- a/wscript
+++ b/wscript
@@ -33,7 +33,6 @@ children = [
         'libs/timecode',
         'libs/ardour',
         'libs/gtkmm2ext',
-        'libs/clearlooks-newer',
         'libs/audiographer',
         'libs/canvas',
         'gtk2_ardour',
@@ -49,15 +48,6 @@ i18n_children = [
         'libs/gtkmm2ext',
 ]
 
-if sys.platform == 'linux2':
-    children += [ 'tools/sanity_check' ]
-    lxvst_default = True
-elif sys.platform == 'darwin':
-    children += [ 'libs/appleutility' ]
-    lxvst_default = False
-else:
-    lxvst_default = False
-
 # Version stuff
 
 def fetch_gcc_version (CC):
@@ -132,8 +122,9 @@ def set_compiler_flags (conf,opt):
         debug_flags = [ '-pg' ]
 
     if opt.backtrace:
-        if platform != 'darwin' and not is_clang:
-            debug_flags = [ '-rdynamic' ]
+        if opt.dist_target == 'auto':
+            if platform != 'darwin' and not is_clang:
+                debug_flags = [ '-rdynamic' ]
 
     # Autodetect
     if opt.dist_target == 'auto':
@@ -258,7 +249,7 @@ def set_compiler_flags (conf,opt):
         print("However, this is tricky and not recommended for beginners.")
         sys.exit (-1)
 
-    if opt.lxvst:
+    if conf.env['LXVST_SUPPORT'] == True:
         if conf.env['build_target'] == 'x86_64':
             conf.env.append_value('CXXFLAGS', "-DLXVST_64BIT")
         else:
@@ -416,7 +407,7 @@ def options(opt):
     opt.add_option('--depstack-root', type='string', default='~', dest='depstack_root',
                     help='Directory/folder where dependency stack trees (gtk, a3) can be found (defaults to ~)')
     opt.add_option('--dist-target', type='string', default='auto', dest='dist_target',
-                    help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,powerpc,tiger,leopard]')
+                    help='Specify the target for cross-compiling [auto,none,x86,i386,i686,x86_64,powerpc,tiger,leopard,mingw]')
     opt.add_option('--fpu-optimization', action='store_true', default=True, dest='fpu_optimization',
                     help='Build runtime checked assembler code (default)')
     opt.add_option('--no-fpu-optimization', action='store_false', dest='fpu_optimization')
@@ -434,7 +425,7 @@ def options(opt):
                     help='Compile with support for LV2 (if Lilv+Suil is available)')
     opt.add_option('--no-lv2', action='store_false', dest='lv2',
                     help='Do not compile with support for LV2')
-    opt.add_option('--lxvst', action='store_true', default=lxvst_default, dest='lxvst',
+    opt.add_option('--lxvst', action='store_true', default=True, dest='lxvst',
                     help='Compile with support for linuxVST plugins')
     opt.add_option('--nls', action='store_true', default=True, dest='nls',
                     help='Enable i18n (native language support) (default)')
@@ -617,13 +608,6 @@ def configure(conf):
 
     autowaf.check_header(conf, 'cxx', 'jack/session.h', define="JACK_SESSION", mandatory = False)
 
-    conf.check_cxx(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
-                  execute = "1",
-                  mandatory = True,
-                  msg = 'Checking for boost library >= 1.39',
-                  okmsg = 'ok',
-                  errmsg = 'too old\nPlease install boost version 1.39 or higher.')
-
     autowaf.check_pkg(conf, 'glib-2.0', uselib_store='GLIB', atleast_version='2.2')
     autowaf.check_pkg(conf, 'gthread-2.0', uselib_store='GTHREAD', atleast_version='2.2')
     autowaf.check_pkg(conf, 'glibmm-2.4', uselib_store='GLIBMM', atleast_version='2.32.0')
@@ -632,7 +616,32 @@ def configure(conf):
     autowaf.check_pkg(conf, 'libcurl', uselib_store='CURL', atleast_version='7.0.0')
     autowaf.check_pkg(conf, 'liblo', uselib_store='LO', atleast_version='0.26')
 
-    conf.check_cc(function_name='dlopen', header_name='dlfcn.h', lib='dl', uselib_store='DL')
+    if Options.options.dist_target == 'mingw':
+        Options.options.fpu_optimization = False
+        conf.env.append_value('CFLAGS', '-DPLATFORM_WINDOWS')
+        conf.env.append_value('CFLAGS', '-DCOMPILER_MINGW')
+        conf.env.append_value('CXXFLAGS', '-DPLATFORM_WINDOWS')
+        conf.env.append_value('CXXFLAGS', '-DCOMPILER_MINGW')
+        conf.env.append_value('LIB', 'pthreadGC2')
+        # needed for at least libsmf
+        conf.check_cc(function_name='htonl', header_name='winsock2.h', lib='ws2_32')
+        conf.env.append_value('LIB', 'ws2_32')
+        # needed for mingw64 packages, not harmful on normal mingw build
+        conf.env.append_value('LIB', 'intl')
+        conf.check_cc(function_name='regcomp', header_name='regex.h',
+                      lib='regex', uselib_store="REGEX", define_name='HAVE_REGEX_H')
+        # TODO put this only where it is needed
+        conf.env.append_value('LIB', 'regex')
+
+    if Options.options.dist_target != 'mingw':
+        conf.check_cc(function_name='dlopen', header_name='dlfcn.h', lib='dl', uselib_store='DL')
+
+        conf.check_cxx(fragment = "#include <boost/version.hpp>\nint main(void) { return (BOOST_VERSION >= 103900 ? 0 : 1); }\n",
+                      execute = "1",
+                      mandatory = True,
+                      msg = 'Checking for boost library >= 1.39',
+                      okmsg = 'ok',
+                      errmsg = 'too old\nPlease install boost version 1.39 or higher.')
 
     # Tell everyone that this is a waf build
 
@@ -662,8 +671,13 @@ def configure(conf):
         conf.env.append_value('CXXFLAGS', '-I' + Options.options.wine_include)
         autowaf.check_header(conf, 'cxx', 'windows.h', mandatory = True)
     if opts.lxvst:
-        conf.define('LXVST_SUPPORT', 1)
-        conf.env['LXVST_SUPPORT'] = True
+        if sys.platform == 'darwin':
+            conf.env['LXVST_SUPPORT'] = False
+        elif Options.options.dist_target == 'mingw':
+            conf.env['LXVST_SUPPORT'] = False
+       else:
+           conf.define('LXVST_SUPPORT', 1)
+           conf.env['LXVST_SUPPORT'] = True
     if bool(conf.env['JACK_SESSION']):
         conf.define('HAVE_JACK_SESSION', 1)
     conf.define('WINDOWS_KEY', opts.windows_key)
@@ -682,6 +696,14 @@ def configure(conf):
 
     set_compiler_flags (conf, Options.options)
 
+    if sys.platform == 'darwin':
+        sub_config_and_use(conf, 'libs/appleutility')
+    elif Options.options.dist_target != 'mingw':
+        sub_config_and_use(conf, 'tools/sanity_check')
+
+    if Options.options.dist_target != 'mingw':
+        sub_config_and_use(conf, 'libs/clearlooks-newer')
+
     for i in children:
         sub_config_and_use(conf, i)
 
@@ -764,6 +786,14 @@ def build(bld):
 
     autowaf.set_recursive()
 
+    if sys.platform == 'darwin':
+        bld.recurse('libs/appleutility')
+    elif bld.env['build_target'] != 'mingw':
+        bld.recurse('tools/sanity_check')
+
+    if bld.env['build_target'] != 'mingw':
+        bld.recurse('libs/clearlooks-newer')
+
     for i in children:
         bld.recurse(i)