diff options
Diffstat (limited to 'main')
| -rw-r--r-- | main/CMakeLists.txt | 32 | ||||
| -rw-r--r-- | main/MrsWatsonMain.c | 70 | ||||
| -rw-r--r-- | main/NOTES | 101 | ||||
| -rw-r--r-- | main/cmd | 1 | ||||
| -rwxr-xr-x | main/endian_test | bin | 0 -> 8496 bytes | |||
| -rw-r--r-- | main/endian_test.c | 11 | ||||
| -rwxr-xr-x | main/example.fxp | bin | 0 -> 187581 bytes | |||
| -rw-r--r-- | main/example.mid | bin | 0 -> 261 bytes | |||
| -rwxr-xr-x | main/example.mid.old | bin | 0 -> 21504 bytes | |||
| -rwxr-xr-x | main/example_1.mid | bin | 0 -> 2162 bytes | |||
| -rwxr-xr-x | main/mrswatson | bin | 0 -> 158220 bytes | |||
| -rwxr-xr-x | main/mrswatson64 | bin | 0 -> 151764 bytes | |||
| -rw-r--r-- | main/mytest.bash | 1 | ||||
| -rw-r--r-- | main/new_example.bash | 2 | ||||
| -rw-r--r-- | main/rebuild.bash | 3 |
15 files changed, 221 insertions, 0 deletions
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000..bbcfa35 --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,32 @@ +cmake_minimum_required(VERSION 2.6) +project(MrsWatsonMain) + +include(${cmake_SCRIPTS_DIR}/ConfigureTarget.cmake) + +set(mrswatsonmain_SOURCES MrsWatsonMain.c) +set(mrswatsonmain_LIBS mrswatsoncore) +set(mrswatsonmain_64_LIBS mrswatsoncore64) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + set(mrswatsonmain_LIBS ${mrswatsonmain_LIBS} dl) + set(mrswatsonmain_64_LIBS ${mrswatsonmain_64_LIBS} dl) +endif() + +if(WITH_AUDIOFILE) + set(mrswatsonmain_LIBS ${mrswatsonmain_LIBS} audiofile) + set(mrswatsonmain_64_LIBS ${mrswatsonmain_64_LIBS} audiofile64) + + if(WITH_FLAC) + set(mrswatsonmain_LIBS ${mrswatsonmain_LIBS} flac) + set(mrswatsonmain_64_LIBS ${mrswatsonmain_64_LIBS} flac64) + endif() +endif() + +# Main executable target and associated libraries +add_executable(mrswatson ${mrswatsonmain_SOURCES}) +target_link_libraries(mrswatson ${mrswatsonmain_LIBS}) +add_executable(mrswatson64 ${mrswatsonmain_SOURCES}) +target_link_libraries(mrswatson64 ${mrswatsonmain_64_LIBS}) + +configure_target(mrswatson 32) +configure_target(mrswatson64 64) diff --git a/main/MrsWatsonMain.c b/main/MrsWatsonMain.c new file mode 100644 index 0000000..71063ee --- /dev/null +++ b/main/MrsWatsonMain.c @@ -0,0 +1,70 @@ +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> + +#include "MrsWatson.h" +#include "logging/ErrorReporter.h" +#include "logging/EventLogger.h" + +// This must be global so that in case of a crash or signal, we can still generate +// a complete error report with a reference +static ErrorReporter gErrorReporter = NULL; + +static void handleSignal(int signum) +{ + logCritical("Sent signal %d, exiting", signum); + + if (gErrorReporter != NULL && gErrorReporter->started) { + errorReporterClose(gErrorReporter); + } else { + logPossibleBug("MrsWatson (or one of its hosted plugins) has encountered a serious error and crashed."); + } + + exit(RETURN_CODE_SIGNAL + signum); +} + +int main(int argc, char *argv[]) +{ + gErrorReporter = newErrorReporter(); + + // Set up signal handling only after logging is initialized. If we crash before + // here, something is seriously wrong. +#ifdef SIGHUP + signal(SIGHUP, handleSignal); +#endif +#ifdef SIGINT + signal(SIGINT, handleSignal); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, handleSignal); +#endif +#ifdef SIGILL + signal(SIGILL, handleSignal); +#endif +#ifdef SIGABRT + signal(SIGABRT, handleSignal); +#endif +#ifdef SIGFPE + signal(SIGFPE, handleSignal); +#endif +#ifdef SIGKILL + signal(SIGKILL, handleSignal); +#endif +#ifdef SIGBUS + signal(SIGBUS, handleSignal); +#endif +#ifdef SIGSEGV + signal(SIGSEGV, handleSignal); +#endif +#ifdef SIGSYS + signal(SIGSYS, handleSignal); +#endif +#ifdef SIGPIPE + signal(SIGPIPE, handleSignal); +#endif +#ifdef SIGTERM + signal(SIGTERM, handleSignal); +#endif + + return mrsWatsonMain(gErrorReporter, argc, argv); +} diff --git a/main/NOTES b/main/NOTES new file mode 100644 index 0000000..7a62491 --- /dev/null +++ b/main/NOTES @@ -0,0 +1,101 @@ + +0000000: 5249 4646 2848 4a02 5741 5645 666d 7420 RIFF(HJ.WAVEfmt +0000010: 1400 0000 0100 0200 44ac 0000 10b1 0200 ........D....... +0000020: 0400 1000 0000 0000 6461 7461 0048 4a02 ........data.HJ. +0000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ + +0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ + + + + +//ok good +0000000: 5249 4646 2848 4a02 5741 5645 666d 7420 RIFF(HJ.WAVEfmt +0000010: 1400 0000 0100 0200 44ac 0000 10b1 0200 ........D....... +0000020: 0400 1000 0000 0000 6461 7461 0048 4a02 ........data.HJ. +0000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ + + + + + +$ cat /tmp/test2.wav | xxd | head +0000000: 5249 4646 2470 db01 5741 5645 666d 7420 RIFF$p..WAVEfmt +0000010: 1000 0000 0100 0200 44ac 0000 10b1 0200 ........D....│·· +0000020: 0400 1000 6461 7461 0070 db01 0000 0000 ....data.p...│·· +0000030: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000040: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000050: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000060: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000070: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000080: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +ok well the last thing that needs to be done with mrswatson, I need some sort of way to pass tempo on the commandline. for some reason, there is +a commandline argument for it, but it doesn't seem to work? we had to hardcode tempo, if you remember +seems like it should be easy to fix yeah just change hardcoded value with value from cli variable it already have let's take a look at it? sure + +https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ +5249 4646 2470 db01 5741 5645 # riff , size, wav +666d 7420 # fmt +1000 0000 # chunck1 size +0100 0200 # PCM, 2 ch +44ac 0000 # Sample rate. so wee that in original wav it's 00 00 0000. yeah also + +it's 1000 0000 vs 1400 0000 +4 is tbytes longer htoo, yeah it is... + +kww +ok +5249 4646 === "RIFF" +2870 db01 === size of whole file + +but in the second one +2470 db01 is the size of the whole file...is that an error do you think? could be but it's looks like 4 bytes short only well +docs say: +This is the size of the +entire file in bytes minus 8 bytes for the +two fields not included in this count: +ChunkID and ChunkSize. +almost like he forgot to subtract one of them? y or subtracted too many...not sureep, can fiix that too. ok +should it all be in this function in the code we were looking at? yep. ok I'll try to fix it I guess hoping I'm not going +to get confused about subtracting binary or something, are the lengths we're dealing with here all integers/decimals? yes +so it should be easy? yep + + +yeah thanks, slow connection can't find anything + + + +bash-3.2$ cat test1419968848.wav | xxd | head +0000000: 5249 4646 2870 db01 5741 5645 666d 7420 RIFF(p..WAVEfmt +0000010: 1400 0000 0100 0200 0000 0000 10b1 0200 ............. +0000020: 0400 1000 0000 0000 6461 7461 0070 db01 ........data.p.. +0000030: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000040: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000050: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000060: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000070: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000080: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +0000090: 0000 0000 0000 0000 0000 0000 0000 0000 .............│·· +bash-3.2$ cat test142*.wav | xxd | head +0000000: 5249 4646 2870 db01 5741 5645 666d 7420 RIFF(p..WAVEfmt +0000010: 1400 0000 0100 0200 44ac 0000 10b1 0200 ........D....... +0000020: 0400 1000 0000 0000 6461 7461 0070 db01 ........data.p.. +0000030: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000040: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000050: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000060: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000070: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000080: 0000 0000 0000 0000 0000 0000 0000 0000 ................ +0000090: 0000 0000 0000 0000 0000 0000 0000 0000 ................ diff --git a/main/cmd b/main/cmd new file mode 100644 index 0000000..2471520 --- /dev/null +++ b/main/cmd @@ -0,0 +1 @@ +./mrswatson --plugin 'Omnisphere,example.fxp' -m example.mid -o /tmp/test.wav diff --git a/main/endian_test b/main/endian_test Binary files differnew file mode 100755 index 0000000..3791421 --- /dev/null +++ b/main/endian_test diff --git a/main/endian_test.c b/main/endian_test.c new file mode 100644 index 0000000..3e831dd --- /dev/null +++ b/main/endian_test.c @@ -0,0 +1,11 @@ +#include <stdio.h> +int main(){ + int n = 1; + +// little endian if true + if(*(char *)&n == 1){ + printf("little endian\n"); + }else{ + printf("big endian\n"); + } +} diff --git a/main/example.fxp b/main/example.fxp Binary files differnew file mode 100755 index 0000000..b75c25f --- /dev/null +++ b/main/example.fxp diff --git a/main/example.mid b/main/example.mid Binary files differnew file mode 100644 index 0000000..c1873a4 --- /dev/null +++ b/main/example.mid diff --git a/main/example.mid.old b/main/example.mid.old Binary files differnew file mode 100755 index 0000000..bf3bfc0 --- /dev/null +++ b/main/example.mid.old diff --git a/main/example_1.mid b/main/example_1.mid Binary files differnew file mode 100755 index 0000000..113e354 --- /dev/null +++ b/main/example_1.mid diff --git a/main/mrswatson b/main/mrswatson Binary files differnew file mode 100755 index 0000000..6eb0709 --- /dev/null +++ b/main/mrswatson diff --git a/main/mrswatson64 b/main/mrswatson64 Binary files differnew file mode 100755 index 0000000..8fd7980 --- /dev/null +++ b/main/mrswatson64 diff --git a/main/mytest.bash b/main/mytest.bash new file mode 100644 index 0000000..772bc11 --- /dev/null +++ b/main/mytest.bash @@ -0,0 +1 @@ +/usr/local/lib/MrsWatson/main/mrswatson --tempo 100 -p 'Omnisphere,example.fxp' -m example.mid -o test`date +%s`.wav diff --git a/main/new_example.bash b/main/new_example.bash new file mode 100644 index 0000000..2a5e816 --- /dev/null +++ b/main/new_example.bash @@ -0,0 +1,2 @@ +new_example() { ex=$(cat ~/MIDI_FILES/type0 | sort -R | sed -n 1p); cp ~/MIDI_FILES/files/$ex /tmp/example.mid ; cp /tmp/example.mid ~/example.mid; } +new_example diff --git a/main/rebuild.bash b/main/rebuild.bash new file mode 100644 index 0000000..da93704 --- /dev/null +++ b/main/rebuild.bash @@ -0,0 +1,3 @@ +#!/bin/bash +cd ../; cmake -G "Unix Makefiles"; make clean && make; cd main; + |
