Some questions

The forum for all of your Freebasic needs!

Moderators: Pete, Mods

Post Reply
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

Some questions

Post by TmEE »

I'm gonna port MD tracker to FreeBASIC (since I've hit some major QB limitation) and I've managed to run into some troubles...

1) How can I get keyboard scan codes ? INP(&H60) doesn't do anymore...

2) There is no ON TIMER anymore... I need something that executes part of code after (insert time here)... in QB45 I just wrote new value to PIT and got ON TIMER(1) to do what required...

3) I can do MIDI anymore by just writing to $330 ($ means HEX here... I'm 68K programmer... Mega Drive / Genesis kicks @$$)...
Mida sa loed ? Nagunii aru ei saa :P
Antoni
Veteran
Posts: 132
Joined: Wed Jun 15, 2005 3:01 pm
Contact:

Post by Antoni »

1.- FreeBASIC has a built-in multikey
as those found in QB libraries.

2.-You can emulate ON-TIMER using a background thread. See code .This solution won't compile for DOS...

3.- FB can write to port to $330 if your present compiler can do it. But this is not likely to work in other people's soundcards. For alternative solutions see this thread
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

Post by TmEE »

multikey has no use in my case, I just need keyboard scan codes... hit a key down / release key, the scan code... one key at time.

I'll try to understand the ON TIMER emulation.... I have zero experience with windows programming... and I will not do any pmode DOS stuff...

And for MIDI, writing to $330 won't do in Windows... only in DOS it seems... and I DO NOT want to use any libraries. And I need something very basic.. I don't play MIDI files, I just send in some MIDI commands... stuff like Key On/Off, Program change, Parameter change etc.... I guess Windows API comes here...
Mida sa loed ? Nagunii aru ei saa :P
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

You're right, Windows API is the better way to go in Windows. I did a series on MIDI Programming in QB Express I have 3 parts so far and working on the 4th part.

Part one .MID File format
http://www.petesqbsite.com/sections/exp ... .html#midi

Part Two - Processing of a midi file with interpreted results.
http://www.petesqbsite.com/sections/exp ... ogramming2

Part tree - Actual formatting and sending of MIDI messages to the MIDI devices.
http://www.petesqbsite.com/sections/exp ... ogramming3

The last one shows how to use the API to open MIDI channels formulate and send MIDI messages of all types (note on/off, and the likes.).

For good timing, the API again in Windows, see the QueryPerformanceTimer function for details.


Hope these help.
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
TmEE
Veteran
Posts: 97
Joined: Mon Mar 17, 2008 11:14 am
Location: Estonia, Rapla
Contact:

Post by TmEE »

I've got all answers for my MIDI stuff. Thank you MystikShadows. I might be able to add a MIDI file exporting option too into my tracker.

Scancodes probably come form WinAPI too...

Now I just need to get the playback routine called every 49.4Hz (the closest speed to Mega Drive I got using PCs PIT in QB version).

What a big bite... I need to digest it a little...

EDIT : if anyone's interested in the DOS verison, here's some OLD version : http://www.spritesmind.net/_GenDev//for ... .php?t=220 (latest is 0.4a, but its used for commercial stuff...)
Mida sa loed ? Nagunii aru ei saa :P
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

You're welcome. :-).

Glad it could be of help. I can't wait to see what you'll come with :-).
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
Post Reply