2019-02-10 13:54:26 (edited by CAE_Jones 2019-02-10 14:11:10)

That's not so difficult. I mean, the way images work in Python isn't as intuitive as Java2d, so I couldn't write an example off the top of my head, but gimme a sec to look it up...
Edit: ugh, actually, it is quite hidious. Behold something I think should work:
from pygame import *
def fmod_logo() :
    img=image.load("firelight_logo.png")
    a=surfarray.array3d(img)
    init() # if pygame hasn't already been initialized. I should have just done import pygame instead, but shutup.
    window=display.set_mode(img.get_size())
    display.set_caption("Using FMODEX, from Firelight Studios")
    window.blit(img, Rect((0, 0, img.get_width(), img.get_height())))
    display.flip()

Yep, that's hidious and I'm going to write a graphics_pool to make it more tolerable right now.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2019-02-10 14:42:05

soft openAL has support for hrtf, but it is right handed.

2019-02-10 15:46:56

I'm too flexible to understand what it means for a coordinate system to be right or left handed. Am I pointing my thumb up or down, and am I curling my fingers like halfway toward a fist? And is there something bad about a right-handed system for gamedev?

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2019-02-10 22:43:11 (edited by Ethin 2019-02-10 22:43:58)

@53, no. The way FMOD (and related sound engines and even OpenGL) work is through a graph: an audio graph for FMOD/Wwise and a scene/graphics graph with OpenGL. In either coordinate systems, there are always the x and y axes which act as constants of sorts: positive x is left and right, positive y is up and down. The difference is in the Z axis: in a left-handed coordinate system, positive Z is forward, and negative Z is backward; in a right-handed coordinate system it is just the opposite: negative Z is forward and positive Z is backward.
@52, OpenAL is nice if you like writing your own decoders or enjoy having to link your program against 30-40 DLLs and libraries just to encode an decode audio.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-02-11 08:35:42

Hi,
So I've downloaded and installed FMOD API on my system. Now I copied fmod.dll in a directory. And here is my python script:
import ctypes
lib=ctypes.cdll.LoadLibrary("fmod.dll")
It works, no errors so far. But how do I use the System and other classes?
Running dir function on it didnt show me anything of interest, and if I type Lib.System it throws an error?
Regards,
Amit

There once was a moviestar icon.
Who prefered to sleep with the light on.
They learnt how to code, devices sure glowed,
and lit the night using python.

2019-02-11 09:54:55

you can look the FMOd chm documentation in the fmod directory.

Paul

2019-02-11 10:53:25

Hi,
I've seen them before writing the earlier post. It's either I am using the wrong dll or something. Could somebody provide a little example of playing a sound file using this dll in python? once I see a small example I will be able to write the wrapper using the chm file.
Regards,
Amit

There once was a moviestar icon.
Who prefered to sleep with the light on.
They learnt how to code, devices sure glowed,
and lit the night using python.

2019-02-11 13:23:47

Amit, is there any way to contact you privately? I would like to give you some feedback and send you an updated version of these pythonn scripts I fixed up.

Ivan M. Soto.
Feel free to check out my work and services.
http://ims-productions.com

2019-02-11 13:35:48

Hi,
Thank you. I highly appreciate it.
Yes. You can send me an email at aggarwal dot amit dot 4 4 4 @gmail dot com
Or send a forum pm.
Regards,
Amit

There once was a moviestar icon.
Who prefered to sleep with the light on.
They learnt how to code, devices sure glowed,
and lit the night using python.

2019-02-11 15:19:24

@pauliyobo, that wasn't exactly helpful at all.
@Amit, here is how you use FMOD in Python using ctypes:

# initialize the system object

fmod=ctypes.CDLL("fmod64.dll")
system=ctypes.c_void_p()
# all functions return an FMOD_RESULT. So we save that to a variable
# there are helpers for this, we'll do that in a moment
res = fmod.FMOD_System_Create(ctypes.byref(system))
if res!=0:
    # some error occurred.

# our system object is now created, but not initialized. Initialize it with 4093 maximum voices, no flags, and no extra driver data.
res=fmod.FMOD_System_Init(system, 4093, 0, None)
if res!=0:
    # some error occurred.

