Inheritance: MonoBehaviour
Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        theAM = FindObjectOfType <AudioTest>();

        if (newTrack != null)
        {
            theAM.ChangeBGM(newTrack);
        }
    }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Player")
     {
         if (newTrack != null)
         {
             theAM = FindObjectOfType <AudioTest>();
             theAM.ChangeBGM(newTrack);
         }
     }
 }
Esempio n. 3
0
    void Start()
    {
        if (source == null)
        {
            source = GetComponent <AudioTest>();
        }
        tickTime = 60f / tempo; // seconds per beat

        if (source != null)
        {
            StartCoroutine(StartTicker());
        }
    }
Esempio n. 4
0
        public Game()
        {
            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth       = 800,
                PreferredBackBufferHeight      = 480,
                SynchronizeWithVerticalRetrace = true,
            };
            TargetElapsedTime     = TimeSpan.FromTicks(TimeSpan.TicksPerSecond / _targetFPS);
            Content.RootDirectory = "Content";
            Assets = Content;

            // Arbitrary audio test //
            AudioTest tester = new AudioTest();
            /////////////////////////
        }
Esempio n. 5
0
        string AutoModeAudioTestFunction()
        {
            try
            {
                if (AutoModeAudioTest == null)
                {
                    AutoModeAudioTest = new AudioTest(TestProduct, true);
                }

                string wavFile = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "WinmateAudioTest.wav");
                if (File.Exists(wavFile))
                {
                    AutoModeAudioTest.WavFileName = wavFile;

                    AutoModeAudioTest.ExternalRecordThreshold  = ExternalRecordThreshold;
                    AutoModeAudioTest.InternalRecordThreshold  = InternalRecordThreshold;
                    AutoModeAudioTest.AudioJackRecordThreshold = AudioJackRecordThreshold;

                    Trace.WriteLine("AudioJack Test");
                    AutoModeAudioTest.AudioJackTest();
                    Trace.WriteLine("AudioJackIntensity : " + AutoModeAudioTest.AudioJackIntensity);
                    Trace.WriteLine("AudioJackRecordThreshold : " + AudioJackRecordThreshold);

                    if (IsIntensityCorrect())
                    {
                        return("PASS");
                    }
                    else
                    {
                        return("Intensity does not meet the Threshold.");
                    }
                }
                else
                {
                    Trace.WriteLine("Audio test file (" + wavFile + ") does not exist.");
                    return("Audio test file does not exist");
                }
            }
            catch (Exception ex)
            {
                if (AutoModeAudioTest != null)
                {
                    AutoModeAudioTest = null;
                }
                return("(AudioAutoTest) " + ex.Message);
            }
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            JObject result = new JObject();

            try
            {
                var jsonconfig = GetFullPath("config.json");
                var wavpath    = GetFullPath("WinmateAudioTest.wav");

                if (!File.Exists(jsonconfig))
                {
                    MessageBox.Show("config.json not founded");
                    return;
                }

                result["result"] = "FAIL";
                dynamic jobject = JObject.Parse(File.ReadAllText(jsonconfig));

                if ((bool)jobject.ShowWindow)
                {
                    AllocConsole();
                }

                //var name = jobject.name.ToString();
                //var Model = name.Substring(name.IndexOf("_") + 1);
                var       Model = jobject.TestProduct.ToString();
                AudioTest api   = new AudioTest(Model, true);
                api.WavFileName              = wavpath;
                api.ExternalRecordThreshold  = (double)jobject.ExternalRecordThreshold;
                api.InternalRecordThreshold  = (double)jobject.InternalRecordThreshold;
                api.AudioJackRecordThreshold = (double)jobject.AudioJackRecordThreshold;
                var testresult = api.RunTest();

                Console.WriteLine("file name: {0}", api.WavFileName);
                Console.WriteLine("left: {0}", api.LeftIntensity);
                Console.WriteLine("right: {0}", api.RightIntensity);
                Console.WriteLine("internal: {0}", api.InternalIntensity);
                Console.WriteLine("internal left: {0}", api.InternalLeftIntensity);
                Console.WriteLine("internal right: {0}", api.InternalRightIntensity);
                Console.WriteLine("audiojack: {0}", api.AudioJackIntensity);
                Console.WriteLine("fan: {0}", api.FanIntensity);
                Console.WriteLine("left threshold: {0}", api.ExternalRecordThreshold);
                Console.WriteLine("right threshold: {0}", api.ExternalRecordThreshold);
                Console.WriteLine("internal threshold: {0}", api.InternalRecordThreshold);
                Console.WriteLine("audiojack threshold: {0}", api.AudioJackRecordThreshold);
                Console.WriteLine("fan threshold: {0}", api.FanRecordThreshold);
                Console.WriteLine("exception: {0}", api?.Exception);

                switch (testresult)
                {
                case Result.Pass:
                    Console.WriteLine("Pass");
                    result["result"] = "PASS";
                    result["EIPLog"] = new JObject
                    {
                        { "Audio", "PASS" },
                        { "Audio_Info", string.Format("Left={0} Right={1} Threshold={2} Top={3} Threshold={4}", (int)api.LeftIntensity, (int)api.RightIntensity, (int)api.ExternalRecordThreshold, (int)api.InternalIntensity, (int)api.InternalRecordThreshold) }
                    };
                    break;

                case Result.ExceptionFail:
                    Console.WriteLine("Exception");
                    result["result"] = "FAIL";
                    result["EIPLog"] = new JObject
                    {
                        { "Audio", "FAIL" },
                        { "Audio_Info", api?.Exception.InnerException.Message }
                    };
                    break;

                case Result.FanRecordFail:
                case Result.InternalMicFail:
                case Result.InternalLeftMicFail:
                case Result.InternalRightMicFail:
                case Result.LeftSpeakerFail:
                case Result.RightSpeakerFail:
                    Console.WriteLine("FAIL");
                    result["result"] = "FAIL";
                    result["EIPLog"] = new JObject
                    {
                        { "Audio", "FAIL" },
                        { "Audio_Info", string.Format("Left={0} Right={1} Threshold={2} Top={3} Threshold={4}", (int)api.LeftIntensity, (int)api.RightIntensity, (int)api.ExternalRecordThreshold, (int)api.InternalIntensity, (int)api.InternalRecordThreshold) }
                    };
                    break;

                default:
                    Console.WriteLine("default");
                    result["result"] = "FAIL";
                    result["EIPLog"] = new JObject
                    {
                        { "Audio", "FAIL" },
                        { "Audio_Info", string.Format("Left={0} Right={1} Threshold={2} Top={3} Threshold={4}", (int)api.LeftIntensity, (int)api.RightIntensity, (int)api.ExternalRecordThreshold, (int)api.InternalIntensity, (int)api.InternalRecordThreshold) }
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            File.WriteAllText(GetFullPath("result.json"), result.ToString());
            File.Create(GetFullPath("completed"));
            Console.ReadLine();
        }
Esempio n. 7
0
 private void AudioTest(object sender, RoutedEventArgs e)
 {
     DataContext = new AudioTest();
 }