• Welcome to Dark Bit Factory & Gravity.
 

Tinyptc Ext++ (tinyptc_ext + uFmod)

Started by Rbz, December 20, 2008

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Rbz

Freebasic tinyptc extended++
----------------------------

Standard ptc functions:
-----------------------
ptc_open
ptc_update
ptc_close

Tinyptc extension functions:
----------------------------
ptc_setflip
ptc_getmousex
ptc_getmousey
ptc_getleftbutton
ptc_getrightbutton
ptc_setdialog
ptc_allowclose
ptc_getwindow
ptc_setmousewheel
ptc_getmousewheel

Including ufmod ver.1.25.2a:
----------------------------
uFMOD_PlaySong
uFMOD_StopSong
uFMOD_Pause
uFMOD_Resume
uFMOD_GetStats
uFMOD_GetTime
uFMOD_GetTitle
uFMOD_SetVolume
uFMOD_Jump2Pattern
uFMOD_Rewind()

Sound FX player:
----------------
sndfx_init()
sndfx_load(byval as any ptr, byval samplesize as integer, byval samplenum as integer) as integer
sndfx_play(byval samplenum as integer, byval smploop as integer) as integer
sndfx_stop(byval samplenum as integer) as integer
sndfx_setvolume(byval samplenum as integer, byval volume as integer) as integer
sndfx_release()


To install:
-----------
From "tinyptc_ext++.zip" file extract and copy the new tinyptc_ext++ library
( libtinyptc_ext++.a and libmmx.a) to the freebasic install folder:
Ex.:   C:\FreeBasic\lib\win32
And "tinyptc_ext++.bi" to the folder C:\FreeBasic\inc

Check out examples test folder





This version was designed for people who had troubles adding .xm song to their intros using ufmod, which I admit is a bit annoying to compile, this new library includes the latest ufmod library (1.25.2a) + tinyptc_ext in one file, making newbies life a bit easy.

In the examples folder you will find one example to load song from memory and from file and plus an image loader routine.

Challenge Trophies Won:

bikerboy

#1
thanx man :cheers:

i'll go test it right now  :stirrer:

EDIT: okies i've installed as instructed and i get these results:

result 1 with this command #Include Once "tinyptc.bi"

the code

Screenres 640,480,16,2

#Include Once "tinyptc.bi"
#include "windows.bi"
#include "ufmod.bi"
#include "tune.bas"
#include "crt.bi"

       Dim hWave As HWAVEOUT
       hWave = uFMOD_PlaySong(@Music(0),31009,XM_MEMORY)


the tune.bas

