07-25-2022, 11:06 PM
(This post was last modified: 07-25-2022, 11:08 PM by mnrvovrfc.
Edit Reason: Ignored the above coding example
)
(07-21-2022, 08:23 PM)SierraKen Wrote: This might be a good engine sound, you can play around with it. The << sets the octave 2 times lower.
Code: (Select All)Do
t = t + 1
Print t
Play "MB <<g32"
Loop
I might be mistaken but "PLAY" and "SOUND" are part of the deal for QB64 to emulate M$QB and GW-BASIC as closely as possible. Especially people using the latter product entirely expected sounds playing while doing something else such as keyboard input. It was crucial for those who were able to program impressive text-mode animations while complex music arrangements were being played.
You're better off at least using "_SNDOPEN", "_SNDPLAY", "_SNDSTOP", "_SNDVOL", "_SNDPLAYING" and "_SNDCLOSE", with external audio files. They could be in MP3 or OGG format which could be very small if one-channel and maybe 22050Hz sampling rate. Might want to take advantage of "_INFLATE" and "_MEMSOUND" to even include such a file into your source code. Otherwise "_SNDRAW" is the only way to start and stop sound at will.
I have to check out "_MEMSOUND" myself, but I'm not very comfortable programming for the "_MEM" gang. That statement is a lot like "Catchsound" in Purebasic, made it rather easy to bind media files into an EXE file. Sadly it might be for Windows only unless QB64 could recognize "zlib" on Linux.
EDIT: Uh about the code above, what is done with "t"? Because it's an endless loop.