Re: ANNOUNCE: gstreamermm-0.10.5



On Tue, 2009-11-24 at 13:55 +0100, Carlo Wood wrote:
> Hi, I have another question about gstreamermm. Trying to print the volume
> of the given tracks:
> 
>   // List the tracks of the mixer.
>   typedef std::list<Glib::RefPtr<Gst::MixerTrack> > tracks_type;
>   tracks_type tracks = mixer->list_tracks();
> 
>   for (tracks_type::iterator iter = tracks.begin(); iter != tracks.end(); ++iter)
>   {
>     Glib::RefPtr<Gst::MixerTrack const>& track = *iter;
>     std::cout << track->get_label() << ' ' << mixer->get_volume(track) << std::endl;
>   }
> 
> 
> This doesn't work... First I tried  get_volume(*iter)  but that can't find
> a 'get_volume', because the only get_volume that is there demands a
> Glib::RefPtr<Gst::MixerTrack const> (note the 'const').
> 
> So, I tried to convert *iter (which is a Glib::RefPtr<Gst::MixerTrack>)
> to a Glib::RefPtr<Gst::MixerTrack const> in the line before, and indeed,
> that fails.
> 
> How am I supposed to get the volume of the tracks now?

The problem is that your trying to initialize a Glib::RefPtr<>& from a
Glib::RefPtr<> (which the std::list<> contains).  A std::list<> is not
designed to store references.  You should just do something like:

Glib::RefPtr<..> ref = *iter;

Also, the std::cout line cannot work because the
"mixer->get_volume(track)" returns an array of integers.

I would suggest that you make sure you follow the docs so that you know
what is supported.  One good chapter as far as ArrayHandle and
ListHandle is in the "Intermediate types" section[1] of the online
book[2].

[1]
http://library.gnome.org/devel/gtkmm-tutorial/unstable/sec-intermediate-types.html.en
[2] http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/index.html


-- 
José



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