Add spectrogram viewer with FFT bandpass filter, file browser, zoom/pan controls
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -0,0 +1,154 @@
|
|||||||
|
# Spectrogram Viewer (C/Raylib)
|
||||||
|
|
||||||
|
A real-time spectrogram viewer ported from the Unity Audio-Experiments project, with interactive region selection and audio playback.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- **Spectrogram Visualization**: Displays frequency content of audio over time using STFT
|
||||||
|
- **Time & Frequency Selection**: Select both time regions AND frequency ranges
|
||||||
|
- **Audio Playback**: Play back only the selected time region
|
||||||
|
- **Multiple Colormaps**: 6 different heat map styles
|
||||||
|
- **Adjustable Threshold**: Control the dB floor for visualization
|
||||||
|
- **Drag & Drop**: Load files by dragging them onto the window
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd rspektrum/build
|
||||||
|
./premake5 gmake
|
||||||
|
cd ..
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
## Running
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd rspektrum/bin/Debug
|
||||||
|
./rspektrum
|
||||||
|
```
|
||||||
|
|
||||||
|
## Controls
|
||||||
|
|
||||||
|
| Key | Action |
|
||||||
|
|-----|--------|
|
||||||
|
| **O** | Open file dialog |
|
||||||
|
| **Drag & drop** | Load WAV file |
|
||||||
|
| **LMB Drag** | Select time region |
|
||||||
|
| **Shift+LMB Drag** | Select frequency range |
|
||||||
|
| **SPACE** | Play selected time region |
|
||||||
|
| **M** | Cycle colormap |
|
||||||
|
| **W/S** | Adjust dB floor (up/down) |
|
||||||
|
| **G** | Toggle grid overlay |
|
||||||
|
| **R** | Reset all selections to full range |
|
||||||
|
| **ESC** | Stop playback / Cancel dialog |
|
||||||
|
|
||||||
|
## File Loading
|
||||||
|
|
||||||
|
Two ways to load a WAV file:
|
||||||
|
|
||||||
|
1. **Drag & Drop**: Simply drag a `.wav` file onto the application window
|
||||||
|
2. **File Dialog**: Press **O** to open a file path input dialog
|
||||||
|
|
||||||
|
## Selection Modes
|
||||||
|
|
||||||
|
### Time Selection (Left Mouse Button)
|
||||||
|
- Click and drag horizontally to select a time range
|
||||||
|
- The non-selected areas are greyed out
|
||||||
|
- Yellow borders indicate the selection boundaries
|
||||||
|
|
||||||
|
### Frequency Selection (Shift + Left Mouse Button)
|
||||||
|
- Hold **Shift** and drag vertically to select a frequency range
|
||||||
|
- Cyan borders indicate the frequency selection
|
||||||
|
- Useful for isolating specific frequency bands
|
||||||
|
|
||||||
|
## Colormaps
|
||||||
|
|
||||||
|
Press **M** to cycle through available colormaps:
|
||||||
|
|
||||||
|
1. **Grays** - Classic grayscale
|
||||||
|
2. **Inferno** - Dark purple to bright yellow (default)
|
||||||
|
3. **Viridis** - Purple to yellow (perceptually uniform)
|
||||||
|
4. **Plasma** - Purple to yellow-orange
|
||||||
|
5. **Hot** - Black to red to yellow to white
|
||||||
|
6. **Cool** - Cyan to magenta
|
||||||
|
|
||||||
|
## Threshold Control
|
||||||
|
|
||||||
|
Use **W** and **S** keys to adjust the amplitude floor:
|
||||||
|
- **W**: Raise the floor (show only louder signals)
|
||||||
|
- **S**: Lower the floor (show quieter signals too)
|
||||||
|
|
||||||
|
The current dB floor is displayed in the bottom right corner.
|
||||||
|
|
||||||
|
## Technical Details
|
||||||
|
|
||||||
|
### STFT Parameters
|
||||||
|
- **FFT Size**: 2048 samples
|
||||||
|
- **Hop Size**: 1024 samples (50% overlap)
|
||||||
|
- **Window**: Hann window
|
||||||
|
- **Frequency Resolution**: `sampleRate / 2048` Hz per bin
|
||||||
|
|
||||||
|
### Audio Format Support
|
||||||
|
- WAV files (any sample rate)
|
||||||
|
- Automatically detected sample rate (displayed in info panel)
|
||||||
|
- 8-bit, 16-bit PCM, and 32-bit float supported
|
||||||
|
- Stereo files are converted to mono
|
||||||
|
|
||||||
|
### Display
|
||||||
|
- X-axis: Time (seconds)
|
||||||
|
- Y-axis: Frequency (Hz), scaled to actual sample rate
|
||||||
|
- Color/brightness: Amplitude in dB
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
rspektrum/
|
||||||
|
├── src/
|
||||||
|
│ ├── spectrogram.c # Main application (~1000 lines)
|
||||||
|
│ └── icon.ico # Windows icon
|
||||||
|
├── libs/
|
||||||
|
│ └── ... # Optional external libraries
|
||||||
|
├── build/
|
||||||
|
│ ├── premake5.lua # Build configuration
|
||||||
|
│ └── external/ # Downloaded dependencies (raylib)
|
||||||
|
└── bin/
|
||||||
|
├── Debug/ # Debug build
|
||||||
|
└── Release/ # Release build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Comparison: Unity vs C/Raylib
|
||||||
|
|
||||||
|
| Aspect | Unity Original | C/Raylib Port |
|
||||||
|
|--------|---------------|---------------|
|
||||||
|
| Lines of Code | ~2000+ (multiple files) | ~1000 (single file) |
|
||||||
|
| Build Time | Minutes | Seconds |
|
||||||
|
| Dependencies | Unity Editor, .NET | raylib only |
|
||||||
|
| GPU Acceleration | Compute shaders | CPU-based |
|
||||||
|
| Colormaps | Single gradient | 6 presets |
|
||||||
|
| Freq Selection | No | Yes |
|
||||||
|
| Startup Time | Slow | Fast |
|
||||||
|
|
||||||
|
## Tips
|
||||||
|
|
||||||
|
1. **For 16kHz audio**: The max frequency will show as 8kHz (Nyquist)
|
||||||
|
2. **Better visibility**: Use Inferno or Viridis colormap for better contrast
|
||||||
|
3. **Quiet signals**: Lower the dB floor with 'S' to see quieter content
|
||||||
|
4. **Isolate frequencies**: Use Shift+drag to focus on specific frequency bands
|
||||||
|
5. **Playback**: Only the time selection is played, full frequency range
|
||||||
|
|
||||||
|
## Future Improvements
|
||||||
|
|
||||||
|
- [ ] Logarithmic frequency scale option
|
||||||
|
- [ ] Zoom in/out on frequency axis
|
||||||
|
- [ ] Real-time microphone input
|
||||||
|
- [ ] Export selection as WAV
|
||||||
|
- [ ] Faster FFT (pffft/kissfft)
|
||||||
|
- [ ] Save/load presets
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Based on Unity Audio-Experiments by Sebastian Lague (Coding Adventure series)
|
||||||
|
|
||||||
|
C/Raylib port created for educational purposes.
|
||||||
+2
-1
@@ -196,7 +196,7 @@ if (downloadRaylib) then
|
|||||||
["Game Resource Files/*"] = {"../resources/**"},
|
["Game Resource Files/*"] = {"../resources/**"},
|
||||||
}
|
}
|
||||||
|
|
||||||
files {"../src/**.c", "../src/**.cpp", "../src/**.h", "../src/**.hpp", "../include/**.h", "../include/**.hpp"}
|
files {"../src/spectrogram.c", "../src/**.h", "../src/**.hpp", "../include/**.h", "../include/**.hpp"}
|
||||||
|
|
||||||
filter {"system:windows", "action:vs*"}
|
filter {"system:windows", "action:vs*"}
|
||||||
files {"../src/*.rc", "../src/*.ico"}
|
files {"../src/*.rc", "../src/*.ico"}
|
||||||
@@ -213,6 +213,7 @@ if (downloadRaylib) then
|
|||||||
cppdialect "C++17"
|
cppdialect "C++17"
|
||||||
|
|
||||||
includedirs {raylib_dir .. "/src" }
|
includedirs {raylib_dir .. "/src" }
|
||||||
|
includedirs {raylib_dir .. "/src/external/miniaudio" }
|
||||||
|
|
||||||
flags { "ShadowedVariables"}
|
flags { "ShadowedVariables"}
|
||||||
platform_defines()
|
platform_defines()
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Generate test WAV files with a 1kHz sine wave tone at different sample rates.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import wave
|
||||||
|
import struct
|
||||||
|
import math
|
||||||
|
import os
|
||||||
|
|
||||||
|
def generate_tone_wav(filename, sample_rate, duration_sec=2.0, frequency=1000.0, amplitude=0.5):
|
||||||
|
"""
|
||||||
|
Generate a WAV file with a single sine wave tone.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
filename: Output WAV file path
|
||||||
|
sample_rate: Sample rate in Hz (e.g., 16000, 22050, 44100)
|
||||||
|
duration_sec: Duration in seconds
|
||||||
|
frequency: Tone frequency in Hz
|
||||||
|
amplitude: Amplitude 0.0-1.0
|
||||||
|
"""
|
||||||
|
num_samples = int(sample_rate * duration_sec)
|
||||||
|
|
||||||
|
# Generate samples
|
||||||
|
samples = []
|
||||||
|
for i in range(num_samples):
|
||||||
|
t = i / sample_rate
|
||||||
|
sample = amplitude * math.sin(2 * math.pi * frequency * t)
|
||||||
|
# Convert to 16-bit PCM
|
||||||
|
sample_int = int(sample * 32767)
|
||||||
|
samples.append(sample_int)
|
||||||
|
|
||||||
|
# Write WAV file
|
||||||
|
with wave.open(filename, 'w') as wav_file:
|
||||||
|
wav_file.setnchannels(1) # Mono
|
||||||
|
wav_file.setsampwidth(2) # 16-bit (2 bytes)
|
||||||
|
wav_file.setframerate(sample_rate)
|
||||||
|
|
||||||
|
for sample in samples:
|
||||||
|
wav_file.writeframes(struct.pack('<h', sample)) # Little-endian 16-bit
|
||||||
|
|
||||||
|
print(f"Created: {filename}")
|
||||||
|
print(f" Sample Rate: {sample_rate} Hz")
|
||||||
|
print(f" Duration: {duration_sec} sec")
|
||||||
|
print(f" Frequency: {frequency} Hz")
|
||||||
|
print(f" Samples: {num_samples}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Get the directory where this script is located
|
||||||
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
# Test frequencies and sample rates
|
||||||
|
tone_frequency = 1000.0 # 1 kHz tone
|
||||||
|
|
||||||
|
sample_rates = [
|
||||||
|
(16000, "16k"),
|
||||||
|
(22050, "22k"),
|
||||||
|
(44100, "44k"),
|
||||||
|
]
|
||||||
|
|
||||||
|
print(f"Generating {tone_frequency} Hz test tones at different sample rates...\n")
|
||||||
|
|
||||||
|
for sample_rate, suffix in sample_rates:
|
||||||
|
filename = os.path.join(script_dir, f"test_tone_{suffix}_{int(tone_frequency)}hz.wav")
|
||||||
|
generate_tone_wav(filename, sample_rate, duration_sec=2.0, frequency=tone_frequency)
|
||||||
|
|
||||||
|
print("Done! Copy these WAV files to your spectrogram viewer to test.")
|
||||||
|
print("\nExpected display:")
|
||||||
|
print(" - 16k file: Tone should appear at 1kHz (1/8 of max 8kHz)")
|
||||||
|
print(" - 22k file: Tone should appear at 1kHz (~1/11 of max 11kHz)")
|
||||||
|
print(" - 44k file: Tone should appear at 1kHz (~1/22 of max 22kHz)")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
+9060
File diff suppressed because it is too large
Load Diff
+95864
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
|||||||
|
404: Not Found
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
404: Not Found
|
||||||
+213
@@ -0,0 +1,213 @@
|
|||||||
|
# GNU Make project makefile autogenerated by Premake
|
||||||
|
|
||||||
|
ifndef config
|
||||||
|
config=debug_x64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef verbose
|
||||||
|
SILENT = @
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: clean prebuild
|
||||||
|
|
||||||
|
SHELLTYPE := posix
|
||||||
|
ifeq ($(shell echo "test"), "test")
|
||||||
|
SHELLTYPE := msdos
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Configurations
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
ifeq ($(origin CC), default)
|
||||||
|
CC = gcc
|
||||||
|
endif
|
||||||
|
ifeq ($(origin CXX), default)
|
||||||
|
CXX = g++
|
||||||
|
endif
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
|
AR = ar
|
||||||
|
endif
|
||||||
|
RESCOMP = windres
|
||||||
|
INCLUDES += -Ibuild/external/raylib-master/src -Ibuild/external/raylib-master/src/external/glfw/include
|
||||||
|
FORCE_INCLUDE +=
|
||||||
|
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
|
||||||
|
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
|
||||||
|
LIBS +=
|
||||||
|
LDDEPS +=
|
||||||
|
LINKCMD = $(AR) -rcs "$@" $(OBJECTS)
|
||||||
|
define PREBUILDCMDS
|
||||||
|
endef
|
||||||
|
define PRELINKCMDS
|
||||||
|
endef
|
||||||
|
define POSTBUILDCMDS
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(config),debug_x64)
|
||||||
|
TARGETDIR = bin/Debug
|
||||||
|
TARGET = $(TARGETDIR)/libraylib.a
|
||||||
|
OBJDIR = obj/x64/Debug/raylib
|
||||||
|
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -g
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -g
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64
|
||||||
|
|
||||||
|
else ifeq ($(config),debug_x86)
|
||||||
|
TARGETDIR = bin/Debug
|
||||||
|
TARGET = $(TARGETDIR)/libraylib.a
|
||||||
|
OBJDIR = obj/x86/Debug/raylib
|
||||||
|
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -g
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -g
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32
|
||||||
|
|
||||||
|
else ifeq ($(config),debug_arm64)
|
||||||
|
TARGETDIR = bin/Debug
|
||||||
|
TARGET = $(TARGETDIR)/libraylib.a
|
||||||
|
OBJDIR = obj/ARM64/Debug/raylib
|
||||||
|
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS)
|
||||||
|
|
||||||
|
else ifeq ($(config),release_x64)
|
||||||
|
TARGETDIR = bin/Release
|
||||||
|
TARGET = $(TARGETDIR)/libraylib.a
|
||||||
|
OBJDIR = obj/x64/Release/raylib
|
||||||
|
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -O2
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -O2
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s
|
||||||
|
|
||||||
|
else ifeq ($(config),release_x86)
|
||||||
|
TARGETDIR = bin/Release
|
||||||
|
TARGET = $(TARGETDIR)/libraylib.a
|
||||||
|
OBJDIR = obj/x86/Release/raylib
|
||||||
|
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -O2
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -O2
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s
|
||||||
|
|
||||||
|
else ifeq ($(config),release_arm64)
|
||||||
|
TARGETDIR = bin/Release
|
||||||
|
TARGET = $(TARGETDIR)/libraylib.a
|
||||||
|
OBJDIR = obj/ARM64/Release/raylib
|
||||||
|
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O2
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O2
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Per File Configurations
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
|
||||||
|
# File sets
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
GENERATED :=
|
||||||
|
OBJECTS :=
|
||||||
|
|
||||||
|
GENERATED += $(OBJDIR)/raudio.o
|
||||||
|
GENERATED += $(OBJDIR)/rcore.o
|
||||||
|
GENERATED += $(OBJDIR)/rglfw.o
|
||||||
|
GENERATED += $(OBJDIR)/rmodels.o
|
||||||
|
GENERATED += $(OBJDIR)/rshapes.o
|
||||||
|
GENERATED += $(OBJDIR)/rtext.o
|
||||||
|
GENERATED += $(OBJDIR)/rtextures.o
|
||||||
|
OBJECTS += $(OBJDIR)/raudio.o
|
||||||
|
OBJECTS += $(OBJDIR)/rcore.o
|
||||||
|
OBJECTS += $(OBJDIR)/rglfw.o
|
||||||
|
OBJECTS += $(OBJDIR)/rmodels.o
|
||||||
|
OBJECTS += $(OBJDIR)/rshapes.o
|
||||||
|
OBJECTS += $(OBJDIR)/rtext.o
|
||||||
|
OBJECTS += $(OBJDIR)/rtextures.o
|
||||||
|
|
||||||
|
# Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
@:
|
||||||
|
|
||||||
|
$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
|
||||||
|
$(PRELINKCMDS)
|
||||||
|
@echo Linking raylib
|
||||||
|
$(SILENT) $(LINKCMD)
|
||||||
|
$(POSTBUILDCMDS)
|
||||||
|
|
||||||
|
$(TARGETDIR):
|
||||||
|
@echo Creating $(TARGETDIR)
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) mkdir -p $(TARGETDIR)
|
||||||
|
else
|
||||||
|
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
@echo Creating $(OBJDIR)
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) mkdir -p $(OBJDIR)
|
||||||
|
else
|
||||||
|
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo Cleaning raylib
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) rm -f $(TARGET)
|
||||||
|
$(SILENT) rm -rf $(GENERATED)
|
||||||
|
$(SILENT) rm -rf $(OBJDIR)
|
||||||
|
else
|
||||||
|
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
|
||||||
|
$(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED))
|
||||||
|
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
|
||||||
|
endif
|
||||||
|
|
||||||
|
prebuild: | $(OBJDIR)
|
||||||
|
$(PREBUILDCMDS)
|
||||||
|
|
||||||
|
ifneq (,$(PCH))
|
||||||
|
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
|
||||||
|
$(GCH): $(PCH) | prebuild
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CC) -x c-header $(ALL_CFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||||
|
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) touch "$@"
|
||||||
|
else
|
||||||
|
$(SILENT) echo $null >> "$@"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(OBJECTS): | prebuild
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/raudio.o: build/external/raylib-master/src/raudio.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/rcore.o: build/external/raylib-master/src/rcore.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/rglfw.o: build/external/raylib-master/src/rglfw.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/rmodels.o: build/external/raylib-master/src/rmodels.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/rshapes.o: build/external/raylib-master/src/rshapes.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/rtext.o: build/external/raylib-master/src/rtext.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
$(OBJDIR)/rtextures.o: build/external/raylib-master/src/rtextures.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
|
-include $(OBJECTS:%.o=%.d)
|
||||||
|
ifneq (,$(PCH))
|
||||||
|
-include $(PCH_PLACEHOLDER).d
|
||||||
|
endif
|
||||||
Binary file not shown.
+193
@@ -0,0 +1,193 @@
|
|||||||
|
# GNU Make project makefile autogenerated by Premake
|
||||||
|
|
||||||
|
ifndef config
|
||||||
|
config=debug_x64
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef verbose
|
||||||
|
SILENT = @
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: clean prebuild
|
||||||
|
|
||||||
|
SHELLTYPE := posix
|
||||||
|
ifeq ($(shell echo "test"), "test")
|
||||||
|
SHELLTYPE := msdos
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Configurations
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
ifeq ($(origin CC), default)
|
||||||
|
CC = gcc
|
||||||
|
endif
|
||||||
|
ifeq ($(origin CXX), default)
|
||||||
|
CXX = g++
|
||||||
|
endif
|
||||||
|
ifeq ($(origin AR), default)
|
||||||
|
AR = ar
|
||||||
|
endif
|
||||||
|
RESCOMP = windres
|
||||||
|
INCLUDES += -Isrc -Iinclude -Ibuild/external/raylib-master/src -Ibuild/external/raylib-master/src/external/miniaudio
|
||||||
|
FORCE_INCLUDE +=
|
||||||
|
ALL_CPPFLAGS += $(CPPFLAGS) -MD -MP $(DEFINES) $(INCLUDES)
|
||||||
|
ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)
|
||||||
|
LINKCMD = $(CXX) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS)
|
||||||
|
define PREBUILDCMDS
|
||||||
|
endef
|
||||||
|
define PRELINKCMDS
|
||||||
|
endef
|
||||||
|
define POSTBUILDCMDS
|
||||||
|
endef
|
||||||
|
|
||||||
|
ifeq ($(config),debug_x64)
|
||||||
|
TARGETDIR = bin/Debug
|
||||||
|
TARGET = $(TARGETDIR)/rspektrum
|
||||||
|
OBJDIR = obj/x64/Debug/rspektrum
|
||||||
|
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -g -std=c17
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -g -std=c++17
|
||||||
|
LIBS += bin/Debug/libraylib.a -lpthread -lm -ldl -lrt -lX11
|
||||||
|
LDDEPS += bin/Debug/libraylib.a
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64
|
||||||
|
|
||||||
|
else ifeq ($(config),debug_x86)
|
||||||
|
TARGETDIR = bin/Debug
|
||||||
|
TARGET = $(TARGETDIR)/rspektrum
|
||||||
|
OBJDIR = obj/x86/Debug/rspektrum
|
||||||
|
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -g -std=c17
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -g -std=c++17
|
||||||
|
LIBS += bin/Debug/libraylib.a -lpthread -lm -ldl -lrt -lX11
|
||||||
|
LDDEPS += bin/Debug/libraylib.a
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32
|
||||||
|
|
||||||
|
else ifeq ($(config),debug_arm64)
|
||||||
|
TARGETDIR = bin/Debug
|
||||||
|
TARGET = $(TARGETDIR)/rspektrum
|
||||||
|
OBJDIR = obj/ARM64/Debug/rspektrum
|
||||||
|
DEFINES += -DDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wshadow -g -std=c17
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wshadow -g -std=c++17
|
||||||
|
LIBS += bin/Debug/libraylib.a -lpthread -lm -ldl -lrt -lX11
|
||||||
|
LDDEPS += bin/Debug/libraylib.a
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS)
|
||||||
|
|
||||||
|
else ifeq ($(config),release_x64)
|
||||||
|
TARGETDIR = bin/Release
|
||||||
|
TARGET = $(TARGETDIR)/rspektrum
|
||||||
|
OBJDIR = obj/x64/Release/rspektrum
|
||||||
|
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -O2 -std=c17
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m64 -Wshadow -O2 -std=c++17
|
||||||
|
LIBS += bin/Release/libraylib.a -lpthread -lm -ldl -lrt -lX11
|
||||||
|
LDDEPS += bin/Release/libraylib.a
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib64 -m64 -s
|
||||||
|
|
||||||
|
else ifeq ($(config),release_x86)
|
||||||
|
TARGETDIR = bin/Release
|
||||||
|
TARGET = $(TARGETDIR)/rspektrum
|
||||||
|
OBJDIR = obj/x86/Release/rspektrum
|
||||||
|
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -O2 -std=c17
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -m32 -Wshadow -O2 -std=c++17
|
||||||
|
LIBS += bin/Release/libraylib.a -lpthread -lm -ldl -lrt -lX11
|
||||||
|
LDDEPS += bin/Release/libraylib.a
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -L/usr/lib32 -m32 -s
|
||||||
|
|
||||||
|
else ifeq ($(config),release_arm64)
|
||||||
|
TARGETDIR = bin/Release
|
||||||
|
TARGET = $(TARGETDIR)/rspektrum
|
||||||
|
OBJDIR = obj/ARM64/Release/rspektrum
|
||||||
|
DEFINES += -DNDEBUG -DPLATFORM_DESKTOP -DGRAPHICS_API_OPENGL_33 -D_GLFW_X11
|
||||||
|
ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -Wshadow -O2 -std=c17
|
||||||
|
ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -Wshadow -O2 -std=c++17
|
||||||
|
LIBS += bin/Release/libraylib.a -lpthread -lm -ldl -lrt -lX11
|
||||||
|
LDDEPS += bin/Release/libraylib.a
|
||||||
|
ALL_LDFLAGS += $(LDFLAGS) -s
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Per File Configurations
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
|
||||||
|
# File sets
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
GENERATED :=
|
||||||
|
OBJECTS :=
|
||||||
|
|
||||||
|
GENERATED += $(OBJDIR)/spectrogram.o
|
||||||
|
OBJECTS += $(OBJDIR)/spectrogram.o
|
||||||
|
|
||||||
|
# Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
@:
|
||||||
|
|
||||||
|
$(TARGET): $(GENERATED) $(OBJECTS) $(LDDEPS) | $(TARGETDIR)
|
||||||
|
$(PRELINKCMDS)
|
||||||
|
@echo Linking rspektrum
|
||||||
|
$(SILENT) $(LINKCMD)
|
||||||
|
$(POSTBUILDCMDS)
|
||||||
|
|
||||||
|
$(TARGETDIR):
|
||||||
|
@echo Creating $(TARGETDIR)
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) mkdir -p $(TARGETDIR)
|
||||||
|
else
|
||||||
|
$(SILENT) mkdir $(subst /,\\,$(TARGETDIR))
|
||||||
|
endif
|
||||||
|
|
||||||
|
$(OBJDIR):
|
||||||
|
@echo Creating $(OBJDIR)
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) mkdir -p $(OBJDIR)
|
||||||
|
else
|
||||||
|
$(SILENT) mkdir $(subst /,\\,$(OBJDIR))
|
||||||
|
endif
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo Cleaning rspektrum
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) rm -f $(TARGET)
|
||||||
|
$(SILENT) rm -rf $(GENERATED)
|
||||||
|
$(SILENT) rm -rf $(OBJDIR)
|
||||||
|
else
|
||||||
|
$(SILENT) if exist $(subst /,\\,$(TARGET)) del $(subst /,\\,$(TARGET))
|
||||||
|
$(SILENT) if exist $(subst /,\\,$(GENERATED)) del /s /q $(subst /,\\,$(GENERATED))
|
||||||
|
$(SILENT) if exist $(subst /,\\,$(OBJDIR)) rmdir /s /q $(subst /,\\,$(OBJDIR))
|
||||||
|
endif
|
||||||
|
|
||||||
|
prebuild: | $(OBJDIR)
|
||||||
|
$(PREBUILDCMDS)
|
||||||
|
|
||||||
|
ifneq (,$(PCH))
|
||||||
|
$(OBJECTS): $(GCH) | $(PCH_PLACEHOLDER)
|
||||||
|
$(GCH): $(PCH) | prebuild
|
||||||
|
@echo $(notdir $<)
|
||||||
|
$(SILENT) $(CXX) -x c++-header $(ALL_CXXFLAGS) -o "$@" -MF "$(@:%.gch=%.d)" -c "$<"
|
||||||
|
$(PCH_PLACEHOLDER): $(GCH) | $(OBJDIR)
|
||||||
|
ifeq (posix,$(SHELLTYPE))
|
||||||
|
$(SILENT) touch "$@"
|
||||||
|
else
|
||||||
|
$(SILENT) echo $null >> "$@"
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
$(OBJECTS): | prebuild
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# File Rules
|
||||||
|
# #############################################
|
||||||
|
|
||||||
|
$(OBJDIR)/spectrogram.o: src/spectrogram.c
|
||||||
|
@echo "$(notdir $<)"
|
||||||
|
$(SILENT) $(CC) $(ALL_CFLAGS) $(FORCE_INCLUDE) -o "$@" -MF "$(@:%.o=%.d)" -c "$<"
|
||||||
|
|
||||||
|
-include $(OBJECTS:%.o=%.d)
|
||||||
|
ifneq (,$(PCH))
|
||||||
|
-include $(PCH_PLACEHOLDER).d
|
||||||
|
endif
|
||||||
+1209
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user