setChannel() public method

public setChannel ( string channel, float val ) : void
channel string
val float
return void
    // Update is called once per frame
    void Update()
    {
        ///For startup. Sets up game before allowing the player to begin interactions
        if (randFreq == 0 || randAmp == 0)
        {
            SetupRandomVariables();
        }

        if (allowInput)
        {
            CheckValues(); // check for win

            csound.setChannel("frequency", frequencySlider.value);
            csound.setChannel("amplitude", ampSlider.value);

            freqValue.text = frequencySlider.value.ToString();
            ampValue.text  = ampSlider.value.ToString();
        }
        else
        {
            if (!csound.enabled)
            {
                csound.enabled = true;
            }

            csound.setChannel("sound", soundToPlay);
            csound.setChannel("frequency", randFreq);
            csound.setChannel("amplitude", randAmp);
        }
    }
    public void OnMouseDown()
    {
        switch (isPlayingLeft)
        {
        case false:
            if (!triggered)
            {
                leftsource.Play();
                csoundunity.sendScoreEvent("i1 0 -1");
            }
            if (triggered)
            {
                //leftsource.pitch = 0.92f;
                leftsource.pitch = 1f;
            }
            isPlayingLeft = true;
            triggered     = true;
            break;

        case true:
            //leftsource.pitch = 0f;
            csoundunity.setChannel("Time_Scaling", 0f);
            csoundunity.setChannel("Pitch", 0f);
            isPlayingLeft = false;
            break;
        }
    }
 private void ShowRandomMap()
 {
     _cSound.setChannel(OP_CODE_CHANNEL, 1);
     for (int i = 0; i < NUM_BUTTONS; i++)
     {
         _cSound.setChannel(OFF_COLOR_CHANNEL_PREFIX + i, OffColors[Random.Range(0, OffColors.Length)]);
         _cSound.setChannel(STATUS_CHANNEL_PREFIX + i, 144);
     }
 }
Beispiel #4
0
    public override void OnInspectorGUI()
    {
        GUI.skin = (GUISkin)(AssetDatabase.LoadAssetAtPath("Assets/Editor/CsoundUnity.guiskin", typeof(GUISkin)));

        EditorGUILayout.HelpBox(infoText, MessageType.None);
        GUI.SetNextControlName("CsoundfileTextField");
        csoundUnity.csoundFile       = EditorGUILayout.TextField("Csound file", csoundUnity.csoundFile);
        csoundUnity.processClipAudio = EditorGUILayout.Toggle("Process Clip Audio", csoundUnity.processClipAudio);
        csoundUnity.mute             = EditorGUILayout.Toggle("Mute Csound", csoundUnity.mute);
        csoundUnity.logCsoundOutput  = EditorGUILayout.Toggle("Log Csound Output", csoundUnity.logCsoundOutput);

        //create drag and drop area for Csound files
        DropAreaGUI();

        //create controls for each Csound channel found in the file descriptor
        for (int i = 0; i < channelControllers.Count; i++)
        {
            controllerValues.Add(channelControllers[i].value);
            string label = channelControllers[i].text.Length > 3 ? channelControllers[i].text : channelControllers[i].channel;
            if (channelControllers[i].type.Contains("slider"))
            {
                controllerValues[i] = EditorGUILayout.Slider(label, controllerValues[i], channelControllers[i].min, channelControllers[i].max);
                if (controllerValues[i] != channelControllers[i].value)
                {
                    channelControllers[i].value = controllerValues[i];
                    if (Application.isPlaying)
                    {
                        csoundUnity.setChannel(channelControllers[i].channel, controllerValues[i]);
                    }
                }
            }
            else if (channelControllers[i].type.Contains("button"))
            {
                if (GUILayout.Button(label))
                {
                    channelControllers[i].value = channelControllers[i].value == 1 ? 0 : 1;
                    csoundUnity.setChannel(channelControllers[i].channel, channelControllers[i].value);
                }
            }
            else if (channelControllers[i].type.Contains("checkbox"))
            {
                controllerValues[i] = EditorGUILayout.Toggle(label, controllerValues[i] == 1 ? true : false) == true ? 1 : 0;
                if (controllerValues[i] != channelControllers[i].value)
                {
                    channelControllers[i].value = controllerValues[i];
                    if (Application.isPlaying)
                    {
                        csoundUnity.setChannel(channelControllers[i].channel, controllerValues[i]);
                    }
                }
            }
        }
    }
