Author Topic: Tiny Future Composer Player for C/C++, FreeBasic and PureBasic  (Read 22575 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Thanks. :D

I am getting crashes whenever the program stops with using TinyPTC. Try out the listing above, and see if it does the same for you.

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

Challenge Trophies Won:

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Hi Slippy

Yes... where ever i can i use the Static Lib with Purebasic! (u can do that with the commando Import(StaticLib)
it seems that theres an export from MSVCR70.dll
Will test with the other lib from MinGW

Cheers eNeRGy
coding: jwasm,masm
hobby: www.scd2003.de

Offline slippy

  • Atari ST
  • ***
  • Posts: 172
  • Karma: 42
    • View Profile
Hey Clyde,

I didn't encounter any problems when quitting a TinyPTC project ... attached there's a little example (although it's been compiled with FB 0.18 ... perhaps this is the solution to your problem??!)

I wonder if it crashes on your PC upon exit ... please let me know ...

@energy: I just tried it myself and I get unresolved symbol errors on compile - I'm no PB crack ... sorry - perhaps we might hand over this question to some of the other guys here ... :/

SLiPPY

« Last Edit: October 06, 2007 by slippy »

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Ace SLiPPY K++ works great in FB 18, thanks for the info and help.

Note: Just to let you know using the TinyPTC_Ext still produces the error upon exitting.

Cheers and all the very best,
Clyde.
« Last Edit: October 06, 2007 by Clyde »
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
Just as an experiment, try stopping the FC player before exiting PTC.
Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Tried that Jim, and still occurs.
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: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Please post the latest source so that the problem can be fixed.. Thanks :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Code: [Select]
'
' Random Pixels Experiment with Future Composer
' Freebasic Version 18

Option Explicit
Option Static


#Include "tinyPTC.bi"'         "TinyPTC_Ext.bi"
#include "tiny_fc.bi"

Const XRES=640
Const YRES=480
Const ARES=XRES*YRES

Dim Shared ScreenBuffer( ARES )
dim shared dummy as integer

Declare Sub FeedPixels  ( Byval X As Integer, ByVal Y As Integer, Byval Col As Integer )

Declare Sub InitializeExperiment()
Declare Sub RunExperiment()
Declare Sub ShutDownExperiment()

Declare Function Randd(ByVal lower as integer, ByVal upper as integer) As Integer

InitializeExperiment()
RunExperiment()
ShutDownExperiment()


Sub FeedPixels  ( Byval X As Integer, ByVal Y As Integer, Byval Col As Integer )
   
    If X>0 And X<XRES-1 And Y>0 And Y<YRES-1 And Col<>0  Then
        ScreenBuffer( X + ( Y * XRES) ) = Col
    End If   
End Sub

Sub InitializeExperiment()

    initFC(0, @dummy, 0, "slipstream2.fc")
    startFC()
   
    If( ptc_open( "testing", XRES, YRES ) = 0 ) Then
        End -1                                   
    End if
   


End Sub

Sub RunExperiment()

    Dim Key As String
   
    Dim x,y
   
    While Key<>Chr(27)
       
        For y=0 To YRES-1
            For x=0 To XRES-1
               
                FeedPixels(x,y,Randd(0,&HFFFFFF))
       
            Next
        Next
       
       
        PTC_Update @ScreenBuffer(0)
        key=Inkey
    Wend

End Sub


Sub ShutDownExperiment()
   
    stopFC()   

    PTC_Close()

End Sub


Function Randd(ByVal lower as integer, ByVal upper as integer) As Integer
   
    Dim temp as integer
   
    If upper < lower then
        temp=upper
        upper=lower
        lower=temp
    End If
   
    Dim value   As integer
    Dim dist    As integer
   
    value=lower
    dist = Abs(lower-upper)
   
    Return ( Rnd(1)*dist) + value

End function
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: 17412
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Here, use this and stop using out of date tinyptc library ;)

This one works well.

Code: [Select]


        #INCLUDE "TINYPTC_EXT.BI"
        #include  "tiny_fc.bi"
        #Include  "Windows.bi"

Const XRES=640
Const YRES=480
Const ARES=XRES*YRES

Dim Shared Buffer( ARES )
dim shared dummy as integer



initFC(0, @dummy, 0, "sample.fc")
startFC()


'-------------------------------------------------------------------------------
'       SET UP SCREEN;
'-------------------------------------------------------------------------------
       
        PTC_ALLOWCLOSE(0)
        PTC_SETDIALOG(0,"",0,0)   
       
        IF (PTC_OPEN("USE THIS FRAMEWORK",XRES,YRES)=0) THEN
        END-1
        END IF         

    WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767) 

    ptc_update@buffer(0)

    Wend

    ptc_close()
    stopFC()
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2757
  • Karma: 493
    • View Profile
    • https://www.rbraz.com/
Shockie is right, if you need to run something after your while/wend loop you must set ptc_allowclose(0) to disable internal tinyptc library escape key support.
Challenge Trophies Won:

Offline RageSnax

  • C= 64
  • **
  • Posts: 25
  • Karma: 4
    • View Profile
Hi Slippy

thanks very much for a cool lib sorry it took so long to say so  :cheers: K++

RageSnax

abdulwaheed

  • Guest
Thanks for the helpful tip Smashing.