Skip to content
This repository was archived by the owner on Dec 24, 2025. It is now read-only.
Merged
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
16 changes: 0 additions & 16 deletions .devcontainer/devcontainer.json

This file was deleted.

7 changes: 6 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: install alsa-utils
run: |
sudo apt-get -y update
sudo apt-get -y install alsa-utils libasound2-dev

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
go-version: '1.24'

- name: Build
run: make setup build
Expand Down
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.PHONY: all
all: setup fmt build test

.PHONY: setup
setup:
go mod download
go mod tidy

.PHONY: build
build: clean
@echo "==> Building Packages <=="
go build -v ./...
@echo "==> Building cli <=="
go build -o dist/cli ./cmd/impulse/...

.PHONY: test
test:
@echo "==> running Go tests <=="
go test -race ./...

.PHONY: fmt
fmt:
go fmt ./...

.PHONY: clean
clean:
@echo "==> Cleaning dist/ <=="
rm -fr dist/*
2 changes: 1 addition & 1 deletion cmd/impulse/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ func loadModule(filePath string) (module.Module, error) {
return nil, fmt.Errorf("failed to load module: %v", err)
}
return m, nil
}
}
2 changes: 1 addition & 1 deletion cmd/impulse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,4 @@ func main() {
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
}
Binary file added examples/volume-envelope.xm
Binary file not shown.
14 changes: 7 additions & 7 deletions internal/player/audioplayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ func (w *WavPlayer) writeWavHeader() {

// "fmt " sub-chunk
w.writer.Write([]byte("fmt "))
binary.Write(w.writer, binary.LittleEndian, uint32(16)) // Sub-chunk size
binary.Write(w.writer, binary.LittleEndian, uint16(1)) // Audio format (PCM)
binary.Write(w.writer, binary.LittleEndian, uint16(w.opts.NumChannels)) // Num channels
binary.Write(w.writer, binary.LittleEndian, uint32(w.opts.SampleRate)) // Sample rate
binary.Write(w.writer, binary.LittleEndian, uint32(16)) // Sub-chunk size
binary.Write(w.writer, binary.LittleEndian, uint16(1)) // Audio format (PCM)
binary.Write(w.writer, binary.LittleEndian, uint16(w.opts.NumChannels)) // Num channels
binary.Write(w.writer, binary.LittleEndian, uint32(w.opts.SampleRate)) // Sample rate
binary.Write(w.writer, binary.LittleEndian, uint32(w.opts.SampleRate*w.opts.NumChannels*w.opts.BitDepth)) // Byte rate
binary.Write(w.writer, binary.LittleEndian, uint16(w.opts.NumChannels*w.opts.BitDepth)) // Block align
binary.Write(w.writer, binary.LittleEndian, uint16(w.opts.BitDepth*8)) // Bits per sample
binary.Write(w.writer, binary.LittleEndian, uint16(w.opts.NumChannels*w.opts.BitDepth)) // Block align
binary.Write(w.writer, binary.LittleEndian, uint16(w.opts.BitDepth*8)) // Bits per sample

// "data" sub-chunk
w.writer.Write([]byte("data"))
binary.Write(w.writer, binary.LittleEndian, uint32(0)) // Placeholder for data size
}
}
3 changes: 1 addition & 2 deletions internal/player/protracker_ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package player

import "github.com/jesseward/impulse/pkg/module"


var periodTable = [16 * 36]uint16{
856, 808, 762, 720, 678, 640, 604, 570, 538, 508, 480, 453, 428, 404, 381, 360, 339, 320, 302, 285, 269, 254, 240, 226, 214, 202, 190, 180, 170, 160, 151, 143, 135, 127, 120, 113,
850, 802, 757, 715, 674, 637, 601, 567, 535, 505, 477, 450, 425, 401, 379, 357, 337, 318, 300, 284, 268, 253, 239, 225, 213, 201, 189, 179, 169, 159, 150, 142, 134, 126, 119, 113,
Expand Down Expand Up @@ -356,4 +355,4 @@ func (t *ProtrackerTicker) RenderChannelTick(p *Player, state *channelState, tic
state.samplePos += step
}
}
}
}
1 change: 0 additions & 1 deletion pkg/protracker/protracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ func (s *Sample) Panning() byte {
return 128 // Protracker is mono
}


func (s *Sample) LoopEnd() uint32 {
return uint32(s.loopStart + s.loopLength)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/xm/xm.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ func (s *Sample) Panning() byte {
return s.panning
}


func (s *Sample) LoopEnd() uint32 {
return s.loopStart + s.loopLength
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/xm/xm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ func TestRead(t *testing.T) {
if err != nil {
t.Fatalf("Read() failed: %v", err)
}
}
}