Initial commit
This commit is contained in:
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
import pdb
|
||||
import fnmatch
|
||||
|
||||
import sys
|
||||
|
||||
def main():
|
||||
p = subprocess.Popen(["git", "rev-parse", "--show-toplevel"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
|
||||
out = out.strip('\n')
|
||||
track_filepath = os.path.join(out, ".gittrack")
|
||||
|
||||
p = subprocess.Popen(["git", "ls-files", out, "--exclude-standard", "--others"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
|
||||
out = out.splitlines()
|
||||
|
||||
try:
|
||||
with open(track_filepath) as f:
|
||||
content = f.read().splitlines()
|
||||
except IOError:
|
||||
return 0
|
||||
|
||||
|
||||
untracked = []
|
||||
for filepath in out:
|
||||
for name in content:
|
||||
if fnmatch.fnmatch(filepath, name):
|
||||
untracked.append(filepath)
|
||||
|
||||
if untracked:
|
||||
print "The following files are not tracked: "
|
||||
for i in untracked:
|
||||
print i
|
||||
print "Please either stage these files for the commit or add them to the project's .gitignore to disregard them."
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit(main())
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
.DS_Store
|
||||
bin/
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
# Log files
|
||||
*.log
|
||||
|
||||
external/
|
||||
CMakeFiles/
|
||||
@@ -0,0 +1,41 @@
|
||||
# Use this file to configure the Overcommit hooks you wish to use. This will
|
||||
# extend the default configuration defined in:
|
||||
# https://github.com/brigade/overcommit/blob/master/config/default.yml
|
||||
#
|
||||
# At the topmost level of this YAML file is a key representing type of hook
|
||||
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
|
||||
# customize each hook, such as whether to only run it on certain files (via
|
||||
# `include`), whether to only display output if it fails (via `quiet`), etc.
|
||||
#
|
||||
# For a complete list of hooks, see:
|
||||
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
|
||||
#
|
||||
# For a complete list of options that you can use to customize hooks, see:
|
||||
# https://github.com/brigade/overcommit#configuration
|
||||
#
|
||||
# Uncomment the following lines to make the configuration take effect.
|
||||
|
||||
#PreCommit:
|
||||
# RuboCop:
|
||||
# enabled: true
|
||||
# on_warn: fail # Treat all warnings as failures
|
||||
#
|
||||
# TrailingWhitespace:
|
||||
# enabled: true
|
||||
# exclude:
|
||||
# - '**/db/structure.sql' # Ignore trailing whitespace in generated files
|
||||
#
|
||||
#PostCheckout:
|
||||
# ALL: # Special hook name that customizes all hooks of this type
|
||||
# quiet: true # Change all post-checkout hooks to only display output on failure
|
||||
#
|
||||
# IndexTags:
|
||||
# enabled: true # Generate a tags file with `ctags` each time HEAD changes
|
||||
|
||||
|
||||
PreCommit:
|
||||
CheckUntracked:
|
||||
enabled: true
|
||||
quiet: false
|
||||
description: 'Check for files that should be tracked or ignored.'
|
||||
required_executable: './.git-hooks/pre-commit/check_untracked.py'
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
../Bela/scripts/build_project.sh ./src/ -p Assignment_1
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
../Bela/scripts/run_project.sh Assignment_1
|
||||
Binary file not shown.
Binary file not shown.
+106
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* assignment1_crossover
|
||||
* RTDSP 2017
|
||||
*
|
||||
* First assignment for ECS732 RTDSP, to implement a 2-way audio crossover
|
||||
* using the BeagleBone Black.
|
||||
*
|
||||
* Andrew McPherson and Victor Zappi
|
||||
* Edited by Becky Stewart
|
||||
* Queen Mary, University of London
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
#include <libgen.h>
|
||||
#include <signal.h>
|
||||
#include <getopt.h>
|
||||
#include <Bela.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
// Handle Ctrl-C by requesting that the audio rendering stop
|
||||
void interrupt_handler(int var)
|
||||
{
|
||||
gShouldStop = true;
|
||||
}
|
||||
|
||||
// Print usage information
|
||||
void usage(const char * processName)
|
||||
{
|
||||
cerr << "Usage: " << processName << " [options]" << endl;
|
||||
|
||||
Bela_usage();
|
||||
|
||||
cerr << " --help [-h]: Print this menu\n";
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
BelaInitSettings settings; // Standard audio settings
|
||||
float frequency = 1000.0; // Frequency of crossover
|
||||
|
||||
struct option customOptions[] =
|
||||
{
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"frequency", 1, NULL, 'f'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
// Set default settings
|
||||
Bela_defaultSettings(&settings);
|
||||
|
||||
// Parse command-line arguments
|
||||
while (1) {
|
||||
int c;
|
||||
if ((c = Bela_getopt_long(argc, argv, "hf:", customOptions, &settings)) < 0)
|
||||
break;
|
||||
switch (c) {
|
||||
case 'h':
|
||||
usage(basename(argv[0]));
|
||||
exit(0);
|
||||
case 'f':
|
||||
frequency = atof(optarg);
|
||||
if(frequency < 20.0)
|
||||
frequency = 20.0;
|
||||
if(frequency > 5000.0)
|
||||
frequency = 5000.0;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage(basename(argv[0]));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialise the PRU audio device
|
||||
if(Bela_initAudio(&settings, &frequency) != 0) {
|
||||
cout << "Error: unable to initialise audio" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Start the audio device running
|
||||
if(Bela_startAudio()) {
|
||||
cout << "Error: unable to start real-time audio" << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Set up interrupt handler to catch Control-C
|
||||
signal(SIGINT, interrupt_handler);
|
||||
signal(SIGTERM, interrupt_handler);
|
||||
|
||||
// Run until told to stop
|
||||
while(!gShouldStop) {
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
// Stop the audio device
|
||||
Bela_stopAudio();
|
||||
|
||||
// Clean up any resources allocated for audio
|
||||
Bela_cleanupAudio();
|
||||
|
||||
// All done!
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* assignment1_crossover
|
||||
* RTDSP 2017
|
||||
*
|
||||
* First assignment for ECS732 RTDSP, to implement a 2-way audio crossover
|
||||
* using the BeagleBone Black.
|
||||
*
|
||||
* Andrew McPherson and Victor Zappi
|
||||
* Modified by Becky Stewart
|
||||
* Queen Mary, University of London
|
||||
*/
|
||||
|
||||
#include <Bela.h>
|
||||
#include <cmath>
|
||||
#include <Utilities.h>
|
||||
|
||||
/* TASK: declare any global variables you need here */
|
||||
|
||||
// setup() is called once before the audio rendering starts.
|
||||
// Use it to perform any initialisation and allocation which is dependent
|
||||
// on the period size or sample rate.
|
||||
//
|
||||
// userData holds an opaque pointer to a data structure that was passed
|
||||
// in from the call to initAudio().
|
||||
//
|
||||
// Return true on success; returning false halts the program.
|
||||
|
||||
bool setup(BelaContext *context, void *userData)
|
||||
{
|
||||
float crossoverFrequency;
|
||||
// Retrieve a parameter passed in from the initAudio() call
|
||||
if(userData != 0)
|
||||
crossoverFrequency = *(float *)userData;
|
||||
|
||||
/* TASK:
|
||||
* Calculate the filter coefficients based on the given
|
||||
* crossover frequency.
|
||||
*
|
||||
* Initialise any previous state (clearing buffers etc.)
|
||||
* to prepare for calls to render()
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// render() is called regularly at the highest priority by the audio engine.
|
||||
// Input and output are given from the audio hardware and the other
|
||||
// ADCs and DACs (if available). If only audio is available, numMatrixFrames
|
||||
// will be 0.
|
||||
|
||||
void render(BelaContext *context, void *userData)
|
||||
{
|
||||
/* TASK:
|
||||
* Mix the two input channels together.
|
||||
*
|
||||
* Apply a lowpass filter and a highpass filter, sending the
|
||||
* lowpass output to the left channel and the highpass output
|
||||
* to the right channel.
|
||||
*/
|
||||
}
|
||||
|
||||
// cleanup_render() is called once at the end, after the audio has stopped.
|
||||
// Release any resources that were allocated in initialise_render().
|
||||
|
||||
void cleanup(BelaContext *context, void *userData)
|
||||
{
|
||||
/* TASK:
|
||||
* If you allocate any memory, be sure to release it here.
|
||||
* You may or may not need anything in this function, depending
|
||||
* on your implementation.
|
||||
*/
|
||||
}
|
||||
Reference in New Issue
Block a user