Skip to content

Commit

Permalink
Merge branch 'master' into feature-midi-in
Browse files Browse the repository at this point in the history
  • Loading branch information
djdiskmachine authored Sep 30, 2024
2 parents d5a4510 + 4a38b1e commit f05d194
Show file tree
Hide file tree
Showing 16 changed files with 321 additions and 75 deletions.
4 changes: 4 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: Never
144 changes: 140 additions & 4 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,56 @@ name: Check build viability
on: [pull_request]

jobs:

clang-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch all branches
run: git fetch

- name: Check formatting
run: |
git fetch origin master:master
CHANGED_FILES=$(git diff --name-only master --diff-filter=ACM | grep -iE '\.(cpp|h|c|hpp)$')
if [ -z "$CHANGED_FILES" ]; then
echo "No C/C++ files changed."
exit 0
fi
NEEDS_FORMATTING=0
# Run clang-format on the changed lines of each staged file
for FILE in $CHANGED_FILES; do
# Get the changed lines in the file
CHANGED_LINES=$(git diff -U0 master -- $FILE | grep -E '^@@' | awk '{print $3}' | cut -d',' -f1)
# Format each changed line in the file
for LINE in $CHANGED_LINES; do
LINE_START=$(echo $LINE | cut -d'+' -f2)
if [ -z "$LINE_START" ]; then
continue
fi
clang-format -i --lines=$LINE_START:$LINE_START $FILE
done
if ! git diff --quiet $FILE; then
NEEDS_FORMATTING=1
fi
done
if [ $NEEDS_FORMATTING -eq 1 ]; then
git diff
echo "Some files need formatting. Please review the diff."
echo "Tip: install pre-commit:"
echo "cp pre-commit ./git/hooks"
exit 1
else
echo "All files are properly formatted."
fi
win32:
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -49,6 +99,13 @@ jobs:
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

deb:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -76,6 +133,13 @@ jobs:
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

x86:
runs-on: ubuntu-latest
steps:
Expand All @@ -102,7 +166,14 @@ jobs:
mv lgpt-resources-1.0/*/ ./resources/packaging
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

psp:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -135,7 +206,14 @@ jobs:
mv lgpt-resources-1.0/*/ ./resources/packaging
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

bittboy:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -163,6 +241,13 @@ jobs:
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

garlic:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -191,6 +276,13 @@ jobs:
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

garlicplus:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -218,7 +310,14 @@ jobs:
mv lgpt-resources-1.0/*/ ./resources/packaging
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

rg35xxplus:
runs-on: ubuntu-latest

Expand All @@ -245,7 +344,14 @@ jobs:
unzip lgpt-resources.zip
mv lgpt-resources-1.0/*/ ./resources/packaging
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

miyoo:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -276,6 +382,13 @@ jobs:
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

x64:
runs-on: ubuntu-latest

