added logarithmic option for waveform scaling. added save/restore of rectified and...
authorJesse Chappell <jesse@essej.net>
Sat, 16 Dec 2006 05:14:34 +0000 (05:14 +0000)
committerJesse Chappell <jesse@essej.net>
Sat, 16 Dec 2006 05:14:34 +0000 (05:14 +0000)
git-svn-id: svn://localhost/ardour2/trunk@1219 d708f5d6-7413-0410-9779-e7cbd77b26cf

15 files changed:
SConstruct
gtk2_ardour/audio_region_view.cc
gtk2_ardour/audio_region_view.h
gtk2_ardour/audio_streamview.cc
gtk2_ardour/audio_streamview.h
gtk2_ardour/audio_time_axis.cc
gtk2_ardour/audio_time_axis.h
gtk2_ardour/canvas-waveview.c
gtk2_ardour/canvas-waveview.h
gtk2_ardour/enums.h
gtk2_ardour/logmeter.h
gtk2_ardour/waveview.cc
gtk2_ardour/waveview.h
libs/libsndfile/SConscript
libs/libsndfile/configure

index 46cbfc74857736735da102979537538ad601c771..d9f6ebf6d0f5937c19b3fcf12a40867e86df8101 100644 (file)
@@ -502,10 +502,184 @@ libraries['midi++2'] = LibraryInfo (LIBS='midi++', LIBPATH='#libs/midi++2', CPPP
 libraries['pbd']    = LibraryInfo (LIBS='pbd', LIBPATH='#libs/pbd', CPPPATH='#libs/pbd')
 libraries['gtkmm2ext'] = LibraryInfo (LIBS='gtkmm2ext', LIBPATH='#libs/gtkmm2ext', CPPPATH='#libs/gtkmm2ext')
 
+
+# SCons should really do this for us
+
+conf = Configure (env)
+
+have_cxx = conf.TryAction (Action (str(env['CXX']) + ' --version'))
+if have_cxx[0] != 1:
+    print "This system has no functional C++ compiler. You cannot build Ardour from source without one."
+    sys.exit (1)
+else:
+    print "Congratulations, you have a functioning C++ compiler."
+
+env = conf.Finish()
+
+
+#
+# Compiler flags and other system-dependent stuff
+#
+
+opt_flags = []
+debug_flags = [ '-g' ]
+
+# guess at the platform, used to define compiler flags
+
+config_guess = os.popen("tools/config.guess").read()[:-1]
+
+config_cpu = 0
+config_arch = 1
+config_kernel = 2
+config_os = 3
+config = config_guess.split ("-")
+
+print "system triple: " + config_guess
+
+# Autodetect
+if env['DIST_TARGET'] == 'auto':
+    if config[config_arch] == 'apple':
+        # The [.] matches to the dot after the major version, "." would match any character
+        if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
+            env['DIST_TARGET'] = 'panther'
+        else:
+            env['DIST_TARGET'] = 'tiger'
+    else:
+        if re.search ("x86_64", config[config_cpu]) != None:
+            env['DIST_TARGET'] = 'x86_64'
+        elif re.search("i[0-5]86", config[config_cpu]) != None:
+            env['DIST_TARGET'] = 'i386'
+        elif re.search("powerpc", config[config_cpu]) != None:
+            env['DIST_TARGET'] = 'powerpc'
+        else:
+            env['DIST_TARGET'] = 'i686'
+    print "\n*******************************"
+    print "detected DIST_TARGET = " + env['DIST_TARGET']
+    print "*******************************\n"
+
+
+if config[config_cpu] == 'powerpc' and env['DIST_TARGET'] != 'none':
+    #
+    # Apple/PowerPC optimization options
+    #
+    # -mcpu=7450 does not reliably work with gcc 3.*
+    #
+    if env['DIST_TARGET'] == 'panther' or env['DIST_TARGET'] == 'tiger':
+        if config[config_arch] == 'apple':
+            opt_flags.extend ([ "-mcpu=7450", "-faltivec"])
+        else:
+            opt_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec"])
+    else:
+        opt_flags.extend([ "-mcpu=750", "-mmultiple" ])
+    opt_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
+
+elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and env['DIST_TARGET'] != 'none':
+    
+    build_host_supports_sse = 0
+    
+    debug_flags.append ("-DARCH_X86")
+    opt_flags.append ("-DARCH_X86")
+    
+    if config[config_kernel] == 'linux' :
+        
+        if env['DIST_TARGET'] != 'i386':
+            
+            flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
+            x86_flags = flag_line.split (": ")[1:][0].split (' ')
+            
+            if "mmx" in x86_flags:
+                opt_flags.append ("-mmmx")
+            if "sse" in x86_flags:
+                build_host_supports_sse = 1
+            if "3dnow" in x86_flags:
+                opt_flags.append ("-m3dnow")
+            
+            if config[config_cpu] == "i586":
+                opt_flags.append ("-march=i586")
+            elif config[config_cpu] == "i686":
+                opt_flags.append ("-march=i686")
+    
+    if ((env['DIST_TARGET'] == 'i686') or (env['DIST_TARGET'] == 'x86_64')) and build_host_supports_sse:
+        opt_flags.extend (["-msse", "-mfpmath=sse"])
+        debug_flags.extend (["-msse", "-mfpmath=sse"])
+# end of processor-specific section
+
+# optimization section
+if env['FPU_OPTIMIZATION']:
+    if env['DIST_TARGET'] == 'tiger':
+        opt_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS")
+        debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS")
+        libraries['core'].Append(LINKFLAGS= '-framework Accelerate')
+    elif env['DIST_TARGET'] == 'i686' or env['DIST_TARGET'] == 'x86_64':
+        opt_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
+        debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
+        if env['DIST_TARGET'] == 'x86_64':
+            opt_flags.append ("-DUSE_X86_64_ASM")
+            debug_flags.append ("-DUSE_X86_64_ASM")
+        if build_host_supports_sse != 1:
+            print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
+# end optimization section
+
+#
+# save off guessed arch element in an env
+#
+env.Append(CONFIG_ARCH=config[config_arch])
+
+
+#
+# ARCH="..." overrides all
+#
+
+if env['ARCH'] != '':
+    opt_flags = env['ARCH'].split()
+
+#
+# prepend boiler plate optimization flags
+#
+
+opt_flags[:0] = [
+    "-O3",
+    "-fomit-frame-pointer",
+    "-ffast-math",
+    "-fstrength-reduce"
+    ]
+
+if env['DEBUG'] == 1:
+    env.Append(CCFLAGS=" ".join (debug_flags))
+else:
+    env.Append(CCFLAGS=" ".join (opt_flags))
+
+#
+# warnings flags
+#
+
+env.Append(CCFLAGS="-Wall")
+env.Append(CXXFLAGS="-Woverloaded-virtual")
+
+if env['EXTRA_WARN']:
+    env.Append(CCFLAGS="-Wextra -pedantic")
+    env.Append(CXXFLAGS="-ansi")
+
+if env['LIBLO']:
+    env.Append(CCFLAGS="-DHAVE_LIBLO")
+
+
+#
+# fix scons nitpickiness on APPLE
+#
+
+
+def prep_libcheck(topenv, libinfo):
+    if topenv['DIST_TARGET'] == 'panther' or topenv['DIST_TARGET'] == 'tiger':
+        libinfo.Append(CCFLAGS="-I/opt/local/include", LINKFLAGS="-L/opt/local/lib")
+
+prep_libcheck(env, env)
+
 #
 # Check for libusb
 
 libraries['usb'] = LibraryInfo ()
+prep_libcheck(env, libraries['usb'])
 
 conf = Configure (libraries['usb'])
 if conf.CheckLib ('usb', 'usb_interrupt_write'):
@@ -519,6 +693,8 @@ libraries['usb'] = conf.Finish ()
 # Check for FLAC
 
 libraries['flac'] = LibraryInfo ()
+prep_libcheck(env, libraries['flac'])
+libraries['flac'].Append(CCFLAGS="-I/usr/local/include", LINKFLAGS="-L/usr/local/lib")
 
 conf = Configure (libraries['flac'])
 conf.CheckLib ('FLAC', 'FLAC__stream_decoder_new', language='CXX')
@@ -530,6 +706,8 @@ libraries['flac'] = conf.Finish ()
 # boost (we don't link against boost, just use some header files)
 
 libraries['boost'] = LibraryInfo ()
+prep_libcheck(env, libraries['boost'])
+libraries['boost'].Append(CCFLAGS="-I/usr/local/include", LINKFLAGS="-L/usr/local/lib")
 conf = Configure (libraries['boost'])
 if conf.CheckHeader ('boost/shared_ptr.hpp', language='CXX') == False:
         print "Boost header files do not appear to be installed."
@@ -542,7 +720,8 @@ libraries['boost'] = conf.Finish ()
 
 if env['LIBLO']:
     libraries['lo'] = LibraryInfo ()
-    
+    prep_libcheck(env, libraries['lo'])
+
     conf = Configure (libraries['lo'])
     if conf.CheckLib ('lo', 'lo_server_new') == False:
         print "liblo does not appear to be installed."
@@ -554,6 +733,7 @@ if env['LIBLO']:
 # Check for dmalloc
 
 libraries['dmalloc'] = LibraryInfo ()
+prep_libcheck(env, libraries['dmalloc'])
 
 #
 # look for the threaded version
@@ -794,177 +974,12 @@ else:
 
 config_prefix = '$DESTDIR' + final_config_prefix
 
-# SCons should really do this for us
-
-conf = Configure (env)
-
-have_cxx = conf.TryAction (Action (str(env['CXX']) + ' --version'))
-if have_cxx[0] != 1:
-    print "This system has no functional C++ compiler. You cannot build Ardour from source without one."
-    sys.exit (1)
-else:
-    print "Congratulations, you have a functioning C++ compiler."
-
-env = conf.Finish()
-
-#
-# Compiler flags and other system-dependent stuff
-#
-
-opt_flags = []
-debug_flags = [ '-g' ]
-
-# guess at the platform, used to define compiler flags
-
-config_guess = os.popen("tools/config.guess").read()[:-1]
-
-config_cpu = 0
-config_arch = 1
-config_kernel = 2
-config_os = 3
-config = config_guess.split ("-")
-
-print "system triple: " + config_guess
-
-# Autodetect
-if env['DIST_TARGET'] == 'auto':
-    if config[config_arch] == 'apple':
-        # The [.] matches to the dot after the major version, "." would match any character
-        if re.search ("darwin[0-7][.]", config[config_kernel]) != None:
-            env['DIST_TARGET'] = 'panther'
-        else:
-            env['DIST_TARGET'] = 'tiger'
-    else:
-        if re.search ("x86_64", config[config_cpu]) != None:
-            env['DIST_TARGET'] = 'x86_64'
-        elif re.search("i[0-5]86", config[config_cpu]) != None:
-            env['DIST_TARGET'] = 'i386'
-        elif re.search("powerpc", config[config_cpu]) != None:
-            env['DIST_TARGET'] = 'powerpc'
-        else:
-            env['DIST_TARGET'] = 'i686'
-    print "\n*******************************"
-    print "detected DIST_TARGET = " + env['DIST_TARGET']
-    print "*******************************\n"
-
-
-if config[config_cpu] == 'powerpc' and env['DIST_TARGET'] != 'none':
-    #
-    # Apple/PowerPC optimization options
-    #
-    # -mcpu=7450 does not reliably work with gcc 3.*
-    #
-    if env['DIST_TARGET'] == 'panther' or env['DIST_TARGET'] == 'tiger':
-        if config[config_arch] == 'apple':
-            opt_flags.extend ([ "-mcpu=7450", "-faltivec"])
-        else:
-            opt_flags.extend ([ "-mcpu=7400", "-maltivec", "-mabi=altivec"])
-    else:
-        opt_flags.extend([ "-mcpu=750", "-mmultiple" ])
-    opt_flags.extend (["-mhard-float", "-mpowerpc-gfxopt"])
-
-elif ((re.search ("i[0-9]86", config[config_cpu]) != None) or (re.search ("x86_64", config[config_cpu]) != None)) and env['DIST_TARGET'] != 'none':
-    
-    build_host_supports_sse = 0
-    
-    debug_flags.append ("-DARCH_X86")
-    opt_flags.append ("-DARCH_X86")
-    
-    if config[config_kernel] == 'linux' :
-        
-        if env['DIST_TARGET'] != 'i386':
-            
-            flag_line = os.popen ("cat /proc/cpuinfo | grep '^flags'").read()[:-1]
-            x86_flags = flag_line.split (": ")[1:][0].split (' ')
-            
-            if "mmx" in x86_flags:
-                opt_flags.append ("-mmmx")
-            if "sse" in x86_flags:
-                build_host_supports_sse = 1
-            if "3dnow" in x86_flags:
-                opt_flags.append ("-m3dnow")
-            
-            if config[config_cpu] == "i586":
-                opt_flags.append ("-march=i586")
-            elif config[config_cpu] == "i686":
-                opt_flags.append ("-march=i686")
-    
-    if ((env['DIST_TARGET'] == 'i686') or (env['DIST_TARGET'] == 'x86_64')) and build_host_supports_sse:
-        opt_flags.extend (["-msse", "-mfpmath=sse"])
-        debug_flags.extend (["-msse", "-mfpmath=sse"])
-# end of processor-specific section
-
-# optimization section
-if env['FPU_OPTIMIZATION']:
-    if env['DIST_TARGET'] == 'tiger':
-        opt_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS")
-        debug_flags.append ("-DBUILD_VECLIB_OPTIMIZATIONS")
-        libraries['core'].Append(LINKFLAGS= '-framework Accelerate')
-    elif env['DIST_TARGET'] == 'i686' or env['DIST_TARGET'] == 'x86_64':
-        opt_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
-        debug_flags.append ("-DBUILD_SSE_OPTIMIZATIONS")
-        if env['DIST_TARGET'] == 'x86_64':
-            opt_flags.append ("-DUSE_X86_64_ASM")
-            debug_flags.append ("-DUSE_X86_64_ASM")
-        if build_host_supports_sse != 1:
-            print "\nWarning: you are building Ardour with SSE support even though your system does not support these instructions. (This may not be an error, especially if you are a package maintainer)"
-# end optimization section
-
-#
-# save off guessed arch element in an env
-#
-env.Append(CONFIG_ARCH=config[config_arch])
-
-
-#
-# ARCH="..." overrides all
-#
-
-if env['ARCH'] != '':
-    opt_flags = env['ARCH'].split()
-
-#
-# prepend boiler plate optimization flags
-#
-
-opt_flags[:0] = [
-    "-O3",
-    "-fomit-frame-pointer",
-    "-ffast-math",
-    "-fstrength-reduce"
-    ]
-
-if env['DEBUG'] == 1:
-    env.Append(CCFLAGS=" ".join (debug_flags))
-else:
-    env.Append(CCFLAGS=" ".join (opt_flags))
-
-#
-# warnings flags
-#
-
-env.Append(CCFLAGS="-Wall")
-env.Append(CXXFLAGS="-Woverloaded-virtual")
-
-if env['EXTRA_WARN']:
-    env.Append(CCFLAGS="-Wextra -pedantic")
-    env.Append(CXXFLAGS="-ansi")
-
-if env['LIBLO']:
-    env.Append(CCFLAGS="-DHAVE_LIBLO")
-
 #
 # everybody needs this
 #
 
 env.Merge ([ libraries['core'] ])
 
-#
-# fix scons nitpickiness on APPLE
-#
-
-if env['DIST_TARGET'] == 'panther' or env['DIST_TARGET'] == 'tiger':
-    env.Append(CCFLAGS="-I/opt/local/include", LINKFLAGS="-L/opt/local/lib")
 
 #
 # i18n support
index dd2f972970081081ff14d6d9b5902455506bc834..02debbaf8abf02bf9a121504a654962819a7c531 100644 (file)
@@ -851,6 +851,8 @@ AudioRegionView::create_one_wave (uint32_t which, bool direct)
        wave->property_amplitude_above_axis() =  _amplitude_above_axis;
        wave->property_wave_color() = _region->muted() ? color_map[cMutedWaveForm] : color_map[cWaveForm];
        wave->property_region_start() = _region->start();
+       wave->property_rectified() = (bool) (_flags & WaveformRectified);
+       wave->property_logscaled() = (bool) (_flags & WaveformLogScaled);
 
        if (!(_flags & WaveformVisible)) {
                wave->hide();
@@ -965,6 +967,8 @@ AudioRegionView::store_flags()
 
        node->add_property ("waveform-visible", (_flags & WaveformVisible) ? "yes" : "no");
        node->add_property ("envelope-visible", (_flags & EnvelopeVisible) ? "yes" : "no");
+       node->add_property ("waveform-rectified", (_flags & WaveformRectified) ? "yes" : "no");
+       node->add_property ("waveform-logscaled", (_flags & WaveformLogScaled) ? "yes" : "no");
 
        _region->add_extra_xml (*node);
 }
@@ -985,6 +989,18 @@ AudioRegionView::set_flags (XMLNode* node)
                        _flags |= EnvelopeVisible;
                }
        }
