Hat schon jemand Erfahrung mit FMOD EX (FMOD 4.0)?

Fragen zu Grafik- & Soundproblemen und zur Spieleprogrammierung haben hier ihren Platz.
Benutzeravatar
Lebostein
Beiträge: 674
Registriert: 13.09.2004 11:31
Wohnort: Erzgebirge

Hat schon jemand Erfahrung mit FMOD EX (FMOD 4.0)?

Beitrag von Lebostein »

Seit 1. August ist ja die neue FMOD-Version draußen mit einer völlig neuen API und internen Struktur. Hat schon jemand mal versucht, mit PureBasic das Ding zu nutzen bzw. hat jemand von euch PBlern schon geplant, einen neuen Wrapper zu schreiben?

http://www.fmod.org/
Benutzeravatar
Froggerprogger
Badmin
Beiträge: 855
Registriert: 08.09.2004 20:02

Beitrag von Froggerprogger »

Jau.
FMOD Ex läuft wunderbar mit PB (wenn man direkt per OpenLibrary geht).
Aufgrund eines PB-Bugs jedoch konnten einige Funktionen nicht importiert werden, weswegen ich noch keinen Wrapper erstellen konnte.
Der Bug sollte jetzt mit der aktuellen PB-Beta ausgebügelt sein, aber noch habe ich keine Zeit für den Wrapper gefunden.

FMOD Ex wird aber für Anfänger wohl zunächst noch etwas schwerer zu blicken sein, da z.B. der Rückgabewert immer nur den Erfolg (=0) bzw. Fehlercode des Aufrufs liefert, und Ergebniswerte stattdessen in per reference übergebene Funktionsparameter geschrieben werden.
Dieses Verfahren gefällt mir, ist aber für Programmiereinsteiger nicht gerade intuitiv (man muss halt immer schauen, ob man nun eine Adresse, oder einen Wert übergeben muss).
Auch sonst wird man einiges an Zeit einbringen müssen, um die komplexeren Konzepte zu verstehen (DSP-Network, Sub-Mixing, Sound-Envelopes, externe PlugIns...) und damit FMOD Ex auszureizen.

Als 'einfache' tolle Neurerungen kommen endlich hauseigene plattformunabhängige Effekte hinzu, die nicht mehr wie zuvor nur bei Hardwareunterstützung laufen, als 'komplexeste' Neuerung, dass man nun FMOD Ex eine 3D-Polygon-Spielewelt übergeben kann, sowie die Orte der Soundquellen und Listener darin, und FMOD Ex berechnet daraus den Sound des/der Listener - inklusive allen Dämpfungen/Reflexionen/Doppler, etc.)
:allright:
!UD2
Benutzeravatar
Lebostein
Beiträge: 674
Registriert: 13.09.2004 11:31
Wohnort: Erzgebirge

Beitrag von Lebostein »

Wow! Klingt gut.

Und wie siehts mit der Geschwindigkeit aus, trotz der vielen Neuerungen?
Kann FMOD nun immer noch von sich behaupten, eine der schnellsten Audioengines zu sein oder hat man durch die Plattform- und Hardwareunabhängigkeit und den zusätzlichen 'Ballast' durch die ganzen Neuerungen an Geschwindigkeit eingebüßt? Ich nehme doch mal stark an, da man ansonsten nicht die 3.74 weiterhin zum download angeboten hätte... oder?
Benutzeravatar
Froggerprogger
Badmin
Beiträge: 855
Registriert: 08.09.2004 20:02

Beitrag von Froggerprogger »

Ich gehe mal stark davon aus, dass die Mixingroutinen, etc. eher noch weiter optimiert worden sind (sofern machbar).
Diese ganzen neuen komplexen Features haben ja nicht unbedingt Einfluss auf die Geschwindigkeit, sondern bieten lediglich eine Menge Alternativen.
Der 'kritische Pfad' des Audiosignals vom Memory zum Soundkartenausgang bei einfacher Wiedergabe mehrerer Sounds wird sich nicht verlängert haben, er kann aber eben auf Wunsch um neue Features ausgebaut werden.
Vielleicht gibt es ein paar If-Abfragen mehr je wiedergegebenem Buffer und das wars.
Nutzt man z.B. für einen Sound dieses Envelope-Feature, wird für diesen Sound in Abhängigkeit der Spielzeit laufend nach Parameteränderungen gesucht, was dann vielleicht etwas bremst, aber eben nur optional.
Auch das SubMixing kann nur dann bremsen, wenn man Subchannel nutzt, und auf die z.B. wieder Effekte legt. Das sind Sachen, die gehen in FMOD 3.74 nicht.

