public void Open()
        {
            lock (waveOpenCloseLock)
            {
                if (hWaveOut != IntPtr.Zero)
                {
                    return;
                }

                WAVEFORMATEX waveFormatEx = new WAVEFORMATEX();
                waveFormatEx.wFormatTag      = (ushort)WaveFormats.WAVE_FORMAT_PCM;
                waveFormatEx.nChannels       = (ushort)this.channels;
                waveFormatEx.nSamplesPerSec  = (uint)this.frequency;
                waveFormatEx.wBitsPerSample  = (ushort)this.bits;
                waveFormatEx.nBlockAlign     = (ushort)(waveFormatEx.nChannels * (waveFormatEx.wBitsPerSample / 8));
                waveFormatEx.nAvgBytesPerSec = waveFormatEx.nSamplesPerSec * waveFormatEx.nBlockAlign;
                waveFormatEx.cbSize          = 0;

                callbackProc = new WaveOutProc(WaveOutCallback);

                Debug.WriteLine(waveOutOpen(out hWaveOut, WAVE_MAPPER, ref waveFormatEx, callbackProc, UIntPtr.Zero, WaveOutFlags.CALLBACK_FUNCTION));
                Debug.WriteLine("hWaveOut: " + hWaveOut.ToString());

                lock (bufferLock)
                {
                    isActive = true;
                    Monitor.Pulse(bufferLock);
                }

                bufferMonitorThread = new Thread(BufferMonitor);
                bufferMonitorThread.IsBackground = true;
                bufferMonitorThread.Start();
            }
        }
예제 #2
0
파일: WaveOut.cs 프로젝트: otac0n/winmm
        /// <summary>
        /// Initializes a new instance of the WaveOut class, based on an available Device Id.
        /// </summary>
        /// <param name="deviceId">The device identifier to obtain.</param>
        /// <exception cref="ArgumentOutOfRangeException">If <paramref name="deviceId"/> is not in the valid range.</exception>
        public WaveOut(int deviceId)
        {
            if ((deviceId >= DeviceCount || deviceId < 0) && deviceId != WaveOutMapperDeviceId)
            {
                throw new ArgumentOutOfRangeException("deviceId", "The Device ID specified was not within the valid range.");
            }

            this.callback = new WaveOutProc(this.InternalCallback);

            this.deviceId = deviceId;
        }
예제 #3
0
 static extern MMSYSERROR waveOutOpen(ref IntPtr handle, int uDeviceID, ref WAVEFORMATEX pwfx, WaveOutProc dwCallback, IntPtr dwCallbackInstance, WaveOpenFlags dwFlags);
예제 #4
0
 static extern int waveOutOpen(out IntPtr waveIn, uint deviceID, ref WAVEFORMATEX format, WaveOutProc callback, IntPtr callbackInstance, int flags);
 private static extern WAVEERROR waveOutOpen(out IntPtr hWaveOut, UInt32 uDeviceID, ref WAVEFORMATEX wfx, WaveOutProc dwCallback, UIntPtr dwInstance, WaveOutFlags fdwOpen);
예제 #6
0
 internal static partial MMSYSERR waveOutOpen(ref IntPtr phwo, int uDeviceID, byte[] pwfx, WaveOutProc dwCallback, IntPtr dwInstance, uint fdwOpen);
예제 #7
0
 public static extern RESULT waveOutOpen(out IntPtr hWaveOut, IntPtr uDeviceID, ref WAVEFORMATEX lpFormat, WaveOutProc dwCallback, IntPtr dwInstance, OPEN_FLAGS dwFlags);
예제 #8
0
파일: DllImports.cs 프로젝트: desla/AS
 public static extern uint waveOutOpen(ref IntPtr hWaveOut, uint uDeviceId, ref WAVEFORMATEX lpFormat,
     WaveOutProc dwCallback, IntPtr dwInstance, uint dwFlags);