Add cabpack generation with default mode and file organization

This commit is contained in:
Bastian Bührig
2025-12-02 14:28:39 +01:00
parent 1954312833
commit 73cff7ea08
4 changed files with 1076 additions and 171 deletions

View File

@@ -36,6 +36,15 @@ func toMono(data []float64, channels int) []float64 {
// ReadWAVFile reads a WAV file and returns its PCM data as float64 (resampled to 96kHz mono)
func ReadWAVFile(filePath string) (*WAVData, error) {
// Check if path is a directory
info, err := os.Stat(filePath)
if err != nil {
return nil, fmt.Errorf("failed to access file %s: %w", filePath, err)
}
if info.IsDir() {
return nil, fmt.Errorf("path %s is a directory, not a WAV file", filePath)
}
file, err := os.Open(filePath)
if err != nil {
return nil, fmt.Errorf("failed to open file %s: %w", filePath, err)