'// Created with Bin2Bas V0.22 - by Rbraz (c) 2006
dim shared music(0 to 31009) as ubyte = { _
&H45,&H78,&H74,&H65,&H6E,&H64,&


and the error

Compiler output:
C:\Program Files\FreeBASIC\FBIDETEMP.o:fake:(.text+0x51): undefined reference to `uFMOD_PlaySong@12'


result 2 using #Include Once "tinyptc_ext++.bi" , same code and tune.bas file as above

Compiler output:
C:/Program Files/FreeBASIC/ufmod.bi(45) error 4: Duplicated definition
declare function uFMOD_PlaySong stdcall alias "uFMOD_PlaySong" (byval as LPVOID , byval as DWORD, byval as DWORD) as HWAVEOUT
                                                                                                                     ^
C:/Program Files/FreeBASIC/ufmod.bi(51) error 4: Duplicated definition
declare sub uFMOD_Pause stdcall alias "uFMOD_Pause" ()
                                                     ^
C:/Program Files/FreeBASIC/ufmod.bi(54) error 4: Duplicated definition
declare sub uFMOD_Resume stdcall alias "uFMOD_Resume" ()
                                                       ^
C:/Program Files/FreeBASIC/ufmod.bi(63) error 4: Duplicated definition
declare function uFMOD_GetStats stdcall alias "uFMOD_GetStats" () as UINTEGER
                                                                     ^
C:/Program Files/FreeBASIC/ufmod.bi(71) error 4: Duplicated definition
declare function uFMOD_GetTime stdcall alias "uFMOD_GetTime" () as UINTEGER
                                                                   ^
C:/Program Files/FreeBASIC/ufmod.bi(78) error 4: Duplicated definition
declare function uFMOD_GetTitle stdcall alias "uFMOD_GetTitle" () as ZSTRING ptr
                                                                             ^
C:/Program Files/FreeBASIC/ufmod.bi(87) error 4: Duplicated definition
declare sub uFMOD_SetVolume stdcall alias "uFMOD_SetVolume" (byval as DWORD)
                                                                           ^

Results:
Compilation failed


Hotshot

work GREAT  ;D Excellent Library  8) 8) 8)

Rbz

@bikerboy: Use the source code example from the examples folder, your old source code won't work anymore.

Challenge Trophies Won:

bikerboy

#4
Screenres 640,480,16,2

#Include Once "tinyptc_ext++.bi"
'#Include Once "tinyptc.bi"
#include "windows.bi"
#include "ufmod.bi"
#include "tune.bas"
#include "crt.bi"

       'Play our music
    Dim hWave As HWAVEOUT
    hWave = uFMOD_PlaySong(@Music(0),31009,XM_MEMORY)

    'Main loop
    while(GetAsyncKeyState(VK_ESCAPE)<>-32767)
       
        for x = 0 to 320
            for y = 0 to 240
                    buffer(x+(y*XRES)) = image(x+(y*320))
            next
        next
       
        ptc_update(@buffer(0))
           
        erase buffer
           
    wend

    'Stop playing
    uFMOD_StopSong()


'// Created with Bin2Bas V0.22 - by Rbraz (c) 2006
dim shared Music(0 to 31009) as ubyte = { _
&H45,&H78,&H74,&H65,


Compiler output:
C:/Program Files/FreeBASIC/ufmod.bi(45) error 4: Duplicated definition
declare function uFMOD_PlaySong stdcall alias "uFMOD_PlaySong" (byval as LPVOID , byval as DWORD, byval as DWORD) as HWAVEOUT
                                                                                                                     ^
C:/Program Files/FreeBASIC/ufmod.bi(51) error 4: Duplicated definition
declare sub uFMOD_Pause stdcall alias "uFMOD_Pause" ()
                                                     ^
C:/Program Files/FreeBASIC/ufmod.bi(54) error 4: Duplicated definition
declare sub uFMOD_Resume stdcall alias "uFMOD_Resume" ()
                                                       ^
C:/Program Files/FreeBASIC/ufmod.bi(63) error 4: Duplicated definition
declare function uFMOD_GetStats stdcall alias "uFMOD_GetStats" () as UINTEGER
                                                                     ^
C:/Program Files/FreeBASIC/ufmod.bi(71) error 4: Duplicated definition
declare function uFMOD_GetTime stdcall alias "uFMOD_GetTime" () as UINTEGER
                                                                   ^
C:/Program Files/FreeBASIC/ufmod.bi(78) error 4: Duplicated definition
declare function uFMOD_GetTitle stdcall alias "uFMOD_GetTitle" () as ZSTRING ptr
                                                                             ^
C:/Program Files/FreeBASIC/ufmod.bi(87) error 4: Duplicated definition
declare sub uFMOD_SetVolume stdcall alias "uFMOD_SetVolume" (byval as DWORD)
                                                                           ^
C:/Program Files/FreeBASIC/FBIDETEMP.bas(19) error 67: Array not dimensioned, before '('
                    buffer(x+(y*XRES)) = image(x+(y*320))
                           ^
C:/Program Files/FreeBASIC/FBIDETEMP.bas(19) warning 12(0): Implicit variable allocation, image
C:/Program Files/FreeBASIC/FBIDETEMP.bas(23) error 67: Array not dimensioned, before '('
        ptc_update(@buffer(0))
                           ^
C:/Program Files/FreeBASIC/FBIDETEMP.bas(25) error 59: Expected array
        erase buffer
              ^
C:/Program Files/FreeBASIC/FBIDETEMP.bas(25) error 123: Too many errors, exiting

Results:
Compilation failed


:skint:

Ps.i have every file in the same folder

EDIT: just commented '#include "ufmod.bi" and it compiles just fine but no sound :skint:

EDIT3: lol my n00bness is unlimited :P

i had '#include "ufmod.bi" that's why there was no bling bling :P

works perfect now ;D

thanx again man :cheers:

question, is this method still valid for putting the bas file into the exe one? -> fbc -s console ufmod.o your_intro_name.bas

EDIT4: :o lol

yup it was a dump question it works perfectly :D


Shockwave

Shockwave ^ Codigos
Challenge Trophies Won:

bikerboy

#6
hey guys i think i have a problem (as usual  ::))

the music plays just fine and it compiles and everything , but ...

the song plays only once and then pure silence, is there a command to add or something to make it start again once it's finished?


Clyde

Had no idea there were 2 different versions available of TinyPTC_Ext.
I have been using the download from the other post without UFmod included, as I only need for now PTC_Ext.

o_O
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Rbz

And did you find it useful ?
Challenge Trophies Won:

Clyde

I've used the other tinyptc_ext topic download link for ages, and its extremely usefull.
With this one tinyptc_ext++, I am not sure if this is exactly the same as the one im currently using plus the added bonus of ufmod, or if the tinyptc parts are totally different.

I do know one thing mind, if you use this one ( ext++.bi ) it clashes with Bass.
So I am presuming that the other sticky has an identical ptc_ext. just the ++ means its got UFMOD thrown in with it.

I may of answered my own question above, lack of sleep :)

Cheers,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Shockwave

If you need to be analysing sound channel data etc I find that minifmod works really well with this version of tinyptc.
Shockwave ^ Codigos
Challenge Trophies Won:

Clyde

So is this an entirely new version update of tinyptc_ext?
or is it that it's the same version but with the added support of UFmod?

Thanks.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Jim

Challenge Trophies Won:

Rbz

Quote from: Clyde on May 26, 2009
...
or is it that it's the same version but with the added support of UFmod?
...
Yes, the idea is to make it easy for newcomers to use ufmod library on their projects.
Challenge Trophies Won:

Clyde

Ok cool, thanks for clarifying.

Just remember anyone using this version which is #include "tinyptc_ext++.bi" that if you want to use bass.bi for a change, you'll need to download and use the standalone tinyptc_ext.bi in the other sticky, as it will clash with ufmod.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Rbz

Clyde, it does work with bass, just need some changes in the bass.bi,  I've attached one example here that uses ufmod and bass.
The dude who have converted bass.bi used some mmsystem.bi defines on it's file which clash with another library using mmsytem.bi like tinyptc++.

Challenge Trophies Won:

Clyde

Thanks kindly rbz.

Cheers your ex partner is crime,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.


Challenge Trophies Won:

Mountiho


Shockwave

Welcome to the forum Mountiho :)
Shockwave ^ Codigos
Challenge Trophies Won:

nzo

Thanks for this! It has enabled me to get up and running very quickly and is absolutely ideal for retro remaking :)

cheers