Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
fmodaudio [2019/03/12 13:12] – [Android] admin | fmodaudio [2020/01/09 14:20] – [Remarks] admin | ||
---|---|---|---|
Line 33: | Line 33: | ||
</ | </ | ||
- | To simplify usage of the massive amount of functions, Gorilla3D provides higher level structure declarations in Gorilla.Audio.FMOD.* units. | + | To simplify usage of the massive amount of functions, Gorilla3D provides higher level structure declarations in Gorilla.Audio.FMOD.Intf.* and Gorilla.Audio.FMOD.* units. |
+ | |||
+ | < | ||
+ | Gorilla.Audio.FMOD.Intf.System | ||
+ | Gorilla.Audio.FMOD.Intf.Channel | ||
+ | Gorilla.Audio.FMOD.Intf.ChannelGroup | ||
+ | Gorilla.Audio.FMOD.Intf.DSP | ||
+ | Gorilla.Audio.FMOD.Intf.Sound | ||
+ | Gorilla.Audio.FMOD.Intf.SoundGroup | ||
+ | Gorilla.Audio.FMOD.Intf.Reverb3D | ||
+ | Gorilla.Audio.FMOD.Intf.Geometry | ||
+ | </ | ||
< | < | ||
Line 53: | Line 64: | ||
</ | </ | ||
+ | __**Remarks: | ||
===== Examples ===== | ===== Examples ===== | ||
Line 67: | Line 79: | ||
procedure TForm1.FormShow(Sender: | procedure TForm1.FormShow(Sender: | ||
var LPath : String; | var LPath : String; | ||
- | LSound : PGorillaFMODSound; | + | LSound : IGorillaFMODSound; |
begin | begin | ||
FFMOD := TGorillaFMODAudioManager.Create(Self); | FFMOD := TGorillaFMODAudioManager.Create(Self); | ||
Line 90: | Line 102: | ||
uses | uses | ||
Gorilla.Audio.FMOD, | Gorilla.Audio.FMOD, | ||
- | Gorilla.Audio.FMOD.Sound, | + | Gorilla.Audio.FMOD.Intf.Sound, |
- | Gorilla.Audio.FMOD.Channel; | + | Gorilla.Audio.FMOD.Intf.Channel; |
procedure TForm1.Timer1Timer(Sender: | procedure TForm1.Timer1Timer(Sender: | ||
- | var LSound : PGorillaFMODSound; | + | var LSound : IGorillaFMODSound; |
LMS, LLenMS : UInt32; | LMS, LLenMS : UInt32; | ||
begin | begin | ||
{...} | {...} | ||
- | LMS := FChannel^.Position[FMOD_TIMEUNIT_MS]; | + | LMS := FChannel.Position[FMOD_TIMEUNIT_MS]; |
- | LSound := PGorillaFMODSound(LChannel^.GetCurrentSound()); | + | LSound := LChannel.GetCurrentSound() |
if Assigned(LSound) then | if Assigned(LSound) then | ||
begin | begin | ||
- | LLenMS := LSound^.Length[FMOD_TIMEUNIT_MS]; | + | LLenMS := LSound.Length[FMOD_TIMEUNIT_MS]; |
Self.Caption := Format(' | Self.Caption := Format(' | ||
end; | end; | ||
Line 118: | Line 130: | ||
procedure TForm1.FormShow(Sender: | procedure TForm1.FormShow(Sender: | ||
- | var LSound : PGorillaFMODSound; | + | var LSound : IGorillaFMODSound; |
- | LChannel : PGorillaFMODChannel; | + | LChannel : IGorillaFMODChannel; |
LClock, LPClock : UInt64; | LClock, LPClock : UInt64; | ||
begin | begin | ||
Line 126: | Line 138: | ||
if Assigned(LChannel) then | if Assigned(LChannel) then | ||
begin | begin | ||
- | LChannel^.GetDSPClock(LClock, | + | LChannel.GetDSPClock(LClock, |
- | LChannel^.AddFadePoint(LPClock, | + | LChannel.AddFadePoint(LPClock, |
- | LChannel^.AddFadePoint(LPClock + 48000, 1.0); | + | LChannel.AddFadePoint(LPClock + 48000, 1.0); |
end; | end; | ||
end; | end; | ||
Line 177: | Line 189: | ||
procedure TForm1.FormShow(Sender: | procedure TForm1.FormShow(Sender: | ||
- | var LSound : PGorillaFMODSound; | + | var LSound : IGorillaFMODSound; |
begin | begin | ||
{...} | {...} | ||
LSound := LFMOD.LoadSoundFromFile(' | LSound := LFMOD.LoadSoundFromFile(' | ||
- | LSound^.Mode := FMOD_LOOP_NORMAL; | + | LSound.Mode := FMOD_LOOP_NORMAL; |
end; | end; | ||
</ | </ | ||
Line 197: | Line 209: | ||
Next step: [[assetsmanager|AssetsManager]] | Next step: [[assetsmanager|AssetsManager]] | ||
+ | ===== Remarks ===== | ||
+ | It is not allowed to release FMOD interfaces when the TGorillaFMODAudioManager component, especially the IGorillaFMODSystem interface inside of it, is already destroyed. | ||
+ | In this case you will receive an AccessViolation, | ||
+ | |||
+ | **WRONG:** | ||
+ | <file pascal> | ||
+ | var LFMOD : TGorillaFMODAudioManager; | ||
+ | LSound : IGorillaFMODSound; | ||
+ | | ||
+ | [...] | ||
+ | |||
+ | LFMOD := TGorillaFMODAudioManager.Create(nil); | ||
+ | try | ||
+ | LSound := LFMOD.LoadSoundFromFile(Common_MediaPathRaw(' | ||
+ | finally | ||
+ | FreeAndNil(LFMOD); | ||
+ | LSound := nil; // <<< | ||
+ | end; | ||
+ | </ | ||
+ | |||
+ | **CORRECT: | ||
+ | <file pascal> | ||
+ | var LFMOD : TGorillaFMODAudioManager; | ||
+ | LSound : IGorillaFMODSound; | ||
+ | | ||
+ | [...] | ||
+ | |||
+ | LFMOD := TGorillaFMODAudioManager.Create(nil); | ||
+ | try | ||
+ | LSound := LFMOD.LoadSoundFromFile(Common_MediaPathRaw(' | ||
+ | finally | ||
+ | LSound := nil; // !!! CORRECT! | ||
+ | FreeAndNil(LFMOD); | ||
+ | end; | ||
+ | </ | ||
+ | |||
+ | Next step: [[assetsmanager|Assets Manager]] |