Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / how to put this in function

Author
Message
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 4th Aug 2011 23:39
i made a program to record video and audio from the game, but there is a small problem with this, how can i put this code into the function so i can activate and deactivate it by pressing space key or something, and how can i get this to work and update the screen, the main problem is that when this code is active i don't get screen update

CumQuaT
AGK Master
16
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 5th Aug 2011 02:35
Currently the way you have it, in theory, will only record the screen while the space key is being held down. Perhaps that has something to do with it?

Also, the way you have the code up there, I don't know if your scancode value stored in KB_SPACE is correct. You can just use SPACEKEY() instead:



Which may help...

Malevolence: The Sword of Ahkranox
www.msoa-game.com
www.facebook.com/malevolencegame
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 5th Aug 2011 13:38

This is the reason your screen won't update. Everything is drawn to the image and not to the screen.
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 5th Aug 2011 23:21
@Max P
I tried your code and even tried to use it with mine and in both cases it crashes to windows


the idea was to use one button for starting and stopping recording of the gameplay and that is why i have problems with getting this into a function, try the code from the first post and this post to see the problem.
Bluespark
15
Years of Service
User Offline
Joined: 18th Mar 2011
Location:
Posted: 6th Aug 2011 02:06
You can use this code to start recording with one spacekey press (holding it won't repeatedly start it):

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 6th Aug 2011 21:13
this code crashes with error sound not found

i don't know how to fix this, and i didn't been able to test this to see if it solves the problem from the first post
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Aug 2011 00:51 Edited at: 7th Aug 2011 00:52
You guys are forgetting to setup the memblock:

make memblock mem_ID,10
delete memblock mem_ID


Also nruser, your going to encounter a problem with your code. The moment recording starts, it stops will the next argument.

nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 7th Aug 2011 15:58
ok that helped a lot but i still don't see why am i required to use memblock without it program crashes
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Aug 2011 16:27
The Memblock is used to pass data to dlls, some dll required a memblock setup to work. Sparky's collision dll does I believe (or did).
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 7th Aug 2011 18:07
ok here is the working code


now the unexpected problem is that when i stop recording i have captured around one second of video and five of sound how can i fix this?
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Aug 2011 18:48 Edited at: 7th Aug 2011 18:48
You can't I think. Due to audio and video being captured independently, well that's my guess. The main issue is get image is just far to slow for this to be any useful. It could slow your program down to 1 fps with tons of object at a low resolution (if was any higher than 800x600 give up). Just imagine, it would take 60 seconds to record one second of video. You'd then have 59 (actually, you wouldn't be able to use any of it) seconds of useless audio.
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 7th Aug 2011 19:36
DB hasn't the poke to do this at 60 fps as you are doing. You would have more success lowering your capture rate to 30 or less. I played about with this plugin awhile back and found 15 a reasonable compromise.


Here is the code I used at the time. Using get image at 60 fps is asking a lot from DB especially if you have a high res. Lowering your framerate to a lower one and matching it with the avi capture plugin produces fairly good results. I have a timer to test the length of the video against the avi, they seem to match fairly well. Didn't try sound, but I cannot see why it wouldn't work as long as you match your framerates.

http://s6.bitefight.org/c.php?uid=103081
nruser
18
Years of Service
User Offline
Joined: 22nd Dec 2007
Location: Serbia
Posted: 8th Aug 2011 02:19
with 15 in sync rate and in make avi sometimes audio and video have almost exact lenght and sometimes there is 3 or more seconds difference, is there a way to make sound and video record at the same sync event or something like a timer system?

Login to post a reply

Server time is: 2026-07-10 10:19:42
Your offset time is: 2026-07-10 10:19:42