Exemple #1
0
 /// <summary>
 /// Play a wav file.
 /// </summary>
 /// <param name="fileName">The *.wav file.</param>
 /// <param name="duration">Duration (ms).  If this is negative then the waveform is repeated (-duration) times.</param>
 /// <returns>The wave name or "" on failure.</returns>
 public static Primitive PlayWavFile(Primitive fileName, Primitive duration)
 {
     if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
     {
         return("");
     }
     return(_PlayWavFile(fileName, duration));
 }
Exemple #2
0
 /// <summary>
 /// Play DX7.
 /// </summary>
 /// <param name="channels">An array of values for each channel (values between 0 and 1, usually 8 channels).</param>
 /// <returns>The wave name or "" on failure.</returns>
 public static Primitive PlayDX7(Primitive channels)
 {
     if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
     {
         return("");
     }
     return(_PlayDX7(channels));
 }
Exemple #3
0
 /// <summary>
 /// Play a user defined wave form as a sum of harmonics.
 /// </summary>
 /// <param name="frequency">Frequency (HZ).</param>
 /// <param name="duration">Duration (ms).  If this is negative then the waveform is repeated (-duration) times.</param>
 /// <param name="harmonics">Harmonic amplitudes.
 /// This is an array, where the index is a harmonic multiple of the base frequency (2, 3, etc) and the value is the relative amplitude of the harmonic.
 /// A square wave can be formed by (https://en.wikipedia.org/wiki/Square_wave):
 /// For i = 3 To 21 Step 2
 ///   harmonics[i] = 1/i
 /// EndFor
 /// squareWave = LDWaveForm.PlayHarmonics(256,1000,harmonics)</param>
 /// <returns>The wave name or "" on failure.</returns>
 public static Primitive PlayHarmonics(Primitive frequency, Primitive duration, Primitive harmonics)
 {
     if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
     {
         return("");
     }
     return(_PlayHarmonics(frequency, duration, harmonics));
 }
Exemple #4
0
 /// <summary>
 /// Play a user defined wave form.
 /// </summary>
 /// <param name="frequency">Frequency (HZ).</param>
 /// <param name="duration">Duration (ms).  If this is negative then the waveform is repeated (-duration) times.</param>
 /// <param name="waveform">Form for the repeating wave.
 /// This is an array, where the index is an increasing relative time (the actual value is normalised to the frequency) and the value is an amplitude (-1 to 1).
 /// Example of a triangular wave would be "0=-1;1=1;2=-1;"</param>
 /// <returns>The wave name or "" on failure.</returns>
 public static Primitive PlayWave(Primitive frequency, Primitive duration, Primitive waveform)
 {
     if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
     {
         return("");
     }
     return(_PlayWave(frequency, duration, waveform));
 }
Exemple #5
0
 /// <summary>
 /// Play a square wave form.
 /// </summary>
 /// <param name="frequency">Frequency (HZ).</param>
 /// <param name="duration">Duration (ms).  If this is negative then the waveform is repeated (-duration) times.</param>
 /// <returns>The wave name or "" on failure.</returns>
 public static Primitive PlaySquareWave(Primitive frequency, Primitive duration)
 {
     if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
     {
         return("");
     }
     return(_Play(frequency, duration, 2));
 }
Exemple #6
0
 /// <summary>
 /// Get the rotation of a controller joystick.
 /// </summary>
 /// <param name="controller">A USB attached controller number (e.g. joystick or gamepad) indexed from 1.</param>
 /// <returns>An array of (X,Y,Z) rotation values (-100 to 100)</returns>
 public static Primitive Rotation(Primitive controller)
 {
     if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
     {
         return("");
     }
     return(_Rotation(controller));
 }
Exemple #7
0
        /// <summary>
        /// Stop a playing sound.
        /// </summary>
        /// <param name="waveName">The sound wave name.</param>
        public static void Stop(Primitive waveName)
        {
            if (!VerifySlimDX.Verify(Utilities.GetCurrentMethod()))
            {
                return;
            }

            foreach (Buffer buffer in buffers)
            {
                if (waveName == buffer.name)
                {
                    buffer.bPlaying = false;
                }
            }
        }