# Now we can wrap the error checking in an FMOD callback
# This takes a bit of ctypes magic though
# declare the FMOD_ERRORCALLBACK_INFO structure
class FMOD_ERRORCALLBACK_INFO (ctypes.Structure): pass
# declare its fields
FMOD_ERRORCALLBACK_INFO._fields_=[
    ("result", ctypes.c_int),
    ("instancetype", ctypes.c_void_p),
    ("instance", ctypes.c_void_p),
    ("functionname", ctypes.c_char_p),
    ("functionparams", ctypes.c_char_p)
]
# declare the callback
ErrorCallback = ctypes.CFUNCTYPE(ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p)
def SystemErrorCallback(system, type, commanddata1, commanddata2, userdata):
    if type==0x00000080: # error callback
        info=ctypes.cast(commanddata1, FMOD_ERRORCALLBACK_INFO)
        if info.result!=0:
            # error occurred, handle it here

callback=ErrorCallback(SystemErrorCallback)
res=fmod.FMOD_System_SetCallback(system, ctypes.byref(callback), 0x00000080)
if res!=0:
    # an error occurred setting the callback and it wasn't set

That's generally how you use it. It looks really complicated (and I haven't tested the error callback code above yet), but it gets much easier after a while. Declaring enumerations also isn't very hard with the Aenum package. The difficulty is declaring float* arrays ahead-of-time.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-02-11 19:40:14

python is better than bgt
the bgt outdated crap,  it  won't get bug fix,  or future updates, philip doesn't care his engine anymore
it has more errors in windows 10
bgt is    limited

2019-02-12 15:42:38

There are lots of python game libraries here:
https://wiki.python.org/moin/PythonGameLibraries
Relevant to those use to BGT is Direct Python, which wraps Direct X, which is what BGT uses (Direct Sound, Direct Input, etc).

Found by asking Google "what is the easiest way to get 3d audio in python". I did not get an answer, unless OpenAL is an answer, which I am disinclined  to believe.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2019-02-12 16:05:32

#60 It could have been my missunderstanding.
I thought he wanted to know where to find the FMOD functions.

Paul

2019-02-12 16:50:28

Panda3d seems like the least ass-pain-inflicting way to do more complex games. Apparently I ate something that has me more mentally fragile than usual today, though, so find that the idea of some sort of Skype "class" on how to use it sounds unusually nice. Something that would focus on the stuff relevant to audio games, rather than a million pages on the subtleties of 3d graphics (3d audio gets a whole page in the manual. "Oh, yeah, we have this, too. Here are four or five useful function-method-magigs. Now, back to chapter 10 on shading texture lights in antialiased fog-ramps...").

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2019-02-12 18:32:44 (edited by Ethin 2019-02-12 18:33:02)

@64, lol. The problem with those python libraries is that 99 percent of them are python 2-specific. Yuck. smile

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-02-12 20:40:26

I'm continuing to realize how nice it would be for us to have our own library for the making of blind audio games.
Python isn't really meant just for making games. Sure if you know where to look, you can dig up enormous things, but it's a general purpose language.
This means there are many! many! many many many different modules, functions, built in variables, methods, and objects you have to sort through to find what you need.
Add to that the names are a bit misleading if you're me, and the tutorial isn't written as nicely as in BGT, what I mean it's right down to business which is OK, but it doesn't give you as much room to figure out what it does.
I've practiced Python a bit, and ran a few functions, imported a module or 2, but i'm not getting anywhere fast nor am I expecting to.

2019-02-12 20:49:22

@65: You're telling this to the person who tried to accessify Mario, Sonic, and Streets of Rage 2 tongue This just makes me want to make an audio game for the Atari 2600 tongue.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2019-02-12 21:01:42

@67, point taken.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2019-02-13 06:34:57

Hi,
@Ethin, thank you. OK, before I try and begin writing all of it by hand, can tools like swig or boost python be used to generate the bindings automatically? Because if I am not mistaken, qt5 python binding is computer generated?
Regards,
Amit

There once was a moviestar icon.
Who prefered to sleep with the light on.
They learnt how to code, devices sure glowed,
and lit the night using python.

2019-02-13 07:06:15

@69, I generally don't (to ensure I don't need to rebuild it per Python release), but you probably could. It would be a bitch.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github