AROS World Exec

Development => Development (General) => Topic started by: paolone on November 26, 2018, 07:58:58 AM

Title: Request: a command to change sound volume
Post by: paolone on November 26, 2018, 07:58:58 AM
This is a help request to current Amiga developers. Unluckily I do not have the skill to do this by myself, but I guess many of you are. I'd need a simple utility in C to change the sound volume with AHI. A quick implementation of it would just change the 'main' volume, from 0 to 100%, for all the available music and audio units. Would anyone volounteer? Requisites: being open source and straight-to-compile on any Amiganoid system and platform.

My intermediate goal is just having the cance to open a shell window and give a command like

ahivolume 0 --> to set the overall sound volume to null
ahivolume 100 --> to set the overall sound volume to max

and obviously any intermediate value in the range 0-100, independently from the physical device used for sound (it shall work with any audio driver / audio mode).

Is this feasible? Or are ther technical problems making it a complete mess? Thank you.



The final (longer term) goal will be, at least on Icaros Desktop, writing a simple GUI/frontend in lua with a slider, a mute and a setting button, but I should be able to do this by myself.
Title: Re: Request: a command to change sound volume
Post by: paolone on November 26, 2018, 08:42:37 AM
I've just realized that it should also show the current volume values, if called without any parameter...
Title: Re: Request: a command to change sound volume
Post by: cavemann on November 26, 2018, 04:10:12 PM
There is an Arexx program in Aminet called mmvolume that controls volume. But it doesn't seem to worik on AROS. But perhaps something similar might be helpful.
 
Title: Re: Request: a command to change sound volume
Post by: paolone on November 26, 2018, 11:33:34 PM
There is an Arexx program in Aminet called mmvolume that controls volume. But it doesn't seem to worik on AROS. But perhaps something similar might be helpful.
AROS and Arexx do not sound good together... :-(
That's why I've been asking for a command in C. By the way, I was just thinking about you writing it. :-)
Title: Re: Request: a command to change sound volume
Post by: paolone on November 27, 2018, 06:36:57 AM
There is an Arexx program in Aminet called mmvolume that controls volume. But it doesn't seem to worik on AROS. But perhaps something similar might be helpful.
Tested it right now on Icaros Desktop and, as you told me, it does not work. I get this output from RX command:
RX Mute
5 *-* MASTERMUTE  +++ RC=30 +++
But no change to sound volume.
Title: Re: Request: a command to change sound volume
Post by: paolone on November 27, 2018, 06:45:24 AM
...but maybe it has to do with the fact that:
Quote
The Mixer commodity has to be running for the controls to work, though it doesn't have to be visible.
and we don't have such a commodity on AROS i386, AFAIK.

Title: Re: Request: a command to change sound volume
Post by: paolone on November 27, 2018, 06:53:42 AM
Would this be portable to AROS?
http://aminet.net/package/util/cdity/Mixer (http://aminet.net/package/util/cdity/Mixer)

Supports emu10kx, fm801, sb128, cmi8738, cs4281, Aureon 5.1 sky, M-Audio Revolution 5.1, ess1938/solo-1 chips, and A1-XE onboard sound (VIA686B) if you have the AC'97 codec chip onboard. The project and SVN are hosted at OpenAmiga.org.http://openamiga.org/?function=viewproject&projectid=62 (http://openamiga.org/?function=viewproject&projectid=62)
Title: Re: Request: a command to change sound volume
Post by: paolone on November 28, 2018, 02:27:28 AM
On Amigaworld.net I got an interesting link. Please have a look at this:
https://amigaworld.net/modules/newbb/viewtopic.php?topic_id=42983&start=0&post_id=819274&order=0&viewmode=flat&pid=819265&forum=2#819274
and obviously this
https://en.m.wikibooks.org/wiki/Aros/Developer/AHIDrivers
Section Other Examples -> master volume utility
I cannot compile this by myself, too much higher skill required than mine. :-(
Title: Re: Request: a command to change sound volume
Post by: nikos on November 28, 2018, 05:26:09 AM
I understand what you are looking for. Would be a great thing to have for AROS.

It would be nice to see and have some stuff like online, offline, master volume controll etc. in title bar or something.
Title: Re: Request: a command to change sound volume
Post by: BSzili on November 28, 2018, 06:12:28 AM
The only way I see this would be doable on AROS is to change the volume in the prefs file. Fortunately the format is public, there's an example on how to read it (CheckAHIPrefs), and the Prefs program is open source too with the rest of AHI.
I'm not very familiar with IFFParse.library, but I can give it a shot this weekend if nobody else is interested.
Title: Re: Request: a command to change sound volume
Post by: paolone on November 28, 2018, 07:03:29 AM
@Nikos

I understand what you are looking for. Would be a great thing to have for AROS.

It would be nice to see and have some stuff like online, offline, master volume controll etc. in title bar or something.
You have centered the point. Either in AmiStart or in BoingIconBar or in the title bar... A gadget which would allow changing the damn sound volume on the fly is something I've been missing for too long, on AROS.

@BSzili
You would be welcome!!!!!
Title: Re: Request: a command to change sound volume
Post by: nikos on November 28, 2018, 07:38:02 AM
BSzili: That would be fantastic  :)

You know a program like MPlayer got volume controll that is working with AROS.
Could not that part be made part of AROS and make some kind of volume slider.
It should be part of Wanderer. Every OS has something like this.
In Wanderer prefs, options, make some box to select or unselect volume controll in Titlebar.
At least that is what I would like to see.
Title: Re: Request: a command to change sound volume
Post by: paolone on November 28, 2018, 09:24:36 AM
BSzili: That would be fantastic  :)

You know a program like MPlayer got volume controll that is working with AROS.
Could not that part be made part of AROS and make some kind of volume slider.
It should be part of Wanderer. Every OS has something like this.
In Wanderer prefs, options, make some box to select or unselect volume controll in Titlebar.
At least that is what I would like to see.
Even without taking pieces from Mplayer, we have the AHI preference program which can control volume. Just taking only the part which control the volume for the four units, and let it change the volume for all 4 together with a single slider, would be enough. I've even proposed a C command to do exactly the same thing, I'd have worked on a LUA GUI if necessary with the slider and the mute button alone. You are right it should be part of wanderer, however I'd prefer a separed solution so it would be usable with Magellan, Scalos, etc too.
Title: Re: Request: a command to change sound volume
Post by: BSzili on November 28, 2018, 10:17:27 AM
The original request was about a cli command, which I'll try to make. If somebody else wants to create a GUI for it, they can.
Title: Re: Request: a command to change sound volume
Post by: paolone on November 28, 2018, 01:49:20 PM
The original request was about a cli command, which I'll try to make. If somebody else wants to create a GUI for it, they can.
Great!
Title: Re: Request: a command to change sound volume
Post by: aha on November 29, 2018, 02:22:55 AM
The original request was about a cli command, which I'll try to make. If somebody else wants to create a GUI for it, they can.
Great!
Thank you both! I am looking forward for it!
Title: Re: Request: a command to change sound volume
Post by: paolone on November 29, 2018, 08:28:59 AM
The original request was about a cli command, which I'll try to make. If somebody else wants to create a GUI for it, they can.
What do you think about this one? :-)
(http://www.icarosdesktop.com/img/225/225-sndvol.jpg)
It will basically work like this:

1. at the beginning, it will launch your command without values, to get the current volume (a numeric value between 0 and 100)
2. the knob in the slide will move accordingly
3. if I tick Mute, your command with the 0 value will be shot immediately
4. if Unmute, your command with the initial value will be shot
5. when exiting the value in the knob will be applied

The "AHI Mixer" button already opens prefs/AHI, this will let user do the fine tuning without opening Prefs every time. I will have to manage things in a way that exiting it won't change volume in this case, if necessary.


Title: Re: Request: a command to change sound volume
Post by: Devlin on December 03, 2020, 11:21:51 AM
Has any progress been made on this? I'd much like to be able to adjust the volume globally instead of per-unit.
Title: Re: Request: a command to change sound volume
Post by: aGGreSSor on December 05, 2020, 05:11:43 PM
Would this be portable to AROS?
http://aminet.net/package/util/cdity/Mixer (http://aminet.net/package/util/cdity/Mixer)
This commodity has an interface for ReAction (need to rewrite for MUI/Zune), ARexx  support (have to throw away arexx.c, arexx.h) and then a personal hell begins for each card. I don't think it will appear for AROS anytime soon. The quest is interesting, but it will take a lot of time.  ::)

Supports emu10kx, fm801, sb128, cmi8738, cs4281, Aureon 5.1 sky, M-Audio Revolution 5.1, ess1938/solo-1 chips, and A1-XE onboard sound (VIA686B) if you have the AC'97 codec chip onboard.
The problem is that it isn't something universal, systemic. it's such a branched crutch.
Title: Re: Request: a command to change sound volume
Post by: paolone on December 08, 2020, 04:39:09 AM
Has any progress been made on this? I'd much like to be able to adjust the volume globally instead of per-unit.


As I've said: the GUI is ready. The command that's supposed to do the job, not. I'm sorry.
Title: Re: Request: a command to change sound volume
Post by: aGGreSSor on December 08, 2020, 05:23:06 AM
Has any progress been made on this? I'd much like to be able to adjust the volume globally instead of per-unit.
As I've said: the GUI is ready. The command that's supposed to do the job, not. I'm sorry.
What means: the GUI is ready? How does it look, where can you see it?
There the problem is that each sound card is processed individually (although unified).
In principle, you can take sb128_ctrl.c and attach an CLI interface to it, then you can hang it on FKey.
This should work in VMware Player (only), but the sound is so awful that I don't see much point in it.
I think this is completely unsuitable for the distribution Besides, how many have this sb128 on real hardware?
This is an unsatisfactory solution, but I don't know another one.
Title: Re: Request: a command to change sound volume
Post by: paolone on December 08, 2020, 07:28:53 AM
Has any progress been made on this? I'd much like to be able to adjust the volume globally instead of per-unit.
As I've said: the GUI is ready. The command that's supposed to do the job, not. I'm sorry.
What means: the GUI is ready? How does it look, where can you see it?
There the problem is that each sound card is processed individually (although unified).


Sure! See it in attachment.


My point is that if AHI can have a single slider for master volume, even if this setting comes from different modules for each sound card, we can also have a CLI command doing exactly the same thing. And re-use of open source code should be encouraged by its openess itself. I am ready to release my LUA GUI with any open license if necessary.

Title: Re: Request: a command to change sound volume
Post by: aGGreSSor on December 08, 2020, 11:32:48 AM
My point is that if AHI can have a single slider for master volume, even if this setting comes from different modules for each sound card
My point is that:
Code: [Select]
for (Channel = 0; Channel < 6; Channel += 1)
{
   Volume(Channel, Percentage);
}
closes this question. The Volume function () can be viewed in sb128_ctrl.c
we can also have a CLI command doing exactly the same thing.
It's not difficult to make a CLI command from the code above.
And re-use of open source code should be encouraged by its openess itself.
Unfortunately I don't have a similar code for setting the volume in AHI, there is only open source code going into specific sound card and doing it there.
I am ready to release my LUA GUI with any open license if necessary.
In any case, it's more convenient than FKey.
Title: Re: Request: a command to change sound volume
Post by: aGGreSSor on December 08, 2020, 04:08:12 PM
If you have an idea how to control the sound of AHI (theoretically understandable - AHI_SetVol( channel, volume, pan, audioctrl, flags ); ), you can add this code to the source from the attachment and compile. This is the CLI application where you need to add this function.  ::)

