package com.headswilllol.mineflat;

import java.io.File;
import java.net.MalformedURLException;

import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.SoundSystemException;
import paulscode.sound.codecs.CodecJOrbis;
import paulscode.sound.libraries.LibraryLWJGLOpenAL;

public class SoundManager {

	static SoundSystem soundSystem = null;

	public static void initialize(){
		try {
			SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
			SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
		}
		catch (SoundSystemException ex){
			System.err.println("An exception occurred while linking the Codec-JOrbis plugin");
		}
		soundSystem = new SoundSystem();

		try {
			soundSystem.backgroundMusic("Infinity", new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath() +
				"audio/soundtrack/infinity.ogg").toURI().toURL(), "ogg", true);
			// for when running from Eclipse workspace
			//soundSystem.backgroundMusic("Infinity",
			//new File("C:/Users/Maxim/AppData/Roaming/.mineflat/resources/audio/soundtrack/infinity.ogg").toURI().toURL(), "ogg", true);
		}
		catch (MalformedURLException ex){
			ex.printStackTrace();
			System.err.println("Failed to initialize audio stream!");
		}
	}

}

@@ -88,16 +88,52 @@
 ception;
+%0Aimport java.net.URISyntaxException;
 %0A%0Aimport
@@ -747,16 +747,215 @@
 %09%09try %7B%0A
+%09%09%09System.out.println(new File(new File(Main.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile().getPath() +%0A%09%09%09%09%09%22/audio/soundtrack/infinity.ogg%22).toURI().toURL());%0A
 %09%09%09sound
@@ -988,17 +988,31 @@
 finity%22,
- 
+%0A%09%09%09%09%09new File(
 new File
@@ -1088,16 +1088,47 @@
 th()
+).getParentFile().getPath()
  +%0A%09%09%09%09
+%09
-%22
+%09%09%22/
 audi

Fix audio (again)