This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static KeyValuePair<string, string> GetLastChatMessage(string html) | |
{ | |
var startIndex = html.LastIndexOf("username owner", StringComparison.Ordinal); | |
startIndex = html.IndexOf(">", startIndex, StringComparison.Ordinal) + 1; | |
// Get username. | |
var username = html.Substring(startIndex, (html.IndexOf(">", startIndex + 1, StringComparison.Ordinal) - startIndex) - 5); | |
// Get message. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<A class=\"signature user-227577\" href=\"/users/227577/sam\">\r\n<DIV style=\"DISPLAY: none\" class=tiny-signature | |
jQuery17106276336429219909=\"318\">\r\n<DIV class=\"avatar avatar-16\"><IMG title=Sam alt=Sam src=\"http://i.stack.imgur.com/Y22En.png?s=128&g=1&g&s=16\" | |
width=16 height=16></DIV>\r\n<DIV class=\"username owner\">Sam</DIV></DIV>\r\n<DIV style=\"DISPLAY: block\" class=\"avatar avatar-32 clear-both\" | |
jQuery17106276336429219909=\"57\"><IMG title=Sam alt=Sam src=\"http://i.stack.imgur.com/Y22En.png?s=128&g=1&g&s=32\" width=32 height=32>\r | |
\n<DIV></DIV></DIV>\r\n<DIV style=\"DISPLAY: block\" class=\"username owner\" jQuery17106276336429219909=\"56\">Sam</DIV>\r\n<DIV class=flair title=125 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vector<WavFileRead> VSSEnvironment::GetChannels(string directory) | |
{ | |
vector<WavFileRead> files; | |
if (DirectoryTools::FileExists(directory + ChannelsFunctions::GetFriendlyName(FrontLeft) + ".wav")) | |
{ | |
files.push_back(WavFileRead(directory + ChannelsFunctions::GetFriendlyName(FrontLeft) + ".wav")); | |
} | |
if (DirectoryTools::FileExists(directory + ChannelsFunctions::GetFriendlyName(FrontRight) + ".wav")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static IEnumerable<WavFileRead> GetChannels(string directory) | |
{ | |
var files = Enum.GetValues(typeof(Channels)).Cast<Channels>().Where(channel => channel != Channels.Custom && channel != Channels.Mono).Select(channel => Path.Combine(directory, channel.GetFriendlyName() + ".wav")).Where(File.Exists).Select(path => new WavFileRead(path)).ToList(); | |
files.AddRange(Directory.EnumerateFiles(directory).Where(fileName => fileName.Contains(Channels.Mono.GetFriendlyName()) || fileName.Contains(Channels.Custom.GetFriendlyName())).Select(file => new WavFileRead(file))); | |
return files; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (C) 2014 S.Kamber. | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// any later version. | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (C) 2014 S.Kamber. | |
// This program is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// any later version. | |
// This program is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Read32BitSamples is called first. | |
private float[] Read32BitSamples(FileStream stream, int sampleStartIndex, int sampleEndIndex) | |
{ | |
var bytesLength = 0; | |
var allocation = ReadBytes(stream, sampleStartIndex, sampleEndIndex, out bytesLength); | |
var bytes = (byte*)allocation.Allocation; | |
var samples = new float[bytesLength / 4]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Globalization; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Threading; | |
// WARNING: For the code below to exacute properly (without getting a SOE) this program must be | |
// a full-trust app; see, project properties > security > enable "ClickOnce security setting" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Mark's method. | |
public unsafe static void TestMethod2() | |
{ | |
var ptr = Marshal.AllocHGlobal(50000000); | |
try | |
{ | |
float* x = (float*)ptr; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// PFM's method. | |
public static unsafe void TestMethod1() | |
{ | |
float* samples = stackalloc float[12500]; | |
for (var i = 0; i < 100; i++) | |
{ | |
for (var ii = 0; ii < 12500; ii++) | |
{ |