-
Notifications
You must be signed in to change notification settings - Fork 70
Add microphone input support #499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Implements GitHub issue #175, adding support for connecting the browser's microphone to the BBC Micro's analogue port to support software like MicroMike. Key changes: - Create AnalogueSource interface for ADC inputs - Implement GamepadSource to replace the existing hardcoded gamepad handling - Add MicrophoneInput implementation using Web Audio API - Refactor ADC to use multiple sources - Add UI controls in the configuration dialog - Add URL parameter support for settings persistence 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove debug console logs from production code - Maintain explicit channel sources in ADC implementation - Fix test to match channel used in test case 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove separate checkbox for enabling microphone input - Always show microphone settings with disabled option - Centralize microphone handling in Config class - Simplify channel selection with proper disabling option - Add better status messaging for microphone permissions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for using the microphone as an analogue input source for the emulator's ADC, along with corresponding UI updates and configuration handling.
- Introduces a new MicrophoneInput class for managing audio context and microphone data.
- Integrates microphone channel selection into the configuration panel and main emulator setup.
- Updates the configuration and UI (dropdown menu) to allow users to select and configure the microphone channel.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/microphone-input.js | Implements the MicrophoneInput class with audio initialisation and value computation |
src/main.js | Integrates microphone input into the emulator pipeline and handles permissions/resuming the audio context |
src/config.js | Adds configuration support for selecting microphone channels |
index.html | Adds a new dropdown menu for microphone channel selection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds support for using the system microphone as an analogue source for the BBC Micro’s ADC, complete with UI controls and permission handling.
- Introduces a new
MicrophoneInput
class for capturing and scaling audio data. - Integrates microphone channel selection into the configuration panel and URL parameters.
- Displays permission status and error messages in the UI.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/microphone-input.js | Implements MicrophoneInput with init, value scaling, and cleanup |
src/main.js | Imports and configures microphone source, handles URL & permissions |
src/config.js | Adds click handler & setter for microphoneChannel |
index.html | Adds dropdown and status text for microphone channel selection |
Comments suppressed due to low confidence (1)
src/microphone-input.js:102
- Consider adding unit tests for
getValue
, mocking the analyser to verify scaling and 16-bit mapping behavior.
getValue(_channel) {
|
||
// Scale up the signal using a configurable scaling factor | ||
// This can be adjusted based on testing | ||
const scaleFactor = 800; // Amplify the signal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Extract the magic number 800
into a named constant or configurable property to clarify its purpose and make tuning easier.
const scaleFactor = 800; // Amplify the signal | |
const scaleFactor = DEFAULT_SCALE_FACTOR; // Amplify the signal |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <[email protected]>
Summary
Test plan
🤖 Generated with Claude Code