I'm trying to write an application using OpenTK.OpenAL to wrap openal, and I'm concerned about how I should handle a hypothetical situation where I unplug my default audio output device (such as headphones). When I try to open my default device, it labels it "OpenAL Soft" instead of the actual device name, after opening it. And it doesn't seem to respond at all when I unplug the headphones I was using, and once they're plugged back in it just is completely quiet.
I just got done looking through some of OpenTK's OpenAL code. It seems like OpenTK is being as true to OpenAL as possible, they're just wrapping OpenAL calls.
For something like a hardware disconnect event, you'd have to listen for that event from the OS. I don't believe that OpenAL has this function natively. On Windows you'd probably want to look at WM_DEVICECHANGE to determine if an audio device connected or disconnected, and from there set the device like you normally would in OpenTK.
I need to make an app for windows mobile devices which will play and pause media despite of the current player in use. Are there any system calls I can use or any API that I can refer?
Thank you in advance.
Use background audio player to achive your functionality, here is step by step implementation of your query
click here:
Is it possible to play system beep alert sound.I do not want to add the sound file to my resource bundle and i want to access the apple system sounds and play it wherever needed.
Try this
AudioServicesPlaySystemSound(1103);
to vibrate
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
For list of sounds
http://iphonedevwiki.net/index.php/AudioServices
Are there any built-in sounds that can be used while developing metro-style apps? I need to play some simple sounds like a click or coin-tossing etc. Am I required to add a mp3 file to my app, or are there some simple sounds that can be used out-of-the-box?
I have not been able to find any way to play "system" sounds from a WinRT app. There is one minor exception, which you can control what sound is played when a Toast appears.
http://msdn.microsoft.com/en-us/library/windows/apps/Hh761492.aspx
Other than that, I don't believe it's possible.
I am playing a small .wav file using the AudioToolBox.
AudioServicesPlaySystemSound (soundFileObject);
But sometimes it is not playing.
What is the reason?
If you're in the Simulator, make sure that in System Prefrences → Sound, that "Play user interface sound effects" is not turned off. If you're on the device, check that the ringer switch is not set to silent.
Maybe it's this issue? AudioServicesDisposeSystemSoundID() will stop the sound work before playing.
Building on user1056521's answer, use the following code:
AudioServicesPlaySystemSoundWithCompletion(soundID, ^{
AudioServicesDisposeSystemSoundID(soundID);
});
where soundID is the SystemSoundID value you got when you called AudioServicesCreateSystemSoundID().
The completion block ensures the sound was played and completed playing before it is disposed of.
System Preferences → Sound → [x] Play user interface sound — this checkbox helped for me too, it solved the AudioServicesPlaySystemSound(_) issue. But worth noting was that the sample Apple Xcode project "SysSound" worked just fine without checking this box. I'm using the Xcode 4.4.1 for creating own app from scratch. Could there be differencies between projects created with older and newer Xcode tools?
For those who visit this question later,
AudioServicesPlaySystemSoundID()'s volume is based on system Ringer in range of 0.1 ~ 1.0, not mediaVolume
AudioServicesPlayAlertSoundID()'s volume is based on system Ringer in range of approximately 0.3 ~ 1.0
On the device, go into settings and turn up the volume on Sounds->Ringer and Alerts