How to set Left, Center and Right headphone as Default iPhone? - iphone

I am using AudioComponentInstance for listing audio from Mice and play it in headphone directly. Now, I have to play audio if left, right or center as we have in default iPhone settings.
As there is a property called “pan” in AVAudioPlayer to set volume for left, center and right. Capture sound is played in headphone using AudioBuffer. I have to do some calculation and modification in it. I did research on it. But not getting anything. Is there any way that I can do the same thing in AudioComponentInstance?

Related

How can I use two Audio Listeners?

The problem is that I have a character controller the player with a camera and the camera have a Audio Listener.
But I also have another camera the Main Camera that also have a Audio Listener.
The Main Camera is using Cinemachine Brain and using virtual cameras.
If I disable the Audio Listener on the Main Camera the character in my cut scene will walk to a door/s but when the door/s will open there will be no sound of the door open.
And if I disable the player controller camera Audio Listener then when I will move my player around to door/s there will be no sound when the player enter a door.
And I need both to work. While the character in the cut scene is walking and enter a door and the door is open the player can walk around.
Screenshot of the player controller camera and the audio listener:
And this is the Main Camera Audio Listener screenshot:
So now when running the game the character medea_m_arrebola is walking by animation through a door and there is a sound of the door open and close.
This is part of a cut scene that work in the background I mean the cut scene camera is not enabled yet but you can hear the audio.
Later I will switch between the cameras to show parts of the cut scene.
But now also the FPSController ( Player ) is working and the player can move around but when he will walk through a door the door will open but there will be no audio sound of the door.
And if I will enable both Audio Listeners I will get this warning message in the console in the editor say that more then 2 audio listeners are enabled....etc.
This sounds like a design issue to me. Unity can only handle one AudioListener at a time. You basically have to construct your cutscene-system to work with what Unity offers, or find some kind of workaround to fit your specific case.
You could try to en-/disable your AudioListeners on the fly or maybe use AudioSources around you player dedicated to directional audio input while in a cutscene. (Like a surround sound setup with empty objects) That way you could simulate two AudioListeners. The best case would be if you reworked your system to use one AudioListener for both inputs.
Maybe try a workaround first but if it does not 100% work as intended do the rework. It's worth it in the long run.

Audio based on player position in unity

I am working on a unity game, and there is a speaker upstairs in a house playing music. I want the music to get louder as I get closer and quieter as I move further away. I have attached an AudioSource to the object and I have selected force to mono.
I have also set the Rolloff min and max distance to 0.2 and 12. Here is my inspector:
However, for some reason the volume of the music stays the same no matter where I am in the house.
In the AudioSource the value of Spatial Blend ist set to 0 (= 2D). This results in a setting used for a 2D game, where an audio simply gets louder if you get closer.
In order to get a 3D sound set it to 1 (= 3D). This enables all you are after.
After doing that you can adjust further how the volume shall falloff with the distance to the object and tweak all the other effects.

unity camera should rotate around static point

When I press the play button for preview, I want the camera to stay static (rotating around a static point) instread of moving around that point in a fixed radius.
I can't find the correct configuration - does anybody know the setting I have to do?
Create a camera object in unity editor (make sure there is only one camera at that depth level).
1.1. If you are using a different camera as well, then delete the audio listener component on the new camera.
Add MouseLook component to your camera (the script comes as default in unity).
2.2 If you cannot find the MouseLook script component, then go to Assets->Import Package -> Characters, and select MouseLook.
Your done, now when you press play you will be able to rotate around with your mouse, but the camera position will be static.

Samsung Smart TV App: setting video frame position (native player)

I am creating an application for the samsung smart tv that plays music clips in native samsung player. And I want scrolling in, so I must moving the video frame (player window). Here are come some problems:
1) Moving video on screen during scrolling is not fluent (On scroll event I get the position of element, where I want to have video frame, and set this position by function SetDisplayArea). Do you have any experience how handle this?
2) When I am scolling video frame out of display, top/bottom of video cannot slide out.
Is it possible show only a part of video frame (something like SetDisplayArea(0, -200, 400, 225))
Thanks for any suggestions.
Which API version you use?
For API 2.5 to change player position and size SetDisplayArea() is the only solution for native player.
I haven't try it but if SetDisplayArea(0, -200, 400, 225) doesn't go out of the screen it is impossible to do.
Do you want to move player while the video is playing? You can't expect fluent animations on SmartTV platforms especially when you want to move huge (memory expensive) elements.
Possible solution for me will be to make image of your video player and make slide-in animation on this image. After that hide image and show real player instead and start playing the video.
I think it should be possible to use SetCropArea() in case of out of screen.

While playing sound acceleration occurs

I am developing one game where I want to move UIImageView based on accelerometer. When I rotate iphone device left to right or right to left the UIImageView have to rotate in particular angle. It's moving also but the problem occurs when I play background sound because of that sound, it sends some acceleration point even if my iphone is idle.
So my UIImageView is also moving. It should not happen. When I decrease the iphone sound volume it works very well. What I have to do for that.
And also if anyone knows how to get acceleration point only when iphone is moving from left to right or right to left. It should not detect when iphone is xz or yz plane.
If anybody knows the solution please reply.
Have you got any filtering on the input from the accelertometer? I would expect the noise from the speaker the accelerometer is picking up is vastly different in amplitude and frequency than the game control.
There is a simple low pass filter in the Apple accelerometer graph sample code.