Re: chat on some programming languages

2016-02-15 Thread AudioGames . net Forum — Developers room : helsywarner via Audiogames-reflector


  


Re: chat on some programming languages

Check this chat programming samplehttp://csharp.net-informations.com/comm … amming.htmWarner

URL: http://forum.audiogames.net/viewtopic.php?pid=250457#p250457





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-14 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to 
 make the script less readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-14 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to make the script less
  readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-12 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to 
 make the script less readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-12 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to make the script less
  readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-11 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to 
 make the script less readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-11 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to make the script less
  readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-10 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to 
 make the script less readable in case anyone tries to extract it and lookup the password.Edit: If anyones curious here's the OpenAL loader class i'm using, which unfortunately only works with wav files:import wave
import os
import sys

class load_sound(object):
def __init__(self,filename):
self.name = filename
#load/set audio file
if len (sys.argv) < 2:
print ("Usage: %s wavefile" % os.path.basename(sys.argv[0]))
print ("Using an example wav file...")
dirname = os.path.dirname(os.path.realpath(__file__))
##dirname += '/data/'
fname = os.path.join(dirname, filename)
else:
fname = sys.argv[1]

wavefp = wave.open(fname)
channels = wavefp.getnchannels()
bitrate = wavefp.getsampwidth() * 8
samplerate = wavefp.getframerate()
wavbuf = wavefp.readframes(wavefp.getnframes())
self.duration = (len(wavbuf) / float(samplerate))/2
self.length = len(wavbuf)
formatmap = {
(1, 8) : al.AL_FORMAT_MONO8,
(2, 8) : al.AL_FORMAT_STEREO8,
(1, 16): al.AL_FORMAT_MONO16,
(2, 16) : al.AL_FORMAT_STEREO16,
}
alformat = formatmap[(channels, bitrate)]

self.buf = al.ALuint(0)
al.alGenBuffers(1, self.buf)
#allocate buffer space to: buffer, format, data, len(data), and samplerate
al.alBufferData(self.buf, alformat, wavbuf, len(wavbuf), samplerate)

def delete(self):
al.alDeleteBuffers(1, self.buf)

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-10 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files, in this example i'm using one of my own OpenAL functions to load the sound into self.sound, if your using a different method you may need to use resource_path(fileName) to link to the file.import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to 
 make the script less readable in case anyone tries to extract it and lookup the password.

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-10 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Something to keep in mind is that I ran into problems with case sensative files at times, so it might not hurt to double check the capitalization of your file extentions and names. Now, assuming your using the latest Pyinstaller lets say you want to pack a zip file containing your music and want to load it at run time, you start by adding this function to your py script:def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
if hasattr(sys, '_MEIPASS'):
return os.path.join(sys._MEIPASS, relative_path)

return os.path.join(os.path.abspath("."), relative_path)This finds the absolute path to the temporary folder created at run time when running the executable, and where the zip file should end up. Next we load and unpack the audio files:import zipfile
import os
import sys

myzipfile = zipfile.ZipFile(resource_path('data.zip'),'r')

#if you have a password on the zip, this line sets the zipfile password for reading, otherwise exclude.
#myzipfile.setpassword('password')

for fileName in myzipfile.namelist():
if fileName == 'sound.wav':
myzipfile.extract(fileName,resource_path(''))
self.sound = load_sound(fileName)
os.remove(resource_path(fileName))After that we run Pyinstaller.py to generate a spec file and apply the tag to pack it as a single file:pyinstaller.py --onefile --noconsole yourprogram.pyThen we edit the spec file and put in the line to include our zip file between the "pyz = PYZ" and "exe = EXE" lines:a.datas += [('data.zip','C:\folder\\data.zip', 'DATA')]Then we recompile the spec file:pyinstaller.py yourprogram.specThis will grab and include the zipfile into the final executable and unpack it into the temporary folder created when the program is run. There are a few extra steps you can take to protect the zip by compiling your main script as a PYC binary and using a separate loader script, or running it through an obfusticator to 
 make the script less readable in case anyone tries to extract it and lookup the password.

URL: http://forum.audiogames.net/viewtopic.php?pid=249986#p249986





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-10 Thread AudioGames . net Forum — Developers room : danny via Audiogames-reflector


  


Re: chat on some programming languages

That would be cool if you could explain it, I use pyinstaller as well.

URL: http://forum.audiogames.net/viewtopic.php?pid=249981#p249981





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-10 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

It took me awhile to figure out, but you can pack arbitrary data files like password protected zips into your executable in Pyinstaller. If you like I can explain the process, which also involves loading your assets a little differently to link to them properly at runtime.