(https://i.postimg.cc/8CjPv1rL/AROS-Set-Volume.png)
see next answer
Title: Re: Request: a command to change sound volume
Post by: aGGreSSor on December 09, 2020, 01:47:45 AM
In fact I have no sound in AROS. Let's test.  ;D

1. Try to start playback at half volume.
2. Run SetVolume as shown below:
Code: [Select]
> SetVolume.exe -s 10
3. The volume should grow to maximum

Write about the results here. This doesn't work.
I don't understand how AHI works, this is the "scientific poke" method.
Title: Re: Request: a command to change sound volume
Post by: paolone on December 10, 2020, 07:16:24 AM

Write about the results here. This doesn't work.
I don't understand how AHI works, this is the "scientific poke" method.


:D :D


Well, at least you tried! :-)


I am really happy you've tried to help me, thank you! Unluckily setvolume is not working as expected. :-|


I tried changing volume while madahi and mplayer were playing a MP3 file without success, its volume didn't change.
Title: Re: Request: a command to change sound volume
Post by: aGGreSSor on December 10, 2020, 08:24:40 AM
I understood a few points.

1) Not all drivers support changing the volume. If the volume can be changed, SetVolume will output: "Get volume: ANY" and output: "Get volume: FULL" when it is impossible.
2) AHI has flexible settings for what the application plays (including the volume), but AHI has no obvious way to change the volume of the entire system. AHI_SetVol() function only works with the fact that I started to play. I may be wrong, but I think I'm right.
3) There is a AHIGlobalPrefs structure which AHI operates. The global volume in it can be addressed through ahigp_ClipMasterVolume. Undocumented.
4) Also need to write a function for converting percentages to decibels. AHI has its own fun understanding of volume referring to low-end layer.
5) I looked at the AHI Prefs source, but until I was able to compile them, this is another obstacle: SetVolume needs some of them.

Thank you for testing, I figured out how to test it myself. :)
Title: Re: Request: a command to change sound volume
Post by: BSzili on December 14, 2020, 10:20:55 AM

