winmm

Change program's volume on Win 7

对着背影说爱祢 提交于 2020-01-23 05:57:52
问题 I want to change the program's volume (and not master volume). I have the following code right now: DllImport("winmm.dll")] public static extern int waveOutGetVolume(IntPtr hwo, out uint dwVolume); [DllImport("winmm.dll")] public static extern int waveOutSetVolume(IntPtr hwo, uint dwVolume); private void volumeBar_Scroll(object sender, EventArgs e) { // Calculate the volume that's being set int NewVolume = ((ushort.MaxValue / 10) * volumeBar.Value); // Set the same volume for both the left

WinMM Library Issues

一笑奈何 提交于 2020-01-03 05:41:08
问题 I wrote a WinMM library wrapper library that exposes WaveOut and WaveIn classes for the purpose of recording and playing raw audio streams. Everything works great, but in order to follow the operating system specs on how to handle the finished buffers, I added a thread that unprepares the buffers and frees the memory. I also got all of the synchronization down, so that the classes are solid and thread-safe. However, there seems to be a rare issue where I add a buffer to the WaveOut device and

NullReferenceException, no stack trace… where to start?

混江龙づ霸主 提交于 2019-12-29 08:29:33
问题 I have a WPF audio application. Occasionally (and even in the debugger) I'm seeing a NullReferenceException which carries no stack trace information with it. How can one start debugging such an issue? Some background: I'm P/Invoking functions in WinMM.dll which involves registering a callback when calling waveOutOpen [DllImport("winmm.dll")] public static extern MmResult waveOutOpen(out IntPtr phwo, IntPtr uDeviceID, WaveFmt pwfx, WaveCallbk dwCallback, IntPtr dwInstance, int fdwOpen); This

Simple MP3 player, notify not working

℡╲_俬逩灬. 提交于 2019-12-25 02:51:25
问题 C# beginner here. I want to make the player stop immediately after the song ended, so I tried the solution stated here. The problem is player is not stopped after the song finished and I need to manually hit stop button in order to choose another song. Did I do wrong somewhere? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

Simple MP3 player, notify not working

爱⌒轻易说出口 提交于 2019-12-25 02:51:09
问题 C# beginner here. I want to make the player stop immediately after the song ended, so I tried the solution stated here. The problem is player is not stopped after the song finished and I need to manually hit stop button in order to choose another song. Did I do wrong somewhere? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;

Windows 8.1 WPF application mixerSetControlDetails returns MMSYSERR_ERROR

旧巷老猫 提交于 2019-12-23 03:26:08
问题 Edit After modifying the NAudio source code and a little debugging, I found that the mixerSetControlDetails function, which is called when I set the Value property, returns MMSYSERR_ERROR . Is there a way to get further information about why mixerSetControlDetails failed? I'm also open to other ways to accomplish same thing on C#. Original I have some code that computes energy in voice and sets the microphone boost level according to this computed value using NAudio. I have no problem reading

waveout sometimes memory issue

送分小仙女□ 提交于 2019-12-23 01:36:14
问题 This code works to output a piano tone for 2 seconds using winmm.dll via platform invocation services, it seems to work fine on XP but waveoutopen fails in windows 7 rc updated based on feedback from John Knoeller Imports System.Runtime.InteropServices Public Class AudioStream <StructLayout(LayoutKind.Sequential)> _ Private Structure WAVEHDR Public lpData As Integer Public dwBufferLength As Integer Public dwBytesRecorded As Integer Public dwUser As Integer Public dwFlags As Integer Public

waveout sometimes memory issue

情到浓时终转凉″ 提交于 2019-12-23 01:35:24
问题 This code works to output a piano tone for 2 seconds using winmm.dll via platform invocation services, it seems to work fine on XP but waveoutopen fails in windows 7 rc updated based on feedback from John Knoeller Imports System.Runtime.InteropServices Public Class AudioStream <StructLayout(LayoutKind.Sequential)> _ Private Structure WAVEHDR Public lpData As Integer Public dwBufferLength As Integer Public dwBytesRecorded As Integer Public dwUser As Integer Public dwFlags As Integer Public

CMAKE : how to link executable to winmm imm32 version on windows with Visual Studio?

◇◆丶佛笑我妖孽 提交于 2019-12-11 03:53:29
问题 Is it possible to find these libraries easily? I do not want to reinvent the wheel and write uber-long find_library call! Even more, I just want to put line "winmm.lib etc" into "Librarian" => "Additional dependencies" or "Linker" => "Additional dependencies" These libraries are good friends of Windows and Visual Studio so they know very well how to find them. 回答1: Solution from Andre works. In my project this line did the trick: target_link_libraries(${target_name} winmm.lib) 来源: https:/

Audio manipulation and delete some part of the audio

牧云@^-^@ 提交于 2019-12-11 02:09:24
问题 I'm new in voice codding, now I am succeed to recording microphone in the files and save each 10 seconds in a file with SaveRecordtoFile function(doing this with no problem) Now I want to delete for example 2 seconds from the recorded data so my output will be 8 seconds instead of 10, in the randomTime array 0 is the number of seconds witch I want to be delete... In a for-loop I copy the data of waveHeader->lpData in a new buffer if (randomTime[i] == '1') 10 seconds: delete the data of second