Oberon Community Platform Forum
October 23, 2019, 04:04:18 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
   Home   Help Search Login Register  
Pages: [1]
Author Topic: Weird behaviour of volume setting  (Read 3945 times)
Full Member
Posts: 170

« on: October 25, 2009, 02:02:14 PM »

Seems I found the reason why volume setting is so weird Grin
At first start the WMMixer, and run something that will produce the sound output. I use *.ogg files that plays under A2 just perfect  Wink
There are two main strange scenarios (tested on YMF724 card):
1. Set the MasterOut to the max and try slowly change the PCM value from min to max. In my case I clearly hear that sound gets loud on exactly two positions: middle and max Shocked It's evident that the only one maximum should exist!
2. Set the PCM to the max, set the MasterOut to the min, set the volume on your speeker to the maximum loudest value. I my case I still hear very quiet sound  Shocked But it's evident that MasterOut's min should correspond to fully muted (94.5 dB attenuation as noted in AC'97 specification) output!
It seems that problem is in code that detects the count of volume bits (piece from MixerChannel initializer from YMF754.Mod):
(* Get number of volume bits *)
drv.ACC.RegWrite16(regVol, 803FH); (* set first 6 bits and mute bit *)
tmpVol := drv.ACC.RegRead16(regVol); (* read back volume value *)
SELF.volBits := 0;
tmpVol := SYSTEM.LSH(tmpVol, -1);
Code is nice and logical, but it actually fails from some weird reason.
I've tryed use predefined count of volume bits from AC'97 specification http://download.intel.com/support/motherboards/desktop/d201gly/sb/ac97r22.pdf and it seems fixed the problem.
And one more little issue related to default mixer settings. Driver sets the default for every chanel to 128, but it's very quiet setting. Let's change that value to something like 224-240  Wink
Code snippets with all needed fixes according to AC'97 specification, Table. 15:
PROCEDURE &Constr*(drv: Driver; regVol: LONGINT; inverted, mute: BOOLEAN; name: NameStr; desc: DescStr; volBits: LONGINT);
SELF.drv := drv;
SELF.regVol := regVol;
SELF.inverted := inverted;
SELF.name := name;
SELF.desc := desc;
SELF.volBits := volBits;
SELF.mute := mute; (* set mute state of channel *)
END Constr;
(* Create mixer channel objects *)
NEW(mixerChannels[0], SELF, ACCRegVolMasterOut, TRUE, FALSE, "MasterOut", "Master output mixer channel", 6);
NEW(mixerChannels[1], SELF, ACCRegRecordGain, FALSE, FALSE, "MasterIn", "Master input mixer channel", 4);
NEW(mixerChannels[2], SELF, ACCRegVolLineIn, TRUE, TRUE, "LineIn", "LineIn mixer channel", 5);
NEW(mixerChannels[3], SELF, ACCRegVolPCM, TRUE, FALSE, "PCM", "PCM mixer channel", 5);
NEW(mixerChannels[4], SELF, ACCRegVolCD, TRUE, TRUE, "CD", "CD mixer channel", 5);
NEW(mixerChannels[5], SELF, ACCRegVolMic, TRUE, TRUE, "Mic", "Microphone mixer channel", 5);
Probably, all sound drivers has the same problem, because all of them seems try detect count of volume bits.
I only have YMF724 and Ensoniq cards, so I'll test it soon on Ensoniq too  Wink
« Last Edit: October 25, 2009, 02:05:43 PM by sage » Logged
Full Member
Posts: 170

« Reply #1 on: October 25, 2009, 02:43:20 PM »

Ensoniq driver has no problem, because volume bits are hardcoded.
MixerChanel object has 5 volume bits. The corresponding code for truncation of volume value: resl := 31-SELF.vol DIV 8;
PlayMixerChanel (6 bits) and RecMixerChanel (4 bits) are inherited from MixerChanel and overrides the SetVolume method.
Corresponding code for truncation of volume value respectively: resl := 63-vol DIV 4; and resl := vol DIV 16;

i810Sound driver has the code for detection of volume bits, so, probably potentially may has the problem. But I can't test it.
Pages: [1]
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!