Skip to content

a740g/MIDI-Player-64

Repository files navigation

MIDI PLAYER 64

MIDI Player 64 is a QB64-PE compatible MIDI player library built using the rtmidi and fmidi libraries.

Screenshot 1 Screenshot 2

FEATURES

  • Simplified API designed for quick integration into projects.
  • Works with both 64-bit and 32-bit versions of QB64-PE.
  • No shared library dependencies, offering a simpler setup compared to solutions requiring DLLs.
  • Runs on Windows, Linux, and macOS.
  • Includes an example to demonstrate library usage.

USAGE

  1. Clone this repository to a directory of your choice:

    git clone https://github.com/a740g/MIDI-Player-64.git
    cd MIDIPlayer64
  2. Initialize the submodules:

    git submodule update --init --recursive
  3. Open MIDIPlayer64.bas in the QB64-PE IDE.

  4. Press F5 to compile and run

To use the library in your project, add the Toolbox64 repository as a Git submodule

API

The library provides the following functions and subroutines:

FUNCTION MIDI_GetErrorMessage$
FUNCTION MIDI_GetPortCount~&
FUNCTION MIDI_GetPortName$ (portIndex AS _UNSIGNED LONG)
FUNCTION MIDI_SetPort%% (portIndex AS _UNSIGNED LONG)
FUNCTION MIDI_GetPort~&
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_Loop (loops AS LONG)
FUNCTION MIDI_IsLooping%%
SUB MIDI_Pause (state AS _BYTE)
FUNCTION MIDI_IsPaused%%
FUNCTION MIDI_GetTotalTime#
FUNCTION MIDI_GetCurrentTime#
SUB MIDI_SetVolume (volume AS SINGLE)
FUNCTION MIDI_GetVolume!
SUB MIDI_SeekToTime (seekTime AS DOUBLE)
FUNCTION MIDI_GetFormat$

NOTES

  • Requires the latest version of QB64-PE

  • When cloning this repository, submodules are not cloned automatically. Run:

    git submodule update --init --recursive
  • This library supports MIDI playback through the system's MIDI output device instead of a software synthesizer.

ASSETS