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.
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.
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
kb si teh luv
I wish kb was drunk on pouet everyday <3
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.
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 ;)
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 ;)
kb:
Exactly! See this thread.
Quote:
And now I want a forum that's suitable for sharing stuff like this.
Exactly! See this thread.
what about codeplex.org, sf.net or pastebin.com? :)
Quote:
what about codeplex.org, sf.net or pastebin.com? :)
You forgot about pouet.net's code tag:
Code:
CODE
See? No need to use external sites!
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%.
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 ;)
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 ;)
thanX for the Flashback,kb... :)
...and yeZz...Scene needZ a
...and yeZz...Scene needZ a
Quote:
forum that's suitable for sharing stuff like this.
Quote:
And now I want a forum that's suitable for sharing stuff like this.
Bitfellas?
Learn norwegian and go to demoscene.no/forum
:>
:>
Can someone post a compiled example ?
remind me again when i get home tonight, drunk. :)
Quote:
2007-12-06: first "release". Note to self: Don't post stuff on pouet.net when drunk.
lol.
kb : sure, I won't miss the opportunity to remind you about V2 2.0 with sample support ;)
keops: hahaha!
Anyhoo: Executable version available:
http://www.1337haxorz.de/drugs/tinymod.exe
As cheap as a commandline player can get. You'll figure it out.
Anyhoo: Executable version available:
http://www.1337haxorz.de/drugs/tinymod.exe
As cheap as a commandline player can get. You'll figure it out.
kb = Rulez! ;)
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
Try this module to test: http://amp.dascene.net/downmod.php?index=44074
kb already sober? What a shame, the player was promising.
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.
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.
Quote:
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
http://www.rockbox.org
v2 not supported? i guess kb is out :/