Skip to content
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

Switch to PortAudio #76

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Cuda-Chen
Copy link
Contributor

@Cuda-Chen Cuda-Chen commented Feb 23, 2025

Switch to PortAudio for cross-platform and cross backend compatibility.

Yet, there are two known limitations for current sound playback implementation:

  1. The last period of sound is lost.
  2. You cannot play sound twice or the device will crash thus
    whole system crashes.

Summary by Bito

This pull request integrates PortAudio to enhance cross-platform audio playback, replacing the previous CNFA submodule. It updates the Makefile for better build configurations, addresses issues like sound loss and system crashes, and improves PCM stream handling and compatibility, while also updating documentation.

Unit tests added: False

Estimated effort to review (1-5, lower is better): 2

@jserv
Copy link
Collaborator

jserv commented Feb 23, 2025

You should explain the motivation and benefit for the migration of PortAudio.

@Cuda-Chen Cuda-Chen force-pushed the switch-to-portaudio branch 3 times, most recently from fd58de0 to 0d81990 Compare February 23, 2025 04:39
Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

4 similar comments
Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

@jserv
Copy link
Collaborator

jserv commented Feb 24, 2025

Build failure:

  LD	semu
/usr/bin/ld: cannot find -lpulse: No such file or directory
collect2: error: ld returned 1 exit status

@sysprog21 sysprog21 deleted a comment from bito-code-review bot Feb 24, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Feb 24, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Feb 24, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Feb 24, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Feb 24, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Feb 24, 2025
@Cuda-Chen
Copy link
Contributor Author

Build failure:

  LD	semu
/usr/bin/ld: cannot find -lpulse: No such file or directory
collect2: error: ld returned 1 exit status

Thanks for the reminder!
I am still working on this issue.

@Cuda-Chen Cuda-Chen force-pushed the switch-to-portaudio branch from f26f174 to e331ed7 Compare March 1, 2025 08:47
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Mar 1, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Mar 1, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Mar 1, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Mar 1, 2025
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Mar 1, 2025
Makefile Outdated
git submodule update --init portaudio
$(PORTAUDIOLIB): portaudio/Makefile
@cd $(dir $<) && ./configure
@cd $(dir $<) && $(MAKE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with $(MAKE) -C $(dir $<).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jserv ,
As the $(MAKE) -C $(dir $<) have problems with Automake project, so I use a solution of @cd $(dir $<) with the help of LLM.
However, there might be some solutions exist. I will try to figure out.

@Cuda-Chen Cuda-Chen force-pushed the switch-to-portaudio branch from e331ed7 to e7184f0 Compare March 1, 2025 11:56
goto early_continue; \
} \
\
if (WRITE) { \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using IIF macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jserv ,

As I don't find any IIF macro in semu repo, the IIF macro you mean is the Linux Kernel networking code for extracting the index of the network interface?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jserv ,
Thanks for the hint! I will take as a reference.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually, the semu project will be merged into rv32emu, meaning that you can utilize the existing helper macros from rv32emu.

@jserv jserv changed the title [WIP] Switch to PortAudio Switch to PortAudio Mar 1, 2025
Switch to PortAudio for cross-platform and cross backend compatibility.

Yet, there are two known limitations for current sound playback implementation:
1. The last period of sound is lost.
2. You cannot play sound twice or the device will crash thus
whole system crashes.
@Cuda-Chen Cuda-Chen force-pushed the switch-to-portaudio branch from e7184f0 to a73d91d Compare March 1, 2025 12:14
@Cuda-Chen Cuda-Chen marked this pull request as ready for review March 1, 2025 12:14
@jserv jserv marked this pull request as draft March 1, 2025 14:12
@sysprog21 sysprog21 deleted a comment from bito-code-review bot Mar 1, 2025
Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

Copy link

Code Review Agent Run Status

  • Limitations and other issues: ❌ Failure - The AI Code Review Agent skipped reviewing this change because it is configured to exclude certain pull requests based on the source/target branch or the pull request status. You can change the settings here, or contact the agent instance creator at jserv.tw@gmail.com.

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