All of lore.kernel.org
 help / color / mirror / Atom feed
* Alsa Callbacks and C++ classes
@ 2008-04-21  2:28 Reuben Martin
  2008-04-21 15:55 ` Takashi Iwai
  2008-04-21 18:08 ` John Utz
  0 siblings, 2 replies; 4+ messages in thread
From: Reuben Martin @ 2008-04-21  2:28 UTC (permalink / raw)
  To: ALSA Development Mailing List

Hello all,

I have an AES32 sound card that I am trying to write a general control 
interface for using qt4. I'm wanting to register callbacks so that the 
interface will reflect changes made by other apps. Now I'm not entirely up to 
speed on the API, but from what I can gather, the callback can be registered 
to call a regular function, or to change a public class variable.

Since I decided to use qt4, everything is in classes. Is there any way to have 
the callback trigger a public class function? I guess I don't understand why 
you would want to use a public variable instead. Wouldn't you have to set up 
a means within the class to continually pole the variable to see if it has 
been changed? Or can the option to call a regular function be used to call a 
public class function as well?

Go easy on me. I'm not much of an experienced programmer. More of a hack who 
can kinda get by with his sloppy programming most of the time.

Thanks,
-Reuben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Alsa Callbacks and C++ classes
  2008-04-21  2:28 Alsa Callbacks and C++ classes Reuben Martin
@ 2008-04-21 15:55 ` Takashi Iwai
  2008-04-22  0:49   ` Reuben Martin
  2008-04-21 18:08 ` John Utz
  1 sibling, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2008-04-21 15:55 UTC (permalink / raw)
  To: Reuben Martin; +Cc: alsa-devel

At Sun, 20 Apr 2008 21:28:25 -0500,
Reuben Martin wrote:
> 
> Hello all,
> 
> I have an AES32 sound card that I am trying to write a general control 
> interface for using qt4. I'm wanting to register callbacks so that the 
> interface will reflect changes made by other apps. Now I'm not entirely up to 
> speed on the API, but from what I can gather, the callback can be registered 
> to call a regular function, or to change a public class variable.
> 
> Since I decided to use qt4, everything is in classes. Is there any way to have 
> the callback trigger a public class function? I guess I don't understand why 
> you would want to use a public variable instead. Wouldn't you have to set up 
> a means within the class to continually pole the variable to see if it has 
> been changed? Or can the option to call a regular function be used to call a 
> public class function as well?

Well, which callback do you have in your mind?  A bit more
specificically please...


Takashi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Alsa Callbacks and C++ classes
  2008-04-21  2:28 Alsa Callbacks and C++ classes Reuben Martin
  2008-04-21 15:55 ` Takashi Iwai
@ 2008-04-21 18:08 ` John Utz
  1 sibling, 0 replies; 4+ messages in thread
From: John Utz @ 2008-04-21 18:08 UTC (permalink / raw)
  To: Reuben Martin; +Cc: ALSA Development Mailing List

On Sun, 20 Apr 2008 21:28:25 -0500
"Reuben Martin" <reuben.m@gmail.com> wrote:

> Hello all,
> 
> I have an AES32 sound card that I am trying to write a general
> control interface for using qt4. I'm wanting to register callbacks so
> that the interface will reflect changes made by other apps. Now I'm
> not entirely up to speed on the API, but from what I can gather, the
> callback can be registered to call a regular function, or to change a
> public class variable.
> 
> Since I decided to use qt4, everything is in classes. Is there any
> way to have the callback trigger a public class function? I guess I
> don't understand why you would want to use a public variable instead.
> Wouldn't you have to set up a means within the class to continually
> pole the variable to see if it has been changed? Or can the option to
> call a regular function be used to call a public class function as
> well?

I am not looking at the API docs at the moment, but I would expect that
it would work but would probably require a significant bit of casting
fu to deal with the c++ pointers and maybe some #defines to deal
with C++ name mangling, ie:

00000000 T dqzport_CommunicateInit__FPi
dfxportInit.o:
00000000 a dqzportInit.cpp
00000000 T dqzportInit__FPPiPciP6CSlout
         U dqzport_CommunicateInit__FPi

Given the grief that i have experienced attempting to get c and c++ to
play nicely together, i'd be choosing to communicate via some other
means.

My interoperability issues may be tied to the fact that i am stuck with
dealing with some legacy c++ libs that where written with g++2 and it
may all be solved and work transparently when using gcc4/g++4, i dont
really know because i dont get to use it for our application.

> Go easy on me. I'm not much of an experienced programmer. More of a
> hack who can kinda get by with his sloppy programming most of the
> time.

No prob, the public variable idea certainly seems to be appropriate
given that perspective. :-)

> Thanks,
> -Reuben
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Alsa Callbacks and C++ classes
  2008-04-21 15:55 ` Takashi Iwai
@ 2008-04-22  0:49   ` Reuben Martin
  0 siblings, 0 replies; 4+ messages in thread
From: Reuben Martin @ 2008-04-22  0:49 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Back on Monday 21 April 2008, Takashi Iwai was like:
> At Sun, 20 Apr 2008 21:28:25 -0500,
>
> Reuben Martin wrote:
> > Hello all,
> >
> > I have an AES32 sound card that I am trying to write a general control
> > interface for using qt4. I'm wanting to register callbacks so that the
> > interface will reflect changes made by other apps. Now I'm not entirely
> > up to speed on the API, but from what I can gather, the callback can be
> > registered to call a regular function, or to change a public class
> > variable.
> >
> > Since I decided to use qt4, everything is in classes. Is there any way to
> > have the callback trigger a public class function? I guess I don't
> > understand why you would want to use a public variable instead. Wouldn't
> > you have to set up a means within the class to continually pole the
> > variable to see if it has been changed? Or can the option to call a
> > regular function be used to call a public class function as well?
>
> Well, which callback do you have in your mind?  A bit more
> specificically please...

Sorry about that. The callbacks I was referring to are mixer callbacks, 
specifically snd_mixer_set_callback and snd_mixer_set_callback_private.

I wrote "public" in my original post, when I meant "private". And now that I'm 
looking at it I think I may have misunderstood what 
snd_mixer_set_callback_private was for.

Anyway, I'm just wondering if it's possible (while maintaining sanity) to 
interface one of these mixer callbacks with a class public function. Or if 
there is a better means to get feedback when changes are made to one of the 
simple mixer elements.

Thanks,
-Reuben

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-22  0:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-21  2:28 Alsa Callbacks and C++ classes Reuben Martin
2008-04-21 15:55 ` Takashi Iwai
2008-04-22  0:49   ` Reuben Martin
2008-04-21 18:08 ` John Utz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.