Expand All @@ -295,6 +408,22 @@ jobs:
run: |
make PLATFORM=X64
- name: Package build
working-directory: projects
run: |
curl -L -o lgpt-resources.zip https://github.com/djdiskmachine/lgpt-resources/archive/refs/tags/1.0.zip
unzip lgpt-resources.zip
mv lgpt-resources-1.0/*/ ./resources/packaging
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error

macos:
runs-on: macos-13
steps:
Expand All @@ -320,3 +449,10 @@ jobs:
mv lgpt-resources-1.0/*/ ./resources/packaging
rm -rf lgpt-resources*
./resources/packaging/lgpt_package.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: LGPT-${{ github.job }}-${{ github.sha }}.zip
path: projects/*.zip
if-no-files-found: error
5 changes: 3 additions & 2 deletions docs/wiki/What-is-LittlePiggyTracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ To move from one screen to the other, press the RTrigger combined with the direc
- The top of the phrase screen displays the .wav file loaded into the instrument under your cursor. The left of the phrase screen is the play-time visualizer.
- The seven columns of the phrase screen, from left to right: (red) row counter, note trigger, instrument selector, effect one, parameters for effect one, effect two, parameters for effect two.
- You can clone instruments and tables in the phrase screen: LT+(B,A) as usual. You can get a new table or instrument: A,A.
- If you copy/cut anything in the phrase screen, pasting will always put the data back in the same column (regardless if you've moved the cursor to another column). so effects in column one are always pasted back there, and you can't accidentally paste a note into the effect column, etc.
- If you copy/cut anything in the phrase screen, pasting will put the data in the column where you are currently located. Pasting incompatible data like a note into the effect column etc does nothing.
- you can clone a MIDI instrument in the phrase screen by pressing L_TRIGGER+(B,A) on instrument number in phrase screen. Properly saved & restored. You can't delete them once cloned (can't revert them to sample type).
- If no instrument is set when triggering a new note, tables are not stopped, running commands are not stopped and phase of oscillator instrument is not reset (allowing for clickless transition)

Expand Down Expand Up @@ -381,7 +381,8 @@ A midi instrument has the following settings:
## Table Screen

![](https://d2mxuefqeaa7sj.cloudfront.net/s_B9C92C3440E8671360862F10CAB0FE70873BFE49CFB51CA246C781C17506C258_1522140549562_table_1.1f.png)

- The seven columns of the phrase screen, from left to right: (red) row counter, effect one, parameters for effect one, effect two, parameters for effect two, effect three, parameters for effect three.
- If you copy/cut anything in the table screen, pasting will put the data in the column where you are currently located. Pasting incompatible data like parameters into the effect columns and vice versa does nothing.
- Hopping to self in table holds the step for x ticks. For example

05 HOP 1005
Expand Down
36 changes: 36 additions & 0 deletions pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -iE '\.(cpp|h|c|hpp)$')

if [ -z "$STAGED_FILES" ]; then
exit 0
fi

NEEDS_FORMATTING=0

# Run clang-format on the changed lines of each staged file
for FILE in $STAGED_FILES; do
# Get the changed lines in the file
CHANGED_LINES=$(git diff --cached -U0 -- $FILE | grep -E '^@@' | awk '{print $3}' | cut -d',' -f1)

# Format each changed line in the file
for LINE in $CHANGED_LINES; do
LINE_START=$(echo $LINE | cut -d'+' -f2)
if [ -z "$LINE_START" ]; then
continue
fi
clang-format -i --lines=$LINE_START:$LINE_START $FILE
done

if ! git diff --quiet $FILE; then
NEEDS_FORMATTING=1
echo $FILE
fi
done

if [ $NEEDS_FORMATTING -eq 1 ]; then
echo "The above files were formatted. Please review and stage the changes before committing."
exit 1
fi

exit 0
4 changes: 2 additions & 2 deletions projects/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ SDL2AUDIODIRS := \

BEAGLEBOARDDIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(RTAUDIODIRS) $(SDLDIRS)
DEBDIRS := $(DBDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RASPIDIRS := $(LINUXDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RASPIDIRS := $(DBDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
RG35XXPLUSDIRS := $(LINUXDIRS) $(DUMMYMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
STEAMDIRS := $(LINUXDIRS) $(JACKDIRS) $(RTAUDIODIRS) $(RTMIDIDIRS) $(SDLDIRS)
X64DIRS := $(LINUXDIRS) $(RTMIDIDIRS) $(SDL2DIRS) $(SDL2AUDIODIRS)
Expand Down Expand Up @@ -324,7 +324,7 @@ SDLAUDIOFILES := \

DEBFILES := $(DBFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
BEAGLEBOARDFILES := $(LINUXFILES) $(DUMMYMIDIFILES)
RASPIFILES := $(LINUXFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
RASPIFILES := $(DBDIRS) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
RG35XXPLUSFILES := $(LINUXFILES) $(SDLAUDIOFILES) $(DUMMYMIDIFILES)
STEAMFILES := $(LINUXFILES) $(RTAUDIOFILES) $(RTMIDIFILES) $(JACKFILES)
X64FILES := $(LINUXFILES) $(RTMIDIFILES) $(SDLAUDIOFILES)
Expand Down
5 changes: 4 additions & 1 deletion projects/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Recommendation: Install pre-commit
From repo root: cp pre-commit ./git/hooks

##### Windows: Use Visual 2008 express edition + will need the DirectX SDK (I'm using March 2008)

##### CAANOO: Compile under linux with the caanoo toolchain
Expand Down Expand Up @@ -30,7 +33,7 @@
##### X64: Compile under Linux
Required libs:
sudo apt install -y git make libsdl2 libasound2-plugins libjack-dev python3 python3-pillow
sudo apt install -y git make libsdl2-dev libasound2-plugins libjack-dev python3 python3-pillow

Build with:
make PLATFORM=X64
Expand Down
2 changes: 1 addition & 1 deletion sources/Application/Model/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#define PROJECT_NUMBER "1"
#define PROJECT_RELEASE "4"
#define BUILD_COUNT "2"
#define BUILD_COUNT "3-bacon0"


#define MAX_TAP 3
Expand Down
28 changes: 26 additions & 2 deletions sources/Application/Views/BaseClasses/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
bool View::initPrivate_=false ;

int View::margin_=0 ;
int View::songRowCount_ ;//=21 ;
int View::songRowCount_; //=21 sets screen height among other things
bool View::miniLayout_=false ;
int View::altRowNumber_ = 4;

Expand All @@ -24,7 +24,7 @@ View::View(GUIWindow &w,ViewData *viewData):
GUIRect rect=w.GetRect() ;
miniLayout_=(rect.Width()<320);
View::margin_=0 ;
songRowCount_=miniLayout_?16:22 ;
songRowCount_ = miniLayout_ ? 16:22; // 22 is row display count among other things

const char *altRowStr = Config::GetInstance()->GetValue("ALTROWNUMBER");
if (altRowStr) {
Expand All @@ -37,6 +37,8 @@ View::View(GUIWindow &w,ViewData *viewData):
viewMode_=VM_NORMAL ;
locked_=false ;
viewData_=viewData;
NOTIFICATION_TIMEOUT = 1000;
displayNotification_ = "";
} ;

GUIPoint View::GetAnchor() {
Expand Down Expand Up @@ -234,3 +236,25 @@ void View::DrawString(int x,int y,const char *txt,GUITextProperties &props) {
w_.DrawString(txt,pos,props) ;
} ;

/*
Displays the saved notification for 1 second
*/
void View::EnableNotification() {
if ((SDL_GetTicks() - notificationTime_) <= NOTIFICATION_TIMEOUT) {
SetColor(CD_NORMAL);
GUITextProperties props;
DrawString(10, 2, displayNotification_, props);
} else {
displayNotification_ = "";
}
}

/*
Set displayed notification and save the current time
*/
void View::SetNotification(const char *notification) {
notificationTime_ = SDL_GetTicks();
displayNotification_ = (char*) notification;
isDirty_ = true;
}

Loading

0 comments on commit f05d194

Please sign in to comment.