Demo FMOD Studio

Demonstration of FMOD application through ctypes and editing of sounds via FMOD Studio.

Press 1 - to listen to the standard “click” sound.
Press 2 to listen to the standard “rollover” sound.
Press 3 - to listen to the standard “click” sound with reverb.
Press 4 to listen to the standard “rollover” sound with a delay.

#!/usr/bin/env python  
# -*- coding: utf-8 -*-  

from ctypes import *

from panda3d.core import loadPrcFileData
loadPrcFileData("", "audio-library-name null")

from direct.showbase.ShowBase import ShowBase  

PLATFORM_SUFFIX = "64" if sizeof(c_voidp) == 8 else ""
VERSION = 0x00011000
BANK_FILES = [ "demo\Build\Desktop\Master", "demo\Build\Desktop\Master", "demo\Build\Desktop\" ]

# Return result code / Возвращаемый результат кода.
def check_result(r):
    if r != 0:
        print("ERROR: Got FMOD_RESULT {0}".format(r))

class DemoFMOD(ShowBase):

    def __init__(self):

        self.accept("1", self.play_sound, ["event:/GUI_click"])
        self.accept("2", self.play_sound, ["event:/GUI_rollover"])
        self.accept("3", self.play_sound, ["event:/GUI_click_reverb"])
        self.accept("4", self.play_sound, ["event:/GUI_rollover_delay"])

        # import FMOD / Импорт FMOD.
        self.studio_dll = WinDLL("fmodstudio" + PLATFORM_SUFFIX)
        self.lowlevel_dll = WinDLL("fmod" + PLATFORM_SUFFIX)

        # Create studio system / Создание системы студио.
        self.studio_sys = c_voidp()
        check_result(self.studio_dll.FMOD_Studio_System_Create(byref(self.studio_sys), VERSION))

        # Call System init / Вызов иницилизации системы.
        check_result(self.studio_dll.FMOD_Studio_System_Initialize(self.studio_sys, 256, 0, 0, c_voidp()))

        # Load banks / Загрузка банков.
        for bankname in BANK_FILES:
            bank = c_voidp()
            check_result(self.studio_dll.FMOD_Studio_System_LoadBankFile(self.studio_sys, bankname.encode('ascii'), 0, byref(bank)))

        taskMgr.add(self.sound_update, 'sound_update')

    # Audio playback function / Функция проигрывания звука.
    def play_sound(self, soundname):

        event_desc = c_voidp()
        check_result(self.studio_dll.FMOD_Studio_System_GetEvent(self.studio_sys, soundname.encode('ascii'), byref(event_desc)))
        event_inst = c_voidp()
        check_result(self.studio_dll.FMOD_Studio_EventDescription_CreateInstance(event_desc, byref(event_inst)))
    # Sound update function / Функция обновления звука.
    def sound_update(self, task):
        return task.cont
demo = DemoFMOD() 

However, I wondered why you need internal API support when there are ctypes?
Files are attached.
DemoFMOD.7z (1.46 MB)