/// <summary>
        /// Starts recording.
        /// </summary>
        /// <param name="Frequency">The sample rate to record at.</param>
        /// <param name="Channels">The number of channels... 1 = mono, 2 = stereo, etc.</param>
        /// <param name="Flags">Any combination of <see cref="BassFlags.Byte"/>, <see cref="BassFlags.Float"/> and <see cref="BassFlags.RecordPause"/>.</param>
        /// <param name="Procedure">The user defined function to receive the recorded sample data... can be <see langword="null" /> if you do not wish to use a callback.</param>
        /// <param name="User">User instance data to pass to the callback function.</param>
        /// <returns>If successful, the new recording's handle is returned, else <see langword="false" /> is returned. Use <see cref="LastError"/> to get the error code.</returns>
        /// <remarks>
        /// Use <see cref="ChannelStop" /> to stop the recording, and <see cref="ChannelPause" /> to pause it.
        /// Recording can also be started in a paused state (via the <see cref="BassFlags.RecordPause"/> flag), allowing DSP/FX to be set on it before any data reaches the callback function.
        /// <para>The sample data will generally arrive from the recording device in blocks rather than in a continuous stream, so when specifying a very short period between callbacks, some calls may be skipped due to there being no new data available since the last call.</para>
        /// <para>
        /// When not using a callback (proc = <see langword="null" />), the recorded data is instead retrieved via <see cref="ChannelGetData(int, IntPtr, int)" />.
        /// To keep latency at a minimum, the amount of data in the recording buffer should be monitored (also done via <see cref="ChannelGetData(int, IntPtr, int)" />, with the <see cref="DataFlags.Available"/> flag) to check that there is not too much data;
        /// freshly recorded data will only be retrieved after the older data in the buffer is.
        /// </para>
        /// <para><b>Platform-specific</b></para>
        /// <para>
        /// Multiple simultaneous recordings can be made from the same device on Windows XP and later, but generally not on older Windows.
        /// Multiple simultaneous recordings are possible on iOS and OSX, but may not always be on Linux or Windows CE.
        /// On OSX and iOS, the device is instructed (when possible) to deliver data at the period set in the HIWORD of flags, even when a callback function is not used.
        /// On other platforms, it is up the the system when data arrives from the device.
        /// </para>
        /// <para>
        /// Unlike Bass.Net, a reference to <paramref name="Procedure"/> doesn't need to be held by you manually.
        /// ManagedBass automatically holds a reference and frees it when the Channel is freed.
        /// </para>
        /// </remarks>
        /// <exception cref="Errors.Init"><see cref="RecordInit" /> has not been successfully called.</exception>
        /// <exception cref="Errors.Busy">
        /// The device is busy.
        /// An existing recording must be stopped before starting another one.
        /// Multiple simultaneous recordings can be made from the same device on Windows XP and Vista, but generally not on older Windows.
        /// </exception>
        /// <exception cref="Errors.NotAvailable">
        /// The recording device is not available.
        /// Another application may already be recording with it, or it could be a half-duplex device and is currently being used for playback.
        /// </exception>
        /// <exception cref="Errors.SampleFormat">
        /// The specified format is not supported.
        /// If using the <see cref="BassFlags.Float"/> flag, it could be that floating-point recording is not supported.
        /// </exception>
        /// <exception cref="Errors.Memory">There is insufficient memory.</exception>
        /// <exception cref="Errors.Unknown">Some other mystery problem!</exception>
        public static int RecordStart(int Frequency, int Channels, BassFlags Flags, RecordProcedure Procedure, IntPtr User = default(IntPtr))
        {
            var h = BASS_RecordStart(Frequency, Channels, Flags, Procedure, User);

            if (h != 0)
            {
                ChannelReferences.Add(h, 0, Procedure);
            }

            return(h);
        }
        public Recording(RecordingDevice Device = null, Resolution BufferKind = Resolution.Short)
            : base(BufferKind)
        {
            if (Device == null)
            {
                Device = RecordingDevice.DefaultDevice;
            }

            Device.Initialize();
            DeviceIndex = Device.DeviceIndex;

            Bass.CurrentRecordingDevice = DeviceIndex;

            RecordProcedure = new RecordProcedure(Processing);

            Handle = Bass.StartRecording(44100, 2, BassFlags.RecordPause | BassFlags.Float, RecordProcedure);
        }
 static extern int BASS_RecordStart(int freq, int chans, BassFlags flags, RecordProcedure proc, IntPtr User);
 /// <summary>
 /// Starts recording.
 /// </summary>
 /// <param name="Frequency">The sample rate to record at.</param>
 /// <param name="Channels">The number of channels... 1 = mono, 2 = stereo.</param>
 /// <param name="Flags">Any combination of <see cref="BassFlags.Byte"/>, <see cref="BassFlags.Float"/> and <see cref="BassFlags.RecordPause"/>.</param>
 /// <param name="Period">
 /// Set the period (in milliseconds) between calls to the callback function (<see cref="RecordProcedure" />).
 /// The minimum period is 5ms, the maximum the maximum is half the <see cref="RecordingBufferLength"/> setting.
 /// If the period specified is outside this range, it is automatically capped. The default is 100ms.
 /// </param>
 /// <param name="Procedure">The user defined function to receive the recorded sample data... can be <see langword="null" /> if you do not wish to use a callback.</param>
 /// <param name="User">User instance data to pass to the callback function.</param>
 /// <returns>If successful, the new recording's handle is returned, else <see langword="false" /> is returned. Use <see cref="LastError"/> to get the error code.</returns>
 /// <exception cref="Errors.Init"><see cref="RecordInit" /> has not been successfully called.</exception>
 /// <exception cref="Errors.Busy">
 /// The device is busy.
 /// An existing recording must be stopped before starting another one.
 /// Multiple simultaneous recordings can be made from the same device on Windows XP and Vista, but generally not on older Windows.
 /// </exception>
 /// <exception cref="Errors.NotAvailable">
 /// The recording device is not available.
 /// Another application may already be recording with it, or it could be a half-duplex device and is currently being used for playback.
 /// </exception>
 /// <exception cref="Errors.SampleFormat">
 /// The specified format is not supported.
 /// If using the <see cref="BassFlags.Float"/> flag, it could be that floating-point recording is not supported.
 /// </exception>
 /// <exception cref="Errors.Memory">There is insufficient memory.</exception>
 /// <exception cref="Errors.Unknown">Some other mystery problem!</exception>
 public static int RecordStart(int Frequency, int Channels, BassFlags Flags, int Period, RecordProcedure Procedure, IntPtr User = default(IntPtr))
 {
     return(RecordStart(Frequency, Channels, (BassFlags)BitHelper.MakeLong((short)Flags, (short)Period), Procedure, User));
 }
Exemple #5
0
 public extern static int StartRecording(int freq, int chans, BassFlags flags, RecordProcedure proc, IntPtr User = default(IntPtr));