Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using UnityEditor;
- using System;
- using System.Diagnostics;
- using System.IO;
- public class OnGuiScript : MonoBehaviour {
- public bool CanSaveGui = false;
- // Use this for initialization
- void Start () {
- }
- public void SaveAudio(){
- //helpGetPath = Path.Combine(nameProgramm, idCatcher);
- SavWav.Save("myfile", GetComponent<RecordAu>().bofferAudioClip, Path.Combine(Application.persistentDataPath, Path.Combine(GetComponent<RecordAu>().nameProgramm, GetComponent<RecordAu>().idCatcher)));
- GetComponent<RecordAu>().canSave = false;
- //Debug.Log("Audio saved");
- }
- void OnGui(){
- if(GUI.Button(new Rect ( 10, 150 , 150, 50), "Test start")){
- Process PrFoo = new Process();
- PrFoo.StartInfo.FileName = "C:/Program Files (x86)/Far Manager/Far.exe";
- PrFoo.Start();
- }
- if(!Microphone.IsRecording(GetComponent<RecordAu> ().deviceName)){
- if(GUI.Button(new Rect ( 10, 10 , 150, 50), "Record")){
- RecordAu.registerAudio();
- }
- }else{
- if(GUI.Button(new Rect ( 10, 70 , 150, 50), "Stop Recording")){
- RecordAu.stopRecording();
- }
- }
- if(GUI.Button(new Rect ( 10, 270, 150, 50), "Save")) {
- if(GetComponent<RecordAu>().hideLabel) {
- GUI.Label(new Rect(200, 270, 150, 50), "Audio Saved");
- GetComponent<RecordAu>().canSave = true;
- SaveAudio();
- GetComponent<RecordAu>().hideLabel=false;
- /*Debug.Log (GetComponent<runFilePath>().amountOfPrPaths + " - amount");
- Debug.Log (GetComponent<runFilePath>().ProgsPath[idPr].prPath + " - path");*/
- }
- }
- if(Microphone.IsRecording(GetComponent<RecordAu> ().deviceName)){
- GUI.Label(new Rect(200, 83, 150, 50), "Recording");
- }else{
- GUI.Label(new Rect(200, 23, 150, 50), "Not Recording");
- }
- GetComponent<RecordAu>().path = GUI.TextField(new Rect(400, 10, 150, 20), GetComponent<RecordAu>().path, 50); // Ввод пути
- GetComponent<RecordAu>().idCatcher = GUI.TextField (new Rect (400, 130, 150, 20), GetComponent<RecordAu>().idCatcher, 50);
- GetComponent<RecordAu>().nameProgramm = GUI.TextField (new Rect (400, 270, 150, 20), GetComponent<RecordAu>().nameProgramm, 50); //Ввод названия
- Int32.TryParse(GetComponent<RecordAu>().idCatcher,out GetComponent<RecordAu>().idPr); //Из строки в число
- //Debug.Log (idPr);
- }
- // Update is called once per frame
- void Update () {
- GetComponent<RecordAu>().canSave = CanSaveGui;
- }
- }
- Assets/Scripts/OnGuiScript.cs(31,42): error CS0120: An object reference is required to access non-static member `RecordAu.registerAudio()'
- Assets/Scripts/OnGuiScript.cs(36,42): error CS0120: An object reference is required to access non-static member `RecordAu.stopRecording()'
Add Comment
Please, Sign In to add comment