Making a Start - richardjwild/arctracker GitHub Wiki
The first thing that was bugging me was that ALSA was not working. My initial reaction was that they had changed the API, but inspection of the documentation showed that they have not. Something else must have caused the configure script to disable ALSA. I decided to try forcing it by editing config.h manually to enable ALSA:
#define HAVE_LIBASOUND 1
I tried compiling the program to see what effect that would have:
~/arctracker$ make
gcc -g -O2 -c arctracker.c
In file included from arctracker.c:19:0:
arctracker.h:33:10: fatal error: alsa/asoundlib.h: No such file or directory
#include <alsa/asoundlib.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:30: recipe for target 'arctracker.o' failed
make: *** [arctracker.o] Error 1
Aha! I don't have the header file. Dimly from the recesses of my memory, I recall that you need to have the developer package installed on your system. A quick google search showed me which package needs to be installed:
~/arctracker$ sudo apt-get install libasound2-dev
Then I ran ./configure again and this time:
checking for snd_pcm_writei in -lasound... yes
Wahey! So I tried compiling, and this time a ton of errors:
~/arctracker$ make
gcc -g -O2 -c arctracker.c
arctracker.c:22:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
main(int argc, char *argv[])
^~~~
In file included from arctracker.c:19:0:
arctracker.h:484:24: warning: inline function ‘output_data’ declared but never defined
__inline return_status output_data(
^~~~~~~~~~~
arctracker.h:474:15: warning: inline function ‘write_channel_audio_data’ declared but never defined
__inline void write_channel_audio_data(
^~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:463:24: warning: inline function ‘write_audio_data’ declared but never defined
__inline return_status write_audio_data(
^~~~~~~~~~~~~~~~
arctracker.h:444:15: warning: inline function ‘mix_channels’ declared but never defined
__inline void mix_channels(
^~~~~~~~~~~~
arctracker.h:436:15: warning: inline function ‘prepare_current_frame_sample_data’ declared but never defined
__inline void prepare_current_frame_sample_data(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:426:15: warning: inline function ‘process_desktop_tracker_command’ declared but never defined
__inline void process_desktop_tracker_command(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:417:15: warning: inline function ‘process_tracker_command’ declared but never defined
__inline void process_tracker_command(
^~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:407:15: warning: inline function ‘get_new_note’ declared but never defined
__inline void get_new_note(
^~~~~~~~~~~~
arctracker.h:401:15: warning: inline function ‘get_current_pattern_line’ declared but never defined
__inline void get_current_pattern_line(
^~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:396:13: warning: inline function ‘update_counters’ declared but never defined
__inline yn update_counters(
^~~~~~~~~~~~~~~
arctracker.h:386:15: warning: inline function ‘initialise_values’ declared but never defined
__inline void initialise_values(
^~~~~~~~~~~~~~~~~
gcc -g -O2 -c initialise.c
In file included from initialise.c:19:0:
arctracker.h:484:24: warning: inline function ‘output_data’ declared but never defined
__inline return_status output_data(
^~~~~~~~~~~
arctracker.h:474:15: warning: inline function ‘write_channel_audio_data’ declared but never defined
__inline void write_channel_audio_data(
^~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:463:24: warning: inline function ‘write_audio_data’ declared but never defined
__inline return_status write_audio_data(
^~~~~~~~~~~~~~~~
arctracker.h:444:15: warning: inline function ‘mix_channels’ declared but never defined
__inline void mix_channels(
^~~~~~~~~~~~
arctracker.h:436:15: warning: inline function ‘prepare_current_frame_sample_data’ declared but never defined
__inline void prepare_current_frame_sample_data(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:426:15: warning: inline function ‘process_desktop_tracker_command’ declared but never defined
__inline void process_desktop_tracker_command(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:417:15: warning: inline function ‘process_tracker_command’ declared but never defined
__inline void process_tracker_command(
^~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:407:15: warning: inline function ‘get_new_note’ declared but never defined
__inline void get_new_note(
^~~~~~~~~~~~
arctracker.h:401:15: warning: inline function ‘get_current_pattern_line’ declared but never defined
__inline void get_current_pattern_line(
^~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:396:13: warning: inline function ‘update_counters’ declared but never defined
__inline yn update_counters(
^~~~~~~~~~~~~~~
arctracker.h:386:15: warning: inline function ‘initialise_values’ declared but never defined
__inline void initialise_values(
^~~~~~~~~~~~~~~~~
gcc -g -O2 -c read_mod.c
read_mod.c: In function ‘validate_modfile’:
read_mod.c:843:55: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
fprintf(stderr,"Modfile corrupt - number of voices %d invalid\n", p_module->num_channels);
~^ ~~~~~~~~~~~~~~~~~~~~~~
%ld
read_mod.c:858:50: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
fprintf(stderr,"Modfile corrupt - tune length %d invalid\n", p_module->tune_length);
~^ ~~~~~~~~~~~~~~~~~~~~~
%ld
read_mod.c:863:57: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
fprintf(stderr,"Modfile corrupt - number of patterns %d invalid\n", p_module->num_patterns);
~^ ~~~~~~~~~~~~~~~~~~~~~~
%ld
read_mod.c:880:58: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
fprintf(stderr,"Modfile corrupt - sample %d volume %d invalid\n", i, p_sample->volume);
~^ ~~~~~~~~~~~~~~~~
%ld
read_mod.c:885:58: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
fprintf(stderr,"Modfile corrupt - sample %d length %d invalid\n", i, p_sample->sample_length);
~^ ~~~~~~~~~~~~~~~~~~~~~~~
%ld
read_mod.c:891:58: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
stderr,"Modfile corrput - sample %d repeat offset %d greater than sample length %d\n",
~^
%ld
i, p_sample->repeat_offset, p_sample->sample_length);
~~~~~~~~~~~~~~~~~~~~~~~
read_mod.c:891:88: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long int’ [-Wformat=]
stderr,"Modfile corrput - sample %d repeat offset %d greater than sample length %d\n",
~^
%ld
i, p_sample->repeat_offset, p_sample->sample_length);
~~~~~~~~~~~~~~~~~~~~~~~
In file included from read_mod.c:19:0:
read_mod.c: At top level:
arctracker.h:484:24: warning: inline function ‘output_data’ declared but never defined
__inline return_status output_data(
^~~~~~~~~~~
arctracker.h:474:15: warning: inline function ‘write_channel_audio_data’ declared but never defined
__inline void write_channel_audio_data(
^~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:463:24: warning: inline function ‘write_audio_data’ declared but never defined
__inline return_status write_audio_data(
^~~~~~~~~~~~~~~~
arctracker.h:444:15: warning: inline function ‘mix_channels’ declared but never defined
__inline void mix_channels(
^~~~~~~~~~~~
arctracker.h:436:15: warning: inline function ‘prepare_current_frame_sample_data’ declared but never defined
__inline void prepare_current_frame_sample_data(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:426:15: warning: inline function ‘process_desktop_tracker_command’ declared but never defined
__inline void process_desktop_tracker_command(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:417:15: warning: inline function ‘process_tracker_command’ declared but never defined
__inline void process_tracker_command(
^~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:407:15: warning: inline function ‘get_new_note’ declared but never defined
__inline void get_new_note(
^~~~~~~~~~~~
arctracker.h:401:15: warning: inline function ‘get_current_pattern_line’ declared but never defined
__inline void get_current_pattern_line(
^~~~~~~~~~~~~~~~~~~~~~~~
arctracker.h:396:13: warning: inline function ‘update_counters’ declared but never defined
__inline yn update_counters(
^~~~~~~~~~~~~~~
arctracker.h:386:15: warning: inline function ‘initialise_values’ declared but never defined
__inline void initialise_values(
^~~~~~~~~~~~~~~~~
gcc -g -O2 -c play_mod.c
play_mod.c: In function ‘initialise_values’:
play_mod.c:262:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
printf("Playing position 1 of %d", p_module->tune_length);
~^ ~~~~~~~~~~~~~~~~~~~~~
%ld
play_mod.c: In function ‘update_counters’:
play_mod.c:300:32: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
"%cPlaying position %d of %d ",
~^
%ld
play_mod.c:303:5:
p_module->tune_length);
~~~~~~~~~~~~~~~~~~~~~
play_mod.c: At top level:
play_mod.c:889:14: warning: ‘bufptr’ is static but declared in inline function ‘write_audio_data’ which is not static
static long bufptr = 0;
^~~~~~
play_mod.c:888:13: warning: ‘nframes_fraction’ is static but declared in inline function ‘write_audio_data’ which is not static
static int nframes_fraction = 0;
^~~~~~~~~~~~~~~~
In file included from play_mod.c:19:0:
arctracker.h:444:15: warning: inline function ‘mix_channels’ declared but never defined
__inline void mix_channels(
^~~~~~~~~~~~
arctracker.h:436:15: warning: inline function ‘prepare_current_frame_sample_data’ declared but never defined
__inline void prepare_current_frame_sample_data(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc -g -O2 -lasound -o arctracker arctracker.o initialise.o read_mod.o play_mod.o
initialise.o: In function `initialise_alsa':
/home/richard/arctracker/initialise.c:215: undefined reference to `snd_pcm_open'
/home/richard/arctracker/initialise.c:221: undefined reference to `snd_pcm_hw_params_malloc'
/home/richard/arctracker/initialise.c:227: undefined reference to `snd_pcm_hw_params_any'
/home/richard/arctracker/initialise.c:233: undefined reference to `snd_pcm_hw_params_set_access'
/home/richard/arctracker/initialise.c:239: undefined reference to `snd_pcm_hw_params_set_format'
/home/richard/arctracker/initialise.c:240: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:246: undefined reference to `snd_pcm_hw_params_set_rate_near'
/home/richard/arctracker/initialise.c:254: undefined reference to `snd_pcm_hw_params_set_channels'
/home/richard/arctracker/initialise.c:255: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:216: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:262: undefined reference to `snd_pcm_hw_params'
/home/richard/arctracker/initialise.c:269: undefined reference to `snd_pcm_hw_params_free'
/home/richard/arctracker/initialise.c:271: undefined reference to `snd_pcm_prepare'
/home/richard/arctracker/initialise.c:272: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:228: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:222: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:234: undefined reference to `snd_strerror'
/home/richard/arctracker/initialise.c:247: undefined reference to `snd_strerror'
initialise.o:/home/richard/arctracker/initialise.c:263: more undefined references to `snd_strerror' follow
play_mod.o: In function `output_data':
/home/richard/arctracker/play_mod.c:1145: undefined reference to `snd_pcm_writei'
/home/richard/arctracker/play_mod.c:1146: undefined reference to `snd_strerror'
collect2: error: ld returned 1 exit status
Makefile:27: recipe for target 'arctracker' failed
make: *** [arctracker] Error 1
Most of those are warnings, which need to be dealt with for sure, but none of them are the thing that prevented it from compiling. Looking towards the bottom, this line showed that the compilation succeeded and the error occurred during linking:
gcc -g -O2 -lasound -o arctracker arctracker.o initialise.o read_mod.o play_mod.o
By changing the resolution order as suggested in this thread I managed to get the program to link:
gcc -g -O2 -o arctracker arctracker.o initialise.o read_mod.o play_mod.o -lasound
And that worked!
~/arctracker$ ./arctracker --alsa ../example_modfiles/occ_san_geen.trk
File is TRACKER format.
Module name: occ-san-geen
Author: Converted from Amiga
Playing position 1 of 72
Evidently there was a problem in my Makefile. I had a terrible feeling that I was going to be forced to relearn Automake and Autoconf...
Previous: Getting It Running Again | Next: Automake and Autoconf