URL: http://forum.audiogames.net/viewtopic.php?pid=249976#p249976





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-02-10 Thread AudioGames . net Forum — Developers room : Hrvoje via Audiogames-reflector


  


Re: chat on some programming languages

I'm currently experimenting in writing games with 3 languages, BGT, PureBasic, and Python. My final choice will of course be the one that will satisfy all my needs. Here are my findings and opinions.BGT: BGT is probably the only one that has all required stuff for writing audio games (sound menus, sound positioning, speaking numbers, pathfinder, audio forms), and that's why it's made for. However, it's syntax is C-like and I prefere more easily readable syntax like the one in Python and Basic languages. Also for some game stuff, such as creating maps and enemies, you'll probably need to spend more lines of code in BGT than you'll need with Python or PB.PureBasic: I was nostalgic about BNS Basic that I've learned to use back in late 2003. So I decided to buy PB in order to experiment with no limitation and to use it for some smaller app projects. It has the ability to pack sounds into the executable, which is good if I wanna protect my
  sounds from modifying by other users. The only thing that I have to find out yet is how much time it will take for me to transition from Python to PB, since there are big differences in some parts of the language .Python: Python would be the best choice for me, I'm programming in Python for 6 years and I will not have to learn new stuff required for transitioning to other programming language. However, the one and only reason why I don't feel good at writing games in Python is that I can't easily pack and encrypt sound files like I can do it in BGT. If I ever find the easy way on how to pack and encrypt sounds so they can't be modified by users, then I will not have to look forward, and I can choose Python and Pyglet with not too much thinking. It's always easier to write the game in something that you already know to use quite well, than with som
 ething that's new to you.

URL: http://forum.audiogames.net/viewtopic.php?pid=249964#p249964





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-01-12 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: chat on some programming languages

Before you do anything that involves networking, I recommend you learn how a network functions and how the internet functions. If you don't have an in-depth knowledge of how the internet functions (how frames are processed, what the different OSI and TCP/IP models are and what the 7 and 4 layers do, respectively, etc), you will not understand how your code words, and you may then have poorer code or poorer performance.

URL: http://forum.audiogames.net/viewtopic.php?pid=246546#p246546





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-01-11 Thread AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector


  


Re: chat on some programming languages

you need a network library first (it makes your life easier)or os speciffic socket apithen you need to implement a server which get's messages from clients and send it back to other clientslook at sdl_net, it has an example of chat client and servermaybe you need to create a private messaging system, but instead of broadcasting the message to others, it just send it to 1 client

URL: http://forum.audiogames.net/viewtopic.php?pid=246447#p246447





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-01-11 Thread AudioGames . net Forum — Developers room : visualstudio via Audiogames-reflector


  


Re: chat on some programming languages

you need a network library first (it makes your life easier)or os speciffic socket apithen you need to implement a server which get's messages from clients and send it back to other clientslook at sdl_net, it has an example of chat client and servermaybe you need to create a private messaging system, which is like that server, but instead of broadcasting the message to others, it just send it to 1 client

URL: http://forum.audiogames.net/viewtopic.php?pid=246447#p246447





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-01-11 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: chat on some programming languages

Assuming you mean you want to know more about networking in the various languages, the answer will be more or less the same for all of them. All programming languages are more or less the same, they all have loops, variables, etc. The only differences between them are syntax and a feature here and there.Having said that, in Python you can network between different applications using the built in Socket module, or use the Python Twisted library which can make things abit easier. Really though, you may find reading books and tutorials on general networking principles like Sockets, TCP and UDP protocols, Client Server models, etc. much more useful than language specific networking questions, and if you don't know how to program you should definitely learn more about that first.

URL: http://forum.audiogames.net/viewtopic.php?pid=246389#p246389





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: chat on some programming languages

2016-01-11 Thread AudioGames . net Forum — Developers room : Ethin via Audiogames-reflector


  


Re: chat on some programming languages

Hi,I would not do chat in BGT. It is rather... difficult and complicated. The others, though... that's complicated too. It's harder than it sounds.

URL: http://forum.audiogames.net/viewtopic.php?pid=246374#p246374





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

chat on some programming languages

2016-01-05 Thread AudioGames . net Forum — Developers room : jonikster via Audiogames-reflector


  


chat on some programming languages

Greetings to all!Who can lay please online chat in the following languages:PythonBGTVb 6VB.netC #C ++I am a language where it is easier to network applications.Thanks in advance!

URL: http://forum.audiogames.net/viewtopic.php?pid=245654#p245654





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector