Disable Symbol scanner 'beep' on successful scan? - c#

I'm working with a motorolla MC55 which scans and beeps on a successful scan, I need to disable that feature so that it doesn't play any sounds at all on a scan.
Any ideas how I can accomplish this?

Scan the following barcodes to enable/disable the beep.

Try this:
Symbol.Barcode.Reader reader = new Symbol.Barcode.Reader();
// Other initialization
reader.Parameters.Feedback.Success.BeepTime = 0;

You may want to just adjust the level of the sound:
Symbol.Audio.Device MyDevice = (Symbol.Audio.Device)Symbol.StandardForms.SelectDevice.Select(
Symbol.Audio.Controller.Title,
Symbol.Audio.Device.AvailableDevices);
Symbol.Audio.StandardAudio MyAudioDevice = new Symbol.Audio.StandardAudio(MyDevice);
// set the volume of the audio from the settings file.
MyAudioDevice.BeeperVolume = NewLevel;
// set the audio device to nothing
MyAudioDevice.Dispose();
MyAudioDevice = null;
MyDevice = null;

Related

C# How can I get the masterpeek value from a specific application with Naudio

I'm fairly new to C#. In my program, I can measure the masterpeek value of the computer. But what I need right now is only the masterpeek value of a particular application, rather than the masterpeek value of the computer. For example chrome.exe masterpeek value.
I'm importing audio output devices into ComboBox.
var deviceEnum = new MMDeviceEnumerator();
var devices = deviceEnum.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active);
foreach (var dev in devices)
{
comboDevices.Items.Add(dev.FriendlyName);
}
comboDevices.SelectedIndex = 0;
deviceEnum.Dispose();
I choose the output device.
using (MMDeviceEnumerator deviceEnum = new MMDeviceEnumerator())
{
var deviceList = deviceEnum.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active).ToList();
device = deviceList[comboDevices.SelectedIndex];
}
I can show the masterpeek value with the progressbar.
if (comboDevices.SelectedItem != null)
{
var mpValue = Math.Round(device.AudioMeterInformation.MasterPeakValue * 100);
progressAudioMeter.Value = Convert.ToInt32(mpValue);
}
But now what I want to do exactly is the volume value of a particular application instead of the total volume value. For example chrome.exe
An example image from the audio mixer
I did some research and couldn't find exactly what I wanted. Can you help me? I don't know how I can do this.

How to get all enabled keyboard in xamarin.forms with C#

Good day,
in android phone -> virtual keyboard, system list all the enabled keyboards in this page, how can i get all enabled keyboards type with C# in my Xamarin.forms APP?
Thanks!
Roll
In Android, you could use InputDevice.
InputDevice: https://developer.android.com/reference/android/view/InputDevice
You could try the code below:
int[] devicesIds = InputDevice.GetDeviceIds();
foreach (var item in devicesIds)
{
//Check the device you want
InputDevice device = InputDevice.GetDevice(item);
//device.getName must to have virtual
var s = device.Name;
var b = device.KeyboardType;
}
You could use DependencyService to call this in Xamarin.Forms.
DependencyService: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/dependency-service/introduction
thanks your reply, i try the way you suggested, but the returned value was not i want...
i found another post here, use that way and finally get the things i want,
here is my code to share:
InputMethodManager manager = (InputMethodManager)context.GetSystemService(Context.InputMethodService);
IList<InputMethodInfo> mInputMethodProperties = manager.EnabledInputMethodList;
IEnumerator<InputMethodInfo> imi = mInputMethodProperties.GetEnumerator();
while (imi.MoveNext())
{
InputMethodInfo inputInfo = imi.Current;
var iN = inputInfo.ServiceName;
}
Best Regards & thanks
Roll

Play audio at two different Audiodevices simultaneously with Naudio

