readme.txt
1Local copy used for A2DP Source demo in BTstack.
2
3Github repository: https://github.com/jfdelnero/HxCModPlayer
4Thanks for providing this nice and compact implementation!
5
6--------------------------------------------------------------------------------------
7Original readme.txt
8--------------------------------------------------------------------------------------
9
10///////////////////////////////////////////////////////////////////////////////////
11//-------------------------------------------------------------------------------//
12//-------------------------------------------------------------------------------//
13//-----------H----H--X----X-----CCCCC----22222----0000-----0000------11----------//
14//----------H----H----X-X-----C--------------2---0----0---0----0---1-1-----------//
15//---------HHHHHH-----X------C----------22222---0----0---0----0-----1------------//
16//--------H----H----X--X----C----------2-------0----0---0----0-----1-------------//
17//-------H----H---X-----X---CCCCC-----222222----0000-----0000----1111------------//
18//-------------------------------------------------------------------------------//
19//----------------------------------------------------- http://hxc2001.free.fr --//
20///////////////////////////////////////////////////////////////////////////////////
21
22 HxCMOD player
23
24The HxCMOD player is a tiny music module player.
25
26It currently supports the Noisetracker/Soundtracker/Protracker Module Format (*.mod)
27
28The core (hxcmod.c/hxcmod.h) is designed to have the least external dependency.
29So it should be usable on almost all OS and systems.
30You can use the hxcmod.c / hxcmod.h files to add a mod replay support
31to a demo/game/software.
32
33You are free to do what you want with this code.
34(A credit is always appreciated if you include it into your prod ;) )
35
36The test program is into the win32 folder. Just drag and drop a mod on the main
37window to load it. Linux & Mac OS X version it planned.
38
39Please note that this core was "Emscriptened" successfully and is now working in
40JavaScript with Android, Chrome, Firefox, Edge, Safari browsers and probably
41with others browsers supporting the Web Audio API support.
42
43You can test it at this address : http://hxc2001.free.fr/hxcmod/
44
45The native Mod player demonstration video is available on youtube :
46https://www.youtube.com/watch?v=MEU9FGZzjac
47
48Another video showing the player working on a STM32F105 microcontroller based device :
49https://www.youtube.com/watch?v=kiOT8-zWVkA
50
51Another case, this time with an STM32 microcontroller without DAC hardware.
52The firmware implements a 1 bit delta sigma / PDM stream generator :
53https://www.youtube.com/watch?v=AQ--IiXPUGA
54
55--------------------------------------------------------------------------------------
56 HxCMOD Core API
57--------------------------------------------------------------------------------------
58
59int hxcmod_init( modcontext * modctx )
60
61- Initialize the modcontext buffer. Must be called before doing anything else.
62 Return 1 if success. 0 in case of error.
63
64int hxcmod_setcfg( modcontext * modctx, int samplerate, int stereo_separation, int filter);
65
66- Configure the player :
67 samplerate specify the sample rate. (44100 by default).
68 stereo_separation - Left/Right channel separation.
69 filter - if non null, the filter is applied (default)
70
71int hxcmod_load( modcontext * modctx, void * mod_data, int mod_data_size )
72
73- "Load" a MOD from memory (from "mod_data" with size "mod_data_size").
74 Return 1 if success. 0 in case of error.
75
76
77void hxcmod_fillbuffer( modcontext * modctx, unsigned short * outbuffer, unsigned long nbsample, tracker_buffer_state * trkbuf )
78
79- Generate and return the next samples chunk to outbuffer.
80 nbsample specify the number of stereo 16bits samples you want.
81 The default output format is signed 44100Hz 16-bit Stereo PCM samples.
82 The output format can be changed with the C flags HXCMOD_MONO_OUTPUT, HXCMOD_8BITS_OUTPUT and HXCMOD_UNSIGNED_OUTPUT.
83 The output buffer size in byte must be equal to ( nbsample * sample_size * (mono=1 or stereo=2) ).
84 The optional trkbuf parameter can be used to get detailed status of the player. Put NULL/0 if unused.
85
86
87void hxcmod_unload( modcontext * modctx )
88- "Unload" / clear the player status.
89
90Compile-time C defines options :
91
92HXCMOD_MONO_OUTPUT : Turn the output format in mono mode.
93HXCMOD_8BITS_OUTPUT : Set the output wave format in 8bits.
94HXCMOD_UNSIGNED_OUTPUT : Set the output wave format unsigned.
95HXCMOD_MAXCHANNELS : Set the maximum supported channels (default : 32).
96 Reduce it to gain some RAM space.
97 Increase it if you want to support some specials mods
98 (up to 999).
99HXCMOD_BIGENDIAN_MACHINE : The target machine is big endian.
100HXCMOD_SLOW_TARGET : For slow targets : Disable stereo mixing and output filter.
101HXCMOD_USE_PRECALC_VOLUME_TABLE : Use precalculated volume table for the mixing.
102 suppress the multiply operations for slow targets.
103 The table need 32KB of RAM.
104--------------------------------------------------------------------------------------
105 Files on the repository
106--------------------------------------------------------------------------------------
107
108- hxcmod.c / hxcmod.h
109The HxC core mod replay routines. These files don't have any dependency with others files
110and can be used into other project.
111
112- framegenerator.c / framegenerator.h
113Generate a 640*480 framebuffer from the player status to be displayed in real-time.
114(not needed by the core)
115
116- win32/
117The Windows test software.
118(linux & Mac version planned)
119
120- js_emscripten/
121The Web browser/JavaScript version. (Build with Emscripten)
122
123- STM32/
124STM32 microcontroller / "Gotek" demo.
125
126- packer/
127Data compression utility. Used to embed one mod and some graphical stuff into the executable.
128Not directly used by the core.
129
130- data/
131Some packed data files.
132
133--------------------------------------------------------------------------------------
134
135Jean-Fran�ois DEL NERO (Jeff) / HxC2001
136
137Email : jeanfrancoisdelnero <> free.fr
138
139http://hxc2001.free.fr
140
14111 July 2015
142