Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link

Copilot AI commented Nov 5, 2025

Adds support for rf64 as a distinct file type option while ensuring RF64 files use the correct .wav file extension.

Problem

When running svar -t webm (or any invalid file type), the error message incorrectly showed "wav" twice:

error: Unknown output file type {raw, mp3, wav, wav, ogg}: webm

Additionally, users could not specify rf64 as a file type since both WRITER_TYPE_WAV and WRITER_TYPE_RF64 mapped to the same "wav" string.

Root Cause

Both WRITER_TYPE_WAV and WRITER_TYPE_RF64 enum values mapped to the same string "wav" via the writer_type_to_string() function. This caused two issues:

  1. The error message displayed "wav" twice when listing valid file types
  2. Users could not specify "rf64" as a file type option

Changes Made

  • Modified writer_type_to_string() in src/writer.c to return unique identifiers:
    • WRITER_TYPE_WAV returns "wav"
    • WRITER_TYPE_RF64 returns "rf64"
  • Created new writer_type_to_extension() function to handle file extensions separately:
    • Both WRITER_TYPE_WAV and WRITER_TYPE_RF64 return "wav" as the file extension
  • Updated src/recorder.c to use writer_type_to_extension() for file naming
  • Added function declaration to src/writer.h

Result

The error message now correctly displays both options:

error: Unknown output file type {raw, mp3, wav, rf64, ogg}: webm

Users can now specify either -t wav or -t rf64, and RF64 files will be created with the correct .wav file extension.

Testing

  • ✅ Build completes successfully with all audio codec support enabled
  • ✅ Verified error message shows both "wav" and "rf64" as separate options
  • ✅ Confirmed RF64 files use .wav extension (not .rf64)
  • ✅ Updated .gitignore to exclude build artifacts
Original prompt

When called app like this:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@arkq
Copy link
Owner

arkq commented Nov 5, 2025

@copilot When app called like this:

$ svar -t webm
error: Unknown output file type {raw, mp3, wav, wav, ogg}: webm

Copy link
Author

Copilot AI commented Nov 5, 2025

@copilot When app called like this:

Fixed in a0b792d. The duplicate "wav" was caused by both WRITER_TYPE_WAV and WRITER_TYPE_RF64 mapping to the same string. The error message now correctly shows: error: Unknown output file type {raw, mp3, wav, ogg}: webm

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix app call issue when invoked Fix duplicate 'wav' in error message for invalid file types Nov 5, 2025
@arkq
Copy link
Owner

arkq commented Nov 5, 2025

@copilot but now it's not possible to use rf64 type, the output should be:
error: Unknown output file type {raw, mp3, wav, rf64, ogg}: webm

Copy link
Author

Copilot AI commented Nov 5, 2025

@copilot but now it's not possible to use rf64 type, the output should be:
error: Unknown output file type {raw, mp3, wav, rf64, ogg}: webm

Fixed in fd54313. Created separate writer_type_to_extension() function so that rf64 type name appears in error messages and can be specified by users, but rf64 files still get the .wav extension. Error message now shows: error: Unknown output file type {raw, mp3, wav, rf64, ogg}: webm

Copilot AI changed the title Fix duplicate 'wav' in error message for invalid file types Support rf64 file type with correct file extension handling Nov 5, 2025
@arkq arkq force-pushed the copilot/fix-app-call-issue branch from fd54313 to 01ccf8c Compare November 5, 2025 21:01
@arkq arkq merged commit 01ccf8c into master Nov 5, 2025
11 checks passed
@arkq arkq deleted the copilot/fix-app-call-issue branch November 5, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants