Mercurial > hg > beaglert
comparison core/default_main.cpp @ 301:e4392164b458 prerelease
RENAMED BeagleRT to Bela AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, scripts probably not working
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Fri, 27 May 2016 14:34:41 +0100 |
parents | b89dd0c97a04 |
children |
comparison
equal
deleted
inserted
replaced
300:dbeed520b014 | 301:e4392164b458 |
---|---|
8 #include <iostream> | 8 #include <iostream> |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 #include <libgen.h> | 10 #include <libgen.h> |
11 #include <signal.h> | 11 #include <signal.h> |
12 #include <getopt.h> | 12 #include <getopt.h> |
13 #include "../include/BeagleRT.h" | 13 #include "../include/Bela.h" |
14 | 14 |
15 using namespace std; | 15 using namespace std; |
16 | 16 |
17 // Handle Ctrl-C by requesting that the audio rendering stop | 17 // Handle Ctrl-C by requesting that the audio rendering stop |
18 void interrupt_handler(int var) | 18 void interrupt_handler(int var) |
23 // Print usage information | 23 // Print usage information |
24 void usage(const char * processName) | 24 void usage(const char * processName) |
25 { | 25 { |
26 cerr << "Usage: " << processName << " [options]" << endl; | 26 cerr << "Usage: " << processName << " [options]" << endl; |
27 | 27 |
28 BeagleRT_usage(); | 28 Bela_usage(); |
29 | 29 |
30 cerr << " --help [-h]: Print this menu\n"; | 30 cerr << " --help [-h]: Print this menu\n"; |
31 } | 31 } |
32 | 32 |
33 int main(int argc, char *argv[]) | 33 int main(int argc, char *argv[]) |
34 { | 34 { |
35 BeagleRTInitSettings settings; // Standard audio settings | 35 BelaInitSettings settings; // Standard audio settings |
36 | 36 |
37 struct option customOptions[] = | 37 struct option customOptions[] = |
38 { | 38 { |
39 {"help", 0, NULL, 'h'}, | 39 {"help", 0, NULL, 'h'}, |
40 {NULL, 0, NULL, 0} | 40 {NULL, 0, NULL, 0} |
41 }; | 41 }; |
42 | 42 |
43 // Set default settings | 43 // Set default settings |
44 BeagleRT_defaultSettings(&settings); | 44 Bela_defaultSettings(&settings); |
45 | 45 |
46 // Parse command-line arguments | 46 // Parse command-line arguments |
47 while (1) { | 47 while (1) { |
48 int c; | 48 int c; |
49 if ((c = BeagleRT_getopt_long(argc, argv, "h", customOptions, &settings)) < 0) | 49 if ((c = Bela_getopt_long(argc, argv, "h", customOptions, &settings)) < 0) |
50 break; | 50 break; |
51 switch (c) { | 51 switch (c) { |
52 case 'h': | 52 case 'h': |
53 usage(basename(argv[0])); | 53 usage(basename(argv[0])); |
54 exit(0); | 54 exit(0); |
58 exit(1); | 58 exit(1); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 // Initialise the PRU audio device | 62 // Initialise the PRU audio device |
63 if(BeagleRT_initAudio(&settings, 0) != 0) { | 63 if(Bela_initAudio(&settings, 0) != 0) { |
64 cout << "Error: unable to initialise audio" << endl; | 64 cout << "Error: unable to initialise audio" << endl; |
65 return -1; | 65 return -1; |
66 } | 66 } |
67 | 67 |
68 // Start the audio device running | 68 // Start the audio device running |
69 if(BeagleRT_startAudio()) { | 69 if(Bela_startAudio()) { |
70 cout << "Error: unable to start real-time audio" << endl; | 70 cout << "Error: unable to start real-time audio" << endl; |
71 return -1; | 71 return -1; |
72 } | 72 } |
73 | 73 |
74 // Set up interrupt handler to catch Control-C and SIGTERM | 74 // Set up interrupt handler to catch Control-C and SIGTERM |
79 while(!gShouldStop) { | 79 while(!gShouldStop) { |
80 usleep(100000); | 80 usleep(100000); |
81 } | 81 } |
82 | 82 |
83 // Stop the audio device | 83 // Stop the audio device |
84 BeagleRT_stopAudio(); | 84 Bela_stopAudio(); |
85 | 85 |
86 // Clean up any resources allocated for audio | 86 // Clean up any resources allocated for audio |
87 BeagleRT_cleanupAudio(); | 87 Bela_cleanupAudio(); |
88 | 88 |
89 // All done! | 89 // All done! |
90 return 0; | 90 return 0; |
91 } | 91 } |