Author Topic: Tinyptc Ext++ (tinyptc_ext + uFmod)  (Read 12770 times)

0 Members and 1 Guest are viewing this topic.

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2711
  • Karma: 484
    • View Profile
    • http://www.rbraz.com/
Tinyptc Ext++ (tinyptc_ext + uFmod)
« on: December 20, 2008 »
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.

« Last Edit: June 12, 2011 by rbz »
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #1 on: December 20, 2008 »
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

Code: [Select]
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

Code: [Select]
'// 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

Code: [Select]
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

Code: [Select]
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
« Last Edit: December 21, 2008 by va!n »


Offline Hotshot

  • DBF Aficionado
  • ******
  • Posts: 2114
  • Karma: 91
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #2 on: December 20, 2008 »
work GREAT  ;D Excellent Library  8) 8) 8)

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2711
  • Karma: 484
    • View Profile
    • http://www.rbraz.com/
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #3 on: December 20, 2008 »
@bikerboy: Use the source code example from the examples folder, your old source code won't work anymore.

Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #4 on: December 20, 2008 »
Code: [Select]
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()

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

Code: [Select]
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
« Last Edit: December 21, 2008 by va!n »


Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17374
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #5 on: December 20, 2008 »
Hey Rbz, you rock :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline bikerboy

  • Amiga 1200
  • ****
  • Posts: 349
  • Karma: 12
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #6 on: December 20, 2008 »
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?
« Last Edit: December 21, 2008 by va!n »


Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #7 on: May 17, 2009 »
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:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2711
  • Karma: 484
    • View Profile
    • http://www.rbraz.com/
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #8 on: May 17, 2009 »
And did you find it useful ?
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #9 on: May 19, 2009 »
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:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17374
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #10 on: May 20, 2009 »
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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #11 on: May 26, 2009 »
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:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #12 on: May 26, 2009 »
Yes.

Jim.

The latter.
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2711
  • Karma: 484
    • View Profile
    • http://www.rbraz.com/
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #13 on: May 27, 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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #14 on: May 27, 2009 »
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:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2711
  • Karma: 484
    • View Profile
    • http://www.rbraz.com/
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #15 on: July 18, 2009 »
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:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #16 on: July 22, 2009 »
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:

Offline Mountiho

  • ZX 81
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #17 on: October 06, 2009 »
Great work!
Thank a lot1!

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17374
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #18 on: October 06, 2009 »
Welcome to the forum Mountiho :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline nzo

  • Atari ST
  • ***
  • Posts: 126
  • Karma: 67
    • View Profile
    • Amiga Remakes in DHTML
Re: Tinyptc Ext++ (tinyptc_ext + uFmod)
« Reply #19 on: November 22, 2009 »
Thanks for this! It has enabled me to get up and running very quickly and is absolutely ideal for retro remaking :)

cheers