Deviation Actions

TomyLobo's avatar

Automated AVSTrans APE (beta)

By TomyLobo
7 Favourites
wee! i finally made it!
With some help from Jaak (and some nice ppl in a c++ help channel :)), i translated AVSTrans to C++!
After doing this, it was only a minor step to integrating AVSTrans into my existing eeltrans.ape (which used the VB AVSTrans via COM before).
Now, eeltrans.ape is completely self-contained and can thus be spread along with a preset for example :)
Also, it can now be used without admin rights and should also run fine on wine.

This APE should do the same as the latest VB version. if it doesnt, or if it crashes or outputs strange errors that the VB version doesnt, plz send me the code piece that causes the problems and I'll see what i can do about it.

The APE also has a code logger that writes all your code into various files in c:\avslog

have fun with it :)
manual coming soon :)

The latest VB Version is available here: [link]

- major fixup: code saving and displaying works now. crashes less often.

- I fixed and changed the behaviour of global code. You can now have multiple instances of AVSTrans concurrently and even specify global code for each one. The code will simply be concatenated in this case. There should be no more "Instance conflict" dialog boxes or lost code.

- gmegabuf loading should be much faster with this new version and the upcoming version 1.1 of Jheriko's Global Variable Manager

- You can now include external files using "#include filename". Refer to eeltrans.txt for more information and an example.
- log path is now customisable

- allowed things like a=b=c; (assigns the value of c to a and b)

- crash bug fixed that would occur if "*)*(*;*)*" was entered, where * is any combination of characters (except brackets) including no characters at all. thx fsk for first reporting this (very vaguely though :))
- some optimisations

- hopefully everything in the #defines fixed :)
- fixed a bug that prevented loading the settings when switching from one eeltrans preset to another

- added documentation
- fixed config dialog grabbing focus when loaded
- fixed a (stupid) bug in the #defines that prevented using token identifiers longer than 1 character :)
- fixed another bug in the #defines that prevented some uses of the token insertion operator (##) not to work

- fixed freezing when entering incomplete #defines
- fixed freezing when having bracket errors while using macros
- fixed a stupid bug in the code logger that caused it to crash when entering code with "%" in it

- improved preset changing behaviour (will not delete the AVSTrans component anymore)
© 2004 - 2021 TomyLobo
Join the community to add your comment. Already a deviant? Log In
TomyLobo's avatar
source code is available at now, if anyone wants it (probably not)
Grandchild's avatar

Did you btw, also do Triangle APE? That one would also save me a bit of work, if the source is still around. Normalize shouldn't be too hard to do... Buffer Blend seems to be built into the later versions of AVS.

Grandchild's avatar

Hah, you're actually still on here! :D And you released source for the APE! :love:

Could I use your code to incorporate the APE code into my GCC-build fork of AVS at ? That's under a BSD license. It would be highly appreciated!

TomyLobo's avatar
I made a command line tool.

The source is at the same URL.
Just run "make" in the "AVSTrans_cpp" subdirectory.

I also made a travis build for it, so there's a Linux release binary, too:

As Binary releases for Linux go, this might not work on all Linux versions.
I tested it on my WSL (the windows bash thing) which is xenial.
The Travis worker ran on trusty, so that should work too.

In theory, you should be able to compile and run this on any POSIX-compliant system with GCC installed, including Cygwin/Babun on Windows.
With some minor effort, it should run on Visual Studio, too.

./avstrans-cli < eeltrans-code.txt > avs-code.txt

MinigunShooter600's avatar
why is avstrans crashing winamp?
TomyLobo's avatar
No idea tbh... They probably released a new, incompatible AVS version.
MinigunShooter600's avatar
i wish there was a way to convert the eeltrans code to avs code
TomyLobo's avatar
There is, now!
See my featured comment
Spudd86's avatar
I've had a thought, ya know what'd be nice? If you could translate the preset then save a translated version, for distribution in packs, since at the moment it's still kinda unstable for me... at least on this computer, I know I could use the VB version and do it by hand, but I've got a preset with rather a lot of separate components that all use AVStrans features... (mostly control stuff)
TomyLobo's avatar
that's a good idea
all i need for that would be a complete format description for .avs files
Spudd86's avatar
hmmm would it be possible for you to have macros expand inside other macros...