+
+       if ((prop = node->property ("waveform-rectified")) != 0) {
+               if (prop->value() == "yes") {
+                       _flags |= WaveformRectified;
+               }
+       }
+
+       if ((prop = node->property ("waveform-logscaled")) != 0) {
+               if (prop->value() == "yes") {
+                       _flags |= WaveformLogScaled;
+               }
+       }
 }
        
 void
@@ -1024,9 +1040,30 @@ AudioRegionView::set_waveform_shape (WaveformShape shape)
                } else {
                        _flags &= ~WaveformRectified;
                }
+               store_flags ();
+       }
+}
+
+void
+AudioRegionView::set_waveform_scale (WaveformScale scale)
+{
+       bool yn = (scale == LogWaveform);
+
+       if (yn != (bool) (_flags & WaveformLogScaled)) {
+               for (vector<WaveView *>::iterator wave = waves.begin(); wave != waves.end() ; ++wave) {
+                       (*wave)->property_logscaled() = yn;
+               }
+
+               if (yn) {
+                       _flags |= WaveformLogScaled;
+               } else {
+                       _flags &= ~WaveformLogScaled;
+               }
+               store_flags ();
        }
 }
 
+
 GhostRegion*
 AudioRegionView::add_ghost (AutomationTimeAxisView& atv)
 {
index 0ced1aca55b87fe51fd9550243c9e92b81f5be18..3c46e906df4f0aa20f3fe2cd5347a986f93eacb1 100644 (file)
@@ -72,8 +72,10 @@ class AudioRegionView : public RegionView
        void set_envelope_visible (bool);
        void set_waveform_visible (bool yn);
        void set_waveform_shape (WaveformShape);
+       void set_waveform_scale (WaveformScale);
        
        bool waveform_rectified() const { return _flags & WaveformRectified; }
+       bool waveform_logscaled() const { return _flags & WaveformLogScaled; }
        bool waveform_visible()   const { return _flags & WaveformVisible; }
        bool envelope_visible()   const { return _flags & EnvelopeVisible; }
        
@@ -116,7 +118,8 @@ class AudioRegionView : public RegionView
     enum Flags {
            EnvelopeVisible = 0x1,
            WaveformVisible = 0x4,
-           WaveformRectified = 0x8
+           WaveformRectified = 0x8,
+           WaveformLogScaled = 0x10,
     };
     
     void reset_fade_shapes ();
index 185a961064bd6f3116d5c90daf1545b3e9a9c358..d5760c7bb68d550cc2a42671d369b3cfd6169581 100644 (file)
@@ -383,7 +383,47 @@ AudioStreamView::set_waveform_shape (WaveformShape shape)
                        arv->set_waveform_shape (shape);
        }
 }              
