diff --git a/README.md b/README.md index d33d07c..0705b80 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ Features added since the last commit of [Headshot's AO2XP](https://github.com/he - Playing music over HTTPS (on systems where the BASS library can't do it on its own) - Connections over secure websockets (wss) - FLAC music support -- MIDI music support (needs a soundfount file named `gm.sf2` in the root AO2XP directory) - Module music support (MOD, XM, IT, S3M) - Unicode support everywhere diff --git a/audio.py b/audio.py index 1c697ea..e385cd7 100644 --- a/audio.py +++ b/audio.py @@ -8,23 +8,19 @@ dll = None dllf = "" opus = "" flac = "" -midi = "" use_ctypes = False if platform.system() == "Windows": dllf = "bass.dll" opus = "bassopus.dll" flac = "bassflac.dll" - midi = "bassmidi.dll" elif platform.system() == "Darwin": dllf = "libbass.dylib" opus = "libbassopus.dylib" flac = "libbassflac.dylib" - midi = "libbassmidi.dylib" else: dllf = "libbass.so" opus = "libbassopus.so" flac = "libbassflac.so" - midi = "libbassmidi.so" def checkAvailable(): """ @@ -34,11 +30,9 @@ Returns string with dll name if it's missing, empty if all DLLs are in place one = os.path.exists(os.path.abspath(dllf)) two = os.path.exists(os.path.abspath(opus)) three = os.path.exists(os.path.abspath(flac)) - four = os.path.exists(os.path.abspath(midi)) if not one: return dllf if not two: return two if not three: return three - if not four: return four return "" @@ -62,13 +56,6 @@ Initialize BASS and the opus plugin print "[audio] Opus plugin failed to load. Error", getBassError() if not dll.BASS_PluginLoad(os.path.abspath(flac), 0): print "[audio] FLAC plugin failed to load. Error", getBassError() - if not dll.BASS_PluginLoad(os.path.abspath(midi), 0): - print "[audio] MIDI plugin failed to load. Error", getBassError() - - if os.path.exists(os.path.abspath("gm.sf2")): - dll.BASS_SetConfigPtr(bassmidi.BASS_CONFIG_MIDI_DEFFONT, "gm.sf2"); - else: - print "[audio] Soundfont not fount. MIDI files will not play." def free(): """ diff --git a/gameview.py b/gameview.py index bb1f037..fa3b953 100644 --- a/gameview.py +++ b/gameview.py @@ -1622,7 +1622,7 @@ class GUI(QtGui.QWidget): self.notGuiltySfx = 0 self.stream = 0 - self.specialStream = 0 + self.specialStream = False self.downloadThread = None self.tcp = None self.demoPlayer = None @@ -3787,12 +3787,10 @@ class GUI(QtGui.QWidget): else: error = audio.getBassError() #print "[audio] Couldn't play music. Error", error - # Here comes the evil HTTPS hack for XP systems, but it also allows us to download and play modules and midis, because, why not? + # Here comes the evil HTTPS hack for XP systems, but it also allows us to download and play modules, because, why not? musext = os.path.splitext(basename(musl))[-1] - if musext in ['.mid', '.midi']: - self.specialStream = 1 - elif musext in ['.xm', '.mod', '.mo3', '.it', '.s3m', '.mtm', '.umx']: - self.specialStream = 2 + if musext in ['.xm', '.mod', '.mo3', '.it', '.s3m', '.mtm', '.umx']: + self.specialStream = True if (musl.startswith("https") and error == 2) or self.specialStream: print "[audio] Downloading music with urllib2" self.downloadThread = MusicDownloadThread(self, mus) @@ -3804,9 +3802,8 @@ class GUI(QtGui.QWidget): if audio.handleIsActive(self.music): audio.stopHandle(self.music) if self.specialStream: - if self.specialStream == 2: - audio.freeMOD(self.music) - self.specialStream = 0 + audio.freeMOD(self.music) + self.specialStream = False else: audio.freeHandle(self.music) if self.stream: @@ -3820,9 +3817,7 @@ class GUI(QtGui.QWidget): def playDownloadedMusic(self, file_length): # Part of the evil HTTPS music download hack for XP systems print "[audio] Done downloading; playing stream" - if self.specialStream == 1: - self.music = audio.loadMIDI(True, self.stream, 0, file_length, BASS_SAMPLE_LOOP) - elif self.specialStream == 2: + if self.specialStream: self.music = audio.loadMOD(True, self.stream, 0, file_length, BASS_SAMPLE_LOOP) else: self.music = audio.loadHandle(True, self.stream, 0, file_length, BASS_SAMPLE_LOOP) diff --git a/setup.py b/py2exe.py similarity index 100% rename from setup.py rename to py2exe.py diff --git a/quicksetup.py b/quicksetup.py index e0bf8ca..1241124 100644 --- a/quicksetup.py +++ b/quicksetup.py @@ -37,8 +37,6 @@ BASSOPUSZIP = "bassopus24.zip" BASSOPUSDLL = "bassopus.dll" BASSFLACZIP = "bassflac24.zip" BASSFLACDLL = "bassflac.dll" -BASSMIDIZIP = "bassmidi24.zip" -BASSMIDIDLL = "bassmidi.dll" if platform.system() == "Darwin": BASSZIP = "bass24-osx.zip" BASSDLL = "libbass.dylib" @@ -46,8 +44,6 @@ if platform.system() == "Darwin": BASSOPUSDLL = "libbassopus.dylib" BASSFLACZIP = "bassflac24-osx.zip" BASSFLACDLL = "libbassflac.dylib" - BASSMIDIZIP = "bassmidi24-osx.zip" - BASSMIDIDLL = "libbassmidi.dylib" elif platform.system() == "Linux": BASSZIP = "bass24-linux.zip" BASSDLL = "libbass.so" @@ -55,9 +51,6 @@ elif platform.system() == "Linux": BASSOPUSDLL = "libbassopus.so" BASSFLACZIP = "bassflac24-linux.zip" BASSFLACDLL = "libbassflac.so" - BASSMIDIZIP = "bassmidi24-linux.zip" - BASSMIDIDLL = "libbassmidi.so" - print "downloading", BASSZIP filedata = urllib2.urlopen('http://us.un4seen.com/files/'+BASSZIP) datatowrite = filedata.read() diff --git a/setup_mac.py b/setup_mac.py deleted file mode 100644 index efa08b5..0000000 --- a/setup_mac.py +++ /dev/null @@ -1,49 +0,0 @@ -""" -This is a setup.py script generated by py2applet - -Usage: - python setup.py py2app -""" - -from setuptools import setup - -APP = ['AO2XP.py'] -DATA_FILES = [] -OPTIONS = dict( - iconfile = "AO2XP.icns", - - includes = [ - "PyQt4.QtCore", - "PyQt4.QtGui", - ], - - excludes = [ - "PyQt4.QtDesigner", - "PyQt4.QtNetwork", - "PyQt4.QtOpenGL", - "PyQt4.QtScript", - "PyQt4.QtSql", - "PyQt4.QtTest", - "PyQt4.QtWebKit", - "PyQt4.QtXml", - "PyQt4.phonon", - ], - - resources = [ - "AO2XPbase", - "libbass.dylib", - "libbassopus.dylib", - "mod_call.wav", - "placeholder.png", - "word_call.wav", - ], - - argv_emulation = False -) - -setup( - app=APP, - data_files=DATA_FILES, - options={'py2app': OPTIONS}, - setup_requires=['py2app'], -)