#define lin(pos,v1,v2) (pos*v1+v2*(1 - pos))
#define biLin(px,py,v1,v2,v3,v4) (py*(px*v1+(1-px)*v2)+(1-py)*(px*v3+(1-px)*v4))
#define triLin(px,py,pz,v1,v2,v3,v4,v5,v6,v7,v8) ((py*(px*v1+(1-px)*v2)+(1-py)*(px*v3+(1-px)*v4))*pz+(1-pz)*(py*(px*v5+(1-px)*v6)+(1-py)*(px*v7+(1-px)*v8)) )

is what I have right now, and there are things that I'm gonna use those in that it wouldbe nice to be able to one of these macros inside another... not to mention that the above would be nicely simplefied to:

#define lin(pos,v1,v2) (pos*v1+v2*(1 - pos))
#define biLin(px,py,v1,v2,v3,v4) lin(py,lin(px,v1,v2),lin(px,v3,v4))
#define triLin(px,py,pz,v1,v2,v3,v4,v5,v6,v7,v8) lin(pz,biLin(px,py,v1,v2,v3,v4),biLin(px,py,v5,v6,v7,v8))
TomyLobo's avatar
it is indeed possible, you just have to reverse the order of your #defines
#define triLin(px,py,pz,v1,v2,v3,v4,v5,v6,v7,v8) lin(pz,biLin(px,py,v1,v2,v3,v4),biLin(px,py,v5,v6,v7,v8))
#define biLin(px,py,v1,v2,v3,v4) lin(py,lin(px,v1,v2),lin(px,v3,v4))
#define lin(pos,v1,v2) (pos*v1+v2*(1 - pos))

#defines are applied to the code, in their order of appearance in the original code
dRRew's avatar
Automated AVSTrans APE, wait no.
its TWO years old...damn it, i feel stupid.
TomyLobo's avatar
it's way older than that :)
but before it was like Frankenstein's creature: half VB half C++
dRRew's avatar
god damn, i dont even no what that is.
i dont even no what C++ is.
im guessing its a type of programming thing? ive heard been said a few times.
TomyLobo's avatar
C++ is an object-oriented programming language built from the structured language C

its advantages are speed and complete/real OO

Visual Basic (VB) is a pseudo-object-oriented Rapid Application Development language basing on the Syntax of the well-known "BASIC" language

it doesnt have real Object orientation in version 6. the reason i use it anyway is that it makes application development faster by doing all the interface stuff for you.
but if you just want a library and dont need a user interface, you have a problem, since VB is not capable of making a simple DLL and exporting some functions and you must use the component object model (COM) instead. COM is a bitch to use in C++ though, with a hugely complex interface.
dRRew's avatar
Automated AVSTrans APE is one year old today.
TomyLobo's avatar
well 1.23 beta 4.5 is the latest [u]VB[/u] version
adasha's avatar
been using this for a while now and it really speeds things up, and makes your code much more readable. nice work!

something i'd like to see is some way of simplifying nested ifs, like a case statement or something. also, is it possible to write if statements that drop the 'else' argument? I thought I saw it in an example you gave, but it never seems to work when I try it :(
TomyLobo's avatar
switch statement would be hard to do properly i'm afraid :(
make proposals for the syntax :)

if there is a missing else part, i must've forgotten it, sorry
fragmer's avatar
switch( * ) {
case *:
case *:

By the way, it's version 1.25 already, it's time to update the "latest VB Version" link :)
TomyLobo's avatar
1.25? did i miss something? :D
fragmer's avatar
well... my AVS Automation APE says "Using Translator v 1.25.00" so I thought your "latest VB Version" link was outdated - it points to "". Anyway, it works great! :D
Join the community to add your comment. Already a deviant? Log In