Write about the results here. This doesn't work.
I don't understand how AHI works, this is the "scientific poke" method.


:D :D


Well, at least you tried! :-)


I am really happy you've tried to help me, thank you! Unluckily setvolume is not working as expected. :-|


I tried changing volume while madahi and mplayer were playing a MP3 file without success, its volume didn't change.
In my defense I tried too back in... was it two years ago? Gosh. I'm still having nightmares about iffparse.library.
Title: Re: Request: a command to change sound volume
Post by: miker1264 on February 04, 2021, 09:14:18 AM
@paolone

Did you get you volume adjustments utility in c: yet?
Title: Re: Request: a command to change sound volume
Post by: paolone on February 04, 2021, 09:44:56 AM
@paolone

Did you get you volume adjustments utility in c: yet?


Unluckily, no. Aggressor went really near to it, though. His command didn't work with SB128 driver used by vmware, even though it should havel at least theoretically, and it might have been working with other hardware I could not personally test.
Title: Re: Request: a command to change sound volume
Post by: miker1264 on February 04, 2021, 10:10:40 AM
@paolone

Where is the driver located? Binary or sources?

I assume it is for 32bit and for VMWare.

I'm using VirtualBox. I haven't tried HD Audio.

Is the sound utility app connected to your nice volume adjust gui? I like the simplicity of it. And I like the idea of a Titlebar gadget for sound.

I can do some testing.
Title: Re: Request: a command to change sound volume
Post by: paolone on February 05, 2021, 05:16:51 AM
@paolone

Where is the driver located? Binary or sources?

I assume it is for 32bit and for VMWare.

I'm using VirtualBox. I haven't tried HD Audio.

Is the sound utility app connected to your nice volume adjust gui? I like the simplicity of it. And I like the idea of a Titlebar gadget for sound.

I can do some testing.


You'd better ask Aggressor instead. You might help him debugging/finalizing it, THEN, I can link it to my GUI.
Title: Re: Request: a command to change sound volume
Post by: miker1264 on February 05, 2021, 08:59:15 AM
@paolone

Thanks for the tip. I'll ask Agressor if I can help testing the sound volume control. I believe it goes hand in hand nicely with the work deadwood is doing improving hdaudio.

On the subject of this thread earlier someone mentioned placing a Sound Gadget in the Titlebar?

I think it's a good time to think about User Gadgets for AROS Titlebar? More on that later. ;-)
Title: Re: Request: a command to change sound volume
Post by: miker1264 on February 05, 2021, 09:12:01 AM
@paolone

If you think of it we already use Titlebar Gadgets even if we don't realize it. There are two defined areas: System Gadgets and Gadget Strings on the Left Side with the AROS System Graphic and User Gadgets and Gadget Strings such as Date & Time on the Right. The Depth Gadget is part of Standard Gadgets like Window Gadgets.

I envision a more modern full featured set of User Gadgets much like Mac OS X or like perhaps Linux.

If we make GadgetMenu a seperate app and copy it to WBStartup or in startup-sequence then double click on the Titlebar could activate the menu. I like that idea. No Prefs required. And I like the idea of a Sound Gadget in the Titlebar.

I'll demonstrate this in another thread. Thanks for your time.

Have a good day! :-)
Title: Re: Request: a command to change sound volume
Post by: paolone on February 22, 2021, 02:30:26 AM
@paolone

If you think of it we already use Titlebar Gadgets even if we don't realize it. There are two defined areas: System Gadgets and Gadget Strings on the Left Side with the AROS System Graphic and User Gadgets and Gadget Strings such as Date & Time on the Right. The Depth Gadget is part of Standard Gadgets like Window Gadgets.

I envision a more modern full featured set of User Gadgets much like Mac OS X or like perhaps Linux.

If we make GadgetMenu a seperate app and copy it to WBStartup or in startup-sequence then double click on the Titlebar could activate the menu. I like that idea. No Prefs required. And I like the idea of a Sound Gadget in the Titlebar.

I'll demonstrate this in another thread. Thanks for your time.

Have a good day! :-)


Any working idea would be highly appreciated. My GUI would just pop-up somewhere on the screen like any other Zune-LUA based application, and I'd have simply added it to AmiStart on Icaros. But something AROS-wise (that would work also on any flavour of AROS) would be a far better solution, IMHO.
Title: Re: Request: a command to change sound volume
Post by: miker1264 on April 18, 2021, 11:01:10 AM
paolone or aGGreSSor

Is there a link somewhere to AHI Sound System API functions ?

My intent is to do some research and some testing if possible to find out why the SetVolume.exe isn't working or how it can be made better so that aGGreSSor can finish the sound volume ctrl.