commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r4147 - gnuradio/branches/developers/brickle/jack/gr-a


From: eb
Subject: [Commit-gnuradio] r4147 - gnuradio/branches/developers/brickle/jack/gr-audio-jack/src
Date: Mon, 18 Dec 2006 18:14:44 -0700 (MST)

Author: eb
Date: 2006-12-18 18:14:44 -0700 (Mon, 18 Dec 2006)
New Revision: 4147

Added:
   gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.cc
   gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.h
Modified:
   gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/Makefile.am
Log:
beginning of connection manager for jack

Modified: 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/Makefile.am     
2006-12-18 21:33:02 UTC (rev 4146)
+++ gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/Makefile.am     
2006-12-19 01:14:44 UTC (rev 4147)
@@ -59,11 +59,13 @@
 
 _audio_jack_la_SOURCES =               \
        audio_jack.cc                   \
+       audio_jack_mgr.cc               \
        audio_jack_sink.cc              \
        audio_jack_source.cc            \
        gri_jack.cc                     
 
 grinclude_HEADERS =                    \
+       audio_jack_mgr.h                \
        audio_jack_sink.h               \
        audio_jack_source.h             
 

Added: 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.cc
===================================================================
--- 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.cc   
                            (rev 0)
+++ 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.cc   
    2006-12-19 01:14:44 UTC (rev 4147)
@@ -0,0 +1,61 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <audio_jack_mgr.h>
+#include <boost/weak_ptr.hpp>
+#include <iostream>
+
+static boost::weak_ptr<audio_jack_mgr> s_singleton;
+
+
+audio_jack_mgr::audio_jack_mgr(int sample_rate, const std::string name)
+  : d_sample_rate(sample_rate), d_name(name)
+{
+  std::cerr << "audio_jack_mgr: constructor called\n";
+}
+
+audio_jack_mgr::~audio_jack_mgr()
+{
+  std::cerr << "audio_jack_mgr: destructor called\n";
+}
+
+audio_jack_mgr_sptr
+audio_jack_mgr::singleton(int sample_rate, const std::string name)
+{
+  // If there's already an instance use it, otherwise construct a new one.
+  // See http://www.boost.org/libs/smart_ptr/weak_ptr.htm for info on
+  // boost weak pointers.
+
+  audio_jack_mgr_sptr r = s_singleton.lock();
+  if (r)                       // was weak_ptr valid?
+    return r;                  // yes, return shared_ptr
+
+  // need to construct a new instance
+
+  r = audio_jack_mgr_sptr(new audio_jack_mgr(sample_rate, name));
+  s_singleton = r;
+  return r;
+}


Property changes on: 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.h
===================================================================
--- 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.h    
                            (rev 0)
+++ 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.h    
    2006-12-19 01:14:44 UTC (rev 4147)
@@ -0,0 +1,50 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef INCLUDED_AUDIO_JACK_MGR_H
+#define INCLUDED_AUDIO_JACK_MGR_H
+
+#include <boost/shared_ptr.hpp>
+#include <string>
+
+class audio_jack_mgr;
+typedef boost::shared_ptr<audio_jack_mgr> audio_jack_mgr_sptr;
+
+/*!
+ * \brief class that coordinates all GNU Radio access to jack
+ */
+class audio_jack_mgr {
+  int                  d_sample_rate;
+  std::string          d_name;
+
+  audio_jack_mgr (int sample_rate, const std::string name);
+
+ public:
+  ~audio_jack_mgr ();
+
+  /*!
+   * \brief return single instance, create if required
+   */
+  static audio_jack_mgr_sptr 
+  singleton(int sample_rate, const std::string name = "");
+};
+
+#endif /* INCLUDED_AUDIO_JACK_MGR_H */


Property changes on: 
gnuradio/branches/developers/brickle/jack/gr-audio-jack/src/audio_jack_mgr.h
___________________________________________________________________
Name: svn:eol-style
   + native





reply via email to

[Prev in Thread] Current Thread [Next in Thread]