Coder Social home page Coder Social logo

a740g / qb64-mod-player Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 3.0 252.73 MB

A MOD player & library for QB64-PE

Home Page: https://qb64phoenix.com/forum/showthread.php?tid=1045

License: MIT License

BASIC 100.00%
basic basic-programming music music-library music-player qb64 retro protracker tracker-music fasttracker

qb64-mod-player's Introduction

QB64 MOD PLAYER

This is a MOD player and library written in QB64-PE.

It currently supports the following formats:


Screenshot 1 Screenshot 2

FEATURES

  • No dependency on third party libraries
  • Everything is statically linked (no shared library dependency)
  • Easy plug-&-play API optimized for demos & games
  • Cross-platform (works on Windows, Linux & macOS)
  • Support all MOD types (1 - 99 channels, 31 samples etc.)
  • Support all MOD effects
  • Demo player that shows how to use the library

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 QB64MODPlayer.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

' Main Player API
FUNCTION MODPlayer_GetName$
FUNCTION MODPlayer_GetOrders~%
FUNCTION MODPlayer_GetPosition&
FUNCTION MODPlayer_GetType$
SUB MODPlayer_GoToNextPosition
SUB MODPlayer_GoToPreviousPosition
FUNCTION MODPlayer_IsLooping%%
FUNCTION MODPlayer_IsPaused%%
FUNCTION MODPlayer_IsPlaying%%
FUNCTION MODPlayer_LoadFromDisk%% (fileName AS STRING)
FUNCTION MODPlayer_LoadFromMemory%% (buffer AS STRING)
SUB MODPlayer_Loop (state AS _BYTE)
SUB MODPlayer_Pause (state AS _BYTE)
SUB MODPlayer_Play
SUB MODPlayer_SetPosition (position AS _UNSIGNED INTEGER)
SUB MODPlayer_Stop
SUB MODPlayer_Update (bufferTimeSecs AS SINGLE)
' Sample Mixer API
FUNCTION SoftSynth_BytesToFrames~& (bytes AS _UNSIGNED LONG, bytesPerSample AS _UNSIGNED _BYTE, channels AS _UNSIGNED _BYTE)
SUB SoftSynth_Finalize
FUNCTION SoftSynth_GetActiveVoices~&
FUNCTION SoftSynth_GetBufferedSoundTime#
FUNCTION SoftSynth_GetGlobalVolume!
FUNCTION SoftSynth_GetMasterVolume!
FUNCTION SoftSynth_GetSampleRate~&
FUNCTION SoftSynth_GetTotalSounds~&
FUNCTION SoftSynth_GetTotalVoices~&
FUNCTION SoftSynth_GetVoiceBalance! (voice AS _UNSIGNED LONG)
FUNCTION SoftSynth_GetVoiceFrequency~& (voice AS _UNSIGNED LONG)
FUNCTION SoftSynth_GetVoiceVolume! (voice AS _UNSIGNED LONG)
FUNCTION SoftSynth_Initialize%%
FUNCTION SoftSynth_IsInitialized%%
SUB SoftSynth_LoadSound (snd AS LONG, buffer AS STRING, bytesPerSample AS _UNSIGNED _BYTE, channels AS _UNSIGNED _BYTE)
FUNCTION SoftSynth_PeekSoundFrameByte%% (snd AS LONG, position AS _UNSIGNED LONG)
FUNCTION SoftSynth_PeekSoundFrameInteger% (snd AS LONG, position AS _UNSIGNED LONG)
FUNCTION SoftSynth_PeekSoundFrameSingle! (snd AS LONG, position AS _UNSIGNED LONG)
SUB SoftSynth_PlayVoice (voice AS _UNSIGNED LONG, snd AS LONG, position AS _UNSIGNED LONG, mode AS LONG, startFrame AS _UNSIGNED LONG, endFrame AS _UNSIGNED LONG)
SUB SoftSynth_PokeSoundFrameByte (snd AS LONG, position AS _UNSIGNED LONG, frame AS _BYTE)
SUB SoftSynth_PokeSoundFrameInteger (snd AS LONG, position AS _UNSIGNED LONG, frame AS INTEGER)
SUB SoftSynth_PokeSoundFrameSingle (snd AS LONG, position AS _UNSIGNED LONG, frame AS SINGLE)
SUB SoftSynth_SetGlobalVolume (volume AS SINGLE)
SUB SoftSynth_SetMasterVolume (volume AS SINGLE)
SUB SoftSynth_SetTotalVoices (voices AS _UNSIGNED LONG)
SUB SoftSynth_SetVoiceBalance (voice AS _UNSIGNED LONG, balance AS SINGLE)
SUB SoftSynth_SetVoiceFrequency (voice AS _UNSIGNED LONG, frequency AS _UNSIGNED LONG)
SUB SoftSynth_SetVoiceVolume (voice AS _UNSIGNED LONG, volume AS SINGLE)
SUB SoftSynth_StopVoice (voice AS _UNSIGNED LONG)
SUB SoftSynth_Update (frames AS _UNSIGNED LONG)

FAQ

Why a MOD player in QB64?

  • Just for learning and fun! Long answer: I have seen plenty of MOD players code and libraries in C & C++ but very little in other languages. I know about some JavaScript, Java and C# ones. But, I am not a fan of those languages. I learnt to code on DOS using QuickBASIC and then graduated to C & C++. So, QuickBASIC always had a special place in my heart. Then, I found QB64 on the internet and the rest is history. As far as I know this is the first of it's kind. Let me know if there are any other MOD players written in pure QB64.

Can you implment feature x / y?

  • With the limited time I have between my day job, home and family, there is only so much I can do. I do maintain a list of TODO (see below). However, those do not have any set deadlines. If you need something implemented, submit a GitHub issue about it or do it yourself and submit a PR.

I found a bug. How can I help?

  • Let me know using GitHub issues or fix it yourself and submit a PR!

Can this be used in a game / demo?

  • Absolutely. The player UI code included in a great example.

You keep saying QB64-PE with miniaudio backend. Where is it?

I see that the miniaudio backend version of QB64-PE already has MOD, S3M, XM, IT, RADv2 & MIDI support. Why should I care about this?

  • Honestly, you should not! The MOD re-player in QB64-PE with miniaudio backend uses Libxmp-lite and as such is good enough for most use cases. This is just something that I made just to see what can be done using just QB64-PE. If you want to see what MOD files are made of and what makes them tick, then by all means, have at it. There are some interesting things in the code for people who care about this kind of stuff. Also, my MOD re-player is more accurate than the one in Libxmp-lite... I hope. ๐Ÿ˜‰

NOTES

  • This requires the latest version of QB64-PE
  • 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

BIBLIOGRAPHY

ASSETS

  • Icon by Tsukasa-Tux (Azrael Jackie Lockheart)

qb64-mod-player's People

Contributors

a740g avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.