-               
+
+WaveformShape
+AudioStreamView::get_waveform_shape () const
+{
+       // assumes that the first represents all for our purposes
+
+       if (region_views.size() > 0) {
+               AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(region_views.front());
+               if (arv) {
+                       if (arv->waveform_rectified())
+                               return Rectified;
+               }
+       }
+       return Traditional;
+}
+
+void
+AudioStreamView::set_waveform_scale (WaveformScale scale)
+{
+       for (RegionViewList::iterator i = region_views.begin(); i != region_views.end(); ++i) {
+               AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(*i);
+               if (arv)
+                       arv->set_waveform_scale (scale);
+       }
+}              
+
+WaveformScale
+AudioStreamView::get_waveform_scale () const
+{
+       // assumes that the first represents all for our purposes
+
+       if (region_views.size() > 0) {
+               AudioRegionView* const arv = dynamic_cast<AudioRegionView*>(region_views.front());
+               if (arv) {
+                       if (arv->waveform_logscaled())
+                               return LogWaveform;
+               }
+       }
+       return LinearWaveform;
+}
+
 void
 AudioStreamView::setup_rec_box ()
 {
index c6db40f336bd54837d5ad7a22a3af1ffcf25bfb7..ed9c8b7f7f51a6e54cef1d662565f8994c813e8e 100644 (file)
@@ -59,6 +59,9 @@ class AudioStreamView : public StreamView
        ~AudioStreamView ();
 
        void set_waveform_shape (WaveformShape);
+       WaveformShape get_waveform_shape () const;
+       void set_waveform_scale (WaveformScale);
+       WaveformScale get_waveform_scale () const;
 
        int set_height (gdouble h);
        int set_samples_per_unit (gdouble spp);
index 45c8700a6a78a95dee7087829e2734dbe59b789a..81ef046eebb8f336e8df7c593339b8b7e4514dc3 100644 (file)
@@ -253,14 +253,40 @@ AudioTimeAxisView::append_extra_display_menu_items ()
        waveform_item->set_active (editor.show_waveforms());
        ignore_toggle = false;
 
+       waveform_items.push_back (SeparatorElem());
+       
        RadioMenuItem::Group group;
-
+       
        waveform_items.push_back (RadioMenuElem (group, _("Traditional"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Traditional)));
        traditional_item = static_cast<RadioMenuItem *> (&waveform_items.back());
 
        waveform_items.push_back (RadioMenuElem (group, _("Rectified"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_shape), Rectified)));
        rectified_item = static_cast<RadioMenuItem *> (&waveform_items.back());
 