Ich denke, FMOD 3.74 wird deswegen weiterhin supported, da es ja bereits eine vollwertige, ausgereifte AudioEngine ist. Die hat zwar nicht dem Funktionsumfang von FMOD Ex, aber den braucht man ja oft auch gar nicht. Außerdem kostet FMOD 3.74 im PC-Bereich nur die Hälfte, und FMOD Ex gibt es nicht für WinCE (wird es wohl auch nicht geben - wer braucht schon die Möglichkeit von 5-Punkt-Spline-Interpolation auf nem PocketPC :wink: ).
!UD2
Benutzeravatar
SoS
Beiträge: 340
Registriert: 29.08.2004 09:31
Kontaktdaten:

Beitrag von SoS »

Ich habe mich auch schon ein wenig damit beschäftigt,ist aber ohne Wrapper sehr unhandlich *zuFroggerproggerrüberschiel* ;)

Wenn du ein wenig testen willst nim DLL2PBLib von TS-Soft und lese die fmodex.dll aus. (die 1400 Zeilen werde ich hier nicht posten)

Und nun kannst Du hiermit schon mal eine mp3 abspielen.

Code: Alles auswählen

#FMODex_VERSION= $40035

Enumeration 1 ;#FMOD_INITFLAGS
  #FMODex_INIT_NORMAL = $0                           ; All platforms - Initialize normally.
  #FMODex_INIT_NONREALTIME = $1                      ; All platforms - Output is driven with System::update.
  #FMODex_INIT_3D_RIGHTHANDED = $2                   ; All platforms - FMOD will treat +X as left, +Y as up and +Z as forwards.
  #FMODex_INIT_DISABLESOFTWARE = $4                  ; All platforms - Disable software mixer to save memory.  Anything created with FMOD_SOFTWARE will fail and DSP will not work.
  #FMODex_INIT_DSOUND_DEFERRED = $100                ; Win32 only - for DirectSound output - 3D commands are batched together and executed at System::update.
  #FMODex_INIT_DSOUND_HRTFNONE = $200                ; Win32 only - for DirectSound output - FMOD_HARDWARE | FMOD_3D buffers use simple stereo panning/doppler/attenuation when 3D hardware acceleration is not present.
  #FMODex_INIT_DSOUND_HRTFLIGHT = $400               ; Win32 only - for DirectSound output - FMOD_HARDWARE | FMOD_3D buffers use a slightly higher quality algorithm when 3D hardware acceleration is not present.
  #FMODex_INIT_DSOUND_HRTFFULL = $800                ; Win32 only - for DirectSound output - FMOD_HARDWARE | FMOD_3D buffers use full quality 3D playback when 3d hardware acceleration is not present.
  #FMODex_INIT_PS2_DISABLECORE0REVERB = $10000       ; PS2 only - Disable reverb on CORE 0 to regain SRAM.
  #FMODex_INIT_PS2_DISABLECORE1REVERB = $20000       ; PS2 only - Disable reverb on CORE 1 to regain SRAM.
  #FMODex_INIT_XBOX_REMOVEHEADROOM = $100000         ; XBox only - By default DirectSound attenuates all sound by 6db to avoid clipping/distortion.  CAUTION.  If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn;t happen.
EndEnumeration

