@@ -52,19 +52,19 @@ public enum Reader { WindowCaption, File, Website, ProcessMemory };
public LSMeta()
{
src = ptn = tit = "";
encoding = "UTF-8";
encoding = "utf-8";
reader = Reader.WindowCaption;
freq = 500;
grp = 1;
}
public LSMeta(Reader r, string ti, string sr, int fr, string pt, int grp)
public LSMeta(Reader r, string ti, string sr, int fr, string pt, int grp = 1, string enc = "utf-8")
{
reader = r;
tit = ti;
src = sr;
ptn = pt;
freq = fr;
encoding = "UTF-8";
encoding = enc;
this.grp = grp;
}
public override string ToString()
@@ -116,7 +116,7 @@ public class LSParams
public LSPreset[] presets;

public LSParams mp3, ogg;
public long samplerate;
public int samplerate;
public string host;
public int port;
public string pass;
@@ -222,55 +222,52 @@ public void initWhenDeserializationFails()
{
metas.AddRange(new LSMeta[] {
new LSMeta(LSMeta.Reader.WindowCaption, "Foobar 2000", "foobar2000", 500,
@" *(.*[^ ]) *( - foobar2000$|\[foobar2000 v([0-9\.]*)\]$)", 1),
@" *(.*[^ ]) *( - foobar2000$|\[foobar2000 v([0-9\.]*)\]$)"),
new LSMeta(LSMeta.Reader.WindowCaption, "Winamp", "winamp", 500,
@"([0-9]*\. )? *(.*[^ ]) * - Winamp$", 2),
new LSMeta(LSMeta.Reader.WindowCaption, "VLC", "vlc", 500,
@" *(.*[^ ]) * - VLC media player", 1),
@" *(.*[^ ]) * - VLC media player"),
new LSMeta(LSMeta.Reader.ProcessMemory, "iTunes 64bit 11.0.4.4", "itunes", 500,
"iTunes.dll+15C4D52, iTunes.dll+15C4952", 1),
"iTunes.dll+15C4D52, iTunes.dll+15C4952", 1, "utf-16"),
new LSMeta(LSMeta.Reader.Website, "other icecast mount", "http://stream0.r-a-d.io:8000/", 2000,
"<tr>\\n<td><h3>Mount Point /main.mp3</h3></td>.*?<td>Current Song:</td>\\n<td class=\"streamdata\">(.*?)</td>", 1),
"<tr>\\n<td><h3>Mount Point /main.mp3</h3></td>.*?<td>Current Song:</td>\\n<td class=\"streamdata\">(.*?)</td>"),
});
}
}
public void runTests(Splesh splesh)
public void runTests(Splesh splesh, bool forceTest)
{
if (testDevs)
Program.DBGLOG = "";
if (testDevs || forceTest)
{
StringBuilder sw = new StringBuilder();
for (int a = 0; a < devs.Length; a++)
{
splesh.prog(a + 1, devs.Length);
devs[a].test();
}
/*using (System.IO.StreamWriter sw = new System.IO.StreamWriter("Loopstream.devs", false, Encoding.UTF8))
{
foreach (LSDevice dev in devs)
//devs[a].test();
try
{
devs[a].test();
sw.AppendLine(devs[a].mm.ID);
sw.AppendLine(devs[a].mm.DeviceFriendlyName);
sw.AppendLine(devs[a].mm.FriendlyName);
try
{
dev.test();
sw.WriteLine(dev.mm.ID);
sw.WriteLine(dev.mm.DeviceFriendlyName);
sw.WriteLine(dev.mm.FriendlyName);
try
{
sw.WriteLine(LSDevice.stringer(dev.wf));
}
catch
{
sw.WriteLine("*** bad wf ***");
}
sw.AppendLine(LSDevice.stringer(devs[a].wf));
}
catch
{
sw.WriteLine("*!* bad dev *!*");
sw.AppendLine("*** bad wf ***");
}
sw.WriteLine();
sw.WriteLine("---");
sw.WriteLine();
}
}*/
catch
{
sw.AppendLine("*!* bad dev *!*");
}
sw.AppendLine();
sw.AppendLine("---");
sw.AppendLine();
}
Program.DBGLOG += sw.ToString();
}
}

@@ -320,11 +317,13 @@ public static LSSettings load()

