Ask pouet.net: .mod player with c/c++ source code?

category: code [glöplog]
please enlighten my ignorance, what does "that play back-to-back" mean ?
Guardian: You can use the loop start/end points fore some sample concatenation trickery: set the loop end the the current sample's end, and the loop start to the next sample's start. Ideal for streaming interleaved stereo data on some consoles btw *g*

Kusma, in fact you COULD make that Paula class perform this trick, just make sure you always give it the whole sample bank and set the sampleend and looplen variables accordingly.

iq: well, I reckoned some proper filtering couldn't hurt considering I'm downsampling from 3.5MHz to 48KHz and generate the sample volume as the original Paula did it: By pulse width modulation at a rate that's so fast that all ring modulation artifacts would only start at ~55KHz ;). That btw also explains why in mods the volume goes from 0 to a full 64 instead of 63 :)

Generally speaking:
Don't read Pouet when you're drunk and you've got weird stuff lying around on your harddisk. Really. :)

Use this source as you want, I typed it down in one night and tested it with maybe 5 or 6 modules, so it's probably full of bugs. Most of them should be easy to fix tho, as I tried to write that player in a way it could have been done on AMIGAAAAAAAA, which first of all means to use as little CPU as possible for the player (please disregard the Paula emulation at 3.5MHz sample rate for a moment *cough* ;).

And now I want a forum that's suitable for sharing stuff like this.
added on the 2007-12-06 14:26:36 by kb_ kb_
oh, and i forgot to include a few header files. the dsio stuff is a simple DirectSound output routine that takes IEEE float buffers (normalized to 1.0) and sends them to the sound card. Also, you might want to have this header file:

Code:#ifndef TYPES_H_ #define TYPES_H_ #define _CRT_SECURE_NO_DEPRECATE typedef int sInt; typedef unsigned int sUInt; typedef sInt sBool; typedef char sChar; typedef signed char sS8; typedef signed short sS16; typedef signed long sS32; typedef signed __int64 sS64; typedef unsigned char sU8; typedef unsigned short sU16; typedef unsigned long sU32; typedef unsigned __int64 sU64; typedef float sF32; typedef double sF64; #define sTRUE 1 #define sFALSE 0 template<class T> inline T sMin(const T a, const T b) { return (a<b)?a:b; } template<class T> inline T sMax(const T a, const T b) { return (a>b)?a:b; } template<class T> inline T sClamp(const T x, const T min, const T max) { return sMax(min,sMin(max,x)); } #endif
added on the 2007-12-06 14:28:19 by kb_ kb_
kb si teh luv
added on the 2007-12-06 14:30:59 by psenough psenough
I wish kb was drunk on pouet everyday <3
added on the 2007-12-06 15:09:01 by hollowman hollowman
kb: Actually, I think you misunderstood what feature I was talking about. IIRC, when having only a sample and no note in a track, the new sample gets "scheduled" for playback right after the previous one with the same period as the previous one.
added on the 2007-12-06 15:14:17 by kusma kusma
kusma, ah, yeah, the good old "when exactly to start a new note" conundrum. Probably you're right, feel free to fix ;). As said, I only tested it with a handful of modules.

Also I want to apologize for the multiplication at the end of the Tick() function. I got lazy and this is probably also a bug ;)
added on the 2007-12-06 15:32:45 by kb_ kb_
And now I want a forum that's suitable for sharing stuff like this.

Exactly! See this thread.
added on the 2007-12-06 15:46:06 by spike spike
what about codeplex.org, sf.net or pastebin.com? :)
what about codeplex.org, sf.net or pastebin.com? :)

You forgot about pouet.net's code tag:

See? No need to use external sites!
added on the 2007-12-06 19:52:42 by Hatikvah Hatikvah
I fixed the nintendo ds replay (same url as before), that'll teach me to not to thrust libnds defines, so now it can replay "cream of the earth.mod" accurately, it should be ~100%.
added on the 2007-12-06 22:17:30 by hitchhikr hitchhikr
Ok, somewhat cleaned and "official"version of my player now available:

http://www.1337haxorz.de/drugs/tinymod.cpp (consider this a permalink, if i update the thing the URL will be the same)

I even fixed a few bugs that I found when I tried other songs than before ;)
added on the 2007-12-07 02:34:17 by kb_ kb_
thanX for the Flashback,kb... :)

...and yeZz...Scene needZ a

forum that's suitable for sharing stuff like this.


And now I want a forum that's suitable for sharing stuff like this.

added on the 2007-12-07 11:34:14 by scoutski scoutski
Learn norwegian and go to demoscene.no/forum
added on the 2007-12-07 13:33:57 by lug00ber lug00ber
Can someone post a compiled example ?
added on the 2007-12-07 14:19:51 by misioslaw misioslaw
remind me again when i get home tonight, drunk. :)
added on the 2007-12-07 14:42:01 by kb_ kb_
2007-12-06: first "release". Note to self: Don't post stuff on pouet.net when drunk.

added on the 2007-12-07 17:10:56 by raer raer
kb : sure, I won't miss the opportunity to remind you about V2 2.0 with sample support ;)
added on the 2007-12-07 17:15:03 by keops keops
keops: hahaha!

Anyhoo: Executable version available:


As cheap as a commandline player can get. You'll figure it out.
added on the 2007-12-07 22:12:33 by kb_ kb_
kb = Rulez! ;)

added on the 2007-12-07 22:31:01 by rbz rbz
kb: the dxx command fails when there's 2 of them on the same row (1 extra jump) and the note delay is completely fucked up.
Try this module to test: http://amp.dascene.net/downmod.php?index=44074
added on the 2007-12-07 23:05:17 by hitchhikr hitchhikr
kb already sober? What a shame, the player was promising.
added on the 2007-12-08 01:56:29 by Hatikvah Hatikvah
While we're on the subject of tiny .mod players, it would be really nice to get one that works without an MMU or FPU so it could be used in Rockbox.

Rockbox already has one, but I think the issue with it is that it requires the MP3 player to have a lot more memory than is reasonable, just to store and decode the MOD file.
added on the 2007-12-08 03:37:30 by crusader crusader

Rockbox is an open source firmware for mp3 players, written from scratch. It runs on a wide range of players:

* Apple: 1st through 5.5th generation iPod, iPod Mini and 1st generation iPod Nano
(not the Shuffle, 2nd/3rd gen Nano, Classic or Touch)
* Archos: Jukebox 5000, 6000, Studio, Recorder, FM Recorder, Recorder V2 and Ondio
* Cowon: iAudio X5, X5V, X5L, M5 and M5L
* iriver: H100, H300 and H10 series
* SanDisk: Sansa c200, e200 and e200R series (not the v2 models)
* Toshiba: Gigabeat X and F series (not the S series)
* More players are in development

Why should you run Rockbox? Click here to find out


v2 not supported? i guess kb is out :/
added on the 2007-12-08 04:47:10 by Hatikvah Hatikvah