public void SaveToFile(string filename) { FileStream fs = new FileStream(filename, FileMode.Create); StreamWriter sw = new StreamWriter(fs); sw.WriteLine("SPINDELANALYSE"); sw.WriteLine("Sample Rate for EEG:;" + SampleRate.ToString()); sw.WriteLine("Startklokkeslett for EEG:;" + StartTime.ToString("HH:mm:ss")); sw.WriteLine("Gjennomsnittlig spindelvarighet:;" + AverageSpindleDuration.ToString(CultureInfo.InvariantCulture)); sw.WriteLine("Gjennomsnittlig spindelfrekvens:;" + AverageSpindleFrequency.ToString(CultureInfo.InvariantCulture)); sw.WriteLine("Median av medianspindelfrekvens:;" + MedianSpindleFrequency.ToString(CultureInfo.InvariantCulture)); sw.WriteLine("Avledning med mest tydelige spindler:;" + MostSignificantChannel); sw.WriteLine("Antall spindler per 30 sekunder sovn:;" + SpindleDensity.ToString(CultureInfo.InvariantCulture)); sw.WriteLine("Andel av sovn som er sovnspindel:;" + SpindleRatio.ToString(CultureInfo.InvariantCulture)); sw.WriteLine(); sw.WriteLine("Spindelnummer;Starttidspunkt;Varighet;Snittfrekvens;Medianfrekvens;Sees best i avledning;Frekvens i beste avledning"); for (int i = 0; i < SleepSpindles.Count; i++) { sw.Write((i + 1).ToString() + ";"); SleepSpindles[i].WriteToStream(sw); sw.WriteLine(); } sw.Close(); }
public Form1() { InitializeComponent(); for (int i = 1; i <= 16; i++) { checkedListBox1.Items.Add(i, false); } txRate.Text = SampleRate.ToString(); }
public void DisplaySetting() { var list = new List <Tuple <string, string> >(); list.Add(new Tuple <string, string>("Run mode", Run == RunMode.Send ? "Send messages" : "Receive Messages")); list.Add(new Tuple <string, string>("Environment", Environment.ToString())); list.Add(new Tuple <string, string>("Agent Name", AgentName)); list.Add(new Tuple <string, string>("Queue Name", QueueName)); list.Add(new Tuple <string, string>("Delay", Delay.ToString())); list.Add(new Tuple <string, string>("Client Count", ClientCount.ToString())); list.Add(new Tuple <string, string>("Sample Rate", SampleRate.ToString())); list.Add(new Tuple <string, string>("NoLock", NoLock.ToString())); list.Add(new Tuple <string, string>("NoWait", NoWait.ToString())); list.ForEach(x => Console.WriteLine($"{(x.Item1 + ":").PadRight(13, ' ')} {x.Item2}")); }
public void Header() { Console.WriteLine("ChrunkID: " + ChrunkID); Console.WriteLine("ChrunkSize: " + ChrunkSize.ToString()); Console.WriteLine("Format: " + Format); Console.WriteLine("Subchunk1ID: " + Subchunk1ID); Console.WriteLine("Subchunk1Size: " + Subchunk1Size.ToString()); Console.WriteLine("AudioFormat: " + AudioFormat.ToString()); Console.WriteLine("NumChanels: " + NumChanels.ToString()); Console.WriteLine("SampleRate: " + SampleRate.ToString()); Console.WriteLine("ByteRate: " + ByteRate.ToString()); Console.WriteLine("BlockAlign: " + BlockAlign.ToString()); Console.WriteLine("BitsPerSample: " + BitsPerSample.ToString()); Console.WriteLine("Subchunk2ID: " + Subchunk2ID); Console.WriteLine("Subchunk2Size: " + Subchunk2Size.ToString()); /*for (var j = 0; j < Subchunk2Size / 2 / NumChanels; ++j) * for (var i = 0; i < NumChanels; ++i) * Console.WriteLine(Data[i, j].ToString() + " ");*/ /* for (var j = 0; j < Subchunk2Size / 2 / NumChanels; ++j) * Console.WriteLine(Data[0, j].ToString() + " "); * Console.WriteLine("end");*/ }
/// <summary> /// Returns multiline string with wav file metadata. /// </summary> /// <returns></returns> public string GetMetadataString() { var sw = new System.IO.StringWriter(); sw.WriteLine("Nazwa pliku: " + FileName); sw.WriteLine("Czas trwania: " + Subchunk2Size / ByteRate + "s"); sw.WriteLine(); sw.WriteLine("---- METADATA ----"); sw.WriteLine("Chunkid: " + System.Text.Encoding.UTF8.GetString(ChunkID)); sw.WriteLine("Rozmiar: " + ChunkSize.ToString()); sw.WriteLine("Format: " + System.Text.Encoding.UTF8.GetString(Format)); sw.WriteLine("Subchunk1 ID: " + System.Text.Encoding.UTF8.GetString(Subchunk1ID)); sw.WriteLine("Subchunk1 rozmiar: " + Subchunk1Size.ToString()); sw.WriteLine("Audio format: " + AudioFormat.ToString()); sw.WriteLine("Kanaly: " + NumChannels.ToString()); sw.WriteLine("Sample rate: " + SampleRate.ToString()); sw.WriteLine("Byte rate: " + ByteRate.ToString()); sw.WriteLine("Block align: " + BlockAlign.ToString()); sw.WriteLine("Bits per sample: " + BitsPerSample.ToString()); sw.WriteLine("Subchunk2 ID: " + System.Text.Encoding.UTF8.GetString(Subchunk2ID)); sw.WriteLine("Subchunk2 rozmiar: " + Subchunk2Size.ToString()); return(sw.ToString()); }
public override string ToString() { return(ChunkId + " " + ChunkSize.ToString() + " " + Format + " " + Subchunk1Id + " " + Subchunk1Size.ToString() + " " + AudioFormat.ToString() + " " + NumChannels.ToString() + " " + SampleRate.ToString() + " " + ByteRate.ToString() + " " + BlockAlign.ToString() + " " + BitPerSample.ToString() + " " + Subchunk2Id + " " + Subchunk2Size); }
public void Update(MpdResponseCollection statusInfo) { if (statusInfo == null) { throw new BalboaNullValueException(_modName, "Update", "323", "statusInfo"); } string notNumber = @"\D{1,}"; foreach (string item in statusInfo) { string[] statusitem = item.Split(':'); string statusvalue = statusitem[1].TrimStart(' '); switch (statusitem[0]) { case "volume": Volume = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // volume: 0-100 case "repeat": Repeat = (statusvalue == "1") ? true : false; break; // repeat: 0 or 1 case "random": Random = (statusvalue == "1") ? true : false; break; // random: 0 or 1 case "single": Single = (statusvalue == "1") ? true : false; break; // single: 0 or 1 case "consume": Consume = (statusvalue == "1") ? true : false; break; // consume: 0 or 1 case "playlist": PlaylistId = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // playlist: 31-bit unsigned integer, the playlist version number case "playlistlength": PlaylistLength = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // playlistlength: integer, the length of the playlist case "state": State = statusvalue; break; // state: play, stop, or pause case "song": Song = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // song: playlist song number of the current song stopped on or playing case "songid": SongId = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // songid: playlist songid of the current song stopped on or playing case "nextsong": NextSong = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // nextsong: playlist song number of the next song to be played case "nextsongid": NextSongId = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // nextsongid: playlist songid of the next song to be played case "time": Time = float.Parse(statusvalue, CultureInfo.InvariantCulture); break; // time: total time elapsed(of current playing/paused song) case "elapsed": TimeElapsed = float.Parse(statusvalue, CultureInfo.InvariantCulture); break; // elapsed: Total time elapsed within the current song, but with higher resolution. case "bitrate": Bitrate = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // bitrate: instantaneous bitrate in kbps case "xfade": XFade = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; // xfade: crossfade in seconds case "mixrampdb": MixRampdB = float.Parse(statusvalue, CultureInfo.InvariantCulture); break; // mixrampdb: mixramp threshold in dB case "mixrampdelay": MixRampDelay = statusvalue; break; // mixrampdelay: mixrampdelay in seconds case "audio": SampleRate = Regex.IsMatch(statusvalue, notNumber) ? 0 : int.Parse(statusvalue, CultureInfo.InvariantCulture); // audio: sampleRate:bits:channels Bits = Regex.IsMatch(statusitem[2], notNumber) ? 0:int.Parse(statusitem[2], CultureInfo.InvariantCulture); Channels = Regex.IsMatch(statusitem[3], notNumber) ? 0:int.Parse(statusitem[3], CultureInfo.InvariantCulture); AudioParameters = "Sample rate: " + SampleRate.ToString(CultureInfo.InvariantCulture) + " kHz, " + Bits.ToString(CultureInfo.InvariantCulture) + " per sample, channels: " + Channels.ToString(CultureInfo.InvariantCulture); break; case "updating_db": UpdatingDbJobId = int.Parse(statusvalue, CultureInfo.InvariantCulture); break; //updating_db: job id case "error": Error = statusvalue; break; // error } } ExtendedStatus = GetExtendedStatusValue(_state); }
/// <summary> /// Returns a string that represents the current object. /// </summary> /// <returns>A string that represents the current object.</returns> /// <since_tizen> 3 </since_tizen> public override string ToString() => $"SampleRate={ SampleRate.ToString() }, Channels={ Channels.ToString() }, BitRate={ BitRate.ToString() }";