Retrieve low level system from studio / Linux, Mac / python

hey all,

I am using python ctypes to work with fmod studio libs.
Trying to retrieve the Low Level System from the studio system with Studio::System::getLowLevelSystem - which works perfectly on Mac OS, but I am getting invaid handle errors on linux when I try to access functions like getVersion…

mac:

from ctypes import *
from ctypes.util import find_library

VERSION = 0x00010814

def ckresult(ERRCODE):
    print("FMOD:", ERRCODE)

studio_lib = cdll.LoadLibrary(find_library("libfmodstudioL"))
lowlevel_lib = cdll.LoadLibrary(find_library("libfmodL"))

studio = c_void_p()
ckresult(studio_lib.FMOD_Studio_System_Create(byref(studio),VERSION))

lowlevel = c_void_p()
ckresult(studio_lib.FMOD_Studio_System_GetLowLevelSystem(studio, byref(lowlevel)))

VERSION = c_int()
ckresult(lowlevel_lib.FMOD_System_GetVersion(lowlevel, byref(VERSION)))
print("VERSION", VERSION.value)

gives me:

FMOD: 0
[LOG] System::create                 : Header version = 1.08.14. Current version = 1.08.14.
FMOD: 0
FMOD: 0
VERSION 67604

beautiful!
on linux (Linux Mint 18.1 x86_64):

from ctypes import *
from ctypes.util import find_library
    
VERSION = 0x00010814
    
def ckresult(ERRCODE):
    print("FMOD:", ERRCODE)
    
studio_lib = cdll.LoadLibrary("/lib/x86_64-linux-gnu/libfmodstudioL.so.8.14")
lowlevel_lib = cdll.LoadLibrary("/lib/x86_64-linux-gnu/libfmodL.so.8.14")
    
studio = c_void_p()
ckresult(studio_lib.FMOD_Studio_System_Create(byref(studio),VERSION))
    
lowlevel = c_void_p()
ckresult(studio_lib.FMOD_Studio_System_GetLowLevelSystem(studio, byref(lowlevel)))
    
VERSION = c_int()
ckresult(lowlevel_lib.FMOD_System_GetVersion(lowlevel, byref(VERSION)))
print("VERSION", VERSION.value)

gives me:

[LOG] System::create                 : Header version = 1.08.14. Current version = 1.08.14.
FMOD: 0
FMOD: 0
FMOD: 30  /// (FMOD_ERR_INVALID_HANDLE An invalid object handle was used.)
VERSION 0 /// no version...

any ideas? would be a milestone :wink: writing kind of a fmod wrapper at the moment…
Thank you!

I can only say is lowlevel_lib valid? Is it non zero, if it looks like a normal address, then it would be weird, but if it was 0x00000000 for example that would make sense that it returns invalid handle.

1 Like