Hi to all,
I intend to allow users to upload some sounds to the game I’m building. The file format that is to be allowed is the .wav format. Presently I am using the python wave module to ensure that the uploaded file is of type .wav like this:
try:
read_obj=wave.open(sound_sent,'rb')
#the rest of the code.
...
except wave.Error:
#show appropriate message.
...
That does work except at times even when a .wav file is uploaded it still throws the exception; I suppose due to some error in the way the file is encoded even though it works in panda3d when played without passing through that try-exception block of code. Is there a way to ensure that the file is encoded as .wav using panda3d?
The next question regards getting the number of channels. I need the channels to be 1 for certain types of sounds. Again using the python wave module:
if(read_obj.getnchannels()==1):
#rest of the code.
...
Is it possible to get the number of channels for a .wav file using panda3d? If so, how is it done?
Thanks in advance.