Skip to content

a740g/WinMIDI-Player-64

Repository files navigation

WINMIDI PLAYER 64

This is a QB64-PE compatible MIDI player library that uses Win32 WinMM MIDI streaming APIs.

Screenshot 1 Screenshot 2

FEATURES

  • Easy plug-&-play API optimized for demos & games
  • Works with both 64-bit and 32-bit QB64-PE complier
  • Everything is statically linked (no DLL dependency; unlike this)
  • Demo player that shows how to use the library
  • Contains a simple asyncronous .WAV (ACM compressed) player too that supports looping. Great for background .WAV music

USAGE

  • Clone the repository to a directory of your choice
  • Open Terminal and change to the directory using an appropriate OS command
  • Run git submodule update --init --recursive to initialize, fetch and checkout git submodules
  • Open WinMIDIPlayer64.bas in the QB64-PE IDE and press F5 to compile and run
  • To use the library in your project add the Toolbox64 repositiory as a Git submodule

API

Function MIDI_PlayFromMemory%% (buffer As String)
Sub MIDI_PlayFromMemory (buffer As String)
Function MIDI_PlayFromFile%% (fileName As String)
Sub MIDI_PlayFromFile (fileName As String)
Sub MIDI_Stop
Function MIDI_IsPlaying%%
Sub MIDI_SetLooping (ByVal loops As Long)
Function MIDI_IsLooping%%
Sub MIDI_SetPause (ByVal pause As Byte)
Function MIDI_IsPaused%%
Sub MIDI_SetVolume (ByVal volume As Single)
Function MIDI_GetVolume!
Function Sound_PlayFromMemory%% (buffer As String, Byval looping As Byte)
Sub Sound_PlayFromMemory (buffer As String, looping As Byte)
Function Sound_PlayFromFile%% (fileName As String, looping As Byte)
Sub Sound_PlayFromFile (fileName As String, looping As Byte)
Sub Sound_Stop
Sub Sound_Beep (dwFreq AS Unsigned Long, dwDuration AS Unsigned Long)

NOTES

  • This requires the latest version of QB64-PE
  • This works on Windows only because it makes use of the Windows API
  • To use something more cross-platform see MIDI Player 64 or QB64-PE's $MIDISOUNDFONT
  • When you clone a repository that contains submodules, the submodules are not automatically cloned by default
  • You will need to use the git submodule update --init --recursive to initialize, fetch and checkout git submodules
  • MIDI support is built into QB64-PE using TinySoundFont and TinyMidiLoader
  • This can be used when you want to eliminate the extra storage used by soundfonts on Windows

ASSETS