Ejemplo n.º 1
0
        public string ToString(ActionFormat format)
        {
            string join   = ",";
            bool   indent = false;

            switch (format)
            {
            case ActionFormat.Compressed:
                break;

            case ActionFormat.None:
                join += " ";
                break;

            case ActionFormat.Indented:
                join   = ",\n  ";
                indent = true;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(format), format, null);
            }

            return
                (this.TriggerName.ToLowerInvariant() +
                 (indent ? "\n  " : " ") +
                 String.Join(join, this.Commands.Select(c => c.ToString().Trim())));
        }
Ejemplo n.º 2
0
Archivo: Main.cs Proyecto: sjk7/DX90SDK
    private void DlgMainForm_Load(object sender, System.EventArgs e)
    {
        string sdkpath = DXUtil.SdkMediaPath;

        // Get the graphics object for the static groupbox control.
        applicationGraphics = gbStatic.CreateGraphics();
        mappings            = new ActionFormat[1];
        mappings[0]         = new ActionFormat();

        ConstructActionMap();
        // Get the devices on the system that can be mapped to the action map, and are attached.
        applicationDevices = Manager.GetDevices(mappings[0], EnumDevicesBySemanticsFlags.AttachedOnly);

        // Make sure there are sound devices available.
        if (0 == applicationDevices.Count)
        {
            MessageBox.Show("No available input devices. Sample will close.");
            Close();
            return;
        }

        try
        {
            // Create a sound device, and sound buffer array.
            applicationSoundDevice = new SoundDevice();
            applicationSoundDevice.SetCooperativeLevel(this, CooperativeLevel.Normal);
            applicationSoundBuffers = new SecondaryBuffer[8];
        }
        catch (SoundException)
        {
            MessageBox.Show("No available sound device. Sample will close.");
            Close();
            return;
        }

        foreach (SemanticsInstance instance in applicationDevices)
        {
            // Build and set the action map against each device.
            instance.Device.BuildActionMap(mappings[0], ActionMapControl.Default);
            instance.Device.SetActionMap(mappings[0], ApplyActionMap.Default);
        }

        // Load default wav files.
        LoadSoundFile(sdkpath + "drumpad-bass_drum.wav", 0);
        LoadSoundFile(sdkpath + "drumpad-snare_drum.wav", 1);
        LoadSoundFile(sdkpath + "drumpad-hhat_up.wav", 2);
        LoadSoundFile(sdkpath + "drumpad-hhat_down.wav", 3);
        LoadSoundFile(sdkpath + "drumpad-crash.wav", 4);
        LoadSoundFile(sdkpath + "drumpad-voc_female_ec.wav", 5);
        LoadSoundFile(sdkpath + "drumpad-speech.wav", 6);

        // Turn on the timer.
        timer1.Enabled = true;
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns a string that represents the current object.
        /// </summary>
        public string ToString(ActionFormat format)
        {
            string join = ";";

            switch (format)
            {
            case ActionFormat.Compressed:
                break;

            case ActionFormat.None:
                join += " ";
                break;

            case ActionFormat.Indented:
                join = ";\n\n";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(format), format, null);
            }

            return(String.Join(join, this.Triggers.Select(t => t.ToString(format).Trim())));
        }