Qbasicnews.com
April 06, 2020, 11:07:02 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Could someone recommend me a midi playing library/routine?  (Read 3394 times)
Lachie Dazdarian
I hold this place together
*****
Posts: 955



WWW
« on: March 07, 2003, 04:27:22 AM »

You see I need a routine that will play midi files in the background.Nothing more.Somekind of a library which comes with a nice example file.You see I don't have a sound card and I can only check if my proggy runs the midi file on a college PC.So I need something which doesn't require a lot of testing.

Thanx
Logged
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #1 on: March 07, 2003, 10:05:34 AM »

Use QMidi. It is small, easy to use and stable.

FAST instructions:

1. (too bad) you have to set up a BAT file to run SBSIM and SBMIDI, two TSR programs (provided with QMidi, so don't worry).

2. In your program, you have to call the function "driversloaded". If it returns zero, drivers are not loaded, so you must exit the program. The function also does the library initialization.

3. To load a midi, use handle%=LoadMIDI%("FILE.MID").

4. Once loaded, to play it just call PlayMIDI handle%.

5. In your wait loops or in your game loop, be sure to call LoopMIDI. That SUB checks if the midi has ended to play it again from the beginning. That way you get forever looping music.

6. To stop the MIDI, just call StopMIDI

7. To unload the MIDI from memory (once it is not playing anymore, it is better to free the memory it takes) just call UnloadMIDI handle%.

It is as easy as that Smiley
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Piptol
Ancient QBer
****
Posts: 422



WWW
« Reply #2 on: March 07, 2003, 11:50:25 AM »

But if you do that make sure you have a 'no midi' option that doesn't attempt to load the drivers, it really hates some soundcards (like mine). The other option, well, Im sure one of the early DS4QBs could play midi through windows... but which one was it?  :Huh:
Logged

In a world without walls and doors, who needs Windows and Gates?
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #3 on: March 07, 2003, 12:00:20 PM »

I dunno ... I thought there wasn't one. The bad point about DS4QB is that it makes your computer crawl Sad
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Hexadecimal Disaster
Been there, done that
*****
Posts: 1123



« Reply #4 on: March 07, 2003, 09:45:30 PM »

Why? Simple: it uses Winblow$. Stick with QMidi.

Pip: the common sense should insinuate the programmer about the need of "no-whatever" options just for the sake of user-friendlyness (if there's such a word). Sad thing is that almost every QB progger forgets to pay attention to the common sense...

Nath: SBSIM it's no longer needed with newer versions of QMidi, so you can save some of these valuable memory.
Logged

img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #5 on: March 07, 2003, 10:07:02 PM »

Nice to know, HD. I will remove it from my next projects.

An interesting thing that I discovered (I think I did, at least ... ) I was using SBMIDI with an extra parameter in the case that the sound blaster had a wavetable. Using SBMIDI /3 makes the MIDI sound almost like in windows if you have an AWE32, 64PNP and 128, and maybe one of those modern soundcards.

I know that QMidi doesn't like some soundcards (I must be lucky, 'cause it worked with my old Maxisound, with some onboard Soundpro and with an ESS, also onboard), so I always include a no-midi option.

Is there any other MIDI libraries which don't rely on SBMIDI (which actually work and you can attach to your games)?
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Hexadecimal Disaster
Been there, done that
*****
Posts: 1123



« Reply #6 on: March 07, 2003, 11:05:09 PM »

The FM Tracker, by Steve Bigras (if my memory serves me well) emulates a tracker like ST3 or IT (duh) but instead of using samples it used FM patches for the instruments. Problem? Too slow for my taste.

The manual of QMidi version 4.1 says:

Quote
Also, in this version, the PauseMIDI and ResumeMIDI routines no longer require the SBMIDI driver.  What this means is that SBSIM.COM is now not required at all!  You still might want to load it, however, as it seems to improve QMIDI's wavetable synthesis.


About your "discovery", it's very unlikely that the soundcard has hardware wavetable abilities. Instead, they use something called the "software wavetable driver", and if you're in that situation, using the /3 parameter isn't recommended because it makes the "emulation" EXTREMELY slow. That doesn't apply to the SB Live! SB16 emulator, so feel free to use and abuse.
Logged

img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #7 on: March 08, 2003, 12:10:14 AM »

Ok... Anyhow, I had not experienced any slowdown in my crappy 233, and I have tested it with AWE32, 64PNP and 128PCI (yeah, I have that hobbie about replacing my soundcard very often Tongue).

Anyway, I will put this in intensive testing.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Hexadecimal Disaster
Been there, done that
*****
Posts: 1123



« Reply #8 on: March 08, 2003, 12:23:06 AM »

Well, the SB AWE 32 / 64 has hardware wavetable support (I had an AWE64 ISA before the Live!, so I can tell you with some... experience), and **checks soundblaster.com site** it seems that the 128PCI has support also, but not quite sure. Anyways.

Quote
Hardware Settings for SoundBlaster 128PCI

Note: all resource settings are software selectable via Plug and Play. The following is a combination of resources typically used by Legacy Emulation. The values in brackets are default settings.

Interrupt (IRQ): 5, [7], 9, 10
DMA Channel: 0, [1], 3
Sound Blaster I/O Address #1: [220], 240
Sound Blaster I/O Address #2: 388
Base/MIDI port I/O Address: 320, [330], 340, 350
Wave Synthesizer I/O Address: 530, E80, F40 Hex


That's why you haven't experienced slowdowns at all.  Cool
Logged

img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #9 on: March 08, 2003, 12:24:54 AM »

Again, nice to know Smiley thanks.
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Hexadecimal Disaster
Been there, done that
*****
Posts: 1123



« Reply #10 on: March 08, 2003, 12:37:05 AM »

You're welcome. We're here to serve. (NOT!)

BTW, check the FM HSC Tracker v2.0, by Steve Bigras. Fortunately the link still works. Maybe you can find it useful.
Logged

img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
Lachie Dazdarian
I hold this place together
*****
Posts: 955



WWW
« Reply #11 on: March 11, 2003, 10:02:17 AM »

Thanx Nathan.I downloaded it.It's cool that I don't have to compile it with an extra .lib file.Yes,no midi option will be added.

I tried to find some nice tracks for background music.Hmm,I think you'll like some tracks while you'll hate the others.And without real sound effects it won't be so cool.But,better something than nothing.

It will feature Blade Runner end title tunes and classic O Fortuna from Carmina Burana.Among other things.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!