Showing the changes to src (16 of 16 files). Show all
Unified · Split
| @@ -36,6 +36,7 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | #include "chuck_def.h" | 37 | #include "chuck_def.h" |
| 38 | #include <stdio.h> | 38 | #include <stdio.h> |
| 39 | #include <stdarg.h> | ||
| 39 | 40 | ||
| 40 | #if defined(_cplusplus) || defined(__cplusplus) | 41 | #if defined(_cplusplus) || defined(__cplusplus) |
| 41 | extern "C" { | 42 | extern "C" { |
| @@ -600,7 +600,7 @@ void Chuck_Shell::continue_code( string & in ) · 599 unmodified lines | |||
| 600 | void Chuck_Shell::do_code( string & code, string & out, string command ) | 600 | void Chuck_Shell::do_code( string & code, string & out, string command ) |
| 601 | { | 601 | { |
| 602 | // open a temporary file | 602 | // open a temporary file |
| 603 | #if defined(__PLATFORM_LINUX__) || defined(__MACOSX_CORE__) | 603 | #if defined(__PLATFORM_LINUX__) || defined(__MACOSX_CORE__) || defined(__PLATFORM_OPENBSD__) |
| 604 | char tmp_dir[] = "/tmp"; | 604 | char tmp_dir[] = "/tmp"; |
| 605 | char * tmp_filepath = new char [32]; | 605 | char * tmp_filepath = new char [32]; |
| 606 | // 1.4.1.0: changed chuck_file.XXXXXX to chuck_shell.XXXXXX | 606 | // 1.4.1.0: changed chuck_file.XXXXXX to chuck_shell.XXXXXX |
| @@ -1,6 +1,6 @@ | |||
| 1 | 1 | ||
| 2 | 2 | ||
| 3 | #if defined(__MACOSX_CORE__) || defined(__PLATFORM_LINUX__) | 3 | #if defined(__MACOSX_CORE__) || defined(__PLATFORM_LINUX__) || defined(__PLATFORM_OPENBSD__) |
| 4 | 4 | ||
| 5 | /* config.h. Generated from config.h.in by configure. */ | 5 | /* config.h. Generated from config.h.in by configure. */ |
| 6 | /* config.h.in. Generated from configure.ac by autoheader. */ | 6 | /* config.h.in. Generated from configure.ac by autoheader. */ |
| @@ -268,7 +268,7 @@ lo_server lo_server_new_with_proto_internal(const char *group, · 267 unmodified lines | |||
| 268 | if (!port) { | 268 | if (!port) { |
| 269 | /* not a good way to get random numbers, but its not critical */ | 269 | /* not a good way to get random numbers, but its not critical */ |
| 270 | snprintf(pnum, 15, "%ld", 10000 + ((unsigned int)rand() + | 270 | snprintf(pnum, 15, "%ld", 10000 + ((unsigned int)rand() + |
| 271 | time(NULL)) % 10000); | 271 | (long)time(NULL)) % 10000); |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | if ((ret = getaddrinfo(NULL, service, &hints, &ai))) { | 274 | if ((ret = getaddrinfo(NULL, service, &hints, &ai))) { |
| @@ -2,19 +2,19 @@ · 1 unmodified line | |||
| 2 | current: | 2 | current: |
| 3 | @echo "[chuck build]: please use one of the following configurations:" | 3 | @echo "[chuck build]: please use one of the following configurations:" |
| 4 | @echo " make linux-alsa, make linux-jack, make linux-pulse, linux-all," | 4 | @echo " make linux-alsa, make linux-jack, make linux-pulse, linux-all," |
| 5 | @echo " make mac, make mac-ub, make cygwin, or make win32" | 5 | @echo " openbsd-openal, make mac, make mac-ub, make cygwin, or make win32" |
| 6 | 6 | ||
| 7 | .PHONY: mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl test | 7 | .PHONY: mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl test |
| 8 | mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl: chuck-core | 8 | mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl openbsd-openal: chuck-core |
| 9 | 9 | ||
| 10 | win32: | 10 | win32: |
| 11 | make -f makefile.win32 | 11 | make -f makefile.win32 |
| 12 | 12 | ||
| 13 | LEX=flex | 13 | LEX=flex |
| 14 | YACC=bison | 14 | YACC=bison |
| 15 | CC=gcc | 15 | CC?=gcc |
| 16 | CXX=g++ | 16 | CXX?=g++ |
| 17 | LD=g++ | 17 | LD?=g++ |
| 18 | 18 | ||
| 19 | CFLAGS+=-I. -Ilo | 19 | CFLAGS+=-I. -Ilo |
| 20 | 20 | ||
| @@ -64,6 +64,10 @@ ifneq (,$(strip $(filter linux-alsa,$(MAKECMDGOALS)))) · 43 unmodified lines | |||
| 64 | include makefile.x/makefile.alsa | 64 | include makefile.x/makefile.alsa |
| 65 | endif | 65 | endif |
| 66 | 66 | ||
| 67 | ifneq (,$(strip $(filter openbsd-openal,$(MAKECMDGOALS)))) | ||
| 68 | include makefile.x/makefile.openal | ||
| 69 | endif | ||
| 70 | |||
| 67 | ifneq (,$(strip $(filter cygwin,$(MAKECMDGOALS)))) | 71 | ifneq (,$(strip $(filter cygwin,$(MAKECMDGOALS)))) |
| 68 | include makefile.x/makefile.cygwin | 72 | include makefile.x/makefile.cygwin |
| 69 | endif | 73 | endif |
| @@ -0,0 +1,10 @@ | |||
| 1 | CFLAGS+=-D__OPENBSD_OPENAL__ -D__PLATFORM_OPENBSD__ -fno-strict-aliasing -D__CK_SNDFILE_NATIVE__ -DMAX_PATH=4096 -D_DEFAULT_SOURCE $(shell pkg-config --cflags openal) | ||
| 2 | |||
| 3 | ifneq ($(CHUCK_DEBUG),) | ||
| 4 | CFLAGS+= -ggdb | ||
| 5 | else | ||
| 6 | CFLAGS+= -O3 | ||
| 7 | endif | ||
| 8 | |||
| 9 | LDFLAGS+=$(shell pkg-config --libs openal) -lm -lsndfile -lpthread | ||
| 10 | LD=$(CXX) | ||
| @@ -2235,7 +2235,7 @@ void RtMidiOut :: sendMessage( std::vector<unsigned char> *message ) · 2234 unmodified lines | |||
| 2235 | #endif // __WINDOWS_MM__ | 2235 | #endif // __WINDOWS_MM__ |
| 2236 | 2236 | ||
| 2237 | 2237 | ||
| 2238 | #if defined(__LINUX_OSS__) // dummy | 2238 | #if defined(__LINUX_OSS__) || defined(__OPENBSD_OPENAL__) // dummy |
| 2239 | 2239 | ||
| 2240 | /*void midiInputCallback( const MIDIPacketList *list, void *procRef, void *srcRef ) | 2240 | /*void midiInputCallback( const MIDIPacketList *list, void *procRef, void *srcRef ) |
| 2241 | { | 2241 | { |
| @@ -16163,7 +16163,7 @@ void Stk :: setRawwavePath(std::string newPath) · 16162 unmodified lines | |||
| 16163 | rawwavepath += "/"; | 16163 | rawwavepath += "/"; |
| 16164 | } | 16164 | } |
| 16165 | 16165 | ||
| 16166 | void Stk :: swap16(unsigned char *ptr) | 16166 | void Stk :: swapb16(unsigned char *ptr) |
| 16167 | { | 16167 | { |
| 16168 | /* register */ unsigned char val; | 16168 | /* register */ unsigned char val; |
| 16169 | 16169 | ||
| @@ -16173,7 +16173,7 @@ void Stk :: swap16(unsigned char *ptr) · 3 unmodified lines | |||
| 16173 | *(ptr+1) = val; | 16173 | *(ptr+1) = val; |
| 16174 | } | 16174 | } |
| 16175 | 16175 | ||
| 16176 | void Stk :: swap32(unsigned char *ptr) | 16176 | void Stk :: swapb32(unsigned char *ptr) |
| 16177 | { | 16177 | { |
| 16178 | /* register */ unsigned char val; | 16178 | /* register */ unsigned char val; |
| 16179 | 16179 | ||
| @@ -16189,7 +16189,7 @@ void Stk :: swap32(unsigned char *ptr) · 9 unmodified lines | |||
| 16189 | *(ptr+1) = val; | 16189 | *(ptr+1) = val; |
| 16190 | } | 16190 | } |
| 16191 | 16191 | ||
| 16192 | void Stk :: swap64(unsigned char *ptr) | 16192 | void Stk :: swapb64(unsigned char *ptr) |
| 16193 | { | 16193 | { |
| 16194 | /* register */ unsigned char val; | 16194 | /* register */ unsigned char val; |
| 16195 | 16195 | ||
| @@ -16367,7 +16367,7 @@ Table :: Table(char *fileName) · 171 unmodified lines | |||
| 16367 | double temp; | 16367 | double temp; |
| 16368 | while ( fread(&temp, 8, 1, fd) ) { | 16368 | while ( fread(&temp, 8, 1, fd) ) { |
| 16369 | if( little_endian ) | 16369 | if( little_endian ) |
| 16370 | swap64((unsigned char *)&temp); | 16370 | swapb64((unsigned char *)&temp); |
| 16371 | 16371 | ||
| 16372 | data[i++] = (MY_FLOAT) temp; | 16372 | data[i++] = (MY_FLOAT) temp; |
| 16373 | } | 16373 | } |
| @@ -18307,7 +18307,7 @@ bool WvIn :: getWavInfo( const char *fileName ) · 1933 unmodified lines | |||
| 18307 | while ( strncmp(id, "fmt ", 4) ) { | 18307 | while ( strncmp(id, "fmt ", 4) ) { |
| 18308 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; | 18308 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; |
| 18309 | if( !little_endian ) | 18309 | if( !little_endian ) |
| 18310 | swap32((unsigned char *)&chunkSize); | 18310 | swapb32((unsigned char *)&chunkSize); |
| 18311 | 18311 | ||
| 18312 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; | 18312 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; |
| 18313 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; | 18313 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; |
| @@ -18319,8 +18319,8 @@ if( !little_endian ) · 5 unmodified lines | |||
| 18319 | if ( fread(&format_tag, 2, 1, fd) != 1 ) goto error; | 18319 | if ( fread(&format_tag, 2, 1, fd) != 1 ) goto error; |
| 18320 | if( !little_endian ) | 18320 | if( !little_endian ) |
| 18321 | { | 18321 | { |
| 18322 | swap16((unsigned char *)&format_tag); | 18322 | swapb16((unsigned char *)&format_tag); |
| 18323 | swap32((unsigned char *)&chunkSize); | 18323 | swapb32((unsigned char *)&chunkSize); |
| 18324 | } | 18324 | } |
| 18325 | if (format_tag != 1 && format_tag != 3 ) { // PCM = 1, FLOAT = 3 | 18325 | if (format_tag != 1 && format_tag != 3 ) { // PCM = 1, FLOAT = 3 |
| 18326 | snprintf(msg, STK_MSG_BUF_LENGTH, "[chuck](via WvIn): %s contains an unsupported data format type (%d).", fileName, format_tag); | 18326 | snprintf(msg, STK_MSG_BUF_LENGTH, "[chuck](via WvIn): %s contains an unsupported data format type (%d).", fileName, format_tag); |
| @@ -18331,7 +18331,7 @@ if( !little_endian ) · 4 unmodified lines | |||
| 18331 | SINT16 temp; | 18331 | SINT16 temp; |
| 18332 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; | 18332 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; |
| 18333 | if( !little_endian ) | 18333 | if( !little_endian ) |
| 18334 | swap16((unsigned char *)&temp); | 18334 | swapb16((unsigned char *)&temp); |
| 18335 | 18335 | ||
| 18336 | channels = (unsigned int ) temp; | 18336 | channels = (unsigned int ) temp; |
| 18337 | 18337 | ||
| @@ -18339,7 +18339,7 @@ if( !little_endian ) · 1 unmodified line | |||
| 18339 | SINT32 theSrate; | 18339 | SINT32 theSrate; |
| 18340 | if ( fread(&theSrate, 4, 1, fd) != 1 ) goto error; | 18340 | if ( fread(&theSrate, 4, 1, fd) != 1 ) goto error; |
| 18341 | if( !little_endian ) | 18341 | if( !little_endian ) |
| 18342 | swap32((unsigned char *)&theSrate); | 18342 | swapb32((unsigned char *)&theSrate); |
| 18343 | 18343 | ||
| 18344 | fileRate = (MY_FLOAT)theSrate; | 18344 | fileRate = (MY_FLOAT)theSrate; |
| 18345 | 18345 | ||
| @@ -18351,7 +18351,7 @@ if( !little_endian ) · 5 unmodified lines | |||
| 18351 | if ( fseek(fd, 6, SEEK_CUR) == -1 ) goto error; // Locate bits_per_sample info. | 18351 | if ( fseek(fd, 6, SEEK_CUR) == -1 ) goto error; // Locate bits_per_sample info. |
| 18352 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; | 18352 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; |
| 18353 | if( !little_endian ) | 18353 | if( !little_endian ) |
| 18354 | swap16((unsigned char *)&temp); | 18354 | swapb16((unsigned char *)&temp); |
| 18355 | 18355 | ||
| 18356 | if ( format_tag == 1 ) { | 18356 | if ( format_tag == 1 ) { |
| 18357 | if (temp == 8) | 18357 | if (temp == 8) |
| @@ -18383,7 +18383,7 @@ if( !little_endian ) · 25 unmodified lines | |||
| 18383 | while ( strncmp(id, "data", 4) ) { | 18383 | while ( strncmp(id, "data", 4) ) { |
| 18384 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; | 18384 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; |
| 18385 | if( !little_endian ) | 18385 | if( !little_endian ) |
| 18386 | swap32((unsigned char *)&chunkSize); | 18386 | swapb32((unsigned char *)&chunkSize); |
| 18387 | 18387 | ||
| 18388 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; | 18388 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; |
| 18389 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; | 18389 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; |
| @@ -18393,7 +18393,7 @@ if( !little_endian ) · 3 unmodified lines | |||
| 18393 | SINT32 bytes; | 18393 | SINT32 bytes; |
| 18394 | if ( fread(&bytes, 4, 1, fd) != 1 ) goto error; | 18394 | if ( fread(&bytes, 4, 1, fd) != 1 ) goto error; |
| 18395 | if( !little_endian ) | 18395 | if( !little_endian ) |
| 18396 | swap32((unsigned char *)&bytes); | 18396 | swapb32((unsigned char *)&bytes); |
| 18397 | 18397 | ||
| 18398 | fileSize = 8 * bytes / temp / channels; // sample frames | 18398 | fileSize = 8 * bytes / temp / channels; // sample frames |
| 18399 | bufferSize = fileSize; | 18399 | bufferSize = fileSize; |
| @@ -18421,7 +18421,7 @@ bool WvIn :: getSndInfo( const char *fileName ) · 21 unmodified lines | |||
| 18421 | if ( fseek(fd, 12, SEEK_SET) == -1 ) goto error; // Locate format | 18421 | if ( fseek(fd, 12, SEEK_SET) == -1 ) goto error; // Locate format |
| 18422 | if ( fread(&format, 4, 1, fd) != 1 ) goto error; | 18422 | if ( fread(&format, 4, 1, fd) != 1 ) goto error; |
| 18423 | if( little_endian ) | 18423 | if( little_endian ) |
| 18424 | swap32((unsigned char *)&format); | 18424 | swapb32((unsigned char *)&format); |
| 18425 | 18425 | ||
| 18426 | if (format == 2) dataType = STK_SINT8; | 18426 | if (format == 2) dataType = STK_SINT8; |
| 18427 | else if (format == 3) dataType = STK_SINT16; | 18427 | else if (format == 3) dataType = STK_SINT16; |
| @@ -18438,7 +18438,7 @@ if( little_endian ) · 10 unmodified lines | |||
| 18438 | SINT32 theSrate; | 18438 | SINT32 theSrate; |
| 18439 | if ( fread(&theSrate, 4, 1, fd) != 1 ) goto error; | 18439 | if ( fread(&theSrate, 4, 1, fd) != 1 ) goto error; |
| 18440 | if( little_endian ) | 18440 | if( little_endian ) |
| 18441 | swap32((unsigned char *)&theSrate); | 18441 | swapb32((unsigned char *)&theSrate); |
| 18442 | 18442 | ||
| 18443 | fileRate = (MY_FLOAT)theSrate; | 18443 | fileRate = (MY_FLOAT)theSrate; |
| 18444 | 18444 | ||
| @@ -18449,19 +18449,19 @@ if( little_endian ) · 4 unmodified lines | |||
| 18449 | SINT32 chans; | 18449 | SINT32 chans; |
| 18450 | if ( fread(&chans, 4, 1, fd) != 1 ) goto error; | 18450 | if ( fread(&chans, 4, 1, fd) != 1 ) goto error; |
| 18451 | if( little_endian ) | 18451 | if( little_endian ) |
| 18452 | swap32((unsigned char *)&chans); | 18452 | swapb32((unsigned char *)&chans); |
| 18453 | 18453 | ||
| 18454 | channels = chans; | 18454 | channels = chans; |
| 18455 | 18455 | ||
| 18456 | if ( fseek(fd, 4, SEEK_SET) == -1 ) goto error; | 18456 | if ( fseek(fd, 4, SEEK_SET) == -1 ) goto error; |
| 18457 | if ( fread(&dataOffset, 4, 1, fd) != 1 ) goto error; | 18457 | if ( fread(&dataOffset, 4, 1, fd) != 1 ) goto error; |
| 18458 | if( little_endian ) | 18458 | if( little_endian ) |
| 18459 | swap32((unsigned char *)&dataOffset); | 18459 | swapb32((unsigned char *)&dataOffset); |
| 18460 | 18460 | ||
| 18461 | // Get length of data from the header. | 18461 | // Get length of data from the header. |
| 18462 | if ( fread(&fileSize, 4, 1, fd) != 1 ) goto error; | 18462 | if ( fread(&fileSize, 4, 1, fd) != 1 ) goto error; |
| 18463 | if( little_endian ) | 18463 | if( little_endian ) |
| 18464 | swap32((unsigned char *)&fileSize); | 18464 | swapb32((unsigned char *)&fileSize); |
| 18465 | 18465 | ||
| 18466 | fileSize /= 2 * channels; // Convert to sample frames. | 18466 | fileSize /= 2 * channels; // Convert to sample frames. |
| 18467 | bufferSize = fileSize; | 18467 | bufferSize = fileSize; |
| @@ -18497,7 +18497,7 @@ bool WvIn :: getAifInfo( const char *fileName ) · 29 unmodified lines | |||
| 18497 | while ( strncmp(id, "COMM", 4) ) { | 18497 | while ( strncmp(id, "COMM", 4) ) { |
| 18498 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; | 18498 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; |
| 18499 | if( little_endian ) | 18499 | if( little_endian ) |
| 18500 | swap32((unsigned char *)&chunkSize); | 18500 | swapb32((unsigned char *)&chunkSize); |
| 18501 | 18501 | ||
| 18502 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; | 18502 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; |
| 18503 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; | 18503 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; |
| @@ -18508,7 +18508,7 @@ if( little_endian ) · 4 unmodified lines | |||
| 18508 | if ( fseek(fd, 4, SEEK_CUR) == -1 ) goto error; // Jump over chunk size | 18508 | if ( fseek(fd, 4, SEEK_CUR) == -1 ) goto error; // Jump over chunk size |
| 18509 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; | 18509 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; |
| 18510 | if( little_endian ) | 18510 | if( little_endian ) |
| 18511 | swap16((unsigned char *)&temp); | 18511 | swapb16((unsigned char *)&temp); |
| 18512 | 18512 | ||
| 18513 | channels = temp; | 18513 | channels = temp; |
| 18514 | 18514 | ||
| @@ -18516,7 +18516,7 @@ if( little_endian ) · 1 unmodified line | |||
| 18516 | SINT32 frames; | 18516 | SINT32 frames; |
| 18517 | if ( fread(&frames, 4, 1, fd) != 1 ) goto error; | 18517 | if ( fread(&frames, 4, 1, fd) != 1 ) goto error; |
| 18518 | if( little_endian ) | 18518 | if( little_endian ) |
| 18519 | swap32((unsigned char *)&frames); | 18519 | swapb32((unsigned char *)&frames); |
| 18520 | 18520 | ||
| 18521 | fileSize = frames; // sample frames | 18521 | fileSize = frames; // sample frames |
| 18522 | bufferSize = fileSize; | 18522 | bufferSize = fileSize; |
| @@ -18528,7 +18528,7 @@ if( little_endian ) · 5 unmodified lines | |||
| 18528 | // Read the number of bits per sample. | 18528 | // Read the number of bits per sample. |
| 18529 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; | 18529 | if ( fread(&temp, 2, 1, fd) != 1 ) goto error; |
| 18530 | if( little_endian ) | 18530 | if( little_endian ) |
| 18531 | swap16((unsigned char *)&temp); | 18531 | swapb16((unsigned char *)&temp); |
| 18532 | 18532 | ||
| 18533 | // Get file sample rate from the header. For AIFF files, this value | 18533 | // Get file sample rate from the header. For AIFF files, this value |
| 18534 | // is stored in a 10-byte, IEEE Standard 754 floating point number, | 18534 | // is stored in a 10-byte, IEEE Standard 754 floating point number, |
| @@ -18540,7 +18540,7 @@ if( little_endian ) · 5 unmodified lines | |||
| 18540 | if ( fread(&theSrate, 10, 1, fd) != 1 ) goto error; | 18540 | if ( fread(&theSrate, 10, 1, fd) != 1 ) goto error; |
| 18541 | mantissa = (unsigned long) *(unsigned long *)(theSrate+2); | 18541 | mantissa = (unsigned long) *(unsigned long *)(theSrate+2); |
| 18542 | if( little_endian ) | 18542 | if( little_endian ) |
| 18543 | swap32((unsigned char *)&mantissa); | 18543 | swapb32((unsigned char *)&mantissa); |
| 18544 | 18544 | ||
| 18545 | exp = 30 - *(theSrate+1); | 18545 | exp = 30 - *(theSrate+1); |
| 18546 | last = 0; | 18546 | last = 0; |
| @@ -18580,7 +18580,7 @@ if( little_endian ) · 33 unmodified lines | |||
| 18580 | while ( strncmp(id, "SSND", 4) ) { | 18580 | while ( strncmp(id, "SSND", 4) ) { |
| 18581 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; | 18581 | if ( fread(&chunkSize, 4, 1, fd) != 1 ) goto error; |
| 18582 | if( little_endian ) | 18582 | if( little_endian ) |
| 18583 | swap32((unsigned char *)&chunkSize); | 18583 | swapb32((unsigned char *)&chunkSize); |
| 18584 | 18584 | ||
| 18585 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; | 18585 | if ( fseek(fd, chunkSize, SEEK_CUR) == -1 ) goto error; |
| 18586 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; | 18586 | if ( fread(&id, 4, 1, fd) != 1 ) goto error; |
| @@ -18637,7 +18637,7 @@ else · 50 unmodified lines | |||
| 18637 | // Check the data element type | 18637 | // Check the data element type |
| 18638 | SINT32 datatype; | 18638 | SINT32 datatype; |
| 18639 | if ( fread(&datatype, 4, 1, fd) != 1 ) goto error; | 18639 | if ( fread(&datatype, 4, 1, fd) != 1 ) goto error; |
| 18640 | if ( byteswap ) swap32((unsigned char *)&datatype); | 18640 | if ( byteswap ) swapb32((unsigned char *)&datatype); |
| 18641 | if (datatype != 14) { | 18641 | if (datatype != 14) { |
| 18642 | snprintf(msg, STK_MSG_BUF_LENGTH, "[chuck](via WvIn): The file does not contain a single Matlab array (or matrix) data element."); | 18642 | snprintf(msg, STK_MSG_BUF_LENGTH, "[chuck](via WvIn): The file does not contain a single Matlab array (or matrix) data element."); |
| 18643 | return false; | 18643 | return false; |
| @@ -18648,10 +18648,10 @@ else · 4 unmodified lines | |||
| 18648 | SINT32 size; | 18648 | SINT32 size; |
| 18649 | if ( fseek(fd, 168, SEEK_SET) == -1 ) goto error; | 18649 | if ( fseek(fd, 168, SEEK_SET) == -1 ) goto error; |
| 18650 | if ( fread(&tmp, 4, 1, fd) != 1 ) goto error; | 18650 | if ( fread(&tmp, 4, 1, fd) != 1 ) goto error; |
| 18651 | if (byteswap) swap32((unsigned char *)&tmp); | 18651 | if (byteswap) swapb32((unsigned char *)&tmp); |
| 18652 | if (tmp == 1) { // array name > 4 characters | 18652 | if (tmp == 1) { // array name > 4 characters |
| 18653 | if ( fread(&tmp, 4, 1, fd) != 1 ) goto error; // get array name length | 18653 | if ( fread(&tmp, 4, 1, fd) != 1 ) goto error; // get array name length |
| 18654 | if (byteswap) swap32((unsigned char *)&tmp); | 18654 | if (byteswap) swapb32((unsigned char *)&tmp); |
| 18655 | size = (SINT32) ceil((float)tmp / 8); | 18655 | size = (SINT32) ceil((float)tmp / 8); |
| 18656 | if ( fseek(fd, size*8, SEEK_CUR) == -1 ) goto error; // jump over array name | 18656 | if ( fseek(fd, size*8, SEEK_CUR) == -1 ) goto error; // jump over array name |
| 18657 | } | 18657 | } |
| @@ -18659,7 +18659,7 @@ else · 1 unmodified line | |||
| 18659 | if ( fseek(fd, 4, SEEK_CUR) == -1 ) goto error; | 18659 | if ( fseek(fd, 4, SEEK_CUR) == -1 ) goto error; |
| 18660 | } | 18660 | } |
| 18661 | if ( fread(&tmp, 4, 1, fd) != 1 ) goto error; | 18661 | if ( fread(&tmp, 4, 1, fd) != 1 ) goto error; |
| 18662 | if (byteswap) swap32((unsigned char *)&tmp); | 18662 | if (byteswap) swapb32((unsigned char *)&tmp); |
| 18663 | if ( tmp == 1 ) dataType = STK_SINT8; | 18663 | if ( tmp == 1 ) dataType = STK_SINT8; |
| 18664 | else if ( tmp == 3 ) dataType = STK_SINT16; | 18664 | else if ( tmp == 3 ) dataType = STK_SINT16; |
| 18665 | // NOTE: MAT file format does not appear to support 24-bit | 1.5.0.1 (ge) | 18665 | // NOTE: MAT file format does not appear to support 24-bit | 1.5.0.1 (ge) |
| @@ -18675,12 +18675,12 @@ else · 9 unmodified lines | |||
| 18675 | SINT32 rows; | 18675 | SINT32 rows; |
| 18676 | if ( fseek(fd, 160, SEEK_SET) == -1 ) goto error; | 18676 | if ( fseek(fd, 160, SEEK_SET) == -1 ) goto error; |
| 18677 | if ( fread(&rows, 4, 1, fd) != 1 ) goto error; | 18677 | if ( fread(&rows, 4, 1, fd) != 1 ) goto error; |
| 18678 | if (byteswap) swap32((unsigned char *)&rows); | 18678 | if (byteswap) swapb32((unsigned char *)&rows); |
| 18679 | 18679 | ||
| 18680 | // Get number of columns from the header. | 18680 | // Get number of columns from the header. |
| 18681 | SINT32 columns; | 18681 | SINT32 columns; |
| 18682 | if ( fread(&columns,4, 1, fd) != 1 ) goto error; | 18682 | if ( fread(&columns,4, 1, fd) != 1 ) goto error; |
| 18683 | if (byteswap) swap32((unsigned char *)&columns); | 18683 | if (byteswap) swapb32((unsigned char *)&columns); |
| 18684 | 18684 | ||
| 18685 | // Assume channels = smaller of rows or columns. | 18685 | // Assume channels = smaller of rows or columns. |
| 18686 | if (rows < columns) { | 18686 | if (rows < columns) { |
| @@ -18701,7 +18701,7 @@ else · 14 unmodified lines | |||
| 18701 | SINT32 headsize; | 18701 | SINT32 headsize; |
| 18702 | if ( fseek(fd, 132, SEEK_SET) == -1 ) goto error; | 18702 | if ( fseek(fd, 132, SEEK_SET) == -1 ) goto error; |
| 18703 | if ( fread(&headsize, 4, 1, fd) != 1 ) goto error; // file size from 132nd byte | 18703 | if ( fread(&headsize, 4, 1, fd) != 1 ) goto error; // file size from 132nd byte |
| 18704 | if (byteswap) swap32((unsigned char *)&headsize); | 18704 | if (byteswap) swapb32((unsigned char *)&headsize); |
| 18705 | headsize -= fileSize * 8 * channels; | 18705 | headsize -= fileSize * 8 * channels; |
| 18706 | if ( fseek(fd, headsize, SEEK_CUR) == -1 ) goto error; | 18706 | if ( fseek(fd, headsize, SEEK_CUR) == -1 ) goto error; |
| 18707 | dataOffset = ftell(fd); | 18707 | dataOffset = ftell(fd); |
| @@ -18756,7 +18756,7 @@ void WvIn :: readData( unsigned long index ) · 48 unmodified lines | |||
| 18756 | if ( byteswap ) { | 18756 | if ( byteswap ) { |
| 18757 | SINT16 *ptr = buf; | 18757 | SINT16 *ptr = buf; |
| 18758 | for (i=length*channels-1; i>=0; i--) | 18758 | for (i=length*channels-1; i>=0; i--) |
| 18759 | swap16((unsigned char *)(ptr++)); | 18759 | swapb16((unsigned char *)(ptr++)); |
| 18760 | } | 18760 | } |
| 18761 | for (i=length*channels-1; i>=0; i--) | 18761 | for (i=length*channels-1; i>=0; i--) |
| 18762 | data[i] = buf[i]; | 18762 | data[i] = buf[i]; |
| @@ -18780,7 +18780,7 @@ void WvIn :: readData( unsigned long index ) · 17 unmodified lines | |||
| 18780 | if ( byteswap ) { | 18780 | if ( byteswap ) { |
| 18781 | SINT32 *ptr = buf; | 18781 | SINT32 *ptr = buf; |
| 18782 | for (i=length*channels-1; i>=0; i--) | 18782 | for (i=length*channels-1; i>=0; i--) |
| 18783 | swap32((unsigned char *)(ptr++)); | 18783 | swapb32((unsigned char *)(ptr++)); |
| 18784 | } | 18784 | } |
| 18785 | for (i=length*channels-1; i>=0; i--) | 18785 | for (i=length*channels-1; i>=0; i--) |
| 18786 | data[i] = buf[i]; | 18786 | data[i] = buf[i]; |
| @@ -18792,7 +18792,7 @@ void WvIn :: readData( unsigned long index ) · 5 unmodified lines | |||
| 18792 | if ( byteswap ) { | 18792 | if ( byteswap ) { |
| 18793 | FLOAT32 *ptr = buf; | 18793 | FLOAT32 *ptr = buf; |
| 18794 | for (i=length*channels-1; i>=0; i--) | 18794 | for (i=length*channels-1; i>=0; i--) |
| 18795 | swap32((unsigned char *)(ptr++)); | 18795 | swapb32((unsigned char *)(ptr++)); |
| 18796 | } | 18796 | } |
| 18797 | for (i=length*channels-1; i>=0; i--) | 18797 | for (i=length*channels-1; i>=0; i--) |
| 18798 | data[i] = buf[i]; | 18798 | data[i] = buf[i]; |
| @@ -18804,7 +18804,7 @@ void WvIn :: readData( unsigned long index ) · 5 unmodified lines | |||
| 18804 | if ( byteswap ) { | 18804 | if ( byteswap ) { |
| 18805 | FLOAT64 *ptr = buf; | 18805 | FLOAT64 *ptr = buf; |
| 18806 | for (i=length*channels-1; i>=0; i--) | 18806 | for (i=length*channels-1; i>=0; i--) |
| 18807 | swap64((unsigned char *)(ptr++)); | 18807 | swapb64((unsigned char *)(ptr++)); |
| 18808 | } | 18808 | } |
| 18809 | for (i=length*channels-1; i>=0; i--) | 18809 | for (i=length*channels-1; i>=0; i--) |
| 18810 | data[i] = buf[i]; | 18810 | data[i] = buf[i]; |
| @@ -19392,14 +19392,14 @@ bool WvOut :: setWavFile( const char *fileName ) · 581 unmodified lines | |||
| 19392 | if( !little_endian ) | 19392 | if( !little_endian ) |
| 19393 | { | 19393 | { |
| 19394 | byteswap = true; | 19394 | byteswap = true; |
| 19395 | swap32((unsigned char *)&hdr.file_size); | 19395 | swapb32((unsigned char *)&hdr.file_size); |
| 19396 | swap32((unsigned char *)&hdr.chunk_size); | 19396 | swapb32((unsigned char *)&hdr.chunk_size); |
| 19397 | swap16((unsigned char *)&hdr.format_tag); | 19397 | swapb16((unsigned char *)&hdr.format_tag); |
| 19398 | swap16((unsigned char *)&hdr.num_chans); | 19398 | swapb16((unsigned char *)&hdr.num_chans); |
| 19399 | swap32((unsigned char *)&hdr.sample_rate); | 19399 | swapb32((unsigned char *)&hdr.sample_rate); |
| 19400 | swap32((unsigned char *)&hdr.bytes_per_sec); | 19400 | swapb32((unsigned char *)&hdr.bytes_per_sec); |
| 19401 | swap16((unsigned char *)&hdr.bytes_per_samp); | 19401 | swapb16((unsigned char *)&hdr.bytes_per_samp); |
| 19402 | swap16((unsigned char *)&hdr.bits_per_samp); | 19402 | swapb16((unsigned char *)&hdr.bits_per_samp); |
| 19403 | } | 19403 | } |
| 19404 | 19404 | ||
| 19405 | if ( fwrite(&hdr, 4, 11, fd) != 11 ) { | 19405 | if ( fwrite(&hdr, 4, 11, fd) != 11 ) { |
| @@ -19425,14 +19425,14 @@ void WvOut :: closeWavFile( void ) · 19 unmodified lines | |||
| 19425 | 19425 | ||
| 19426 | SINT32 bytes = (SINT32)(totalCount * channels * bytes_per_sample); | 19426 | SINT32 bytes = (SINT32)(totalCount * channels * bytes_per_sample); |
| 19427 | if( !little_endian ) | 19427 | if( !little_endian ) |
| 19428 | swap32((unsigned char *)&bytes); | 19428 | swapb32((unsigned char *)&bytes); |
| 19429 | 19429 | ||
| 19430 | fseek(fd, 40, SEEK_SET); // jump to data length | 19430 | fseek(fd, 40, SEEK_SET); // jump to data length |
| 19431 | fwrite(&bytes, 4, 1, fd); | 19431 | fwrite(&bytes, 4, 1, fd); |
| 19432 | 19432 | ||
| 19433 | bytes = (SINT32)(totalCount * channels * bytes_per_sample + 44); | 19433 | bytes = (SINT32)(totalCount * channels * bytes_per_sample + 44); |
| 19434 | if( !little_endian ) | 19434 | if( !little_endian ) |
| 19435 | swap32((unsigned char *)&bytes); | 19435 | swapb32((unsigned char *)&bytes); |
| 19436 | 19436 | ||
| 19437 | fseek(fd, 4, SEEK_SET); // jump to file size | 19437 | fseek(fd, 4, SEEK_SET); // jump to file size |
| 19438 | fwrite(&bytes, 4, 1, fd); | 19438 | fwrite(&bytes, 4, 1, fd); |
| @@ -19470,10 +19470,10 @@ bool WvOut :: setSndFile( const char *fileName ) · 31 unmodified lines | |||
| 19470 | if( little_endian ) | 19470 | if( little_endian ) |
| 19471 | { | 19471 | { |
| 19472 | byteswap = true; | 19472 | byteswap = true; |
| 19473 | swap32 ((unsigned char *)&hdr.hdr_length); | 19473 | swapb32 ((unsigned char *)&hdr.hdr_length); |
| 19474 | swap32 ((unsigned char *)&hdr.format); | 19474 | swapb32 ((unsigned char *)&hdr.format); |
| 19475 | swap32 ((unsigned char *)&hdr.sample_rate); | 19475 | swapb32 ((unsigned char *)&hdr.sample_rate); |
| 19476 | swap32 ((unsigned char *)&hdr.num_channels); | 19476 | swapb32 ((unsigned char *)&hdr.num_channels); |
| 19477 | } | 19477 | } |
| 19478 | 19478 | ||
| 19479 | if ( fwrite(&hdr, 4, 10, fd) != 10 ) { | 19479 | if ( fwrite(&hdr, 4, 10, fd) != 10 ) { |
| @@ -19499,7 +19499,7 @@ void WvOut :: closeSndFile( void ) · 19 unmodified lines | |||
| 19499 | 19499 | ||
| 19500 | SINT32 bytes = (SINT32)(totalCount * bytes_per_sample * channels); | 19500 | SINT32 bytes = (SINT32)(totalCount * bytes_per_sample * channels); |
| 19501 | if( little_endian ) | 19501 | if( little_endian ) |
| 19502 | swap32 ((unsigned char *)&bytes); | 19502 | swapb32 ((unsigned char *)&bytes); |
| 19503 | 19503 | ||
| 19504 | fseek(fd, 8, SEEK_SET); // jump to data size | 19504 | fseek(fd, 8, SEEK_SET); // jump to data size |
| 19505 | fwrite(&bytes, 4, 1, fd); | 19505 | fwrite(&bytes, 4, 1, fd); |
| @@ -19558,7 +19558,7 @@ bool WvOut :: setAifFile( const char *fileName ) · 52 unmodified lines | |||
| 19558 | } | 19558 | } |
| 19559 | i += 16383; | 19559 | i += 16383; |
| 19560 | if( little_endian ) | 19560 | if( little_endian ) |
| 19561 | swap16((unsigned char *)&i); | 19561 | swapb16((unsigned char *)&i); |
| 19562 | 19562 | ||
| 19563 | *(SINT16 *)(hdr.srate) = (SINT16) i; | 19563 | *(SINT16 *)(hdr.srate) = (SINT16) i; |
| 19564 | 19564 | ||
| @@ -19568,7 +19568,7 @@ if( little_endian ) · 3 unmodified lines | |||
| 19568 | } | 19568 | } |
| 19569 | 19569 | ||
| 19570 | if( little_endian ) | 19570 | if( little_endian ) |
| 19571 | swap32((unsigned char *)&rate); | 19571 | swapb32((unsigned char *)&rate); |
| 19572 | 19572 | ||
| 19573 | *(unsigned long *)(hdr.srate+2) = (unsigned long) rate; | 19573 | *(unsigned long *)(hdr.srate+2) = (unsigned long) rate; |
| 19574 | 19574 | ||
| @@ -19576,13 +19576,13 @@ if( little_endian ) · 1 unmodified line | |||
| 19576 | if( little_endian ) | 19576 | if( little_endian ) |
| 19577 | { | 19577 | { |
| 19578 | byteswap = true; | 19578 | byteswap = true; |
| 19579 | swap32((unsigned char *)&hdr.form_size); | 19579 | swapb32((unsigned char *)&hdr.form_size); |
| 19580 | swap32((unsigned char *)&hdr.comm_size); | 19580 | swapb32((unsigned char *)&hdr.comm_size); |
| 19581 | swap16((unsigned char *)&hdr.num_chans); | 19581 | swapb16((unsigned char *)&hdr.num_chans); |
| 19582 | swap16((unsigned char *)&hdr.sample_size); | 19582 | swapb16((unsigned char *)&hdr.sample_size); |
| 19583 | swap32((unsigned char *)&ssnd.ssnd_size); | 19583 | swapb32((unsigned char *)&ssnd.ssnd_size); |
| 19584 | swap32((unsigned char *)&ssnd.offset); | 19584 | swapb32((unsigned char *)&ssnd.offset); |
| 19585 | swap32((unsigned char *)&ssnd.block_size); | 19585 | swapb32((unsigned char *)&ssnd.block_size); |
| 19586 | } | 19586 | } |
| 19587 | 19587 | ||
| 19588 | // The structure boundaries don't allow a single write of 54 bytes. | 19588 | // The structure boundaries don't allow a single write of 54 bytes. |
| @@ -19619,7 +19619,7 @@ void WvOut :: closeAifFile( void ) · 30 unmodified lines | |||
| 19619 | { | 19619 | { |
| 19620 | unsigned long frames = (unsigned long) totalCount; | 19620 | unsigned long frames = (unsigned long) totalCount; |
| 19621 | if( little_endian ) | 19621 | if( little_endian ) |
| 19622 | swap32((unsigned char *)&frames); | 19622 | swapb32((unsigned char *)&frames); |
| 19623 | 19623 | ||
| 19624 | fseek(fd, 22, SEEK_SET); // jump to "COMM" sample_frames | 19624 | fseek(fd, 22, SEEK_SET); // jump to "COMM" sample_frames |
| 19625 | fwrite(&frames, 4, 1, fd); | 19625 | fwrite(&frames, 4, 1, fd); |
| @@ -19637,7 +19637,7 @@ if( little_endian ) · 11 unmodified lines | |||
| 19637 | unsigned long bytes = totalCount * bytes_per_sample * channels + 46; | 19637 | unsigned long bytes = totalCount * bytes_per_sample * channels + 46; |
| 19638 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; | 19638 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; |
| 19639 | if( little_endian ) | 19639 | if( little_endian ) |
| 19640 | swap32((unsigned char *)&bytes); | 19640 | swapb32((unsigned char *)&bytes); |
| 19641 | 19641 | ||
| 19642 | fseek(fd, 4, SEEK_SET); // jump to file size | 19642 | fseek(fd, 4, SEEK_SET); // jump to file size |
| 19643 | fwrite(&bytes, 4, 1, fd); | 19643 | fwrite(&bytes, 4, 1, fd); |
| @@ -19645,7 +19645,7 @@ if( little_endian ) · 1 unmodified line | |||
| 19645 | bytes = totalCount * bytes_per_sample * channels + 8; | 19645 | bytes = totalCount * bytes_per_sample * channels + 8; |
| 19646 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; | 19646 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) bytes += 6; |
| 19647 | if( little_endian ) | 19647 | if( little_endian ) |
| 19648 | swap32((unsigned char *)&bytes); | 19648 | swapb32((unsigned char *)&bytes); |
| 19649 | 19649 | ||
| 19650 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) | 19650 | if ( dataType == MY_FLOAT32 || dataType == MY_FLOAT64 ) |
| 19651 | fseek(fd, 48, SEEK_SET); // jump to "SSND" chunk size | 19651 | fseek(fd, 48, SEEK_SET); // jump to "SSND" chunk size |
| @@ -19830,7 +19830,7 @@ void WvOut :: writeData( unsigned long frames ) · 178 unmodified lines | |||
| 19830 | if(float_sample > 32767) float_sample = 32767; | 19830 | if(float_sample > 32767) float_sample = 32767; |
| 19831 | SINT16 sample = (SINT16) float_sample; | 19831 | SINT16 sample = (SINT16) float_sample; |
| 19832 | 19832 | ||
| 19833 | if ( byteswap ) swap16( (unsigned char *)&sample ); | 19833 | if ( byteswap ) swapb16( (unsigned char *)&sample ); |
| 19834 | if ( fwrite(&sample, 2, 1, fd) != 1 ) goto error; | 19834 | if ( fwrite(&sample, 2, 1, fd) != 1 ) goto error; |
| 19835 | } | 19835 | } |
| 19836 | } | 19836 | } |
| @@ -19851,7 +19851,7 @@ void WvOut :: writeData( unsigned long frames ) · 14 unmodified lines | |||
| 19851 | if(float_sample > 2147483647.0 ) float_sample = 2147483647.0; // 1.4.2.0 (ge) | using float literal, instead of conversion from int | 19851 | if(float_sample > 2147483647.0 ) float_sample = 2147483647.0; // 1.4.2.0 (ge) | using float literal, instead of conversion from int |
| 19852 | SINT32 sample = (SINT32) float_sample; | 19852 | SINT32 sample = (SINT32) float_sample; |
| 19853 | 19853 | ||
| 19854 | if ( byteswap ) swap32( (unsigned char *)&sample ); | 19854 | if ( byteswap ) swapb32( (unsigned char *)&sample ); |
| 19855 | if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; | 19855 | if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; |
| 19856 | } | 19856 | } |
| 19857 | } | 19857 | } |
| @@ -19860,7 +19860,7 @@ void WvOut :: writeData( unsigned long frames ) · 2 unmodified lines | |||
| 19860 | for ( unsigned long k=0; k<frames*channels; k++ ) { | 19860 | for ( unsigned long k=0; k<frames*channels; k++ ) { |
| 19861 | sample = (FLOAT32) (data[k]); | 19861 | sample = (FLOAT32) (data[k]); |
| 19862 | 19862 | ||
| 19863 | if ( byteswap ) swap32( (unsigned char *)&sample ); | 19863 | if ( byteswap ) swapb32( (unsigned char *)&sample ); |
| 19864 | if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; | 19864 | if ( fwrite(&sample, 4, 1, fd) != 1 ) goto error; |
| 19865 | } | 19865 | } |
| 19866 | } | 19866 | } |
| @@ -19869,7 +19869,7 @@ void WvOut :: writeData( unsigned long frames ) · 2 unmodified lines | |||
| 19869 | for ( unsigned long k=0; k<frames*channels; k++ ) { | 19869 | for ( unsigned long k=0; k<frames*channels; k++ ) { |
| 19870 | sample = (FLOAT64) (data[k]); | 19870 | sample = (FLOAT64) (data[k]); |
| 19871 | 19871 | ||
| 19872 | if ( byteswap ) swap64( (unsigned char *)&sample ); | 19872 | if ( byteswap ) swapb64( (unsigned char *)&sample ); |
| 19873 | if ( fwrite(&sample, 8, 1, fd) != 1 ) goto error; | 19873 | if ( fwrite(&sample, 8, 1, fd) != 1 ) goto error; |
| 19874 | } | 19874 | } |
| 19875 | } | 19875 | } |
| @@ -19982,7 +19982,7 @@ MidiFileIn :: MidiFileIn( std::string fileName ) · 106 unmodified lines | |||
| 19982 | if ( !file_.read( chunkType, 4 ) ) goto error; | 19982 | if ( !file_.read( chunkType, 4 ) ) goto error; |
| 19983 | if ( !file_.read( buffer, 4 ) ) goto error; | 19983 | if ( !file_.read( buffer, 4 ) ) goto error; |
| 19984 | #ifdef __LITTLE_ENDIAN__ | 19984 | #ifdef __LITTLE_ENDIAN__ |
| 19985 | swap32((unsigned char *)&buffer); | 19985 | swapb32((unsigned char *)&buffer); |
| 19986 | #endif | 19986 | #endif |
| 19987 | length = (SINT32 *) &buffer; | 19987 | length = (SINT32 *) &buffer; |
| 19988 | if ( strncmp( chunkType, "MThd", 4 ) || ( *length != 6 ) ) { | 19988 | if ( strncmp( chunkType, "MThd", 4 ) || ( *length != 6 ) ) { |
| @@ -19994,7 +19994,7 @@ MidiFileIn :: MidiFileIn( std::string fileName ) · 5 unmodified lines | |||
| 19994 | SINT16 *data; | 19994 | SINT16 *data; |
| 19995 | if ( !file_.read( buffer, 2 ) ) goto error; | 19995 | if ( !file_.read( buffer, 2 ) ) goto error; |
| 19996 | #ifdef __LITTLE_ENDIAN__ | 19996 | #ifdef __LITTLE_ENDIAN__ |
| 19997 | swap16((unsigned char *)&buffer); | 19997 | swapb16((unsigned char *)&buffer); |
| 19998 | #endif | 19998 | #endif |
| 19999 | data = (SINT16 *) &buffer; | 19999 | data = (SINT16 *) &buffer; |
| 20000 | if ( *data < 0 || *data > 2 ) { | 20000 | if ( *data < 0 || *data > 2 ) { |
| @@ -20006,7 +20006,7 @@ MidiFileIn :: MidiFileIn( std::string fileName ) · 5 unmodified lines | |||
| 20006 | // Read the number of tracks. | 20006 | // Read the number of tracks. |
| 20007 | if ( !file_.read( buffer, 2 ) ) goto error; | 20007 | if ( !file_.read( buffer, 2 ) ) goto error; |
| 20008 | #ifdef __LITTLE_ENDIAN__ | 20008 | #ifdef __LITTLE_ENDIAN__ |
| 20009 | swap16((unsigned char *)&buffer); | 20009 | swapb16((unsigned char *)&buffer); |
| 20010 | #endif | 20010 | #endif |
| 20011 | if ( format_ == 0 && *data != 1 ) { | 20011 | if ( format_ == 0 && *data != 1 ) { |
| 20012 | msg << "MidiFileIn: invalid number of tracks (>1) for a file format = 0!"; | 20012 | msg << "MidiFileIn: invalid number of tracks (>1) for a file format = 0!"; |
| @@ -20017,7 +20017,7 @@ MidiFileIn :: MidiFileIn( std::string fileName ) · 4 unmodified lines | |||
| 20017 | // Read the beat division. | 20017 | // Read the beat division. |
| 20018 | if ( !file_.read( buffer, 2 ) ) goto error; | 20018 | if ( !file_.read( buffer, 2 ) ) goto error; |
| 20019 | #ifdef __LITTLE_ENDIAN__ | 20019 | #ifdef __LITTLE_ENDIAN__ |
| 20020 | swap16((unsigned char *)&buffer); | 20020 | swapb16((unsigned char *)&buffer); |
| 20021 | #endif | 20021 | #endif |
| 20022 | division_ = (int) *data; | 20022 | division_ = (int) *data; |
| 20023 | double tickrate; | 20023 | double tickrate; |
| @@ -20044,7 +20044,7 @@ MidiFileIn :: MidiFileIn( std::string fileName ) · 20 unmodified lines | |||
| 20044 | if ( strncmp( chunkType, "MTrk", 4 ) ) goto error; | 20044 | if ( strncmp( chunkType, "MTrk", 4 ) ) goto error; |
| 20045 | if ( !file_.read( buffer, 4 ) ) goto error; | 20045 | if ( !file_.read( buffer, 4 ) ) goto error; |
| 20046 | #ifdef __LITTLE_ENDIAN__ | 20046 | #ifdef __LITTLE_ENDIAN__ |
| 20047 | swap32((unsigned char *)&buffer); | 20047 | swapb32((unsigned char *)&buffer); |
| 20048 | #endif | 20048 | #endif |
| 20049 | length = (SINT32 *) &buffer; | 20049 | length = (SINT32 *) &buffer; |
| 20050 | trackLengths_.push_back( *length ); | 20050 | trackLengths_.push_back( *length ); |
| @@ -181,13 +181,13 @@ public: · 180 unmodified lines | |||
| 181 | static void setRawwavePath(std::string newPath); | 181 | static void setRawwavePath(std::string newPath); |
| 182 | 182 | ||
| 183 | //! Static method which byte-swaps a 16-bit data type. | 183 | //! Static method which byte-swaps a 16-bit data type. |
| 184 | static void swap16(unsigned char *ptr); | 184 | static void swapb16(unsigned char *ptr); |
| 185 | 185 | ||
| 186 | //! Static method which byte-swaps a 32-bit data type. | 186 | //! Static method which byte-swaps a 32-bit data type. |
| 187 | static void swap32(unsigned char *ptr); | 187 | static void swapb32(unsigned char *ptr); |
| 188 | 188 | ||
| 189 | //! Static method which byte-swaps a 64-bit data type. | 189 | //! Static method which byte-swaps a 64-bit data type. |
| 190 | static void swap64(unsigned char *ptr); | 190 | static void swapb64(unsigned char *ptr); |
| 191 | 191 | ||
| 192 | //! Static cross-platform method to sleep for a number of milliseconds. | 192 | //! Static cross-platform method to sleep for a number of milliseconds. |
| 193 | static void sleep(unsigned long milliseconds); | 193 | static void sleep(unsigned long milliseconds); |
| @@ -8121,3 +8121,163 @@ const char * MultiTouchDevice_name( int ts ) { return NULL; } · 8120 unmodified lines | |||
| 8121 | 8121 | ||
| 8122 | #endif // __CHIP_MODE__ | 8122 | #endif // __CHIP_MODE__ |
| 8123 | 8123 | ||
| 8124 | #ifdef __PLATFORM_OPENBSD__ | ||
| 8125 | |||
| 8126 | void Hid_init(){} | ||
| 8127 | void Hid_poll(){} | ||
| 8128 | void Hid_quit(){} | ||
| 8129 | |||
| 8130 | void Keyboard_init(){} | ||
| 8131 | void Keyboard_poll(){} | ||
| 8132 | void Keyboard_quit(){} | ||
| 8133 | void Keyboard_probe(){} | ||
| 8134 | |||
| 8135 | int Keyboard_count() | ||
| 8136 | { | ||
| 8137 | return 0; | ||
| 8138 | } | ||
| 8139 | |||
| 8140 | int Keyboard_open( int kb ) | ||
| 8141 | { | ||
| 8142 | return -1; | ||
| 8143 | } | ||
| 8144 | |||
| 8145 | int Keyboard_open( const char * name ) | ||
| 8146 | { | ||
| 8147 | return -1; | ||
| 8148 | } | ||
| 8149 | |||
| 8150 | int Keyboard_close( int kb ) | ||
| 8151 | { | ||
| 8152 | return -1; | ||
| 8153 | } | ||
| 8154 | |||
| 8155 | const char * Keyboard_name( int kb ) | ||
| 8156 | { | ||
| 8157 | return NULL; | ||
| 8158 | } | ||
| 8159 | |||
| 8160 | void start_hid_multi_touch() { } | ||
| 8161 | void stop_hid_multi_touch() { } | ||
| 8162 | |||
| 8163 | void Mouse_init(){} | ||
| 8164 | void Mouse_poll(){} | ||
| 8165 | void Mouse_quit(){} | ||
| 8166 | void Mouse_probe(){} | ||
| 8167 | |||
| 8168 | int Mouse_count() | ||
| 8169 | { | ||
| 8170 | return 1; | ||
| 8171 | } | ||
| 8172 | |||
| 8173 | int Mouse_open( int m ) | ||
| 8174 | { | ||
| 8175 | if(m >= 0 && m < 1) | ||
| 8176 | { | ||
| 8177 | start_hid_multi_touch(); | ||
| 8178 | return 0; | ||
| 8179 | } | ||
| 8180 | else | ||
| 8181 | return -1; | ||
| 8182 | } | ||
| 8183 | |||
| 8184 | int Mouse_open( const char * name ) | ||
| 8185 | { | ||
| 8186 | return -1; | ||
| 8187 | } | ||
| 8188 | |||
| 8189 | int Mouse_close( int m ) | ||
| 8190 | { | ||
| 8191 | if(m >= 0 && m < 1) | ||
| 8192 | { | ||
| 8193 | stop_hid_multi_touch(); | ||
| 8194 | return 0; | ||
| 8195 | } | ||
| 8196 | else | ||
| 8197 | return -1; | ||
| 8198 | } | ||
| 8199 | |||
| 8200 | int Mouse_send( int m, const HidMsg * msg ) | ||
| 8201 | { | ||
| 8202 | return -1; | ||
| 8203 | } | ||
| 8204 | |||
| 8205 | const char * Mouse_name( int m ) | ||
| 8206 | { | ||
| 8207 | if(m == 0) | ||
| 8208 | return "iPhone Multitouch"; | ||
| 8209 | else | ||
| 8210 | return NULL; | ||
| 8211 | } | ||
| 8212 | |||
| 8213 | // ge: SMS multi-thread poll rate | ||
| 8214 | t_CKINT TiltSensor_setPollRate( t_CKINT usec ) | ||
| 8215 | { | ||
| 8216 | return -1; | ||
| 8217 | } | ||
| 8218 | |||
| 8219 | t_CKINT TiltSensor_getPollRate( ) | ||
| 8220 | { | ||
| 8221 | return -1; | ||
| 8222 | } | ||
| 8223 | |||
| 8224 | void Joystick_init(){} | ||
| 8225 | |||
| 8226 | void Joystick_poll(){} | ||
| 8227 | |||
| 8228 | void Joystick_quit(){} | ||
| 8229 | |||
| 8230 | void Joystick_probe(){} | ||
| 8231 | |||
| 8232 | int Joystick_count() | ||
| 8233 | { | ||
| 8234 | return 0; | ||
| 8235 | } | ||
| 8236 | |||
| 8237 | int Joystick_open( int js ) | ||
| 8238 | { | ||
| 8239 | return -1; | ||
| 8240 | } | ||
| 8241 | |||
| 8242 | int Joystick_open_async( int js ) | ||
| 8243 | { | ||
| 8244 | return -1; | ||
| 8245 | } | ||
| 8246 | |||
| 8247 | int Joystick_open( const char * name ) | ||
| 8248 | { | ||
| 8249 | return -1; | ||
| 8250 | } | ||
| 8251 | |||
| 8252 | int Joystick_close( int js ) | ||
| 8253 | { | ||
| 8254 | return -1; | ||
| 8255 | } | ||
| 8256 | |||
| 8257 | int Joystick_send( int js, const HidMsg * msg ) | ||
| 8258 | { | ||
| 8259 | return -1; | ||
| 8260 | } | ||
| 8261 | |||
| 8262 | |||
| 8263 | const char * Joystick_name( int js ) | ||
| 8264 | { | ||
| 8265 | return NULL; | ||
| 8266 | } | ||
| 8267 | |||
| 8268 | int Joystick_axes( int js ) | ||
| 8269 | { | ||
| 8270 | return -1; | ||
| 8271 | } | ||
| 8272 | |||
| 8273 | int Joystick_buttons( int js ) | ||
| 8274 | { | ||
| 8275 | return -1; | ||
| 8276 | } | ||
| 8277 | |||
| 8278 | int Joystick_hats( int js ) | ||
| 8279 | { | ||
| 8280 | return -1; | ||
| 8281 | } | ||
| 8282 | |||
| 8283 | #endif // __PLATFORM_OPENBSD__ | ||
| @@ -390,6 +390,8 @@ done: · 389 unmodified lines | |||
| 390 | /* from http://developer.apple.com/library/mac/#qa/qa1549/_index.html */ | 390 | /* from http://developer.apple.com/library/mac/#qa/qa1549/_index.html */ |
| 391 | #if !defined(__PLATFORM_WIN32__) && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !defined(__CHIP_MODE__) | 391 | #if !defined(__PLATFORM_WIN32__) && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !defined(__CHIP_MODE__) |
| 392 | 392 | ||
| 393 | #if !defined(__PLATFORM_OPENBSD__) | ||
| 394 | |||
| 393 | #include <wordexp.h> | 395 | #include <wordexp.h> |
| 394 | //----------------------------------------------------------------------------- | 396 | //----------------------------------------------------------------------------- |
| 395 | // name: expandTildePath() | 397 | // name: expandTildePath() |
| @@ -418,6 +420,17 @@ std::string expandTildePath( const std::string & path ) · 22 unmodified lines | |||
| 418 | return result; | 420 | return result; |
| 419 | } | 421 | } |
| 420 | 422 | ||
| 423 | #else | ||
| 424 | |||
| 425 | //FIXME | ||
| 426 | std::string expandTildePath( const std::string & path ) | ||
| 427 | { | ||
| 428 | // default is the original path | ||
| 429 | std::string result = path; | ||
| 430 | return result; | ||
| 431 | } | ||
| 432 | #endif | ||
| 433 | |||
| 421 | #include <glob.h> | 434 | #include <glob.h> |
| 422 | //----------------------------------------------------------------------------- | 435 | //----------------------------------------------------------------------------- |
| 423 | // name: globTildePath() | 436 | // name: globTildePath() |
| @@ -67,7 +67,7 @@ XThread::XThread( ) · 66 unmodified lines | |||
| 67 | //----------------------------------------------------------------------------- | 67 | //----------------------------------------------------------------------------- |
| 68 | XThread::~XThread( ) | 68 | XThread::~XThread( ) |
| 69 | { | 69 | { |
| 70 | #if defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) | 70 | #if defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) |
| 71 | // can't self-terminate (much like the Terminator) | 71 | // can't self-terminate (much like the Terminator) |
| 72 | bool is_self_thread = (thread == pthread_self()); | 72 | bool is_self_thread = (thread == pthread_self()); |
| 73 | #elif defined(__PLATFORM_WIN32__) | 73 | #elif defined(__PLATFORM_WIN32__) |
| @@ -79,7 +79,7 @@ XThread::~XThread( ) · 5 unmodified lines | |||
| 79 | if( thread != 0 && !is_self_thread ) | 79 | if( thread != 0 && !is_self_thread ) |
| 80 | { | 80 | { |
| 81 | // TODO: find an alternative for Android? | 81 | // TODO: find an alternative for Android? |
| 82 | #if defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) | 82 | #if defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) |
| 83 | // log | 83 | // log |
| 84 | EM_log( CK_LOG_FINER, "cancelling XThread: %u on thread: %u", (t_CKUINT)thread, (t_CKUINT)pthread_self() ); | 84 | EM_log( CK_LOG_FINER, "cancelling XThread: %u on thread: %u", (t_CKUINT)thread, (t_CKUINT)pthread_self() ); |
| 85 | pthread_cancel(thread); | 85 | pthread_cancel(thread); |
| @@ -103,7 +103,7 @@ bool XThread::start( THREAD_FUNCTION routine, void * ptr ) · 17 unmodified lines | |||
| 103 | { | 103 | { |
| 104 | bool result = false; | 104 | bool result = false; |
| 105 | 105 | ||
| 106 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 106 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 107 | if( pthread_create( &thread, NULL, *routine, ptr ) == 0 ) | 107 | if( pthread_create( &thread, NULL, *routine, ptr ) == 0 ) |
| 108 | result = true; | 108 | result = true; |
| 109 | #elif defined(__PLATFORM_WIN32__) | 109 | #elif defined(__PLATFORM_WIN32__) |
| @@ -126,7 +126,7 @@ bool XThread::wait( long milliseconds, bool cancel ) · 16 unmodified lines | |||
| 126 | bool result = false; | 126 | bool result = false; |
| 127 | 127 | ||
| 128 | // TODO: find an alternative for Android? | 128 | // TODO: find an alternative for Android? |
| 129 | #if( defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) ) | 129 | #if( defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 130 | // cancel the thread? | 130 | // cancel the thread? |
| 131 | if( cancel ) pthread_cancel( thread ); | 131 | if( cancel ) pthread_cancel( thread ); |
| 132 | // wait for the thread to terminate | 132 | // wait for the thread to terminate |
| @@ -156,7 +156,7 @@ bool XThread::wait( long milliseconds, bool cancel ) · 23 unmodified lines | |||
| 156 | void XThread :: test( ) | 156 | void XThread :: test( ) |
| 157 | { | 157 | { |
| 158 | // TODO: find an alternative for Android? | 158 | // TODO: find an alternative for Android? |
| 159 | #if ( defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) ) | 159 | #if ( defined(__PLATFORM_MACOSX__) || ( defined(__PLATFORM_LINUX__) && !defined(__ANDROID__) ) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 160 | pthread_testcancel(); | 160 | pthread_testcancel(); |
| 161 | #endif | 161 | #endif |
| 162 | } | 162 | } |
| @@ -170,7 +170,7 @@ void XThread :: test( ) · 7 unmodified lines | |||
| 170 | //----------------------------------------------------------------------------- | 170 | //----------------------------------------------------------------------------- |
| 171 | XMutex::XMutex( ) | 171 | XMutex::XMutex( ) |
| 172 | { | 172 | { |
| 173 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 173 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 174 | pthread_mutex_init(&mutex, NULL); | 174 | pthread_mutex_init(&mutex, NULL); |
| 175 | #elif defined(__PLATFORM_WIN32__) | 175 | #elif defined(__PLATFORM_WIN32__) |
| 176 | InitializeCriticalSection(&mutex); | 176 | InitializeCriticalSection(&mutex); |
| @@ -186,7 +186,7 @@ XMutex::XMutex( ) · 9 unmodified lines | |||
| 186 | //----------------------------------------------------------------------------- | 186 | //----------------------------------------------------------------------------- |
| 187 | XMutex::~XMutex( ) | 187 | XMutex::~XMutex( ) |
| 188 | { | 188 | { |
| 189 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 189 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 190 | pthread_mutex_destroy( &mutex ); | 190 | pthread_mutex_destroy( &mutex ); |
| 191 | #elif defined(__PLATFORM_WIN32__) | 191 | #elif defined(__PLATFORM_WIN32__) |
| 192 | DeleteCriticalSection(&mutex); | 192 | DeleteCriticalSection(&mutex); |
| @@ -202,7 +202,7 @@ XMutex::~XMutex( ) · 9 unmodified lines | |||
| 202 | //----------------------------------------------------------------------------- | 202 | //----------------------------------------------------------------------------- |
| 203 | void XMutex::acquire( ) | 203 | void XMutex::acquire( ) |
| 204 | { | 204 | { |
| 205 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 205 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 206 | pthread_mutex_lock(&mutex); | 206 | pthread_mutex_lock(&mutex); |
| 207 | #elif defined(__PLATFORM_WIN32__) | 207 | #elif defined(__PLATFORM_WIN32__) |
| 208 | EnterCriticalSection(&mutex); | 208 | EnterCriticalSection(&mutex); |
| @@ -218,7 +218,7 @@ void XMutex::acquire( ) · 9 unmodified lines | |||
| 218 | //----------------------------------------------------------------------------- | 218 | //----------------------------------------------------------------------------- |
| 219 | void XMutex::release( ) | 219 | void XMutex::release( ) |
| 220 | { | 220 | { |
| 221 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 221 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 222 | pthread_mutex_unlock(&mutex); | 222 | pthread_mutex_unlock(&mutex); |
| 223 | #elif defined(__PLATFORM_WIN32__) | 223 | #elif defined(__PLATFORM_WIN32__) |
| 224 | LeaveCriticalSection(&mutex); | 224 | LeaveCriticalSection(&mutex); |
| @@ -416,7 +416,7 @@ void XWriteThread::flush_data_buffer() · 191 unmodified lines | |||
| 416 | // name: write_cb() | 416 | // name: write_cb() |
| 417 | // desc: thread function | 417 | // desc: thread function |
| 418 | //----------------------------------------------------------------------------- | 418 | //----------------------------------------------------------------------------- |
| 419 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 419 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 420 | void * XWriteThread::write_cb(void * _thiss) | 420 | void * XWriteThread::write_cb(void * _thiss) |
| 421 | #elif defined(__PLATFORM_WIN32__) | 421 | #elif defined(__PLATFORM_WIN32__) |
| 422 | unsigned XWriteThread::write_cb(void * _thiss) | 422 | unsigned XWriteThread::write_cb(void * _thiss) |
| @@ -43,7 +43,7 @@ class FastCircularBuffer; · 42 unmodified lines | |||
| 43 | template<typename T> class CircularBuffer; | 43 | template<typename T> class CircularBuffer; |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 46 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__PLATFORM_OPENBSD__) || defined(__WINDOWS_PTHREAD__) ) |
| 47 | #include <pthread.h> | 47 | #include <pthread.h> |
| 48 | #define THREAD_TYPE | 48 | #define THREAD_TYPE |
| 49 | typedef pthread_t THREAD_HANDLE; | 49 | typedef pthread_t THREAD_HANDLE; |
| @@ -181,7 +181,7 @@ private: · 131 unmodified lines | |||
| 181 | void flush_data_buffer(); | 181 | void flush_data_buffer(); |
| 182 | 182 | ||
| 183 | // callback | 183 | // callback |
| 184 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) ) | 184 | #if ( defined(__PLATFORM_MACOSX__) || defined(__PLATFORM_LINUX__) || defined(__WINDOWS_PTHREAD__) || defined(__PLATFORM_OPENBSD__) ) |
| 185 | static void * write_cb( void * _thiss ); | 185 | static void * write_cb( void * _thiss ); |
| 186 | #elif defined(__PLATFORM_WIN32__) | 186 | #elif defined(__PLATFORM_WIN32__) |
| 187 | static unsigned THREAD_TYPE write_cb( void * _thiss ); | 187 | static unsigned THREAD_TYPE write_cb( void * _thiss ); |
| @@ -171,6 +171,9 @@ public: · 170 unmodified lines | |||
| 171 | { m_extern_in = in; m_extern_out = out; } | 171 | { m_extern_in = in; m_extern_out = out; } |
| 172 | static int cb( void * output_buffer, void * input_buffer, unsigned int buffer_size, | 172 | static int cb( void * output_buffer, void * input_buffer, unsigned int buffer_size, |
| 173 | double streamTime, RtAudioStreamStatus status, void * user_data ); | 173 | double streamTime, RtAudioStreamStatus status, void * user_data ); |
| 174 | #ifdef __OPENBSD_OPENAL__ | ||
| 175 | static int alcb(void *userptr, void *output_buffer, int len); | ||
| 176 | #endif | ||
| 174 | 177 | ||
| 175 | public: // data | 178 | public: // data |
| 176 | static t_CKBOOL m_init; | 179 | static t_CKBOOL m_init; |
| @@ -0,0 +1,430 @@ | |||
| 1 | /*---------------------------------------------------------------------------- | ||
| 2 | ChucK Concurrent, On-the-fly Audio Programming Language | ||
| 3 | Compiler and Virtual Machine | ||
| 4 | |||
| 5 | Copyright (c) 2004 Ge Wang and Perry R. Cook. All rights reserved. | ||
| 6 | http://chuck.stanford.edu/ | ||
| 7 | http://chuck.cs.princeton.edu/ | ||
| 8 | |||
| 9 | This program is free software; you can redistribute it and/or modify | ||
| 10 | it under the terms of the GNU General Public License as published by | ||
| 11 | the Free Software Foundation; either version 2 of the License, or | ||
| 12 | (at your option) any later version. | ||
| 13 | |||
| 14 | This program is distributed in the hope that it will be useful, | ||
| 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | GNU General Public License for more details. | ||
| 18 | |||
| 19 | You should have received a copy of the GNU General Public License | ||
| 20 | along with this program; if not, write to the Free Software | ||
| 21 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
| 22 | U.S.A. | ||
| 23 | -----------------------------------------------------------------------------*/ | ||
| 24 | |||
| 25 | #include "chuck_audio.h" | ||
| 26 | #include "chuck_errmsg.h" | ||
| 27 | #include "util_thread.h" | ||
| 28 | #include <unistd.h> | ||
| 29 | #include <al.h> | ||
| 30 | #include <alc.h> | ||
| 31 | #define AL_ALEXT_PROTOTYPES | ||
| 32 | #include <alext.h> | ||
| 33 | |||
| 34 | // sample | ||
| 35 | #if defined(__CHUCK_USE_64_BIT_SAMPLE__) | ||
| 36 | #define AUDIO_FORMAT AL_FORMAT_STEREO_DOUBLE_EXT | ||
| 37 | #else | ||
| 38 | #define AUDIO_FORMAT AL_FORMAT_STEREO_FLOAT32 | ||
| 39 | #endif | ||
| 40 | |||
| 41 | // real-time watch dog | ||
| 42 | t_CKBOOL g_do_watchdog = FALSE; | ||
| 43 | // countermeasure | ||
| 44 | #ifdef __MACOSX_CORE__ | ||
| 45 | t_CKUINT g_watchdog_countermeasure_priority = 10; | ||
| 46 | #elif defined(__PLATFORM_WIN32__) && !defined(__WINDOWS_PTHREAD__) | ||
| 47 | t_CKUINT g_watchdog_countermeasure_priority = THREAD_PRIORITY_LOWEST; | ||
| 48 | #else | ||
| 49 | t_CKUINT g_watchdog_countermeasure_priority = 0; | ||
| 50 | #endif | ||
| 51 | // watchdog timeout | ||
| 52 | t_CKFLOAT g_watchdog_timeout = 0.5; | ||
| 53 | |||
| 54 | // static initialization | ||
| 55 | t_CKBOOL ChuckAudio::m_init = FALSE; | ||
| 56 | t_CKBOOL ChuckAudio::m_start = FALSE; | ||
| 57 | t_CKBOOL ChuckAudio::m_go = FALSE; | ||
| 58 | t_CKBOOL ChuckAudio::m_silent = FALSE; | ||
| 59 | t_CKBOOL ChuckAudio::m_expand_in_mono2stereo= FALSE; | ||
| 60 | t_CKUINT ChuckAudio::m_num_channels_out = NUM_CHANNELS_DEFAULT; | ||
| 61 | t_CKUINT ChuckAudio::m_num_channels_in = NUM_CHANNELS_DEFAULT; | ||
| 62 | t_CKUINT ChuckAudio::m_num_channels_max = NUM_CHANNELS_DEFAULT; | ||
| 63 | t_CKUINT ChuckAudio::m_sample_rate = SAMPLE_RATE_DEFAULT; | ||
| 64 | t_CKUINT ChuckAudio::m_buffer_size = BUFFER_SIZE_DEFAULT; | ||
| 65 | t_CKUINT ChuckAudio::m_num_buffers = NUM_BUFFERS_DEFAULT; | ||
| 66 | SAMPLE * ChuckAudio::m_buffer_out = NULL; | ||
| 67 | SAMPLE * ChuckAudio::m_buffer_in = NULL; | ||
| 68 | SAMPLE * ChuckAudio::m_extern_in = NULL; | ||
| 69 | SAMPLE * ChuckAudio::m_extern_out = NULL; | ||
| 70 | t_CKUINT ChuckAudio::m_dac_n = 0; | ||
| 71 | t_CKUINT ChuckAudio::m_adc_n = 0; | ||
| 72 | f_audio_cb ChuckAudio::m_audio_cb = NULL; | ||
| 73 | void * ChuckAudio::m_cb_user_data = NULL; | ||
| 74 | |||
| 75 | static ALCdevice *aldev = NULL; | ||
| 76 | static ALCcontext *alc = NULL; | ||
| 77 | static ALuint albuf; | ||
| 78 | static ALuint alsrc; | ||
| 79 | static pthread_t althread; | ||
| 80 | |||
| 81 | void ChuckAudio::probe() | ||
| 82 | { | ||
| 83 | } | ||
| 84 | |||
| 85 | t_CKINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac, | ||
| 86 | t_CKBOOL needs_adc ) | ||
| 87 | { | ||
| 88 | if(needs_adc || !needs_dac) | ||
| 89 | return -1; | ||
| 90 | const char *dev = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); | ||
| 91 | if(dev == NULL) | ||
| 92 | return -1; | ||
| 93 | const char *s = dev; | ||
| 94 | for(int i = 1; *s; i++){ | ||
| 95 | if(strcmp(s, name.c_str()) == 0) | ||
| 96 | return i; | ||
| 97 | s += strlen(s) + 1; | ||
| 98 | } | ||
| 99 | |||
| 100 | for(int i = 1; *s; i++){ | ||
| 101 | if(strncmp(s, name.c_str(), name.length()) == 0) | ||
| 102 | return i; | ||
| 103 | s += strlen(s) + 1; | ||
| 104 | } | ||
| 105 | |||
| 106 | return -1; | ||
| 107 | } | ||
| 108 | |||
| 109 | static t_CKFLOAT get_current_time( t_CKBOOL fresh = TRUE ) | ||
| 110 | { | ||
| 111 | #ifdef __PLATFORM_WIN32__ | ||
| 112 | struct _timeb t; | ||
| 113 | _ftime(&t); | ||
| 114 | return t.time + t.millitm/1000.0; | ||
| 115 | #else | ||
| 116 | static struct timeval t; | ||
| 117 | if( fresh ) gettimeofday(&t,NULL); | ||
| 118 | return t.tv_sec + (t_CKFLOAT)t.tv_usec/1000000; | ||
| 119 | #endif | ||
| 120 | } | ||
| 121 | |||
| 122 | // watch dog globals | ||
| 123 | static CHUCK_THREAD g_tid_synthesis = 0; | ||
| 124 | static XThread * g_watchdog_thread = NULL; | ||
| 125 | static t_CKBOOL g_watchdog_state = FALSE; | ||
| 126 | static t_CKFLOAT g_watchdog_time = 0; | ||
| 127 | |||
| 128 | #if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__) | ||
| 129 | static void * watch_dog( void * ) | ||
| 130 | #else | ||
| 131 | static unsigned int __stdcall watch_dog( void * ) | ||
| 132 | #endif | ||
| 133 | { | ||
| 134 | // time | ||
| 135 | t_CKFLOAT time = 0; | ||
| 136 | |||
| 137 | // boost priority? | ||
| 138 | t_CKUINT priority = XThreadUtil::our_priority; | ||
| 139 | |||
| 140 | // log | ||
| 141 | EM_log( CK_LOG_SEVERE, "starting real-time watch dog process..." ); | ||
| 142 | // push log | ||
| 143 | EM_pushlog(); | ||
| 144 | EM_log( CK_LOG_INFO, "watchdog timeout: %f::second", g_watchdog_timeout ); | ||
| 145 | EM_log( CK_LOG_INFO, "watchdog thread priority: %d", priority ); | ||
| 146 | EM_log( CK_LOG_INFO, "watchdog countermeasure priority: %d", g_watchdog_countermeasure_priority ); | ||
| 147 | // pop log | ||
| 148 | EM_poplog(); | ||
| 149 | |||
| 150 | // boost watchdog by same priority | ||
| 151 | if( XThreadUtil::our_priority != 0x7fffffff ) | ||
| 152 | XThreadUtil::set_priority( priority ); | ||
| 153 | |||
| 154 | // while going | ||
| 155 | while( g_do_watchdog ) | ||
| 156 | { | ||
| 157 | // get | ||
| 158 | time = get_current_time( TRUE ); | ||
| 159 | // CK_FPRINTF_STDERR( "last: %f now: %f\n", g_watchdog_time, time ); | ||
| 160 | |||
| 161 | // resting | ||
| 162 | if( g_watchdog_state == FALSE ) | ||
| 163 | { | ||
| 164 | // check time vs timeout | ||
| 165 | if( time - g_watchdog_time > g_watchdog_timeout ) | ||
| 166 | { | ||
| 167 | // log | ||
| 168 | EM_log( CK_LOG_SEVERE, "real-time watchdog counter-measure activating..." ); | ||
| 169 | // lowering priority | ||
| 170 | if( g_tid_synthesis && XThreadUtil::our_priority != 0x7fffffff ) | ||
| 171 | XThreadUtil::set_priority( g_tid_synthesis, g_watchdog_countermeasure_priority ); | ||
| 172 | // set state | ||
| 173 | g_watchdog_state = TRUE; | ||
| 174 | } | ||
| 175 | } | ||
| 176 | else | ||
| 177 | { | ||
| 178 | // check time vs timeout | ||
| 179 | if( time - g_watchdog_time < g_watchdog_timeout ) | ||
| 180 | { | ||
| 181 | // log | ||
| 182 | EM_log( CK_LOG_SEVERE, "real-time watchdog resting..." ); | ||
| 183 | // raise priority | ||
| 184 | if( g_tid_synthesis && XThreadUtil::our_priority != 0x7fffffff ) | ||
| 185 | XThreadUtil::set_priority( g_tid_synthesis, XThreadUtil::our_priority ); | ||
| 186 | // set state | ||
| 187 | g_watchdog_state = FALSE; | ||
| 188 | } | ||
| 189 | } | ||
| 190 | |||
| 191 | // advance time | ||
| 192 | usleep( 40000 ); | ||
| 193 | } | ||
| 194 | |||
| 195 | // log | ||
| 196 | EM_log( CK_LOG_SEVERE, "stopping real-time watch dog process..." ); | ||
| 197 | |||
| 198 | return 0; | ||
| 199 | } | ||
| 200 | |||
| 201 | t_CKBOOL ChuckAudio::watchdog_start() | ||
| 202 | { | ||
| 203 | // already | ||
| 204 | if( g_watchdog_thread ) | ||
| 205 | return FALSE; | ||
| 206 | |||
| 207 | // flag | ||
| 208 | g_do_watchdog = TRUE; | ||
| 209 | // allocate it | ||
| 210 | g_watchdog_thread = new XThread; | ||
| 211 | // start it | ||
| 212 | g_watchdog_thread->start( watch_dog, NULL ); | ||
| 213 | |||
| 214 | return TRUE; | ||
| 215 | } | ||
| 216 | |||
| 217 | t_CKBOOL ChuckAudio::watchdog_stop() | ||
| 218 | { | ||
| 219 | // already | ||
| 220 | if( !g_watchdog_thread ) | ||
| 221 | return FALSE; | ||
| 222 | |||
| 223 | // stop things | ||
| 224 | g_do_watchdog = FALSE; | ||
| 225 | // wait a bit | TODO: is this needed? | ||
| 226 | usleep( 100000 ); | ||
| 227 | // delete watchdog thread | TODO: is this safe? | ||
| 228 | SAFE_DELETE( g_watchdog_thread ); | ||
| 229 | |||
| 230 | return TRUE; | ||
| 231 | } | ||
| 232 | |||
| 233 | ALsizei ChuckAudio::alcb(ALvoid *userptr, ALvoid *output_buffer, ALsizei len) | ||
| 234 | { | ||
| 235 | // priority boost | ||
| 236 | if( !m_go && XThreadUtil::our_priority != 0x7fffffff ) | ||
| 237 | { | ||
| 238 | #if !defined(__PLATFORM_WIN32__) || defined(__WINDOWS_PTHREAD__) | ||
| 239 | g_tid_synthesis = pthread_self(); | ||
| 240 | #else | ||
| 241 | // must duplicate for handle to be usable by other threads | ||
| 242 | g_tid_synthesis = NULL; | ||
| 243 | DuplicateHandle( | ||
| 244 | GetCurrentProcess(), | ||
| 245 | GetCurrentThread(), | ||
| 246 | GetCurrentProcess(), | ||
| 247 | &g_tid_synthesis, | ||
| 248 | 0, | ||
| 249 | FALSE, | ||
| 250 | DUPLICATE_SAME_ACCESS | ||
| 251 | ); | ||
| 252 | |||
| 253 | // TODO: close the duplicate handle? | ||
| 254 | #endif | ||
| 255 | XThreadUtil::set_priority( XThreadUtil::our_priority ); | ||
| 256 | memset( output_buffer, 0, len ); | ||
| 257 | m_go = TRUE; | ||
| 258 | |||
| 259 | // start watchdog | ||
| 260 | if( g_do_watchdog ) | ||
| 261 | { | ||
| 262 | // timestamp | ||
| 263 | g_watchdog_time = get_current_time( TRUE ); | ||
| 264 | // start watchdog | ||
| 265 | watchdog_start(); | ||
| 266 | } | ||
| 267 | |||
| 268 | // let it go the first time | ||
| 269 | return len; | ||
| 270 | } | ||
| 271 | |||
| 272 | // timestamp | ||
| 273 | if( g_do_watchdog ) g_watchdog_time = get_current_time( TRUE ); | ||
| 274 | // call the audio cb | ||
| 275 | m_audio_cb( m_buffer_in, m_buffer_out, len/(sizeof(SAMPLE) * m_num_channels_out), | ||
| 276 | m_num_channels_in, m_num_channels_out, m_cb_user_data ); | ||
| 277 | |||
| 278 | // copy local buffer to be rendered | ||
| 279 | // REFACTOR-2017: TODO: m_end was the signal to end, what should it be now? | ||
| 280 | if( m_start ) // REFACTOR-2017: now using m_start to gate this | ||
| 281 | { | ||
| 282 | memcpy( output_buffer, m_buffer_out, len ); | ||
| 283 | } | ||
| 284 | // set all elements of local buffer to silence | ||
| 285 | else | ||
| 286 | { | ||
| 287 | memset( output_buffer, 0, len ); | ||
| 288 | } | ||
| 289 | |||
| 290 | // copy to extern | ||
| 291 | if( m_extern_out ) memcpy( m_extern_out, output_buffer, len ); | ||
| 292 | |||
| 293 | return len; | ||
| 294 | } | ||
| 295 | |||
| 296 | |||
| 297 | t_CKBOOL ChuckAudio::initialize( t_CKUINT num_dac_channels, | ||
| 298 | t_CKUINT num_adc_channels, | ||
| 299 | t_CKUINT sample_rate, | ||
| 300 | t_CKUINT buffer_size, | ||
| 301 | t_CKUINT num_buffers, | ||
| 302 | f_audio_cb callback, | ||
| 303 | void * data, | ||
| 304 | t_CKBOOL force_srate ) | ||
| 305 | { | ||
| 306 | if( m_init ) | ||
| 307 | return FALSE; | ||
| 308 | |||
| 309 | m_num_channels_out = num_dac_channels; | ||
| 310 | m_num_channels_in = num_adc_channels; | ||
| 311 | m_sample_rate = sample_rate; | ||
| 312 | m_buffer_size = buffer_size; | ||
| 313 | m_num_buffers = num_buffers; | ||
| 314 | m_start = 0; | ||
| 315 | m_go = 0; | ||
| 316 | m_silent = 0; | ||
| 317 | |||
| 318 | // remember callback | ||
| 319 | m_audio_cb = callback; | ||
| 320 | // remember user data to pass to callback | ||
| 321 | m_cb_user_data = data; | ||
| 322 | |||
| 323 | // variable to pass by reference into OpenAL | ||
| 324 | unsigned int bufsize = (unsigned int)m_buffer_size; | ||
| 325 | |||
| 326 | // log | ||
| 327 | EM_log( CK_LOG_FINE, "initializing OpenAL..." ); | ||
| 328 | // push indent | ||
| 329 | EM_pushlog(); | ||
| 330 | |||
| 331 | const char *dev = NULL; | ||
| 332 | if(m_dac_n > 0){ | ||
| 333 | const char *s = alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); | ||
| 334 | for(int i = 1; *s; i++){ | ||
| 335 | if(i == m_dac_n){ | ||
| 336 | dev = s; | ||
| 337 | break; | ||
| 338 | } | ||
| 339 | s += strlen(s) + 1; | ||
| 340 | } | ||
| 341 | } | ||
| 342 | |||
| 343 | const ALCint attrlist[] = {ALC_FREQUENCY, (ALCint)sample_rate, 0, 0}; | ||
| 344 | |||
| 345 | althread = pthread_self(); | ||
| 346 | if((aldev = alcOpenDevice(dev)) == NULL) | ||
| 347 | goto error; | ||
| 348 | if((alc = alcCreateContext(aldev, attrlist)) == NULL) | ||
| 349 | goto error; | ||
| 350 | alcMakeContextCurrent(alc); | ||
| 351 | |||
| 352 | alGenSources(1, &alsrc); | ||
| 353 | alGenBuffers(1, &albuf); | ||
| 354 | alBufferCallbackSOFT(albuf, AUDIO_FORMAT, sample_rate, alcb, NULL); | ||
| 355 | alSourcei(alsrc, AL_SOURCE_SPATIALIZE_SOFT, AL_FALSE); | ||
| 356 | alSourcei(alsrc, AL_BUFFER, albuf); | ||
| 357 | alSourcePlay(alsrc); | ||
| 358 | |||
| 359 | // pop indent | ||
| 360 | EM_poplog(); | ||
| 361 | |||
| 362 | // allocate buffers | ||
| 363 | m_buffer_in = new SAMPLE[m_buffer_size * m_num_channels_max]; | ||
| 364 | m_buffer_out = new SAMPLE[m_buffer_size * m_num_channels_max]; | ||
| 365 | memset( m_buffer_in, 0, m_buffer_size * sizeof(SAMPLE) * m_num_channels_max ); | ||
| 366 | memset( m_buffer_out, 0, m_buffer_size * sizeof(SAMPLE) * m_num_channels_max ); | ||
| 367 | |||
| 368 | // set flag and return | ||
| 369 | return m_init = TRUE; | ||
| 370 | |||
| 371 | // handle common error case (added 1.4.1.0) | ||
| 372 | error: | ||
| 373 | if(alc != NULL){ | ||
| 374 | alcDestroyContext(alc); | ||
| 375 | alc = NULL; | ||
| 376 | } | ||
| 377 | if(aldev != NULL){ | ||
| 378 | alcCloseDevice(aldev); | ||
| 379 | aldev = NULL; | ||
| 380 | } | ||
| 381 | // pop log indent (added 1.4.1.0) | ||
| 382 | EM_poplog(); | ||
| 383 | // set flag and return | ||
| 384 | return m_init = FALSE; | ||
| 385 | } | ||
| 386 | |||
| 387 | t_CKBOOL ChuckAudio::start( ) | ||
| 388 | { | ||
| 389 | if( !m_start ) | ||
| 390 | alcDeviceResumeSOFT(aldev); | ||
| 391 | m_start = TRUE; | ||
| 392 | |||
| 393 | return m_start; | ||
| 394 | } | ||
| 395 | |||
| 396 | t_CKBOOL ChuckAudio::stop( ) | ||
| 397 | { | ||
| 398 | if( m_start ) | ||
| 399 | alcDevicePauseSOFT(aldev); | ||
| 400 | m_start = FALSE; | ||
| 401 | |||
| 402 | // REFACTOR-2017: set end flag | ||
| 403 | m_silent = TRUE; | ||
| 404 | |||
| 405 | return !m_start; | ||
| 406 | } | ||
| 407 | |||
| 408 | void ChuckAudio::shutdown() | ||
| 409 | { | ||
| 410 | // check flag | ||
| 411 | if( !m_init ) return; | ||
| 412 | |||
| 413 | // stop watchdog | REFACTOR-2017: moved this earlier to give watchdog | ||
| 414 | // a head start in stopping, to avoid unneeded countermeasure deployment | ||
| 415 | watchdog_stop(); | ||
| 416 | |||
| 417 | if(althread == pthread_self() && alc != NULL){ | ||
| 418 | alSourceStop(alsrc); | ||
| 419 | alDeleteSources(1, &alsrc); | ||
| 420 | alDeleteBuffers(1, &albuf); | ||
| 421 | alcDestroyContext(alc); | ||
| 422 | alc = NULL; | ||
| 423 | alcCloseDevice(aldev); | ||
| 424 | aldev = NULL; | ||
| 425 | } | ||
| 426 | |||
| 427 | // unflag | ||
| 428 | m_init = FALSE; | ||
| 429 | m_start = FALSE; | ||
| 430 | } | ||
| @@ -9,7 +9,7 @@ CK_VERSION=1.5.0.4-dev · 8 unmodified lines | |||
| 9 | current: | 9 | current: |
| 10 | @echo "[chuck build]: please use the following configurations:" | 10 | @echo "[chuck build]: please use the following configurations:" |
| 11 | @echo " make linux-alsa, make linux-jack, make linux-pulse, linux-all," | 11 | @echo " make linux-alsa, make linux-jack, make linux-pulse, linux-all," |
| 12 | @echo " make mac, make mac-ub, make web, make cygwin, make win32" | 12 | @echo " make openbsd-openal, make mac, make mac-ub, make web, make cygwin, make win32" |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | ############################## MAKE INSTALL #################################### | 15 | ############################## MAKE INSTALL #################################### |
| @@ -75,7 +75,7 @@ host_web/webchuck/js/webchuck.js: $(EMSCRIPTENSRCS) · 59 unmodified lines | |||
| 75 | ## > make linux-pulse linux-alsa linux-jack | 75 | ## > make linux-pulse linux-alsa linux-jack |
| 76 | 76 | ||
| 77 | .PHONY: mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl test | 77 | .PHONY: mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl test |
| 78 | mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl: chuck | 78 | mac mac-ub osx linux-all linux linux-pulse linux-jack linux-alsa cygwin osx-rl openbsd-openal: chuck |
| 79 | 79 | ||
| 80 | win32: | 80 | win32: |
| 81 | make -f $(COREDIR)/makefile.x/makefile.win32 | 81 | make -f $(COREDIR)/makefile.x/makefile.win32 |
| @@ -84,9 +84,9 @@ win32: · 2 unmodified lines | |||
| 84 | ########################### COMPILATION TOOLS ################################## | 84 | ########################### COMPILATION TOOLS ################################## |
| 85 | LEX=flex | 85 | LEX=flex |
| 86 | YACC=bison | 86 | YACC=bison |
| 87 | CC=gcc | 87 | CC?=gcc |
| 88 | CXX=g++ | 88 | CXX?=g++ |
| 89 | LD=g++ | 89 | LD?=g++ |
| 90 | 90 | ||
| 91 | 91 | ||
| 92 | ############################# COMPILER FLAGS ################################### | 92 | ############################# COMPILER FLAGS ################################### |
| @@ -142,6 +142,10 @@ ifneq (,$(strip $(filter linux-alsa,$(MAKECMDGOALS)))) · 49 unmodified lines | |||
| 142 | include $(COREDIR)/makefile.x/makefile.alsa | 142 | include $(COREDIR)/makefile.x/makefile.alsa |
| 143 | endif | 143 | endif |
| 144 | 144 | ||
| 145 | ifneq (,$(strip $(filter openbsd-openal,$(MAKECMDGOALS)))) | ||
| 146 | include $(COREDIR)/makefile.x/makefile.openal | ||
| 147 | endif | ||
| 148 | |||
| 145 | ifneq (,$(strip $(filter cygwin,$(MAKECMDGOALS)))) | 149 | ifneq (,$(strip $(filter cygwin,$(MAKECMDGOALS)))) |
| 146 | include $(COREDIR)/makefile.x/makefile.cygwin | 150 | include $(COREDIR)/makefile.x/makefile.cygwin |
| 147 | endif | 151 | endif |
| @@ -170,12 +174,17 @@ LO_COBJS_CORE+= lo/address.o lo/blob.o lo/bundle.o lo/message.o lo/method.o \ · 22 unmodified lines | |||
| 170 | 174 | ||
| 171 | 175 | ||
| 172 | ############################ CHUCK HOST TARGETS ################################ | 176 | ############################ CHUCK HOST TARGETS ################################ |
| 177 | ifneq (,$(strip $(filter openbsd-openal,$(MAKECMDGOALS)))) | ||
| 178 | CXXSRCS_HOST+= chuck_audio_openal.cpp | ||
| 179 | else | ||
| 173 | CXXINC_HOST+= -I${RTAUDIODIR} -I${RTAUDIODIR}/include | 180 | CXXINC_HOST+= -I${RTAUDIODIR} -I${RTAUDIODIR}/include |
| 174 | CXXSRCS_HOST+= chuck_main.cpp chuck_audio.cpp chuck_console.cpp \ | 181 | CXXSRCS_HOST+= chuck_audio.cpp ${RTAUDIODIR}/RtAudio.cpp |
| 175 | ${RTAUDIODIR}/RtAudio.cpp | 182 | endif |
| 176 | # NB: on some windows builds, the ASIO src in RTAUDIODIR/include | 183 | # NB: on some windows builds, the ASIO src in RTAUDIODIR/include |
| 177 | # should be added. | 184 | # should be added. |
| 178 | 185 | ||
| 186 | CXXSRCS_HOST+= chuck_console.cpp chuck_main.cpp | ||
| 187 | |||
| 179 | 188 | ||
| 180 | ############################ OBJECT FILE TARGETS ############################### | 189 | ############################ OBJECT FILE TARGETS ############################### |
| 181 | CXXOBJS_HOST=$(addprefix $(HOSTDIR)/,$(CXXSRCS_HOST:.cpp=.o)) | 190 | CXXOBJS_HOST=$(addprefix $(HOSTDIR)/,$(CXXSRCS_HOST:.cpp=.o)) |