Author Topic: [C++] I Am making a XM player library, now with source-code, lol  (Read 10933 times)

0 Members and 1 Guest are viewing this topic.

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Hello normal (?) people, i am here to announce that i am planning to expend nights, days and all my blood trying to make a library that plays an outdated and unusual format called XM even knowing we already have a lot of them. [/depression]

Just kidding, the real reason to write this library in pure c++ is to get fawking famous try making the XM format more usual, and more easy to use and edit, it will be open-source like the other ones, but without any assembly understandable part, dlls, and infinite size libs, or the well know fake-positive virus detection by some mercenary anti-viruses.

But i will need some help, first, does anybody here know a GOOD documentation for the XM file format? I've found some, even ones written by Triton and another by the ufmod creators, but i am stuck at the pattern data part, also i am searching for great ideas, if you have any kind of idea to implement that would be awesome!

After finishing the xm_loader i will release it for correction or just curiosity, and then finally try to make the xm_player itself ^^", i am even planning to include IT and MOD, but i am still stuck at the XM format :<

Every kind of help is welcome, even a "good luck", or a sugestion (specially the name of it!)
Thanks everybody! Long live to the chip-music!

« Last Edit: October 16, 2012 by Blacksheep8Bit »
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Good luck! :)

Once upon a time some guy ported some version of minifmod to C to make it run on Amiga OS: uniminixmlib.lha.
It's probably a useful reference for an assembly-free implementation.
« Last Edit: July 25, 2012 by hellfire »
Challenge Trophies Won:

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Good luck! :)

Once upon a time some guy ported some version of minifmod to C to make it run on Amiga OS: uniminixmlib.lha.
It's probably a useful reference for an assembly-free implementation.
Thank you hellfire for your support, i will study this as much as i can, and the project is going pretty fine, i already can load the Header, Patterns and all their data (rows and channels), which is A LOT if you take a look at the XM documentation ;D

I Was wondering, should i use WINMM or OpenAL for playback? Or should i put both includes in the project and let the user decide?
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
i already can load the Header, Patterns and all their data (rows and channels), which is A LOT if you take a look at the XM documentation ;D
I know what you're talking about - wrote my own xm player somewhere in the 90s.
The fun part starts when implementing the actual effects because you have to emulate all bugs of the ft2-replay to make it sound right :)

Quote
should i use WINMM or OpenAL for playback?
How about some abstraction layer with a simple "give me x more samples" function, so you can easily encapsulate platform specific stuff without changing the whole concept?
Challenge Trophies Won:

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Quote
How about some abstraction layer with a simple "give me x more samples" function, so you can easily encapsulate platform specific stuff without changing the whole concept?
My brain hurts only by hearing this. OH GOD MAKE IT STOP! So, since you already done a xm player can i make a questions to you? :D

What is the play rate? I Mean, how many notes per second, or there is an specific formula covering tempo and bpm to notes/second?


Edit: Yay, now i can load 1 channel xm's! Hell fire, another question, in what order does the channel and rows come? ex:

row1chan1 ... row1chan2 ... row1chanN

OR

row1chan1 ... row2chan1 ... rowNchan1

i was analyzing the HEX file but i got lost after several tries with a test XM module I've made
« Last Edit: July 25, 2012 by Blacksheep8Bit »
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
another question, in what order does the channel and rows come?
All channels of one row a stored sequentially.

What is the play rate? I Mean, how many notes per second, or there is an specific formula covering tempo and bpm to notes/second?
BPM says how many ticks are processed per minute.
Tempo says how many ticks are in one row.
For a given sample-rate this gives the number of samples per row (which can be fractional!).
Challenge Trophies Won:

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
And another question goes for the sample data, should i make 1 dynamic array containing all the samples? EX:

BYTE samples_size[MAX_SAMPLES];
BYTE * samples = new BYTE[sizeof(allthesampleslol)];
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
And another question goes for the sample data, should i make 1 dynamic array containing all the samples?
Better keep your samples separately.
You'll probably use some kind of filtering in the mixer, so you always need to access neigbouring values of the current sample position - which is a bit tricky at the start/end points of a loop.
This is much easier if you simply make your sample a few values longer to make sure the neighbouring values actually exist.
« Last Edit: July 27, 2012 by hellfire »
Challenge Trophies Won:

Offline tsug

  • ZX 81
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Where is the source code ?

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
Where is the source code ?
The same place it was all the time, in my computer, i currently stopped working on it for some time, but when i finish the basic loading i will release the source code.
Challenge Trophies Won:

Offline mrmudlord

  • ZX 81
  • *
  • Posts: 18
  • Karma: 1
    • View Profile
I hate to be demotivating but XM is one of the most fiddly formats to ever exist. There is no precise specs which means your mileage will vary with other players.

Personally, I would go with the Protracker MOD module format instead, doesn't have things like instruments to make things trickier like envelopes. Yet it will still provide a excellent challenge (and there is decent music in MOD around).

Offline Blacksheep8Bit

  • *Custum Title goes here*
  • C= 64
  • **
  • Posts: 91
  • Karma: 36
  • *useless thing to write goes here*
    • View Profile
I hate to be demotivating but XM is one of the most fiddly formats to ever exist. There is no precise specs which means your mileage will vary with other players.

Personally, I would go with the Protracker MOD module format instead, doesn't have things like instruments to make things trickier like envelopes. Yet it will still provide a excellent challenge (and there is decent music in MOD around).
I Know, i am currently stuck at the instrument loading part, why triton, why did you had to make it so hard? By the way, i will be releasing the code now, i guess i won't take this as far as i though i would take, let me just organize this bitch. /rage
Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
i am currently stuck at the instrument loading part, why triton, why did you had to make it so hard?
Feel free to ask questions...
Challenge Trophies Won:

Offline mrmudlord

  • ZX 81
  • *
  • Posts: 18
  • Karma: 1
    • View Profile
I Know, i am currently stuck at the instrument loading part, why triton, why did you had to make it so hard? By the way, i will be releasing the code now, i guess i won't take this as far as i though i would take, let me just organize this bitch. /rage

yeh, Triton must have designed thier specs to troll people :P instead of giving out a reference player like most things like MP3, FLAC, etc.