~ubuntu-branches/ubuntu/oneiric/gmerlin/oneiric

« back to all changes in this revision

Viewing changes to lib/gtk/vumeter.c

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2010-03-20 10:53:50 UTC
  • mfrom: (1.1.3 upstream) (3.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100320105350-ny481yhh3v12bnuo
* New upstream release. 
Closes: #573833
* Bumped standards-version.
* Bumped build-dep on libgavl.
* Refreshed patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************
2
2
 * gmerlin - a general purpose multimedia framework and applications
3
3
 *
4
 
 * Copyright (c) 2001 - 2008 Members of the Gmerlin project
 
4
 * Copyright (c) 2001 - 2010 Members of the Gmerlin project
5
5
 * gmerlin-general@lists.sourceforge.net
6
6
 * http://gmerlin.sourceforge.net
7
7
 *
686
686
static void draw_dynamic(bg_gtk_vumeter_t * m)
687
687
  {
688
688
  int i;
 
689
 
 
690
  if(!GTK_WIDGET_REALIZED(m->layout) || !m->pixmap_width || !m->pixmap_height)
 
691
    return;
 
692
  
689
693
  if(!m->pixmaps_valid)
690
694
    update_pixmaps(m);
691
695
 
858
862
  m->num_channels = format->num_channels;
859
863
  }
860
864
 
861
 
void bg_gtk_vumeter_update(bg_gtk_vumeter_t * m,
862
 
                           gavl_audio_frame_t * frame)
 
865
void bg_gtk_vumeter_update_peak(bg_gtk_vumeter_t * m,
 
866
                                double * ampl, int samples)
863
867
  {
864
868
  int i;
865
 
  double ampl[GAVL_MAX_CHANNELS];
866
 
  gavl_peak_detector_reset(m->pd);
867
 
  gavl_peak_detector_update(m->pd, frame);
868
 
  gavl_peak_detector_get_peaks(m->pd, (double*)0, (double*)0, ampl);
869
869
  
870
870
  for(i = 0; i < m->num_channels; i++)
871
871
    {
883
883
        m->meters[i].peak_age = 0;
884
884
        }
885
885
      else
886
 
        m->meters[i].peak_age += frame->valid_samples;
 
886
        m->meters[i].peak_age += samples;
887
887
      }
888
888
    else /* Lowpass */
889
889
      {
895
895
        m->meters[i].peak_age = 0;
896
896
        }
897
897
      else
898
 
        m->meters[i].peak_age += frame->valid_samples;
 
898
        m->meters[i].peak_age += samples;
899
899
      }
900
900
    }
901
901
  
903
903
  draw_dynamic(m);
904
904
  }
905
905
 
 
906
void bg_gtk_vumeter_update(bg_gtk_vumeter_t * m,
 
907
                           gavl_audio_frame_t * frame)
 
908
  {
 
909
  double ampl[GAVL_MAX_CHANNELS];
 
910
  gavl_peak_detector_reset(m->pd);
 
911
  gavl_peak_detector_update(m->pd, frame);
 
912
  gavl_peak_detector_get_peaks(m->pd, (double*)0, (double*)0, ampl);
 
913
  bg_gtk_vumeter_update_peak(m, ampl, frame->valid_samples);
 
914
  }
 
915
 
906
916
void bg_gtk_vumeter_draw(bg_gtk_vumeter_t * m)
907
917
  {
908
918
  pthread_mutex_lock(&(m->analysis_mutex));