Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 63 additions & 3 deletions .github/workflows/nob.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: no-build build
on: [push, pull_request]
on:
push:
pull_request:

jobs:
macos:
Expand All @@ -16,6 +18,18 @@ jobs:
with:
name: macos-build-folder
path: build/
- name: Package release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
brew install imagemagick
./nob dist
ditto -c -k --sequesterRsrc --keepParent build/Musializer.app musializer-macos.zip
- name: Upload release package
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: release-macos
path: musializer-macos.zip
ubuntu:
strategy:
matrix:
Expand All @@ -35,6 +49,15 @@ jobs:
with:
name: ubuntu-${{ matrix.cc }}-build-folder
path: build/
- name: Package release
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.cc == 'gcc'
run: ./nob dist
- name: Upload release package
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.cc == 'gcc'
uses: actions/upload-artifact@v4
with:
name: release-linux
path: musializer-linux-x86_64.tar.gz
windows:
name: windows (${{ matrix.hotreload == true && 'hotreload' || '' }})
runs-on: windows-latest
Expand All @@ -51,16 +74,53 @@ jobs:
# https://github.com/actions/runner-images/issues/6205#issuecomment-1241573412
# https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#create-your-own-command-prompt-shortcut
run: |
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat"
cl.exe /Fenob nob.c
- name: Run nob
shell: cmd
run: |
call "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do call "%%i\VC\Auxiliary\Build\vcvars64.bat"
nob.exe config ${{ matrix.hotreload == true && 'hotreload' || '' }}
nob.exe
- name: Upload build folder
uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.hotreload == true && 'hotreload' || '' }}-build-folder
path: build/
# `nob dist` is not implemented for the MSVC target, so package by hand
- name: Package release
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.hotreload == false
shell: pwsh
run: |
New-Item -ItemType Directory musializer-win64
Copy-Item build/musializer.exe musializer-win64/
Copy-Item -Recurse resources musializer-win64/resources
Copy-Item musializer-logged.bat musializer-win64/
Compress-Archive -Path musializer-win64 -DestinationPath musializer-win64.zip
- name: Upload release package
if: github.ref == 'refs/heads/main' && github.event_name == 'push' && matrix.hotreload == false
uses: actions/upload-artifact@v4
with:
name: release-windows
path: musializer-win64.zip
release:
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: [macos, ubuntu, windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download release packages
uses: actions/download-artifact@v4
with:
pattern: release-*
path: dist
merge-multiple: true
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
# Creates the tag on the pushed commit if it doesn't exist yet
tag_name: v0.${{ github.run_number }}
target_commitish: ${{ github.sha }}
files: dist/*
generate_release_notes: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ nob.old
nob.exe
nob.exe.old
nob.obj

# stupid extension creates file
.vscode/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</p>

> [!WARNING]
> This software is unfinished. Keep your expectations low.
> This is a fork of [https://github.com/tsoding/musializer](https://github.com/tsoding/musializer)

The project aims to make a tool for creating beautiful music visualizations and rendering high quality videos of them.

Expand Down
52 changes: 50 additions & 2 deletions src/plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ typedef struct {
int circle_radius_location;
int circle_power_location;
bool fullscreen;
bool castrated;

// Renderer
bool rendering;
Expand Down Expand Up @@ -363,6 +364,10 @@ static void fft_render(Rectangle boundary, size_t m)

Texture2D texture = { rlGetTextureIdDefault(), 1, 1, 1, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 };

// No balls if castrated
if (p->castrated) {return;}


// Display the Smears
SetShaderValue(p->circle, p->circle_radius_location, (float[1]){ 0.3f }, SHADER_UNIFORM_FLOAT);
SetShaderValue(p->circle, p->circle_power_location, (float[1]){ 3.0f }, SHADER_UNIFORM_FLOAT);
Expand Down Expand Up @@ -1227,6 +1232,37 @@ static int render_button_with_location(const char *file, int line, Rectangle bou
return state;
}

static int castrated_checkbox_with_location(const char *file, int line, Rectangle boundary)
{
uint64_t id = DJB2_INIT;
id = djb2(id, file, strlen(file));
id = djb2(id, &line, sizeof(line));

int state = button_with_id(id, boundary);
if (state & BS_CLICKED) {
p->castrated = !p->castrated;
}

Rectangle checkbox = {
.x = boundary.x + boundary.width/2 - boundary.width*0.2f,
.y = boundary.y + boundary.height/2 - boundary.height*0.2f,
.width = boundary.width*0.4f,
.height = boundary.height*0.4f,
};
Color color = (state & BS_HOVEROVER) ? COLOR_TRACK_BUTTON_HOVEROVER : COLOR_TRACK_BUTTON_BACKGROUND;
DrawRectangleRounded(boundary, 0.2f, 20, color);
if (p->castrated) {
DrawRectangleRec(checkbox, COLOR_ACCENT);
}
DrawRectangleLinesEx(checkbox, 2, WHITE);

tooltip(boundary, "Castrated mode (no balls)", SIDE_TOP, false);
return state;
}

#define castrated_checkbox(boundary) \
castrated_checkbox_with_location(__FILE__, __LINE__, (boundary))

#ifdef MUSIALIZER_MICROPHONE
#define microphone_button(boundary) \
microphone_button_with_location(__FILE__, __LINE__, (boundary))
Expand Down Expand Up @@ -1355,9 +1391,9 @@ static bool toolbar(Track *track, Rectangle boundary)
int state = 0;

#ifdef MUSIALIZER_MICROPHONE
size_t buttons_count = 5;
size_t buttons_count = 6;
#else
size_t buttons_count = 4;
size_t buttons_count = 5;
#endif // MUSIALIZER_MICROPHONE

if (boundary.width < HUD_BUTTON_SIZE*buttons_count) return interacted;
Expand Down Expand Up @@ -1390,6 +1426,17 @@ static bool toolbar(Track *track, Rectangle boundary)
start_rendering_track(track);
}

state = castrated_checkbox((CLITERAL(Rectangle) {
x,
boundary.y,
HUD_BUTTON_SIZE,
HUD_BUTTON_SIZE,
}));
x += HUD_BUTTON_SIZE;
if (state & BS_CLICKED) {
interacted = true;
}

#ifdef MUSIALIZER_MICROPHONE
state = microphone_button((CLITERAL(Rectangle) {
x,
Expand Down Expand Up @@ -1871,6 +1918,7 @@ MUSIALIZER_PLUG void plug_init(void)
load_assets();
p->screen = LoadRenderTexture(RENDER_WIDTH, RENDER_HEIGHT);
p->current_track = -1;
p->castrated = false;

// TODO: restore master volume between sessions
SetMasterVolume(0.5);
Expand Down