farbrauschs music lib in a Purebasic userlibrary ...

Developed or developing a new product in PureBasic? Tell the world about it.
WolfgangS
Enthusiast
Enthusiast
Posts: 174
Joined: Fri Apr 25, 2003 3:30 pm

farbrauschs music lib in a Purebasic userlibrary ...

Post by WolfgangS »

Hi,
with some help of traumatic, Paul and Rings I wrapped kb/farbrauschs libv2 static library. Tthe synthesizer that was responsible for creating all sounds in the famous farbrausch intros such as .the .product, poemtoahorse, Candytron, Flybye and of course the 96 kilobyte shoot-em-up .kkrieger to a Purebasic userlibrary.

Summarized: With this userlibrary you can play .v2m songs.


The Links:
+ The userlibrary Libv2Purebasic www.schliess.net
+ .schnurpfel - a lame libv2 player written with Libv2Purebasic www.schliess.net

+ kb/farbrausch http://kebby.org
+ farbrausch www.farb-rausch.de
+ libv2 library with some additional infos http://www.1337haxorz.de/products.html

Have fun + MFG
WolfgangS
Last edited by WolfgangS on Sun Feb 13, 2005 12:07 am, edited 1 time in total.
WolfgangS' projects http://www.schliess.net
Quotation of the month:
<p3hicy>oder ich hol mir so eine geile aus asien
<p3hicy>die ständig poppen will
<p3hicy>'n brötchen pro tag reicht doch
<p3hicy>die essen eh' nich so viel
Tommeh
Enthusiast
Enthusiast
Posts: 149
Joined: Sun Aug 29, 2004 2:25 pm
Location: United Kingdom

Post by Tommeh »

Cool, i'll have fun playing around with this good work :mrgreen:
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: farbrauschs music lib in a Purebasic userlibrary ...

Post by traumatic »

In case someone's interested, here's the original (obviously adapted) example:

Code: Select all

ssInit(?theTune, GetForegroundWindow_())

OpenConsole()
PrintN("Farbrausch Tiny Music Player v0.2")
PrintN("Code and Synthesizer (C) 2000-2004 kb/Farbrausch");
PrintN("Now Playing: 'Experimental Trance' by DaFunk");

ssPlay()

Dim anim.b(3) : anim() = @"|/-\"

Repeat
  ConsoleLocate(0,4)
  Print(FormatDate("%ii:%ss", ssGetTime()*0.001) + " " +Chr(anim(Int(ssGetTime()/250.0)&3)))
 
  Sleep_(10)
Until GetAsyncKeyState_(#VK_ESCAPE)

ssClose()
CloseConsole()
End

DataSection
  theTune:
  IncludeBinary("Dafunk - Experimental Trance.v2m")
EndDataSection 
I really liked the animation ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Works great here, very cool lib..
WolfgangS
Enthusiast
Enthusiast
Posts: 174
Joined: Fri Apr 25, 2003 3:30 pm

Post by WolfgangS »

:*)
...with a little help from my friends...
WolfgangS' projects http://www.schliess.net
Quotation of the month:
<p3hicy>oder ich hol mir so eine geile aus asien
<p3hicy>die ständig poppen will
<p3hicy>'n brötchen pro tag reicht doch
<p3hicy>die essen eh' nich so viel
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: farbrauschs music lib in a Purebasic userlibrary ...

Post by traumatic »

The following line of my above example doesn't work in v3.93b1:

Code: Select all

  Print(FormatDate("%ii:%ss", ssGetTime()*0.001) + " " + Chr(anim(Int(ssGetTime()/250.0)&3)))
only the "Chr(anim(Int(ssGetTime()/250.0)&3)))"-part is shown.

However this works:

Code: Select all

  Print(FormatDate("%ii:%ss", ssGetTime()*0.001) + " " + Hex(anim(Int(ssGetTime()/250.0)&3)))
This works, too:

Code: Select all

  Print(FormatDate("%ii:%ss", ssGetTime()*0.001) + " " + Str(anim(Int(ssGetTime()/250.0)&3)))
And even that works (no additional space):

Code: Select all

  Print(FormatDate("%ii:%ss", ssGetTime()*0.001) + Chr(anim(Int(ssGetTime()/250.0)&3)))
It worked in 3.92. Sorry, I just couldn't nail it down...
Good programmers don't comment their code. It was hard to write, should be hard to read.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: farbrauschs music lib in a Purebasic userlibrary ...

Post by traumatic »

Another strange thing:

Take the above code and remark the following lines:

Code: Select all

; PrintN("Farbrausch Tiny Music Player v0.2")
; PrintN("Code and Synthesizer (C) 2000-2004 kb/Farbrausch");
; PrintN("Now Playing: 'Experimental Trance' by DaFunk");
Now the debugger says: "Array index out of bounds" !?

And no, this is no 3rd party library issue, try the following:

Code: Select all

OpenConsole()
PrintN("PureBasic rules") ; comment me to get "Array index out of bounds"!


Dim anim.b(0) : anim() = @"|/-\"


Repeat
  ConsoleLocate(0,4)
  Print(FormatDate("%ii:%ss", i*0.001) + " " + Chr(anim(Int(i/250.0)&3)))
  i+10
  Sleep_(10)
Until GetAsyncKeyState_(#VK_ESCAPE)

CloseConsole()
End
@WolfgangS: Sorry for hijacking your thread! Maybe some kind admin will move this ;)
Good programmers don't comment their code. It was hard to write, should be hard to read.
traumatic
PureBasic Expert
PureBasic Expert
Posts: 1661
Joined: Sun Apr 27, 2003 4:41 pm
Location: Germany
Contact:

Re: farbrauschs music lib in a Purebasic userlibrary ...

Post by traumatic »

Code: Select all

Dim anim.b(0) : anim() = @"|/-\"
Ok, this is not legal (I knew but liked it) and only worked with pure luck in 3.92

Thanks for clearing this, Fred!
Good programmers don't comment their code. It was hard to write, should be hard to read.
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

Post by THCM »

Hi, there's a new v2m version out! http://www.1337haxorz.de/products.html#v2

It would be very nice to have the new version as a lib for Purebasic!

Thanx in advance!
The Human Code Machine / Masters' Design Group
DarkDragon
Addict
Addict
Posts: 2344
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Post by DarkDragon »

I converted the new v2synth player code within 3 days of work after it was released (This spaghetti code of kb is really damn hard - Never thought anyone would missuse C++ to do spaghetticode in OOP [you can't do spaghetti code in OOP languages, just kb is able to do this] ) to purebasic. If you want it, please send me a private message and I'll send you the translated code.
bye,
Daniel
Post Reply