Added makefile. Fixed char pointer warnings
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -51,3 +51,5 @@ Module.symvers
|
|||||||
Mkfile.old
|
Mkfile.old
|
||||||
dkms.conf
|
dkms.conf
|
||||||
|
|
||||||
|
*.mp3
|
||||||
|
/csoundbox
|
||||||
|
12
csoundbox.c
12
csoundbox.c
@@ -1,8 +1,15 @@
|
|||||||
#include <ao/ao.h>
|
#include <ao/ao.h>
|
||||||
#include <mpg123.h>
|
#include <mpg123.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define BITS 8
|
#define BITS 8
|
||||||
|
|
||||||
|
void exitfunction(void) {
|
||||||
|
|
||||||
|
printf("Exiting csoundbox.\n");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
mpg123_handle *mh;
|
mpg123_handle *mh;
|
||||||
@@ -17,7 +24,8 @@ int main(int argc, char *argv[])
|
|||||||
ao_sample_format format;
|
ao_sample_format format;
|
||||||
int channels, encoding;
|
int channels, encoding;
|
||||||
long rate;
|
long rate;
|
||||||
|
|
||||||
|
atexit(exitfunction);
|
||||||
if(argc < 2)
|
if(argc < 2)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
@@ -43,7 +51,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* decode and play */
|
/* decode and play */
|
||||||
while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK)
|
while (mpg123_read(mh, buffer, buffer_size, &done) == MPG123_OK)
|
||||||
ao_play(dev, buffer, done);
|
ao_play(dev, (char *)buffer, done);
|
||||||
|
|
||||||
/* clean up */
|
/* clean up */
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
20
makefile
Normal file
20
makefile
Normal 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
|
Reference in New Issue
Block a user