HardwareHeaven.com

HardwareHeaven.com

Looking for the skin chooser?
 
 
  • Home

  • Reviews

  • Articles

  • News

  • Tools

  • Gaming at HardwareHeaven

  • Forums

  • Network

 

Go Back   HardwareHeaven.com > Forums > Hardware and Related Topics > kX Project Audio Driver Support Forum > Effects and the DSP


Reply
 
Thread Tools
Old Nov 29, 2009, 05:31 AM   #1
DriverHeaven Newbie
 
Join Date: Nov 2009
Posts: 2
Rep Power: 0
Eversor8 is on a distinguished road

Problems with making plugins

Hi

I was little pissed off about the windows 7 issues with kx drivers and stereo/multichannel audio playback, so i started to create a plugin that should help me (and others) a little.

Main thing that it does is summing up 20 samples of 4 channels that is surround back (left and right), center and sub. If that summed up value is 0 then it means that all surround channels part front left and right are mute so there is only stereo sound. I used limitn function:
Code:
limitn channelout,sumn,channelin,0
where sumn is created by
Code:
tstneg sumn,sum,-sum,0
so if im not mistaken an -abs(sum) thingy where again sum is that summed up value. the channelout and channelin are just names of surround in and surround out channels in my plugin. When i play a multichannel signal so the sumn is <0 then all six channels are passed through using 6 of those limitn functions and when there is only stereo signal they are muted. Everything so far sims good. Problem is i can't create a similar to that part but negative in terms of working and working with stereo output so 2 channels connected to top 2 pins of xrouter (so surrounder+). It should mute them when there is multichannel signal so sumn is <0 and pass front left and front right from surround input when sumn is 0.

My few days fight ended up with many hours of headaches.
For example the acc3 function when used like that:
Code:
acc3 x,-1,1,0
with using:
Code:
macs Left,0,1,x
to see resoults on peak plugin ends up with nothing on said peak (so x is 0). But if insted of that 1 in acc3 i use other value lets say z and use additional function similar to those limitn showed before:
Code:
limitn z,sumn,1,0
so a line that should make z = 1 when there is multichannel signal and 0 if only stereo resoults in x being something close to 1 as the channel on peak connected to Left output is at max value (same value when using macs left,0,1,1). And it doesnt matter if the z is 1 or 0 depending on if there is multichannel signal or only stereo, its like the acc3 function stoped to use z value.

Maybe its just me - i mean - maybe i just dont get the idea of how stuff works here.

For example i added 3 controls, and used the andxor function. On the net i found a manual how it should work. And short saying it didnt work anyhow close to that manual. When manual said resoult should be a nand x it was like a and x etc. Generaly speaking nothing here works close to normal programming im used to xd.

Below is my code. I know it propably could be better/optimized/it could collect more samples etc. But like i said the pass/mute multichannel outputs works pritty damn fine. I just can't add the thing doing oposite thing with passing/mutting Left and Right output (which pass thru FL and FR signals)