My question is similar to one here :
Play audio to two different Audiodevices simultaneously with Naudio
But i ask it here again since it has not been answered clearly in the link above.
I also have it at:
Play sound in both speaker and headset wpf
Inspiration from :
Play a sound in a specific device with C#
I am adding source code and adding the NAudio tag here as well.
I have an wpf application and i am using the soundPlayer class to play sound (for eg ringtone). Currently the tone plays either on speakers or on the headset (if its plugged in). I would like the application to play the tone on speaker even when the headsets are plugged in. I know there are ways to do this in android, but couldn't find any in wpf. I would also like an UI for the user to choose the devices in which he would like to hear sound. Any help is appreciated. Thanks !
public void detectDevices()
{
int waveOutDevices = WaveOut.DeviceCount;
switch (waveOutDevices)
{
case 1:
var wave1 = new WaveOut();
wave1.DeviceNumber = 0;
playSound(0);
break;
case 2:
var wave2 = new WaveOut();
wave2.DeviceNumber = 0;
playSound(0);
var wave3 = new WaveOut();
wave3.DeviceNumber = 1;
playSound(1);
break;
}
}
public void playSound(int deviceNumber)
{
disposeWave();// stop previous sounds before starting
waveReader = new NAudio.Wave.WaveFileReader(fileName);
var waveOut = new NAudio.Wave.WaveOut();
waveOut.DeviceNumber = deviceNumber;
output = waveOut;
output.Init(waveReader);
output.Play();
}
public void disposeWave()
{
if (output != null)
{
if (output.PlaybackState == NAudio.Wave.PlaybackState.Playing)
{
output.Stop();
output.Dispose();
output = null;
}
}
if (wave != null)
{
wave.Dispose();
wave = null;
}
}
case eSelector.startIncomingRinging:
fileName = ("Ring.wav");
detectDevices();
I still hear ringtone just in one device (either in headset or speakers) using the code above.
You need two instances of WaveOut, one for each soundcard. And then the simplest way if you are playing from file, is to also have two instances of WaveFileReader. You can't easily synchronize them I'm afraid, you'll just have to start them both playing together and hope for the best.
The wave1, wave2 and wave3 classes in your code above do abosolutely nothing. The audio will be played with the WaveOut device you create in playSound. You seem to have a single class property called output and another called waveReader, when you need two of each.

How to use function D3DXSaveSurfaceToFile() in C#

I use directx 9 to build model.
I want to save it to bmp file. I found the function D3DXSaveSurfaceToFile()
But I do not know how to use it in C#.
How can I use it?
Unfortunately, there is no such function in c#.
Try the following code instead:
try
{
// initialize D3D device
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
Device myDevice = new
Device(0,DeviceType.Hardware,this,CreateFlags.SoftwareVertexProcessing,presentParams);
// create a surface the size of screen,
// format had to be A8R8G8B8, as the GetFrontBufferData returns
// only memory pool types allowed are Pool.Scratch or Pool.System memory
Surface mySurface =
myDevice.CreateOffscreenPlainSurface(SystemInformation.PrimaryMonitorSize.Width,SystemInformation.PrimaryMonitorSize.Height,Format.A8R8G8B8,Pool.SystemMemory);
//Get the front buffer.
myDevice.GetFrontBufferData(0,mySurface);
//saves surface to file
SurfaceLoader.Save("surface.bmp",ImageFileFormat.Bmp,mySurface);
}
catch
{
//whatever
}

Storing RTSP to a file location

I am able to stream an rtsp on windows 7 64 bit machine through C# Winform application. This is the library i used - VLCDotNet and here is the code sample to play the RTSP stream:
LocationMedia media = new LocationMedia(#"rtsp://192.168.137.73:554/live.sdp");
vlcControl1.Media = media;
vlcControl1.Play();
I would like to store the streams to a file in my PC on a button click and stop the same with another button. How do i achieve this?
Here is the code:
Vlc.DotNet.Core.Medias.MediaBase media1
= new Vlc.DotNet.Core.Medias.PathMedia("rtsp://192.168.137.73:554/live.sdp");
media.AddOption(":sout=#transcode{vcodec=theo,vb=800,
scale=1,acodec=flac,ab=128,channels=2,samplerate=44100}:std{access=file,mux=ogg,
dst=D:\\123.mp4}");
VlcControl control = new VlcControl();
control.Media = media;
control.Play();
VlcContext.StartupOptions.IgnoreConfig = true;
VlcContext.StartupOptions.LogOptions.LogInFile = true;
VlcContext.StartupOptions.LogOptions.ShowLoggerConsole = true;
VlcContext.StartupOptions.LogOptions.Verbosity = VlcLogVerbosities.Debug;
// Disable showing the movie file name as an overlay
// VlcContext.StartupOptions.AddOption("--no-video-title-show");
// VlcContext.StartupOptions.AddOption("--no-audio");
VlcContext.StartupOptions.AddOption("--rtsp-tcp"); //this line was important to make this work
As of Vlc.DotNet.Core 2.1.62, The way to do this is use the extra opts param of the .Play on the vlc control.
var opts = new string[] { #":sout=file/ogg:C:\video.ogg" };
vlc.MediaPlayer.Play(new Uri(videoURI), opts);
`

Categories