Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6251293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:35:18+00:00 2026-05-24T13:35:18+00:00

How can i mute volume with SDL in C++? The speakers are connected into

  • 0

How can i mute volume with SDL in C++?
The speakers are connected into the headphone jack socket. If volume unmuted i can hear background noise, but when i mute (with ‘amixer set Headphone mute’) it stops. I tried Mix_VolumeMusic() and Mix_Volume() to set the volume to zero to achieve the same, but it just change the music voulme, the noise is still there.

Environment:
Debian Sqeeze
Package: libsdl1.2-dev
Version: 1.2.14-6.1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T13:35:18+00:00Added an answer on May 24, 2026 at 1:35 pm

    I don’t think SDL has a mute function beyond what you’re doing, although I’m not even seeing those functions in the documentation on the libsdl.org website. From looking at the API, I’m guessing it just controls an internal software mixer (PCM volume control is in the SDL 1.3 wishlist), but you can check this by adjusting the volume and bringing up the system volume settings with alsamixer (<Esc> key to exit). A dirty workaround would be to use a system call to execute the amixer program. You’ll need to have #include <stdlib.h> and run system("amixer set Headphone mute");. Beyond that, I would look into something else like alsa for a real mute and write your own mute function, so it can be easily replaced later. If you need to support Windows, you could write your #ifdef _WIN32/#else/#endif block inside it.

    While I don’t advocate fixing software problems with hardware, it looks like a better sound card might be in order. Also, you’ll probably get better sound if you’re using the rear jacks on a computer than the front ones. I’ve always picked up a lot of noise from the thin sound cables that plug into the motherboard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone please help quickly mute or unmute the stage volume in Flash CS3
How can I mute my user's Windows volume (the one sitting on the taskbar
Can I turn down volume or possibly mute the computer while they are on
What class is referenced in the volume/mute button popup? Sorry for the awful question
I have 2 prefs - a song title and the audio state(mute or volume)
I'd like to be able to mute activity of my app if I can
Can somebody give me some tips about storing a lot of data into a
How can i mute | unmute a windows mobile pocket pc device (i'm using
Anyone know how can I increase/decrease the volume of the sound from mediaplayer by
Is there a way I can mute all my printf statements conditionally, however, without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.