Maybe some1 better than me will figure it out and make working plugin that will help people with windows 7 to have kx drivers which work (i mean which upmix stereo sources like mp3s,flacs and pass thru multichannel sources like movies 6ch mp3s etc.

Code:
input  FL,FR,SL,SR,SC,LFC

output Left,Right,oFL,oFR,oSL,oSR,oSC,oLFC        

temp sum,summ,sumb,sumn

static tmp1 = 0,tmp2 = 0,tmp3 = 0,tmp4 = 0,tmp5 = 0,tmp6 = 0
static tmp7 = 0,tmp8 = 0,tmp9 = 0,tmp10 = 0,tmp11 = 0,tmp12 = 0
static tmp13 = 0,tmp14 = 0,tmp15 = 0,tmp16 = 0,tmp17 = 0,tmp18 = 0
static tmp19 = 0,tmp20 = 0

acc3 sum,SL,SR,SC
acc3 sum,sum,LFC,0
; sum of all surround signals

macs tmp1,sum,0,tmp1
macs tmp2,tmp1,0,tmp2
macs tmp3,tmp2,0,tmp3
macs tmp4,tmp3,0,tmp4
macs tmp5,tmp4,0,tmp5
macs tmp6,tmp5,0,tmp6
macs tmp7,tmp6,0,tmp7
macs tmp8,tmp7,0,tmp8
macs tmp9,tmp8,0,tmp9
macs tmp10,tmp9,0,tmp10
macs tmp11,tmp10,0,tmp11
macs tmp12,tmp11,0,tmp12
macs tmp13,tmp12,0,tmp13
macs tmp14,tmp13,0,tmp14
macs tmp15,tmp14,0,tmp15
macs tmp16,tmp15,0,tmp16
macs tmp17,tmp16,0,tmp17
macs tmp18,tmp17,0,tmp18
macs tmp19,tmp18,0,tmp19
macs tmp20,tmp19,0,tmp20     
;moving the static registers +1 up
;overwriting the oldest one plus overwriting
;first with actuall sum of surround signals

acc3 sum,tmp1,tmp2,tmp3
acc3 sum,sum,tmp4,tmp5
acc3 sum,sum,tmp6,tmp7
acc3 sum,sum,tmp8,tmp9
acc3 sum,sum,tmp10,tmp11
acc3 sum,sum,tmp12,tmp13
acc3 sum,sum,tmp14,tmp15
acc3 sum,sum,tmp16,tmp17
acc3 sum,sum,tmp18,tmp19
acc3 sum,sum,tmp20,0
;summing of all stored sum's of surround signals (20 last samples)
 
tstneg sumn,sum,-sum,0
;making -(abs(sum))   

limitn oFL,sumn,FL,0 
limitn oFR,sumn,FR,0
limitn oSL,sumn,SL,0
limitn oSR,sumn,SR,0
limitn oSC,sumn,SC,0
limitn oLFC,sumn,LFC,0
;if sumn is lower than 0
;so there is signal on surround channels
;so there is multichannel signal
;then pass through all 6 channels (else pass 0 (mute))

;here should be similar thing passing or not FL and FR
;to Left and Right when there is only stereo signal and
;mute it when there is multichannel signal

end
P.S. i didn't find any solution to that issue in win7 part from instaling creative drivers :/. And i dont like the idea with dual loading dsp profiles with stereo and multichannel configuration xd.
Eversor8 is offline   Reply With Quote


Old Nov 29, 2009, 12:20 PM   #2
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,503
Rep Power: 60
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Problems with making plugins

It seems you are misunderstanding some things:

Quote:
acc3 x, -1, 1, 0
"1" in the above is "fractional 1", which does not equal 1 (it is one LSB less than 1) and as such "-1 + 1" does not equal zero.

Quote:
tstneg sumn,sum,-sum,0
"-sum" is not valid.

For "-(abs)" use the log instruction.

i.e.
log r, x, 0x1, 0x2


The macs instruction does the following (extraneous parenthesis added to emphasize the order of operations):
RESULT = A + (X * Y)

Quote:
macs tmp1, sum, 0, tmp1
In the above, X=0, thus X*Y will always be 0, so what is the purpose of Y here?

i.e.
"macs tmp1, sum, 0, 0" will gave the same result.


In any case, such a plugin is going to have problems because (among other things) multichannel audio might use some of the channels, or all of the channels, at any time during playback, and you have no way of detecting this.

e.g.
If only the front channels are being used at some point (during playback of multichannel content), then your plugin is going to think it is stereo only, and it will be upmixed by Surrounder, which is not what you want .

Last edited by Russ; Nov 29, 2009 at 12:50 PM.
Russ is offline   Reply With Quote
Old Nov 29, 2009, 04:32 PM Threadstarter Thread Starter   #3
DriverHeaven Newbie
 
Join Date: Nov 2009
Posts: 2
Rep Power: 0
Eversor8 is on a distinguished road

Re: Problems with making plugins

About macs:

Quote:
In the above, X=0, thus X*Y will always be 0, so what is the purpose of Y here?

i.e.
"macs tmp1, sum, 0, 0" will gave the same result.
Yeah i know that:P but in the process of making the plugin i just didn't think hard enough to realise that hehe. Well im far from being optimazable programmer xd always do things harder way.

Info about that 1 is 1LSB less than 1 isn't to much of a help. As it doesn't explain lot of stuff i still don't get how the fuck those things work.

I fear using your log statement, as the invalid -sum seems to do the trick. I mean the muting of surround outputs works as intended. And if i delete the '-' from there it stops working, so that '-' actualy does something. What it those is actually a big question:P.

About the multichannel stuff. I tested few mp3s i have being 6channel, playied most movies i have looking for 'silent' moments and my resoult is such that i didnt find a simple moment in which the audio on back,center and sub channels went silent at once to make the 'code' work not as intended. Most movies have propably some ambient audio there, or at least some noise don't know exacly. The only issue here is actually games. Didn't test how stuff works with games or rather if in games back,cen,sub channels are 'silent' enough long to make my plugin go beserk xd. Other issue i just spoted here is actualy games too. Its the thing i quite a lot play games with multichannel sound, with music in those games muted, and playing mp3, thus making my plugin taking multichannel signal with front channels of game mixed with music and put it thru to surrounder not upmixing the stereo mp3 xd.

So in other words i spend few days trying to get a grip on language of programming which is to abstract for me to fully understand, making pluging that at basic concept have had an big error (the game+mp3 thing). In other words it seems i need to use creative drivers:/. As i like more win7 over win xp than i like kx drivers over creative ones.

I wonder if creative drivers with their cmss upmixing will upmix only mp3 while 6channel audio from game will be untouched.

Anyway thanks for answer, and i still hope some1 will 'repair' kx driver issues in win7 so i can use them again, as the game+mp3 issue seems to be a backstaber for multiprofile dsp swiching for stereo/multichannel connections in dsp.
Eversor8 is offline   Reply With Quote
Old Nov 29, 2009, 04:53 PM   #4
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,503
Rep Power: 60
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Problems with making plugins

Quote:
Originally Posted by Eversor8 View Post
Info about that 1 is 1LSB less than 1 isn't to much of a help. As it doesn't explain lot of stuff i still don't get how the fuck those things work.
It basically means that 1 in that instruction is really 0.9999999995343387126922607421875 (i.e. fractional range in the DSP is -1 to 0.9999999995343387126922607421875 (+1 is not representable as a fractional number)), so if you are testing -1 + 1 as in your example acc3 instruction, the result will be -0.000000000465661287307739257813 rather than 0. In most cases the difference is so small that it does not matter much, but in some cases it does make a difference.

It is the same with your example macs instruction (i.e. 1 * x is really 0.9999999995343387126922607421875 * x).

BTW: I was not really sure what you were trying to point out with those example instructions in the first place (but since there is no practical reason to have 1 and -1 in the acc3 instruction I assumed it had something to do with that).

Quote:
Originally Posted by Eversor8 View Post
I fear using your log statement, as the invalid -sum seems to do the trick. I mean the muting of surround outputs works as intended. And if i delete the '-' from there it stops working, so that '-' actualy does something. What it those is actually a big question:P.
Well if you look at the dump (Edit Dump), you will see that it is being replaced by 0x0 (so the result is zero or 0xffffffff).

Last edited by Russ; Nov 30, 2009 at 01:34 AM. Reason: correction
Russ is offline   Reply With Quote
Old Nov 29, 2009, 05:20 PM   #5
HardwareHeaven Extreme Member
 
Join Date: Jan 2005
Posts: 5,503
Rep Power: 60
Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!Russ is just super!

Re: Problems with making plugins

BTW: Some people claim that upmixing works correctly when using the SPDIF device (I have Windows XP so I cannot verify anything related to Vista/7). If that is the case, then that could be a workaround for you.

i.e.
Set Windows (and thus your game) to use Master Mixer as the default device (so that multichannel audio works correctly), and set your MP3 player to use the SPDIF device.
Russ is offline   Reply With Quote
Old Nov 30, 2009, 12:51 AM   #6
h/h member-shmember
 
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66
Max M. is a name known to allMax M. is a name known to allMax M. is a name known to allMax M. is a name known to allMax M. is a name known to allMax M. is a name known to all

Ответ: Problems with making plugins

by the way:
Code:
macs tmp1,sum,0,tmp1
macs tmp2,tmp1,0,tmp2
...
macs tmp19,tmp18,0,tmp19
macs tmp20,tmp19,0,tmp20     
;moving the static registers +1 up
nope, this way you're copying the value of sum to all tmp registers.
To "move +1 up" it should be done in reverse order, i.e.:
Code:
macs tmp20, tmp19, 0, 0
macs tmp19, tmp18, 0, 0
...
macs tmp2, tmp1, 0, 0
macs tmp1, sum, 0, 0
__________________

Last edited by Max M.; Nov 30, 2009 at 01:32 AM. Reason: corrected comma to make oecumenical mind happy
Max M. is offline   Reply With Quote
Old Nov 30, 2009, 03:35 AM   #7
h/h member-shmember
 
Join Date: Dec 2002
Location: Evil Empire
Posts: 2,606
Rep Power: 66
Max M. is a name known to allMax M. is a name known to allMax M. is a name known to allMax M. is a name known to allMax M. is a name known to allMax M. is a name known to all

Ответ: Problems with making plugins

And, well:

Quote:
As it doesn't explain lot of stuff i still don't get how the fuck those things work.
Your code is very close to be working as you planned it to be (and it will be with those small fixes we've mentioned).
(though the idea itself in general probably needs more thinking to become a solution... yep)

Quote:
For example i added 3 controls, and used the andxor function. On the net i found a manual how it should work. And short saying it didnt work anyhow close to that manual. When manual said resoult should be a nand x it was like a and x etc. Generaly speaking nothing here works close to normal programming im used to xd.
I'm not aware of any problems with the andxor instruction (well, to be honest it does have no) so maybe if you give more details on what actual code you tried, what results you expected and what results you got instead - we could give some hints on what was wrong.

Hint #1: you can monitor exact value of each register via kxctrl utility (this could be a bit more handy than watching "results" via peak-meters).
__________________

Last edited by Max M.; Nov 30, 2009 at 03:44 AM.
Max M. is offline   Reply With Quote
Reply

Bookmarks

Thread Tools