int myVer = version();
int iniVer = Convert.ToInt32(ver, 16);
if (myVer != iniVer && false)
if (myVer != iniVer)
{
byte[] bver = BitConverter.GetBytes(iniVer);
Array.Reverse(bver);
System.Windows.Forms.MessageBox.Show(
"Your configuration file is from version " + iniVer + ", which is too old.\r\n\r\n" +
"Starting with default config.",
"Your configuration file is from version " + BitConverter.ToString(bver) + ", which is rather old.\n\n" +
"Don't get your hopes up but I'll try to load it...",
"Incompatible config file",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
@@ -338,7 +337,7 @@ public static LSSettings load()
{
ret = new LSSettings();
System.Windows.Forms.MessageBox.Show(
"Failed to load settings:\r\n«Loopstream.ini» is probably from an old version of the program.\r\n\r\nDetailed information:\r\n" + e.Message + "\r\n" + e.StackTrace,
"Failed to load settings:\n«Loopstream.ini» is probably from an old version of the program.\n\nDetailed information:\n" + e.Message + "\n" + e.StackTrace,
"Default settings",
System.Windows.Forms.MessageBoxButtons.OK,
System.Windows.Forms.MessageBoxIcon.Information);
@@ -353,8 +352,8 @@ public static LSSettings load()
catch (Exception e)
{
System.Windows.Forms.MessageBox.Show(
"Failed to initialize settings object:\r\nPossibly from an outdated version of «Loopstream.ini», though more likely a developer fuckup. Go tell ed this:\r\n\r\n" +
e.Message + "\r\n\r\n" + e.Source + "\r\n\r\n" + e.InnerException + "\r\n\r\n" + e.StackTrace);
"Failed to initialize settings object:\nPossibly from an outdated version of «Loopstream.ini», though more likely a developer fuckup. Go tell ed this:\n\n" +
e.Message + "\n\n" + e.Source + "\n\n" + e.InnerException + "\n\n" + e.StackTrace);
}
}
ret = new LSSettings();
@@ -9,6 +9,7 @@ namespace Loopstream
{
static class Program
{
public static string DBGLOG;
public static bool debug = false;
public static NotifyIcon ni;
public static string tools;
@@ -24,6 +25,7 @@ static void Main(string[] args)
//Console.WriteLine(LSSettings.version().ToString("x"));
//Program.kill();

DBGLOG = "";
SIGNMODE = false;
if (args.Length > 0)
{
@@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
@@ -68,7 +68,7 @@ void apply(bool save)
}
if (Program.debug)
{
dbg += "music=" + LSDevice.stringer(wf) + "\r\n\r\n";
dbg += "music=" + LSDevice.stringer(wf) + "\n\n";
}
}
catch
@@ -90,7 +90,7 @@ void apply(bool save)
}
if (Program.debug)
{
dbg += "mic=" + LSDevice.stringer(wf) + "\r\n\r\n";
dbg += "mic=" + LSDevice.stringer(wf) + "\n\n";
}
}
catch
@@ -100,25 +100,30 @@ void apply(bool save)
}
if (!string.IsNullOrEmpty(fail))
{
MessageBox.Show("I am sorry to say that some devices (" + fail.Trim(',', ' ') + ") fail to open.\r\nThis will probably cause issues :(",
MessageBox.Show("I am sorry to say that some devices (" + fail.Trim(',', ' ') + ") fail to open.\nThis will probably cause issues :(",
"Critical error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
if (!string.IsNullOrEmpty(smp))
{
if (DialogResult.Yes == MessageBox.Show("Hey, got some work for you!\r\n\r\n" +
"Some of your devices (" + smp.Trim(',', ' ') + ") have\r\na different samplerate than what you\r\nspecified in the settings (" + settings.samplerate + " Hz).\r\n\r\n" +
//"This will still work (I am applying a resampler), but there will be lower sound quality and more load on your computer.\r\n\r\n" +
//"If you want to keep things TopNotchâ„¢, please see the\n\"Soundcard Samplerate\" section in the readme.";
"You can't stream like this.\r\n\r\n" +
"Do you want to fix it now? I'll help you!",
if (DialogResult.Yes == MessageBox.Show(
"Some of your devices (" + smp.Trim(',', ' ') + ")\n" +
"have a different samplerate than what you\n" +
"specified in the settings (" + settings.samplerate + " Hz).\n" +
"\n" +
"This will still work, but there will be:\n" +
" - lower sound quality\n" +
" - more latency / audio delay\n" +
" - more load on your computer\n\n" +
"Do you have time to fix this for\n" +
"the ultimate r/a/dio experience?",
"HEY! LISTEN!", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
{
samplerateTutorial();
}
}
if (Program.debug)
{
if (DialogResult.No == MessageBox.Show("-!- DEBUG (no=clipboard)\r\n\r\n" + dbg, "DEBUG", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
if (DialogResult.No == MessageBox.Show("-!- DEBUG (no=clipboard)\n\n" + dbg, "DEBUG", MessageBoxButtons.YesNo, MessageBoxIcon.Information))
{
Clipboard.Clear();
Clipboard.SetText(dbg);
@@ -155,32 +160,55 @@ void samplerateTutorial()
proc.StartInfo.Arguments = "shell32.dll,Control_RunDLL mmsys.cpl,,playback";
proc.StartInfo.FileName = "rundll32.exe";
proc.Start();
MessageBox.Show("I have taken the liberty of opening\r\nyour soundcard control panel.\r\n\r\n" +
"Here's what you'll do:\r\n\r\n" +
"1. Rightclick the first playback device\r\n" +
"2. Select «Properties»\r\n" +
"3. Open the «Advanced» tab\r\n" +
"4. Change «Default Format» to this:\r\n" +
" 16 bit, " + settings.samplerate + " Hz (whatever)\r\n" +
"5. Press OK\r\n\r\n" +
"Now do that with all your playback devices,\r\nthen press OK on both the soundcard\r\ncontrol window and this message.");
MessageBox.Show("I have taken the liberty of opening\nyour soundcard control panel.\n\n" +
"Here's what you'll do:\n\n" +
"1. Rightclick the first playback device\n" +
"2. Select «Properties»\n" +
"3. Open the «Advanced» tab\n" +
"4. Change «Default Format» to this:\n" +
" 16 bit, " + settings.samplerate + " Hz (whatever)\n" +
"5. Press OK\n\n" +
"Now do that with all your playback devices,\nthen press OK on both the soundcard\ncontrol window and this message.");

proc = new System.Diagnostics.Process();
proc.StartInfo.Arguments = "shell32.dll,Control_RunDLL mmsys.cpl,,recording";
proc.StartInfo.FileName = "rundll32.exe";
proc.Start();
MessageBox.Show("Sorry, but you're not finished just yet.\r\n" +
"Don't worry, you're getting good at this!\r\n\r\n" +
"1. Rightclick the first recording device\r\n" +
"2. Select «Properties»\r\n" +
"3. Open the «Advanced» tab\r\n" +
"4. Change «Default Format» to this:\r\n" +
" 2 channel, 16 bit, " + settings.samplerate + " Hz (whatever)\r\n" +
"5. Press OK\r\n\r\n" +
"==== if you can't see a «2 channel»\r\n" +
"==== option, then «1 channel» is OK!\r\n\r\n" +
"Same procedure like last year, do that on all\r\nof your recording devices, then hit OK.\r\n\r\n" +
MessageBox.Show("Sorry, but you're not finished just yet.\n" +
"Don't worry, you're getting good at this!\n\n" +
"1. Rightclick the first recording device\n" +
"2. Select «Properties»\n" +
"3. Open the «Advanced» tab\n" +
"4. Change «Default Format» to this:\n" +
" 2 channel, 16 bit, " + settings.samplerate + " Hz (whatever)\n" +
"5. Press OK\n\n" +
"==== if you can't see a «2 channel»\n" +
"==== option, then «1 channel» is OK!\n\n" +
"Same procedure like last year, do that on all\nof your recording devices, then hit OK.\n\n" +
"Thanks, now you're ready to fly!");

Splesh spl = new Splesh();
spl.Show();
Application.DoEvents();
settings.runTests(spl, true);
spl.gtfo();
string bads = "";
foreach (LSDevice dev in settings.devs)
{
if (dev != null &&
dev.wf != null &&
dev.wf.SampleRate != settings.samplerate)
{
bads += (dev.mm.DataFlow == DataFlow.All ||
dev.mm.DataFlow == DataFlow.Render ?
"Music" : "Microphone") + " source: " +
dev.name + "\n";
}
}
if (!string.IsNullOrEmpty(bads))
{
MessageBox.Show("The following audio devices are still not using the correct samplerate (" + settings.samplerate + "):\n\n" + bads);
}
}

private void ConfigSC_Load(object sender, EventArgs e)
@@ -388,7 +416,15 @@ private void gMount_TextChanged(object sender, EventArgs e)
{
if (gMount.Text.Length > 0)
{
settings.mount = gMount.Text;
settings.mount = gMount.Text.TrimStart('/');
if (settings.mount.EndsWith(".mp3") ||
settings.mount.EndsWith(".ogg") ||
settings.mount.EndsWith(".aac"))
{
settings.mount =
settings.mount.Substring(0,
settings.mount.LastIndexOf('.'));
}
gMount.BackColor = SystemColors.Window;
gMount.ForeColor = SystemColors.WindowText;
}
@@ -603,6 +639,7 @@ private void gHost_MouseLeave(object sender, EventArgs e)
void tPop_Tick(object sender, EventArgs e)
{
tPop.Stop();
if (popTop == gHost) popTop = gMount;
// fucking hell microsoft how did you fuck THIS up
tt.Show(tt.GetToolTip(popTop), gTwoS);
}
@@ -644,17 +681,17 @@ private void gMeta_SelectedIndexChanged(object sender, EventArgs e)

if (IntPtr.Size == 4)
{
MessageBox.Show("I see you're running the 32bit version of Loopstream!\r\n\r\n" +
"If iTunes still doesn't produce correct tags with this edition of Loopstream, then the problem is probably that your version of iTunes is different from the one that Loopstream supports.\r\n\r\n" +
MessageBox.Show("I see you're running the 32bit version of Loopstream!\n\n" +
"If iTunes still doesn't produce correct tags with this edition of Loopstream, then the problem is probably that your version of iTunes is different from the one that Loopstream supports.\n\n" +
"Yes, iTunes is /that/ picky. Sorry :(");
return;
}

if (DialogResult.Yes == MessageBox.Show(
"This media player's a tricky one.\r\n\r\n" +
"If the tags you send appear to be bullshit,\r\n" +
"I can make a copy of myself that might\r\n" +
"work better for this.\r\n\r\n" +
"This media player's a tricky one.\n\n" +
"If the tags you send appear to be bullshit,\n" +
"I can make a copy of myself that might\n" +
"work better for this.\n\n" +
"Should I clone myself to Loopstream32.exe?",
"Hot Cloning Action",
MessageBoxButtons.YesNo,

Large diffs are not rendered by default.

@@ -39,9 +39,11 @@ public Home()
LSPcmFeed pcm;
LSTag tag;
Control[] invals; //sorry
string lqMessage; //sorry

private void Form1_Load(object sender, EventArgs e)
{
pMessage.Height = 64;
myBounds = this.Bounds;
this.Bounds = new Rectangle(0, -100, 0, 0);
this.Icon = Program.icon;
@@ -55,7 +57,9 @@ private void Form1_Load(object sender, EventArgs e)
void t_Tick(object sender, EventArgs e)
{
((Timer)sender).Stop();
this.Text += " v" + Application.ProductVersion;
this.Text += " v" + Application.ProductVersion
//+ "-kilim-1"
;

DFC.coreTest();
if (Directory.Exists(@"..\..\tools\"))
@@ -68,9 +72,10 @@ void t_Tick(object sender, EventArgs e)
splash.vis();
new DFC().extract(splash.pb);
}
splash.unvis();

settings = LSSettings.load();
settings.runTests(splash);
settings.runTests(splash, false);
isPresetLoad = true;

gMusic.valueChanged += gSlider_valueChanged;
@@ -160,6 +165,7 @@ void t_Tick(object sender, EventArgs e)
gOut.graden2,
};
invalOnNext = false;
lqMessage = null;

Timer tTitle = new Timer();
tTitle.Tick += tTitle_Tick;
@@ -258,14 +264,14 @@ private void gConnect_Click(object sender, EventArgs e)
if (settings.devRec == null || settings.devOut == null)
{
if (DialogResult.OK == MessageBox.Show(
"Please take a minute to adjust your settings\r\n\r\n(soundcard and radio server)",
"Please take a minute to adjust your settings\n\n(soundcard and radio server)",
"Audio endpoint is null", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
{
gSettings_Click(sender, e);

if (settings.devRec == null || settings.devOut == null)
{
MessageBox.Show("Config is still invalid.\r\n\r\nGiving up.", "Crit", MessageBoxButtons.OK, MessageBoxIcon.Error);
MessageBox.Show("Config is still invalid.\n\nGiving up.", "Crit", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
@@ -340,8 +346,8 @@ private void label3_Click(object sender, EventArgs e)
{
if (settings.devRec == null || settings.devRec.mm == null)
{
MessageBox.Show("I'm about to open the settings window.\r\n\r\n" +
"In the second dropdown (input Music), please select the speakers output you use when listening to music.\r\n\r\nPress apply when done.");
MessageBox.Show("I'm about to open the settings window.\n\n" +
"In the second dropdown (input Music), please select the speakers output you use when listening to music.\n\nPress apply when done.");
gSettings_Click(sender, e);

if (settings.devRec == null || settings.devRec.mm == null)
@@ -364,8 +370,8 @@ private void label3_Click(object sender, EventArgs e)
Clipboard.Clear();
Clipboard.SetText(str);
MessageBox.Show(
"Capture will begin when you press OK; please open a media player and start listening to some music.\r\n\r\n" +
"While you wait, the following text is on your clipboard... Paste it in irc (Ctrl-V)\r\n\r\n" + str);
"Capture will begin when you press OK; please open a media player and start listening to some music.\n\n" +
"While you wait, the following text is on your clipboard... Paste it in irc (Ctrl-V)\n\n" + str);

wdt_v = File.OpenWrite("Loopstream.raw");
wdt_writer = new NAudio.Wave.WaveFileWriter("Loopstream.wav", wdt_waveIn.WaveFormat);
@@ -381,7 +387,7 @@ private void label3_Click(object sender, EventArgs e)
}
gMic.level = 0;
if (DialogResult.Yes == MessageBox.Show("Test finished! The soundclip has been recorded to Loopstream.wav in the " +
"same folder as this .exe, more specifically here:\r\n\r\n" + Application.StartupPath + "\r\n\r\n" +
"same folder as this .exe, more specifically here:\n\n" + Application.StartupPath + "\n\n" +
"Could you uploading this to pomf.se? Thanks!", "Open browser?", MessageBoxButtons.YesNo))
{
System.Diagnostics.Process.Start("http://pomf.se/");
@@ -431,11 +437,44 @@ private void gGit_Click(object sender, EventArgs e)

void tTitle_Tick(object sender, EventArgs e)
{
if (mixer != null && mixer.isLQ != null)
{
lqMessage = mixer.isLQ;
mixer.isLQ = null;
this.Height += 64;
pMessage.Visible = true;
}
if (tag == null) return;
this.Text = string.Format("{0:0.00} // {1:0.00} // {2}",
Math.Round(settings.mp3.FIXME_kbps, 2),
Math.Round(settings.ogg.FIXME_kbps, 2),
tag.tag);
}

long lastclick = 0;
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
long time = DateTime.UtcNow.Ticks / 10000;
if (time < lastclick + 1000)
{
Clipboard.Clear();
Application.DoEvents();
Clipboard.SetText(Program.DBGLOG);
Application.DoEvents();
MessageBox.Show("Debug information placed on clipboard\n\nGo to pastebin and Ctrl-V");
}
lastclick = time;
}
}

private void gLowQ_Click(object sender, EventArgs e)
{
pMessage.Visible = false;
this.Height -= 64;
MessageBox.Show(lqMessage);
lqMessage = null;
}
}
}
@@ -34,20 +34,26 @@ private void Splesh_Load(object sender, EventArgs e)
public void vis()
{
/*MessageBox.Show(
"Hello there!\r\n" +
"\r\n" +
"Since this is your first run, here's a\r\n" +
"short list of things that don't work yet:\r\n" +
"\r\n" +
" - Streaming to OGG/Vorbis\r\n" +
" (icecast disconnects when you stream silence)\r\n" +
"\r\n" +
"That's about it.\r\n" +
"Hello there!\n" +
"\n" +
"Since this is your first run, here's a\n" +
"short list of things that don't work yet:\n" +
"\n" +
" - Streaming to OGG/Vorbis\n" +
" (icecast disconnects when you stream silence)\n" +
"\n" +
"That's about it.\n" +
"Enjoy streaming!");*/
label1.Visible = label2.Visible = label3.Visible = true;
Application.DoEvents();
}

public void unvis()
{
label1.Visible = label2.Visible = false;
Application.DoEvents();
}

public void prog(int cur, int max)
{
label3.Visible = true;
@@ -3,6 +3,10 @@
+ new feature
~ other change

2013-08-01, 00:16:11 - Loopstream 1.2.0.0
+ Samplerate conversion
+ Shitty debug logger

2013-07-30, 23:18:43 - Loopstream 1.1.1.0
= Streaming without mic
~ Mixer preset tweaks