Beispiel #5
0
 void setUp()
 {
     bpmNow         = originalbpm;
     bpmPre         = originalbpm;
     pitchNow       = 1f;
     pitchPre       = 1f;
     songToPlayLeft = "Symphony.ogg";
     csoundunity.setChannel("Time_Scaling", 1f);
     csoundunity.setStringChannel("SongPlay", songToPlayLeft);
     //csoundunity.sendScoreEvent("i 1 0 3600");
     //csoundunity.setChannel ("fft",2048f);
 }
Beispiel #6
0
 void setUp()
 {
     bpmNow         = originalbpm;
     bpmPre         = originalbpm;
     pitchNow       = 1f;
     pitchPre       = 1f;
     songToPlayLeft = "Symphony.ogg";
     csoundunity.setChannel("Time_Scaling", 1f);
     //audioPaths = Application.dataPath + "/Resources/" +"/Audio/" + songToPlayLeft;//Duplicated
     //print(audioPaths);
     //csoundunity.setStringChannel ("SongPlay", audioPaths);
     //csoundunity.sendScoreEvent("i 1 0 3600");
     //csoundunity.setChannel ("fft",2048f);
 }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown("up"))
        {
            tempo++;
            csound.setChannel("tempo", tempo);
        }
        else if (Input.GetKeyDown("down"))
        {
            tempo--;
            csound.setChannel("tempo", tempo);
        }

        if (currentBeat == csound.getChannel("beat"))
        {
            ResizeCube(currentBeat);
            currentBeat = (currentBeat != 7 ? currentBeat + 1 : 0);
        }
    }
 void Update()
 {
     if (!isDragging && Play_Pause.isPlayingLeft)
     {
         float angle = defaultRotateSpeed * Time.deltaTime;
         transform.Rotate(new Vector3(0f, angle, 0f));
         updatePitch(defaultRotateSpeed);
         Debug.DrawRay(rayTest.origin, rayTest.direction, Color.green);
     }
     else if (!isDragging && !Play_Pause.isPlayingLeft)
     {
         csoundUnityCDJcontrol.setChannel("Time_Scaling", 0f);
         csoundUnityCDJcontrol.setChannel("Pitch", 0f);
     }
 }
    // Update is called once per frame
    void Update()
    {
        csound.setChannel("absoluteHeightSlider", this.transform.position.y);
        csound.setChannel("wheelSlider", wheelVar);
        csound.setChannel("AfterDemoSlider", drumVar);
        csound.setChannel("PlatformSlider", platformVar);
        csound.setChannel("PinballSlider", pinballVar);
        csound.setChannel("SkateboardSlider", skateboardVar);
        csound.setChannel("CristmasLightsSlider", christmassVar);
        csound.setChannel("EndSlider", endVar);
        SetGrounded();

        if (Input.GetButtonDown("Jump"))
        {
            SetJump();
        }
        if (grounded && Input.GetAxis("Jump") > 0)
        {
            Jumping();
        }
        if (!grounded)
        {
            csound.setChannel("relativeHeightSlider", this.transform.position.y - takeOffHeight);
        }
        if (grounded)
        {
            csound.setChannel("relativeHeightSlider", 0);
        }
    }
Beispiel #10
0
 /// <summary>
 /// Updates the frequencies of all oscillators, based on an input
 /// note. Calculates the desired note frequency relative to the
 /// user-defined frequency of each oscillator.
 /// </summary>
 /// <param name="note">
 /// delta frequency from c of the desired note
 /// </param>
 private void UpdateFrequencies(float note = 0)
 {
     csoundUnity.setChannel("sin1Freq", (sin1Frequency + note) * Mathf.Pow(2, octave));
     csoundUnity.setChannel("sin2Freq", (sin2Frequency + note) * Mathf.Pow(2, octave));
     csoundUnity.setChannel("sin3Freq", (sin3Frequency + note) * Mathf.Pow(2, octave));
     csoundUnity.setChannel("sin4Freq", (sin4Frequency + note) * Mathf.Pow(2, octave));
 }
