accessing mixer values

R

ruud

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
 
T

ts

ruud said:
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
 
R

Ron Fox

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top