Enumeration 1 ;#FMOD_MODE
  #FMODex_DEFAULT = $0                       ; FMOD_DEFAULT is a default sound type.  Equivalent to all the defaults listed below.  FMOD_LOOP_OFF, FMOD_2D, FMOD_HARDWARE.
  #FMODex_LOOP_OFF = $1                      ; For non looping sounds. (default).  Overrides FMOD_LOOP_NORMAL / FMOD_LOOP_BIDI.
  #FMODex_LOOP_NORMAL = $2                   ; For forward looping sounds.
  #FMODex_LOOP_BIDI = $4                     ; For bidirectional looping sounds. (only works on software mixed static sounds).
  #FMODex_2D = $8                            ; Ignores any 3d processing. (default).
  #FMODex_3D = $10                           ; Makes the sound positionable in 3D.  Overrides FMOD_2D.
  #FMODex_HARDWARE = $20                     ; Attempts to make sounds use hardware acceleration. (default).
  #FMODex_SOFTWARE = $40                     ; Makes sound reside in software.  Overrides FMOD_HARDWARE.  Use this for FFT,  DSP, 2D multi speaker support and other software related features.
  #FMODex_CREATESTREAM = $80                 ; Decompress at runtime, streaming from the source provided (standard stream).  Overrides FMOD_CREATESAMPLE.
  #FMODex_CREATESAMPLE = $100                ; Decompress at loadtime, decompressing or decoding whole file into memory as the target sample format. (standard sample).
  #FMODex_OPENUSER = $400                    ; Opens a user created static sample or stream.
  #FMODex_OPENMEMORY = $800                  ; "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds.
  #FMODex_OPENRAW = $1000                    ; Will ignore file format and treat as raw pcm.  User may need to declare if data is FMOD_SIGNED or FMOD_UNSIGNED ;
  #FMODex_OPENONLY = $2000                   ; Just open the file, dont prebuffer or read.  Good for fast opens for info, or when sound::readData is to be used.
  #FMODex_ACCURATETIME = $4000               ; For FMOD_System_CreateSound - for accurate FMOD_Sound_GetLength / FMOD_Channel_SetPosition on VBR MP3, AAC and MOD/S3M/XM/IT/MIDI files.  Scans file first, so takes longer to open. FMOD_OPENONLY does not affect this.
  #FMODex_MPEGSEARCH = $8000                 ; For corrupted / bad MP3 files.  This will search all the way through the file until it hits a valid MPEG header.  Normally only searches for 4k.
  #FMODex_NONBLOCKING = $10000               ; For opening sounds asyncronously, return value from open function must be polled for when it is ready.
  #FMODex_UNIQUE = $20000                    ; Unique sound, can only be played one at a time ;
  #FMODex_3D_HEADRELATIVE = $40000           ; Make the sound;s position, velocity And orientation relative To the listener;s position, velocity and orientation.
  #FMODex_3D_WORLDRELATIVE = $80000          ; Make the sound;s position, velocity And orientation absolute. (deDefault
  #FMODex_3D_LOGROLLOFF = $100000            ; This sound will follow the standard logarithmic rolloff model where mindistance = full volume, maxdistance = where sound stops attenuating, and rolloff is fixed according to the global rolloff factor.  (default)
  #FMODex_3D_LINEARROLLOFF = $200000         ; This sound will follow a linear rolloff model where mindistance = full volume, maxdistance = silence.
  #FMODex_CDDA_FORCEASPI = $400000           ; For CDDA sounds only - use ASPI instead of NTSCSI to access the specified CD/DVD device.
  #FMODex_CDDA_JITTERCORRECT = $800000       ; For CDDA sounds only - perform jitter correction. Jitter correction helps produce a more accurate CDDA stream at the cost of more CPU time.
  #FMODex_UNICODE = $1000000                 ; Filename is double-byte unicode.
  #FMODex_IGNORETAGS = $2000000              ; Skips id3v2/asf/etc tag checks when opening a sound, to reduce seek/read overhead when opening files (helps with CD performance).
EndEnumeration

Enumeration 1
  #FMODex_CHANNEL_FREE = -1     ; For a channel index, FMOD chooses a free voice using the priority system.
  #FMODex_CHANNEL_REUSE = -2    ; For a channel index, re-use the channel handle that was passed in.
EndEnumeration

;-------------------------
;XIncludeFile "fmodex.pb"   ; <-- mit DLL2PBLib von TS-Soft erstellen
;-------------------------

OpenConsole()

fmodex_Init() ; siehe  fmodex.pb

result = FMODex_System_Create(@system)
Debug "FMODex_System_Create "+Str(result)
Debug "system "+Str(system)

result = FMODex_System_GetVersion(system, @version)
Debug  "FMODex_System_GetVersion "+Str(result)
Debug "Version "+Hex(version)

result = FMODex_System_Init(system, 6, #FMODex_INIT_NORMAL , #Null)
Debug  "FMODex_System_Init "+Str(result)

song.s=OpenFileRequester("Choose music","","FMOD - MP3 | *.mp3",0)

result = FMODex_System_CreateStream(system, song, #FMODex_SOFTWARE | #FMODex_LOOP_NORMAL , 0, @sound)
Debug "sound "+Str(sound)
Debug  "FMODex_System_CreateStream "+Str(result)

result = FMODex_System_PlaySound(system, #FMODex_CHANNEL_FREE, sound, 0, @channel)
Debug "channel "+Str(channel)
Debug  "FMODex_System_PlaySound "+Str(result)

ende$ = Input()

result = FMODex_Sound_Release(sound)
result = FMODex_System_Close(system)
result = FMODex_System_Release(system)
Ob der Code 100% astrein ist kann ich nicht garantieren,auf jeden fall tut er das was er soll ;)
Antworten