Beispiel #11
0
    void Start()
    {
        // Retrieves and initialises the Csound component

        #region CSound Initialisation

        csoundUnity = GetComponent <CsoundUnity>();

        #endregion

        // Calculate frequencies relative to bottom c

        #region Delta Frequencies

        deltaCC  = (c - c);
        deltaCSC = (cs - c);
        deltaDC  = (d - c);
        deltaEFC = (ef - c);
        deltaEC  = (e - c);
        deltaFC  = (f - c);
        deltaFSC = (fs - c);
        deltaGC  = (g - c);
        deltaGSC = (gs - c);
        deltaAC  = (a - c);
        deltaBFC = (bf - c);
        deltaBC  = (b - c);

        #endregion

        // Initialise Csound channels

        #region Channels

        csoundUnity.setChannel("temp", baseTemp);
        csoundUnity.setChannel("osc", baseToggle);

        csoundUnity.setChannel("sin1", baseToggle);
        csoundUnity.setChannel("sin2", baseToggle);
        csoundUnity.setChannel("sin3", baseToggle);
        csoundUnity.setChannel("sin4", baseToggle);

        csoundUnity.setChannel("sin1Ampl", baseAmpl);
        csoundUnity.setChannel("sin2Ampl", baseAmpl);
        csoundUnity.setChannel("sin3Ampl", baseAmpl);
        csoundUnity.setChannel("sin4Ampl", baseAmpl);

        csoundUnity.setChannel("sin1Freq", baseFreq);
        csoundUnity.setChannel("sin2Freq", baseFreq);
        csoundUnity.setChannel("sin3Freq", baseFreq);
        csoundUnity.setChannel("sin4Freq", baseFreq);

        csoundUnity.setChannel("att", baseAtt);
        csoundUnity.setChannel("dec", baseDec);
        csoundUnity.setChannel("sus", baseSus);
        csoundUnity.setChannel("rel", baseRel);

        #endregion

        // Initialise oscillator values

        #region Sine Osc 1

        sin1Active    = baseToggle;
        sin1Frequency = baseFreq;
        sin1Amplitude = baseAmpl;

        #endregion

        #region Sine Osc 2

        sin2Active    = baseToggle;
        sin2Frequency = baseFreq;
        sin2Amplitude = baseAmpl;

        #endregion

        #region Sine Osc 3

        sin3Active    = baseToggle;
        sin3Frequency = baseFreq;
        sin3Amplitude = baseAmpl;

        #endregion

        #region Sine Osc 4

        sin4Active    = baseToggle;
        sin4Frequency = baseFreq;
        sin4Amplitude = baseAmpl;

        #endregion

        // Initialise Envelope values

        #region Envelope

        attack  = baseAtt;
        decay   = baseDec;
        sustain = baseSus;
        release = baseRel;

        #endregion

        // Initialise master values

        #region Master

        masterActive     = baseToggle;
        instrumentActive = true;

        tempo  = baseTemp;
        octave = baseOctave;

        #endregion
    }
Beispiel #12
0
    void Start()
    {
        //Set the Base Values WIll used to check wether to update.
        currentRSize      = 0.85f;
        currentDampening  = 0.5f;
        currentSendAmount = 0.8f;

        //Send Default Variables to CSound
        csoundUnity.setChannel("RVBSendAmount", currentSendAmount);
        csoundUnity.setChannel("RVBDampening", currentDampening);
        csoundUnity.setChannel("RVBRoomSize", currentRSize);
    }
 // Use this for initialization
 void Start()
 {
     csound = GetComponent <CsoundUnity>();
     csound.setChannel("tempo", tempo);
 }