+       waveform_items.push_back (SeparatorElem());
+       
+       RadioMenuItem::Group group2;
+
+       waveform_items.push_back (RadioMenuElem (group2, _("Linear"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_scale), LinearWaveform)));
+       linearscale_item = static_cast<RadioMenuItem *> (&waveform_items.back());
+
+       waveform_items.push_back (RadioMenuElem (group2, _("Logarithmic"), bind (mem_fun(*this, &AudioTimeAxisView::set_waveform_scale), LogWaveform)));
+       logscale_item = static_cast<RadioMenuItem *> (&waveform_items.back());
+
+       // setting initial item state
+       AudioStreamView* asv = audio_view();
+       if (asv) {
+               ignore_toggle = true;
+               if (asv->get_waveform_shape() == Rectified) 
+                       rectified_item->set_active(true);
+               else traditional_item->set_active(true);
+
+               if (asv->get_waveform_scale() == LogWaveform) 
+                       logscale_item->set_active(true);
+               else linearscale_item->set_active(true);
+               ignore_toggle = false;
+       }
+
        items.push_back (MenuElem (_("Waveform"), *waveform_menu));
 }
 
@@ -303,13 +329,25 @@ AudioTimeAxisView::set_waveform_shape (WaveformShape shape)
 {
        AudioStreamView* asv = audio_view();
 
-       if (asv) {
+       if (asv && !ignore_toggle) {
                asv->set_waveform_shape (shape);
        }
 
        map_frozen ();
 }      
 
+void
+AudioTimeAxisView::set_waveform_scale (WaveformScale scale)
+{
+       AudioStreamView* asv = audio_view();
+
+       if (asv && !ignore_toggle) {
+               asv->set_waveform_scale (scale);
+       }
+
+       map_frozen ();
+}      
+
 void
 AudioTimeAxisView::add_gain_automation_child ()
 {
index 2162771285c32f915c2a45baedcaa2cfdd9884a1..95bd8c0955f86d268060d3545b6f7c2f0b1e21a7 100644 (file)
@@ -98,6 +98,7 @@ class AudioTimeAxisView : public RouteTimeAxisView
        void toggle_show_waveforms ();
        void set_waveform_shape (WaveformShape);
        void toggle_waveforms ();
+       void set_waveform_scale (WaveformScale);
 
        void show_all_automation ();
        void show_existing_automation ();
@@ -125,6 +126,8 @@ class AudioTimeAxisView : public RouteTimeAxisView
        Gtk::CheckMenuItem* waveform_item;
        Gtk::RadioMenuItem* traditional_item;
        Gtk::RadioMenuItem* rectified_item;
+       Gtk::RadioMenuItem* linearscale_item;
+       Gtk::RadioMenuItem* logscale_item;
        Gtk::CheckMenuItem* gain_automation_item;
        Gtk::CheckMenuItem* pan_automation_item;
 };
index 080f6871fa1705bb6f1d9231a17fb8881365400c..747761ea9ae887e6fb1dfb5425580f5aa535ce3d 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <ardour/dB.h>
 
+#include "logmeter.h"
 #include "canvas-waveview.h"
 #include "rgb_macros.h"
 
@@ -49,7 +50,8 @@ enum {
         PROP_HEIGHT,
         PROP_WAVE_COLOR,
         PROP_RECTIFIED,
-        PROP_REGION_START
+        PROP_REGION_START,
+        PROP_LOGSCALED,
 };
 
 static void gnome_canvas_waveview_class_init     (GnomeCanvasWaveViewClass *class);
@@ -253,6 +255,13 @@ gnome_canvas_waveview_class_init (GnomeCanvasWaveViewClass *class)
                  g_param_spec_boolean ("rectified", NULL, NULL,
                                        FALSE,
                                        (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+
+        g_object_class_install_property
+                (gobject_class,
+                 PROP_LOGSCALED,
+                 g_param_spec_boolean ("logscaled", NULL, NULL,
+                                       FALSE,
+                                       (G_PARAM_READABLE | G_PARAM_WRITABLE)));
         
         g_object_class_install_property
                 (gobject_class,
@@ -308,6 +317,7 @@ gnome_canvas_waveview_init (GnomeCanvasWaveView *waveview)
        waveview->gain_curve_function = NULL;
        waveview->gain_src = NULL;
        waveview->rectified = FALSE;
+       waveview->logscaled = FALSE;
        waveview->region_start = 0;
        waveview->samples_per_unit = 1.0;
        waveview->amplitude_above_axis = 1.0;
@@ -577,7 +587,29 @@ gnome_canvas_waveview_ensure_cache (GnomeCanvasWaveView *waveview, gulong start_
                free (gain);
        
        }
+
+       /* do optional log scaling.  this implementation is not particularly efficient */
        
+       if (waveview->logscaled) {
+               guint32 n;
+               GnomeCanvasWaveViewCacheEntry* buf = cache->data;
+               
+               for (n = 0; n < cache->data_size; ++n) {
+
+                       if (buf[n].max > 0.0f) {
+                               buf[n].max = alt_log_meter(coefficient_to_dB(buf[n].max));
+                       } else if (buf[n].max < 0.0f) {
+                               buf[n].max = -alt_log_meter(coefficient_to_dB(-buf[n].max));
+                       }
+                       
+                       if (buf[n].min > 0.0f) {
+                               buf[n].min = alt_log_meter(coefficient_to_dB(buf[n].min));
+                       } else if (buf[n].min < 0.0f) {
+                               buf[n].min = -alt_log_meter(coefficient_to_dB(-buf[n].min));
+                       }
+               }
+       }
+
        cache->start = ostart;
        cache->end = new_cache_end;
 
@@ -770,6 +802,17 @@ gnome_canvas_waveview_set_property (GObject      *object,
                        redraw = TRUE;
                }
                break;
+       case PROP_LOGSCALED:
+               if (waveview->logscaled != g_value_get_boolean(value)) {
+                       waveview->logscaled = g_value_get_boolean(value);
+                       if (waveview->cache_updater) {
+                               waveview->cache->start = 0;
+                               waveview->cache->end = 0;
+                       }
+                       redraw = TRUE;
+                       calc_bounds = TRUE;
+               }
+               break;
        case PROP_REGION_START:
                waveview->region_start = g_value_get_uint(value);
                redraw = TRUE;
@@ -869,6 +912,10 @@ gnome_canvas_waveview_get_property (GObject      *object,
                g_value_set_boolean (value, waveview->rectified);
                break;
 
+       case PROP_LOGSCALED:
+               g_value_set_boolean (value, waveview->logscaled);
+               break;
+
        case PROP_REGION_START:
                g_value_set_uint (value, waveview->region_start);
                break;
index 75281f69ebb5d80752e000361e0e445c29dc388d..81cf35910ee72ed6b04bdfbb6e85dab2eb03187d 100644 (file)
@@ -101,7 +101,8 @@ struct _GnomeCanvasWaveView
     uint32_t wave_color;
 
     char rectified;
-
+    char logscaled; 
+       
     /* These are updated by the update() routine
        to optimize the render() routine, which may
        be called several times after a single update().
index 15ba8743664c398a927a74eb71dc8ce4e97698e9..5b097d059a056bf8d6ce7bae3cfe2480f51383f7 100644 (file)
@@ -8,6 +8,11 @@ enum WaveformShape {
        Rectified
 };
 
+enum WaveformScale {
+       LinearWaveform=0,
+       LogWaveform,
+};
+
 
 enum Width {
        Wide,
index f7ed1dd2be2fc3f2580f34af9395712dd59fbee8..8d9f0b9d8278701ad86d9662efbbe23350a92a26 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef __ardour_gtk_log_meter_h__
 #define __ardour_gtk_log_meter_h__
 
-#if 0
+#if 1
 inline float
 _log_meter (float power, double lower_db, double upper_db, double non_linearity)
 {
@@ -9,7 +9,7 @@ _log_meter (float power, double lower_db, double upper_db, double non_linearity)
 }
 
 inline float
-log_meter (float power)
+alt_log_meter (float power)
 {
        return _log_meter (power, -192.0, 0.0, 8.0);
 }
index 05cc97701d1e680a1d15d478feb075820dd11279..92e4fdd24a4bb6192952c162850ba747c3993308 100644 (file)
@@ -268,6 +268,14 @@ Glib::PropertyProxy_ReadOnly<guint> WaveView::property_region_start() const
 {
        return Glib::PropertyProxy_ReadOnly<guint> (this, "region_start");
 }
+Glib::PropertyProxy<gint> WaveView::property_logscaled()
+{
+       return Glib::PropertyProxy<gint> (this, "logscaled");
+}
+Glib::PropertyProxy_ReadOnly<gint> WaveView::property_logscaled() const
+{
+       return Glib::PropertyProxy_ReadOnly<gint> (this, "logscaled");
+}
 
 } // namespace Canvas
 
index 15efbbcef5a694fa776228790ae039fdd1b8ad98..56d0ed76753b9c178184c4b1984307584fc69222 100644 (file)
@@ -147,6 +147,8 @@ public:
   Glib::PropertyProxy_ReadOnly<gint> property_rectified() const;
   Glib::PropertyProxy<guint> property_region_start();
   Glib::PropertyProxy_ReadOnly<guint> property_region_start() const;
+  Glib::PropertyProxy<gint> property_logscaled();
+  Glib::PropertyProxy_ReadOnly<gint> property_logscaled() const;
 };
 
 } /* namespace Canvas */
index f8e9fc5ecbbe379b9a93889c66ac19922186f1c5..5817397e9546da7feb5db5279a9f70de5a44b0d3 100644 (file)
@@ -6,8 +6,9 @@ import glob
 
 sndfile_files = glob.glob('src/*.c') + glob.glob('src/GSM610/*.c') + glob.glob('src/G72x/*.c')
 
-Import('env install_prefix')
+Import('env install_prefix libraries')
 sndfile = env.Copy()
+sndfile.Merge([libraries['flac'] ])
 
 domain = 'libsndfile'
 
index 8aaca4e783e806bb62289cc6c82ac1c87cd48f8f..bfa95c3aac1dda0a09d55888958f5a97052b2cd2 100755 (executable)
@@ -12235,9 +12235,17 @@ rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>conftest.er1
   ac_status=$?
+  cat conftest.$ac_ext > blah1.c
+
+  echo $CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext > blah1
+
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
+  
+  cat conftest.err > blah2
+  
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } &&
         { ac_try='test -z "$ac_c_werror_flag"