Added makefile. Fixed char pointer warnings

This commit is contained in:
2017-12-13 15:42:10 +01:00
parent 2b6704f538
commit edc9b40636
3 changed files with 32 additions and 2 deletions

2
.gitignore vendored
View File

@@ -51,3 +51,5 @@ Module.symvers
Mkfile.old
dkms.conf
*.mp3
/csoundbox

View File

@@ -1,8 +1,15 @@
#include <ao/ao.h>
#include <mpg123.h>
#include <stdlib.h>
#include <stdio.h>
#define BITS 8
void exitfunction(void) {
printf("Exiting csoundbox.\n");
}
int main(int argc, char *argv[])
{
mpg123_handle *mh;
@@ -18,6 +25,7 @@ int main(int argc, char *argv[])
int channels, encoding;
long rate;
atexit(exitfunction);
if(argc < 2)
exit(0);
@@ -43,7 +51,7 @@ int main(int argc, char *argv[])
/* decode and play */
while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK)
ao_play(dev, buffer, done);
ao_play(dev, (char *)buffer, done);
/* clean up */
free(buffer);

20
makefile Normal file
View File

@@ -0,0 +1,20 @@
#Infos: http://www.ijon.de/comp/tutorials/makefile.html
VERSION = 1.0
CC = cc
CFLAGS = -Wall -O3 -DVERSION=\"$(VERSION)\"
#LDFLAGS = -lm -lpthread `gtk-config --cflags` `gtk-config --libs` -lgthread
LDFLAGS = -lmpg123 -lao
OBJ = csoundbox.o
all: $(OBJ)
$(CC) $(CFLAGS) -o csoundbox $(OBJ) $(LDFLAGS)
%.o: %.c
$(CC) $(CFLAGS) -c $<
.PHONY: clean
clean:
rm -r *.o