accessing mixer values

Discussion in 'Ruby' started by ruud, Mar 27, 2008.

  1. ruud

    ruud Guest

    hi group

    I want to read the volume of the mixer device with a ruby script.
    Can anybody tell me what the ruby equivalent is of what the MIXER_READ
    macro does in C?

    #define SOUND_MIXER_VOLUME 0
    #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
    #define MIXER_READ(dev) _SIOR('M', dev, int)

    I've been googling with keywords like 'ioctl, MIXER_READ SOUND_MIXER',
    but with little result. Hopefully someone can me push me in the right
    direction...


    thanks in advance,

    Ruud
    ruud, Mar 27, 2008
    #1
    1. Advertising

  2. ruud

    ts Guest

    ruud wrote:
    > I want to read the volume of the mixer device with a ruby script.
    > Can anybody tell me what the ruby equivalent is of what the MIXER_READ
    > macro does in C?


    I'm sure that you'll happy to know that, on linux, MIXER_READ(dev) do
    this

    (((2U) << (((0 +8)+8)+14)) | ((('M')) << (0 +8)) | (((dev)) << 0) |
    (((((sizeof(int) == sizeof(int[1]) && sizeof(int) < (1 << 14)) ?
    sizeof(int) : __invalid_size_argument_for_IOC))) << ((0 +8)+8)))


    :)

    > I've been googling with keywords like 'ioctl, MIXER_READ SOUND_MIXER',
    > but with little result. Hopefully someone can me push me in the right
    > direction...


    perhaps best if you use Ruby::Inline to access it

    http://rubyforge.org/projects/rubyinline/


    Guy Decoux
    ts, Mar 27, 2008
    #2
    1. Advertising

  3. ruud

    Ron Fox Guest

    It encodes the ioctl request argument for a transfer of data from the
    device to the program. See:
    man ioctl

    you may also need to look at the ioctl.h header.
    _SIOR in at least the linux soundcard.h file just maps directly to _IOR

    RF
    ruud wrote:
    > hi group
    >
    > I want to read the volume of the mixer device with a ruby script.
    > Can anybody tell me what the ruby equivalent is of what the MIXER_READ
    > macro does in C?
    >
    > #define SOUND_MIXER_VOLUME 0
    > #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
    > #define MIXER_READ(dev) _SIOR('M', dev, int)
    >
    > I've been googling with keywords like 'ioctl, MIXER_READ SOUND_MIXER',
    > but with little result. Hopefully someone can me push me in the right
    > direction...
    >
    >
    > thanks in advance,
    >
    > Ruud
    Ron Fox, Mar 28, 2008
    #3
  4. ruud

    Ron Fox Guest

    http://www.4front-tech.com/pguide/sndcrd.html

    May also help now that you know that

    _SIOR is just _IOR.

    search there for MIXER_READ...below it are the legal values for dev if
    I'm getting this right.



    ruud wrote:
    > hi group
    >
    > I want to read the volume of the mixer device with a ruby script.
    > Can anybody tell me what the ruby equivalent is of what the MIXER_READ
    > macro does in C?
    >
    > #define SOUND_MIXER_VOLUME 0
    > #define SOUND_MIXER_READ_VOLUME MIXER_READ(SOUND_MIXER_VOLUME)
    > #define MIXER_READ(dev) _SIOR('M', dev, int)
    >
    > I've been googling with keywords like 'ioctl, MIXER_READ SOUND_MIXER',
    > but with little result. Hopefully someone can me push me in the right
    > direction...
    >
    >
    > thanks in advance,
    >
    > Ruud
    Ron Fox, Mar 28, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=

    pygame.mixer.music not playing

    =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=, Feb 6, 2005, in forum: Python
    Replies:
    12
    Views:
    2,741
    =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=
    Feb 7, 2005
  2. oss mixer usage

    , Jan 16, 2006, in forum: Python
    Replies:
    0
    Views:
    450
  3. soorya
    Replies:
    1
    Views:
    669
    mlimber
    Oct 27, 2005
  4. Adrian

    Color mixer

    Adrian, Feb 15, 2008, in forum: HTML
    Replies:
    3
    Views:
    462
    Adrian
    Feb 15, 2008
  5. globalrev

    pygame.mixer.load not working

    globalrev, May 4, 2008, in forum: Python
    Replies:
    1
    Views:
    237
    Diez B. Roggisch
    May 4, 2008
Loading...

Share This Page