ModuleInfo "MaxMod2: Audio Driver V1.0"
ModuleInfo "Author: REDi - Cliff Harman"
ModuleInfo "License: MIT"
import brl.blitz
import brl.audio
import brl.linkedlist
import brl.map
import brl.bank
import brl.system
import brl.standardio
MM_BYTES%=0
MM_SAMPLES%=1
MM_MILLISECS%=2
MM_TRACK%=3
MM_LINE%=4
MM_SEQUENCE%=5
IMaxModAudioDriver^Null{
-SetAPI%(api%)="SetAPI"
-Startup%()="Startup"
-Shutdown%()="Shutdown"
-CreateSound:IMaxModMusic(sample:TAudioSample,flags%)="CreateSound"
-AllocChannel:IMaxModChannel()="AllocChannel"
}E=0
IMaxModMusic^Null{
-FillBuffer%(buffer@*,length%)="FillBuffer"
-Seek%(position%,Mode%)="Seek"
-GetLength%(Mode%)="GetLength"
-GetPosition%(Mode%)="GetPosition"
-GetStatus%()="GetStatus"
-SetStatus%(state%)="SetStatus"
-GetChannels%()="GetChannels"
-GetBits%()="GetBits"
-GetSampleRate%()="GetSampleRate"
-GetLoopMode%()="GetLoopMode"
-SetLoopMode%(Mode%)="SetLoopMode"
-IsSeekable%()="IsSeekable"
-AddRef%()="AddRef"
-RemoveRef%()="RemoveRef"
-RefCount%()="RefCount"
-Cue:IMaxModChannel(alloced_channel:IMaxModChannel)="Cue"
}E=0
IMaxModEffect^Null{
-FillBuffer%(buffer@*,length%)="FillBuffer"
-Seek%(position%,Mode%)="Seek"
-GetLength%(Mode%)="GetLength"
-GetPosition%(Mode%)="GetPosition"
-GetStatus%()="GetStatus"
-SetStatus%(state%)="SetStatus"
-GetChannels%()="GetChannels"
-GetBits%()="GetBits"
-GetSampleRate%()="GetSampleRate"
-GetLoopMode%()="GetLoopMode"
-SetLoopMode%(Mode%)="SetLoopMode"
-IsSeekable%()="IsSeekable"
-AddRef%()="AddRef"
-RemoveRef%()="RemoveRef"
-RefCount%()="RefCount"
-Cue:IMaxModChannel(alloced_channel:IMaxModChannel)="Cue"
}E=0
IMaxModChannel^Null{
-Stop%()="Stop"
-SetPaused%(paused%)="SetPaused"
-SetVolume%(volume#)="SetVolume"
-SetPan%(pan#)="SetPan"
-SetDepth%(depth#)="SetDepth"
-SetRate%(rate#)="SetRate"
-Playing%()="Playing"
-GetPosition%(Mode%)="GetPosition"
-GetLength%(Mode%)="GetLength"
-Seek%(position%,Mode%)="Seek"
-GetLoopMode%()="GetLoopMode"
-SetLoopMode%(bool%)="SetLoopMode"
-SetLoopPoints%(startsample%,endsample%)="SetLoopPoints"
-GetUV%(l! Var,r! Var)="GetUV"
-IsSeekable%()="IsSeekable"
}E=0
IMaxModStream^Null{
-Close%()="Close"
-Eof%()="Eof"
-Size%%()="Size"
-Position%%()="Position"
-Seek%%(pos%%)="Seek"
-SeekFrom%%(pos%%,Mode%)="SeekFrom"
-Flush%()="Flush"
-Read%%(buf@*,count%%)="Read"
}E=0
MaxMod_SetGlobalVolume%(vol!)="MaxMod_SetGlobalVolume"
MaxMod_FreeChannel%(channel:IMaxModChannel)="MaxMod_FreeChannel"
MaxMod_CreateSound:IMaxModMusic(channels%,bits%,samplerate%,size%,samples@*,flags%)="MaxMod_CreateSound"
MaxMod_CloseSound%(stream:IMaxModMusic)="MaxMod_CloseSound"
MaxMod_CreateStream:IMaxModStream(file$z)="MaxMod_CreateStream"
MaxMod_CreateMemStream:IMaxModStream(buf@*,length%)="MaxMod_CreateMemStream"
MaxMod_CloseStream%(stream:IMaxModStream)="MaxMod_CloseStream"
MaxMod_SetVerbose%(bool%)="MaxMod_SetVerbose"
MaxMod_FillScope%(buf@*,size%)="MaxMod_FillScope"
LoadMusic_Custom:IMaxModMusic(MusicCustom:TCustomMusic,SampleRate%,Channels%,Bits%)="LoadMusic_Custom"
CloseMusic_Custom%(Music:IMaxModMusic)="CloseMusic_Custom"
CreateAudioStream_Memory:IMaxModChannel(Music:IMaxModMusic,data@*)="CreateAudioStream_Memory"
CloseAudioStream_Memory%(Stream:IMaxModChannel)="CloseAudioStream_Memory"
MaxMod_SetChannelRateAdjuster%(channel:IMaxModChannel,adjuster!)="MaxMod_SetChannelRateAdjuster"
MaxMod_AddChannelEffect%(IMaxModChannel@*,IMaxModEffect@*)="MaxMod_AddChannelEffect"
MaxMod_OutputWavFile%(Music:IMaxModMusic,outputfile$z)="MaxMod_OutputWavFile"
MaxModVerbose%(bool%)="maxmod2_maxmod2_MaxModVerbose"
MaxModFillScope%(buf@*,size%)="maxmod2_maxmod2_MaxModFillScope"
SetAudioStreamDriver%(name$)="maxmod2_maxmod2_SetAudioStreamDriver"
TMaxModStreamDriver^Object{
Drivers:TMap&=mem:p("_maxmod2_maxmod2_TMaxModStreamDriver_Drivers")
-New%()="_maxmod2_maxmod2_TMaxModStreamDriver_New"
-Delete%()="_maxmod2_maxmod2_TMaxModStreamDriver_Delete"
+AddDriver%(Driver:TMaxModDriver,name$)="_maxmod2_maxmod2_TMaxModStreamDriver_AddDriver"
+SetDriver%(name$)="_maxmod2_maxmod2_TMaxModStreamDriver_SetDriver"
}="maxmod2_maxmod2_TMaxModStreamDriver"
GetCurrentAudioDriver:TMaxModDriver()="maxmod2_maxmod2_GetCurrentAudioDriver"
TMaxModDriver^TAudioDriver{
Active:TMaxModDriver&=mem:p("_maxmod2_maxmod2_TMaxModDriver_Active")
APIs:TMap&=mem:p("_maxmod2_maxmod2_TMaxModDriver_APIs")
._driver:IMaxModAudioDriver&
._name$&
._currentAPI%&
-New%()="_maxmod2_maxmod2_TMaxModDriver_New"
-Delete%()="_maxmod2_maxmod2_TMaxModDriver_Delete"
-Name$()="_maxmod2_maxmod2_TMaxModDriver_Name"
-AddAPI%(id%,name$)="_maxmod2_maxmod2_TMaxModDriver_AddAPI"
-RemoveAPI%(id%)="_maxmod2_maxmod2_TMaxModDriver_RemoveAPI"
-SetAPI%(api%)="_maxmod2_maxmod2_TMaxModDriver_SetAPI"
-SetNamedAPI%(namedAPI$)="_maxmod2_maxmod2_TMaxModDriver_SetNamedAPI"
-GetAPIid%(namedAPI$)="_maxmod2_maxmod2_TMaxModDriver_GetAPIid"
-GetAPIName$(api%=-1)="_maxmod2_maxmod2_TMaxModDriver_GetAPIName"
-GetAPINames:Object&[]()="_maxmod2_maxmod2_TMaxModDriver_GetAPINames"
-registerAPIs%()="_maxmod2_maxmod2_TMaxModDriver_registerAPIs"
-Startup%()="_maxmod2_maxmod2_TMaxModDriver_Startup"
-Shutdown%()="_maxmod2_maxmod2_TMaxModDriver_Shutdown"
-CreateSound:TMaxModSound(sample:TAudioSample,flags%)="_maxmod2_maxmod2_TMaxModDriver_CreateSound"
-AllocChannel:TMaxModChannel()="_maxmod2_maxmod2_TMaxModDriver_AllocChannel"
+Create:TMaxModDriver(name$)A="brl_blitz_NullMethodError"
}A="maxmod2_maxmod2_TMaxModDriver"
TMaxModSound^TSound{
._audiosample:TAudioSample&
._sound:IMaxModMusic&
-New%()="_maxmod2_maxmod2_TMaxModSound_New"
-Delete%()="_maxmod2_maxmod2_TMaxModSound_Delete"
-Play:TMaxModChannel(alloced_channel:TChannel)="_maxmod2_maxmod2_TMaxModSound_Play"
-Cue:TMaxModChannel(alloced_channel:TChannel)="_maxmod2_maxmod2_TMaxModSound_Cue"
}="maxmod2_maxmod2_TMaxModSound"
TMaxModChannel^TChannel{
._sound:TMaxModSound&
._channel:IMaxModChannel&
._music:TMusic&
-New%()="_maxmod2_maxmod2_TMaxModChannel_New"
-Delete%()="_maxmod2_maxmod2_TMaxModChannel_Delete"
-Stop%()="_maxmod2_maxmod2_TMaxModChannel_Stop"
-SetPaused%(paused%)="_maxmod2_maxmod2_TMaxModChannel_SetPaused"
-SetVolume%(volume#)="_maxmod2_maxmod2_TMaxModChannel_SetVolume"
-SetPan%(pan#)="_maxmod2_maxmod2_TMaxModChannel_SetPan"
-SetDepth%(depth#)="_maxmod2_maxmod2_TMaxModChannel_SetDepth"
-SetRate%(rate#)="_maxmod2_maxmod2_TMaxModChannel_SetRate"
-Playing%()="_maxmod2_maxmod2_TMaxModChannel_Playing"
-Lock%()="_maxmod2_maxmod2_TMaxModChannel_Lock"
-Unlock%()="_maxmod2_maxmod2_TMaxModChannel_Unlock"
-SetChannelRateAdjuster%(adjuster!)="_maxmod2_maxmod2_TMaxModChannel_SetChannelRateAdjuster"
}="maxmod2_maxmod2_TMaxModChannel"
TMusic^Object{
.Music:IMaxModMusic&
.Stream:IMaxModStream&
.Bank:TBank&
-New%()="_maxmod2_maxmod2_TMusic_New"
-Delete%()="_maxmod2_maxmod2_TMusic_Delete"
+Loader:TMusic(Stream:IMaxModStream,Filename$=$"")A="brl_blitz_NullMethodError"
-FillBuffer%(buffer@*,length%)="_maxmod2_maxmod2_TMusic_FillBuffer"
-Seek%(position%,Mode%)="_maxmod2_maxmod2_TMusic_Seek"
-IsSeekable%()="_maxmod2_maxmod2_TMusic_IsSeekable"
-GetLength%(Mode%=0)="_maxmod2_maxmod2_TMusic_GetLength"
-GetStatus%()="_maxmod2_maxmod2_TMusic_GetStatus"
-SetStatus%(state%)="_maxmod2_maxmod2_TMusic_SetStatus"
-GetPosition%(Mode%=0)="_maxmod2_maxmod2_TMusic_GetPosition"
-GetChannels%()="_maxmod2_maxmod2_TMusic_GetChannels"
-GetBits%()="_maxmod2_maxmod2_TMusic_GetBits"
-GetSampleRate%()="_maxmod2_maxmod2_TMusic_GetSampleRate"
-GetLoopMode%()="_maxmod2_maxmod2_TMusic_GetLoopMode"
-SetLoopMode%(Mode%)="_maxmod2_maxmod2_TMusic_SetLoopMode"
-GetFormat%()="_maxmod2_maxmod2_TMusic_GetFormat"
}A="maxmod2_maxmod2_TMusic"
TMaxModEffect^Object{
._effect:IMaxModEffect&
-New%()="_maxmod2_maxmod2_TMaxModEffect_New"
-Delete%()="_maxmod2_maxmod2_TMaxModEffect_Delete"
}="maxmod2_maxmod2_TMaxModEffect"
MaxModMainCustomThreadProc%(Source:TCustomMusic,buffer@*,size%)="maxmod2_maxmod2_MaxModMainCustomThreadProc"
CreateAudioCallbackStream:TChannel(Music:TCustomMusic,Loop%=0,Paused%=0)="maxmod2_maxmod2_CreateAudioCallbackStream"
TCustomMusic^TMusic{
.SampleRate%&
.Bits%&
.Channels%&
-New%()="_maxmod2_maxmod2_TCustomMusic_New"
-Delete%()="_maxmod2_maxmod2_TCustomMusic_Delete"
+Loader:TMusic(Stream:IMaxModStream,Filename$)="_maxmod2_maxmod2_TCustomMusic_Loader"
-FillBuffer%(buffer@*,length%)A="brl_blitz_NullMethodError"
}A="maxmod2_maxmod2_TCustomMusic"
MaxModLoader^Object{
MMLoader:TMusic(Stream:IMaxModStream,Filename$)&=mem:p("_maxmod2_maxmod2_MaxModLoader_MMLoader")
List:TList&=mem:p("_maxmod2_maxmod2_MaxModLoader_List")
.Name$&
.Func@*&
.Ext$&
-New%()="_maxmod2_maxmod2_MaxModLoader_New"
-Delete%()="_maxmod2_maxmod2_MaxModLoader_Delete"
+Create:MaxModLoader(Func@*,Description$,Extension$)="_maxmod2_maxmod2_MaxModLoader_Create"
+GetExtensions$(AllSupported%=1,AllFiles%=1)="_maxmod2_maxmod2_MaxModLoader_GetExtensions"
+Load:TMusic(URL:Object)="_maxmod2_maxmod2_MaxModLoader_Load"
}="maxmod2_maxmod2_MaxModLoader"
LoadTMusic:TMusic(File:Object)="maxmod2_maxmod2_LoadTMusic"
MusicExtensions$(AllSupported%=1,AllFiles%=1)="maxmod2_maxmod2_MusicExtensions"
LoadMusic:TAudioSample(URL$)="maxmod2_maxmod2_LoadMusic"
CueMusic:TChannel(URL:Object,Loop%=0)="maxmod2_maxmod2_CueMusic"
PlayMusic:TChannel(URL:Object,Loop%=0)="maxmod2_maxmod2_PlayMusic"
CreateMemoryStream:TChannel(URL:Object,buf@*)="maxmod2_maxmod2_CreateMemoryStream"
GetChannelLength%(Channel:TChannel,Mode%=1)="maxmod2_maxmod2_GetChannelLength"
ChannelSeek%(Channel:TChannel,Pos%,Mode%=1)="maxmod2_maxmod2_ChannelSeek"
ChannelSeekable%(Channel:TChannel)="maxmod2_maxmod2_ChannelSeekable"
GetChannelPosition%(Channel:TChannel,Mode%=1)="maxmod2_maxmod2_GetChannelPosition"
GetChannelLoop%(Channel:TChannel)="maxmod2_maxmod2_GetChannelLoop"
SetChannelLoop%(Channel:TChannel,Bool%=1)="maxmod2_maxmod2_SetChannelLoop"
SetChannelLoopPoints%(Channel:TChannel,Start%,Length%)="maxmod2_maxmod2_SetChannelLoopPoints"
GetChannelUV%(Channel:TChannel,L! Var,R! Var)="maxmod2_maxmod2_GetChannelUV"
AddChannelEffect%(channel:TChannel,effect:TMaxModEffect)="maxmod2_maxmod2_AddChannelEffect"
SetGlobalVolume%(Volume!)="maxmod2_maxmod2_SetGlobalVolume"
OutputWavFile:TChannel(source:Object,destination:Object)="maxmod2_maxmod2_OutputWavFile"
