Re: Recording widget motion


yes, using the GstController is the way to go. Initially you will record
a series of timed value changes. The GstController manages this queue
for you. If you hook these changes onto e.g. a GstVOlume element, you
can then listen to the "notify::volume" of it and from the handler set
the value of the slider. When you then replay, GstController will
activate the value changes at the right time and your slider will update


Samuel Cormier-Iijima wrote:
Thanks for the reply!

That is pretty much what I'm doing currently, although your idea of
using a GSList is a much better solution than the weird struct I'm
using now :-). Also, I wasn't sure whether to use g_timeout_add or to
make another thread to update the slider; I thought g_timeout_add
would cause timing to be off (it would unsynchronize over time), but
using a GTimer fixed it. The problem I'm currently having is this: I'd
like to know when the user is "holding" the slider, that is, has the
mouse button pressed on the slider itself, not in the "trough", so
that the user can record "over" his previous recording. This is kinda
hard to explain, and I'm not sure if it's a good idea from a UI point
of view... I've managed to get this by digging into the private struct
adjustment->layout->mouse_location, but that is hackish and not
stable.... Anyways, I'm just rambling, it works now :-)

Now I just need to hook this up to a GstController... but that's a
topic for another list, and I have to read up more anyways. Thanks :-)

Samuel Cormier-Iijima

On 9/7/06, David Nečas (Yeti) <yeti physics muni cz> wrote:
On Thu, Sep 07, 2006 at 08:59:13AM -0400, Samuel Cormier-Iijima wrote:
This is for music editing software I'm thinking about writing.
Basically, the user should be able to "record" the volume during
playback by sliding the GtkHScale around. When he plays it back the
next time, the volume should change according to the way he recorded
it (i.e. it'll wiggle around by itself during the song playback).
Connect to the "value-changed" signal of the corresponding
adjustment.  In the callback, note the current time and
value and add it for example to a GSList (using prepend, not
append to keep it O(1)).  Disconnect when done.

For replay revert the list, set up a periodically called
func with g_timeout_add().  When the function is called it
gets the current time, finds the value to set (if you save
the current position in the list it can be done with simple
forward search quite efficiently) and sets it, possibly with
interpolation.  Remove the func when you hit the end.

This is quite obvious so, although I could probably patent
it, what I missed in the requirements?


Anonyms eat their boogers.
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

gtk-app-devel-list mailing list
gtk-app-devel-list gnome org

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