Browse Source

Updated for NG.
(miniplayer is working on OS X 64-bit)

woollybah 9 years ago
parent
commit
ce5be51e07
6 changed files with 128 additions and 86 deletions
  1. 1 0
      .gitignore
  2. 9 7
      examples/MiniPlayer.bmx
  3. 1 1
      maxmod2.mod/code/maxmod2.h
  4. 2 2
      maxmod2.mod/code/threads.cpp
  5. 96 57
      maxmod2.mod/maxmod2.bmx
  6. 19 19
      rtaudio.mod/rtaudio.bmx

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 commands.html
 commands.html
+.bmx

+ 9 - 7
examples/MiniPlayer.bmx

@@ -20,6 +20,8 @@ Incbin "eject.wav"
 Incbin "click.wav"
 Incbin "click.wav"
 ?Linux
 ?Linux
 TMaxModRtAudioDriver.Init("LINUX_PULSE")
 TMaxModRtAudioDriver.Init("LINUX_PULSE")
+?macos
+TMaxModRtAudioDriver.Init("MACOS_CORE")
 ?
 ?
 
 
 SetAudioDriver("MaxMod RtAudio")
 SetAudioDriver("MaxMod RtAudio")
@@ -123,17 +125,17 @@ Type TApp
 					Case VolSlider
 					Case VolSlider
 						Local vol! = (1!/128)*Event.Data
 						Local vol! = (1!/128)*Event.Data
 						SetStatusText Win,"Volume="+Float(vol)
 						SetStatusText Win,"Volume="+Float(vol)
-						If Stream SetChannelVolume(Stream,vol)
+						If Stream SetChannelVolume(Stream,Float(vol))
 
 
 					Case RateSlider
 					Case RateSlider
 						Pitch = 1+((1!/128)*(Event.Data-128))
 						Pitch = 1+((1!/128)*(Event.Data-128))
 						SetStatusText Win,"Rate="+Float(pitch)
 						SetStatusText Win,"Rate="+Float(pitch)
-						If Stream SetChannelRate(Stream,pitch)
+						If Stream SetChannelRate(Stream,Float(pitch))
 
 
 					Case PanSlider
 					Case PanSlider
 						Local pan! = (1!/128)*(Event.Data-128)
 						Local pan! = (1!/128)*(Event.Data-128)
 						SetStatusText Win,"Pan="+Float(pan)
 						SetStatusText Win,"Pan="+Float(pan)
-						If Stream SetChannelPan(Stream,pan)
+						If Stream SetChannelPan(Stream,Float(pan))
 
 
 					Case SeekZero
 					Case SeekZero
 						If Stream ChannelSeek(Stream,0)
 						If Stream ChannelSeek(Stream,0)
@@ -180,9 +182,9 @@ Type TApp
 					L = (h-2)*L
 					L = (h-2)*L
 					R = (h-2)*R
 					R = (h-2)*R
 					SetColor(0,255,255)
 					SetColor(0,255,255)
-					DrawRect w-20,(h-1)-L,9,L
+					DrawRect w-20,Float((h-1)-L),9,Float(L)
 					SetColor(255,255,0)
 					SetColor(255,255,0)
-					DrawRect w-10,(h-1)-R,9,R
+					DrawRect w-10,Float((h-1)-R),9,Float(R)
 
 
 					Flip
 					Flip
 				EndIf
 				EndIf
@@ -200,8 +202,8 @@ Type TApp
 		SetGadgetText(SizeText,Millisecs2Time(GetChannelLength(Stream,MM_MILLISECS)))
 		SetGadgetText(SizeText,Millisecs2Time(GetChannelLength(Stream,MM_MILLISECS)))
 		SetGadgetText(Play,"Pause")	; Status=1
 		SetGadgetText(Play,"Pause")	; Status=1
 		SetSliderRange(Slider,0,GetChannelLength(Stream,MM_SAMPLES)/512)
 		SetSliderRange(Slider,0,GetChannelLength(Stream,MM_SAMPLES)/512)
-		SetChannelVolume(Stream,(1!/128)*SliderValue(VolSlider))
-		SetChannelRate(Stream,(1!/128)*SliderValue(RateSlider))
+		SetChannelVolume(Stream,Float((1!/128)*SliderValue(VolSlider)))
+		SetChannelRate(Stream,Float((1!/128)*SliderValue(RateSlider)))
 		If Not ChannelSeekable(Stream)
 		If Not ChannelSeekable(Stream)
 			DisableGadget(Slider)
 			DisableGadget(Slider)
 		Else
 		Else

+ 1 - 1
maxmod2.mod/code/maxmod2.h

@@ -117,7 +117,7 @@ extern "C" {
 		public:
 		public:
 		~MMThread();
 		~MMThread();
 		void Start(void* data);
 		void Start(void* data);
-		int Stop();
+		void * Stop();
 		void SetPriority(int Priority);
 		void SetPriority(int Priority);
 	};
 	};
 
 

+ 2 - 2
maxmod2.mod/code/threads.cpp

@@ -62,10 +62,10 @@
 		status = true;
 		status = true;
 	}
 	}
 
 
-	int MMThread::Stop(){
+	void* MMThread::Stop(){
 		void* p=0;
 		void* p=0;
 		pthread_join( handle,&p );
 		pthread_join( handle,&p );
-		return (int)p;
+		return p;
 	}
 	}
 
 
 	void MMThread::SetPriority(int Priority){
 	void MMThread::SetPriority(int Priority){

+ 96 - 57
maxmod2.mod/maxmod2.bmx

@@ -37,54 +37,81 @@ Const MM_SEQUENCE	:Int = 5
 ' ---------------------------------------------------------------------------------------
 ' ---------------------------------------------------------------------------------------
 
 
 Extern "C"
 Extern "C"
-
+?bmxng
+	Interface IMaxModAudioDriver
+?Not bmxng
 	Type IMaxModAudioDriver
 	Type IMaxModAudioDriver
-		Method SetAPI:Int				(api:int)
+?
+		Method SetAPI:Int				(api:Int)
 		Method Startup:Int				()
 		Method Startup:Int				()
 		Method Shutdown:Int				()
 		Method Shutdown:Int				()
 		Method CreateSound:IMaxModMusic	(sample:TAudioSample, flags:Int)
 		Method CreateSound:IMaxModMusic	(sample:TAudioSample, flags:Int)
 		Method AllocChannel:IMaxModChannel	()
 		Method AllocChannel:IMaxModChannel	()
+?bmxng
+	End Interface
+?Not bmxng
 	EndType
 	EndType
+?
 
 
+?bmxng
+	Interface IMaxModMusic
+?Not bmxng
 	Type IMaxModMusic
 	Type IMaxModMusic
+?
 		Method FillBuffer:Int			(buffer:Byte Ptr, length:Int)
 		Method FillBuffer:Int			(buffer:Byte Ptr, length:Int)
-		Method Seek:Int				(position:Int, mode:Int)
-		Method GetLength:Int			(mode:Int)
-		Method GetPosition:Int			(mode:Int)
+		Method Seek:Int				(position:Int, Mode:Int)
+		Method GetLength:Int			(Mode:Int)
+		Method GetPosition:Int			(Mode:Int)
 		Method GetStatus:Int			()
 		Method GetStatus:Int			()
 		Method SetStatus				(state:Int)
 		Method SetStatus				(state:Int)
 		Method GetChannels:Int			()
 		Method GetChannels:Int			()
 		Method GetBits:Int				()
 		Method GetBits:Int				()
 		Method GetSampleRate:Int			()
 		Method GetSampleRate:Int			()
 		Method GetLoopMode:Int			()
 		Method GetLoopMode:Int			()
-		Method SetLoopMode				(mode:Int)
+		Method SetLoopMode				(Mode:Int)
 		Method IsSeekable:Int			()
 		Method IsSeekable:Int			()
 		Method AddRef					()
 		Method AddRef					()
 		Method RemoveRef				()
 		Method RemoveRef				()
 		Method RefCount:Int				()
 		Method RefCount:Int				()
 		Method Cue:IMaxModChannel		(alloced_channel:IMaxModChannel)
 		Method Cue:IMaxModChannel		(alloced_channel:IMaxModChannel)
+?bmxng
+	End Interface
+?Not bmxng
 	EndType
 	EndType
+?
 
 
+?bmxng
+	Interface IMaxModEffect
+?Not bmxng
 	Type IMaxModEffect
 	Type IMaxModEffect
+?
 		Method FillBuffer:Int			(buffer:Byte Ptr, length:Int)
 		Method FillBuffer:Int			(buffer:Byte Ptr, length:Int)
-		Method Seek:Int				(position:Int, mode:Int)
-		Method GetLength:Int			(mode:Int)
-		Method GetPosition:Int			(mode:Int)
+		Method Seek:Int				(position:Int, Mode:Int)
+		Method GetLength:Int			(Mode:Int)
+		Method GetPosition:Int			(Mode:Int)
 		Method GetStatus:Int			()
 		Method GetStatus:Int			()
 		Method SetStatus				(state:Int)
 		Method SetStatus				(state:Int)
 		Method GetChannels:Int			()
 		Method GetChannels:Int			()
 		Method GetBits:Int				()
 		Method GetBits:Int				()
 		Method GetSampleRate:Int			()
 		Method GetSampleRate:Int			()
 		Method GetLoopMode:Int			()
 		Method GetLoopMode:Int			()
-		Method SetLoopMode				(mode:Int)
+		Method SetLoopMode				(Mode:Int)
 		Method IsSeekable:Int			()
 		Method IsSeekable:Int			()
 		Method AddRef					()
 		Method AddRef					()
 		Method RemoveRef				()
 		Method RemoveRef				()
 		Method RefCount:Int				()
 		Method RefCount:Int				()
 		Method Cue:IMaxModChannel		(alloced_channel:IMaxModChannel)
 		Method Cue:IMaxModChannel		(alloced_channel:IMaxModChannel)
+?bmxng
+	End Interface
+?Not bmxng
 	EndType
 	EndType
+?
 
 
+?bmxng
+	Interface IMaxModChannel
+?Not bmxng
 	Type IMaxModChannel
 	Type IMaxModChannel
+?
 		Method Stop					()
 		Method Stop					()
 		Method SetPaused				(paused:Int)
 		Method SetPaused				(paused:Int)
 		Method SetVolume				(volume:Float)
 		Method SetVolume				(volume:Float)
@@ -92,26 +119,38 @@ Extern "C"
 		Method SetDepth				(depth:Float)
 		Method SetDepth				(depth:Float)
 		Method SetRate					(rate:Float)
 		Method SetRate					(rate:Float)
 		Method Playing:Int				()
 		Method Playing:Int				()
-		Method GetPosition:Int			(mode:Int)
-		Method GetLength:Int               (mode:Int)
-		Method Seek:Int				(position:Int, mode:Int)
+		Method GetPosition:Int			(Mode:Int)
+		Method GetLength:Int               (Mode:Int)
+		Method Seek:Int				(position:Int, Mode:Int)
 		Method GetLoopMode:Int			()
 		Method GetLoopMode:Int			()
 		Method SetLoopMode				(bool:Int)
 		Method SetLoopMode				(bool:Int)
 		Method SetLoopPoints			(startsample:Int,endsample:Int)
 		Method SetLoopPoints			(startsample:Int,endsample:Int)
 		Method GetUV					(l:Double Var,r:Double Var)
 		Method GetUV					(l:Double Var,r:Double Var)
 		Method IsSeekable:Int              ()
 		Method IsSeekable:Int              ()
+?bmxng
+	End Interface
+?Not bmxng
 	EndType
 	EndType
+?
 
 
+?bmxng
+	Interface IMaxModStream
+?Not bmxng
 	Type IMaxModStream
 	Type IMaxModStream
+?
 		Method Close					()
 		Method Close					()
 		Method Eof:Int					()
 		Method Eof:Int					()
 		Method Size:Long				()
 		Method Size:Long				()
 		Method Position:Long			()
 		Method Position:Long			()
 		Method Seek:Long				(pos:Long)
 		Method Seek:Long				(pos:Long)
-		Method SeekFrom:Long			(pos:Long, mode:Int)
+		Method SeekFrom:Long			(pos:Long, Mode:Int)
 		Method Flush:Int				()
 		Method Flush:Int				()
 		Method Read:Long				(buf:Byte Ptr, count:Long)
 		Method Read:Long				(buf:Byte Ptr, count:Long)
+?bmxng
+	End Interface
+?Not bmxng
 	EndType
 	EndType
+?
 
 
 	Function MaxMod_SetGlobalVolume(vol:Double)
 	Function MaxMod_SetGlobalVolume(vol:Double)
 	Function MaxMod_FreeChannel(channel:IMaxModChannel)
 	Function MaxMod_FreeChannel(channel:IMaxModChannel)
@@ -132,7 +171,7 @@ Extern "C"
 	Function CreateAudioStream_Memory:IMaxModChannel(Music:IMaxModMusic,data:Byte Ptr)
 	Function CreateAudioStream_Memory:IMaxModChannel(Music:IMaxModMusic,data:Byte Ptr)
 	Function CloseAudioStream_Memory(Stream:IMaxModChannel)
 	Function CloseAudioStream_Memory(Stream:IMaxModChannel)
 
 
-	Function MaxMod_SetChannelRateAdjuster(channel:IMaxModChannel, adjuster:double)
+	Function MaxMod_SetChannelRateAdjuster(channel:IMaxModChannel, adjuster:Double)
 
 
 	Function MaxMod_AddChannelEffect(IMaxModChannel:Byte Ptr, IMaxModEffect:Byte Ptr)
 	Function MaxMod_AddChannelEffect(IMaxModChannel:Byte Ptr, IMaxModEffect:Byte Ptr)
 '	Function MaxMod_RemoveChannelEffect(IMaxModEffect:Byte Ptr)
 '	Function MaxMod_RemoveChannelEffect(IMaxModEffect:Byte Ptr)
@@ -188,7 +227,7 @@ EndType
 
 
 'ron: better getter for current audio driver
 'ron: better getter for current audio driver
 Function GetCurrentAudioDriver:TMaxModDriver()
 Function GetCurrentAudioDriver:TMaxModDriver()
-	return TMaxModDriver.Active
+	Return TMaxModDriver.Active
 End Function
 End Function
 
 
 Type TMaxModDriver Extends TAudioDriver
 Type TMaxModDriver Extends TAudioDriver
@@ -200,7 +239,7 @@ Type TMaxModDriver Extends TAudioDriver
 
 
 	'ron: to access currently set api
 	'ron: to access currently set api
 	'default is automatic
 	'default is automatic
-	Field _currentAPI:int = 0
+	Field _currentAPI:Int = 0
 	'ron: amount of apis the driver handles
 	'ron: amount of apis the driver handles
 	Global APIs:TMap = CreateMap()
 	Global APIs:TMap = CreateMap()
 
 
@@ -208,56 +247,56 @@ Type TMaxModDriver Extends TAudioDriver
 		Return _name
 		Return _name
 	EndMethod
 	EndMethod
 
 
-	Method AddAPI(id:int, name:string)
-		self.APIs.Insert(string(id), name)
+	Method AddAPI(id:Int, name:String)
+		Self.APIs.Insert(String(id), name)
 	End Method
 	End Method
 
 
-	Method RemoveAPI(id:int)
-		self.APIs.Remove(string(id))
+	Method RemoveAPI(id:Int)
+		Self.APIs.Remove(String(id))
 	End Method
 	End Method
 
 
 	'ron - setter if driver has different APIs
 	'ron - setter if driver has different APIs
-	Method SetAPI:int(api:int)
-		self._currentAPI = api
-		return _driver.SetAPI(api)
+	Method SetAPI:Int(api:Int)
+		Self._currentAPI = api
+		Return _driver.SetAPI(api)
 	End Method
 	End Method
 
 
 	'ron - setter if driver has different APIs
 	'ron - setter if driver has different APIs
 	'default is first api (0)
 	'default is first api (0)
-	Method SetNamedAPI:int(namedAPI:string)
-		return self.SetApi( GetAPIid(namedAPI) )
+	Method SetNamedAPI:Int(namedAPI:String)
+		Return Self.SetApi( GetAPIid(namedAPI) )
 	End Method
 	End Method
 
 
-	Method GetAPIid:int(namedAPI:string)
+	Method GetAPIid:Int(namedAPI:String)
 		namedAPI = namedAPI.toUpper()
 		namedAPI = namedAPI.toUpper()
-		for local key:string = eachin self.APIs.Keys()
-			if namedAPI = string( self.APIs.ValueForKey(key) )
-				return int(key)
-			endif
+		For Local key:String = EachIn Self.APIs.Keys()
+			If namedAPI = String( Self.APIs.ValueForKey(key) )
+				Return Int(key)
+			EndIf
 		Next
 		Next
 		'set to default
 		'set to default
-		return 0
+		Return 0
 	End Method
 	End Method
 
 
-	Method GetAPIName:string( api:int = -1)
-		for local key:string = eachin self.APIs.Keys()
-			if int(key) = api then return string( self.APIs.ValueForKey(key) )
+	Method GetAPIName:String( api:Int = -1)
+		For Local key:String = EachIn Self.APIs.Keys()
+			If Int(key) = api Then Return String( Self.APIs.ValueForKey(key) )
 		Next
 		Next
-		return "AUTOMATIC"
+		Return "AUTOMATIC"
 	End Method
 	End Method
 
 
 	'ron: get a array of accepted API names
 	'ron: get a array of accepted API names
-	Method GetAPINames:object[]()
-		local res:TList = CreateList()
+	Method GetAPINames:Object[]()
+		Local res:TList = CreateList()
 		res.addLast("AUTOMATIC")
 		res.addLast("AUTOMATIC")
-		for local str:string = eachin self.APIs.Values()
+		For Local str:String = EachIn Self.APIs.Values()
 			res.addLast( str )
 			res.addLast( str )
 		Next
 		Next
-		return res.toArray()
+		Return res.toArray()
 	End Method
 	End Method
 
 
 	Method registerAPIs()
 	Method registerAPIs()
-		self.AddAPI(0, "AUTOMATIC")	'= "UNSPECIFIED"
+		Self.AddAPI(0, "AUTOMATIC")	'= "UNSPECIFIED"
 	End Method
 	End Method
 
 
 	Method Startup:Int()
 	Method Startup:Int()
@@ -337,27 +376,27 @@ Type TMaxModChannel Extends TChannel
 		MaxMod_FreeChannel(_channel)
 		MaxMod_FreeChannel(_channel)
 	End Method
 	End Method
 
 
-	Method Stop()
+	Method Stop:Int()
 		_channel.Stop()
 		_channel.Stop()
 	End Method
 	End Method
 
 
-	Method SetPaused( paused:Int )
+	Method SetPaused:Int( paused:Int )
 		_channel.SetPaused paused
 		_channel.SetPaused paused
 	End Method
 	End Method
 
 
-	Method SetVolume( volume# )
+	Method SetVolume:Int( volume# )
 		_channel.SetVolume volume
 		_channel.SetVolume volume
 	End Method
 	End Method
 
 
-	Method SetPan( pan# )
+	Method SetPan:Int( pan# )
 		_channel.SetPan pan
 		_channel.SetPan pan
 	End Method
 	End Method
 
 
-	Method SetDepth( depth# )
+	Method SetDepth:Int( depth# )
 		_channel.SetDepth depth
 		_channel.SetDepth depth
 	End Method
 	End Method
 
 
-	Method SetRate( rate# )
+	Method SetRate:Int( rate# )
 		_channel.SetRate rate
 		_channel.SetRate rate
 	End Method
 	End Method
 
 
@@ -392,16 +431,16 @@ Type TMusic
 		Return Music.FillBuffer(buffer,length)
 		Return Music.FillBuffer(buffer,length)
 	EndMethod
 	EndMethod
 
 
-	Method Seek:Int(position:Int,mode:Int)
-		Return Music.Seek(position,mode)
+	Method Seek:Int(position:Int,Mode:Int)
+		Return Music.Seek(position,Mode)
 	EndMethod
 	EndMethod
 
 
 	Method IsSeekable:Int()
 	Method IsSeekable:Int()
 		Return Music.IsSeekable()
 		Return Music.IsSeekable()
 	EndMethod
 	EndMethod
 
 
-	Method GetLength:Int(mode:Int=MM_BYTES)
-		Return Music.GetLength(mode)
+	Method GetLength:Int(Mode:Int=MM_BYTES)
+		Return Music.GetLength(Mode)
 	EndMethod
 	EndMethod
 
 
 	Method GetStatus:Int()
 	Method GetStatus:Int()
@@ -409,11 +448,11 @@ Type TMusic
 	EndMethod
 	EndMethod
 
 
 	Method SetStatus:Int(state:Int)
 	Method SetStatus:Int(state:Int)
-		Return Music.SetStatus(state)
+		Music.SetStatus(state)
 	EndMethod
 	EndMethod
 
 
-	Method GetPosition:Int(mode:Int=MM_BYTES)
-		Return Music.GetPosition(mode)
+	Method GetPosition:Int(Mode:Int=MM_BYTES)
+		Return Music.GetPosition(Mode)
 	EndMethod
 	EndMethod
 
 
 	Method GetChannels:Int()
 	Method GetChannels:Int()
@@ -432,8 +471,8 @@ Type TMusic
 		Return Music.GetLoopMode()
 		Return Music.GetLoopMode()
 	EndMethod
 	EndMethod
 
 
-	Method SetLoopMode(mode:Int)
-		Music.SetLoopMode(mode)
+	Method SetLoopMode(Mode:Int)
+		Music.SetLoopMode(Mode)
 	EndMethod
 	EndMethod
 
 
 	Method GetFormat:Int()
 	Method GetFormat:Int()
@@ -571,7 +610,7 @@ Type MaxModLoader
 				Stream = MaxMod_CreateStream(Str)
 				Stream = MaxMod_CreateStream(Str)
 			EndIf
 			EndIf
 		ElseIf Bank
 		ElseIf Bank
-			Stream = MaxMod_CreateMemStream(Bank.Buf(), Bank.Size())
+			Stream = MaxMod_CreateMemStream(Bank.Buf(), Int(Bank.Size()))
 			URL = "Bank"
 			URL = "Bank"
 		EndIf
 		EndIf
 
 

+ 19 - 19
rtaudio.mod/rtaudio.bmx

@@ -44,18 +44,18 @@ Import "rtaudiodriver.cpp"
 Import "RtAudioOS.cpp"
 Import "RtAudioOS.cpp"
 
 
 Extern
 Extern
-	Function CreateAudioDriver_RtAudio:IMaxModAudioDriver(api:int, showWarnings:int)
+	Function CreateAudioDriver_RtAudio:IMaxModAudioDriver(api:Int, showWarnings:Int)
 	Function CloseAudioDriver_RtAudio(Driver:IMaxModAudioDriver)
 	Function CloseAudioDriver_RtAudio(Driver:IMaxModAudioDriver)
 	'ron: added functionality to disable warnings
 	'ron: added functionality to disable warnings
-	Function RtAudio_showWarnings(Driver:IMaxModAudioDriver, bool:int)
+	Function RtAudio_showWarnings(Driver:IMaxModAudioDriver, bool:Int)
 End Extern
 End Extern
 
 
 Type TMaxModRtAudioDriver Extends TMaxModDriver
 Type TMaxModRtAudioDriver Extends TMaxModDriver
 
 
 	'ron: we store the active one in TMaxModDriver
 	'ron: we store the active one in TMaxModDriver
-	Global Active:TMaxModRtAudioDriver
+'	Global Active:TMaxModRtAudioDriver
 	'ron: show the warnings of rtAudio ?
 	'ron: show the warnings of rtAudio ?
-	Global optShowWarnings:int = True
+	Global optShowWarnings:Int = True
 
 
 	Method Delete()
 	Method Delete()
 		CloseAudioDriver_RtAudio(_driver)
 		CloseAudioDriver_RtAudio(_driver)
@@ -63,10 +63,10 @@ Type TMaxModRtAudioDriver Extends TMaxModDriver
 
 
 	'register on create
 	'register on create
 	Method New()
 	Method New()
-		self.registerAPIs()
+		Self.registerAPIs()
 	End Method
 	End Method
 
 
-	Function CreateSpecific:TMaxModDriver( name:string, api:string)
+	Function CreateSpecific:TMaxModDriver( name:String, api:String)
 '		if Active <> null then CloseAudioDriver_RtAudio( Active._driver)
 '		if Active <> null then CloseAudioDriver_RtAudio( Active._driver)
 		Active = New TMaxModRtAudioDriver
 		Active = New TMaxModRtAudioDriver
 		Active._driver = CreateAudioDriver_RtAudio( Active.GetAPIid(api), optShowWarnings)
 		Active._driver = CreateAudioDriver_RtAudio( Active.GetAPIid(api), optShowWarnings)
@@ -76,17 +76,17 @@ Type TMaxModRtAudioDriver Extends TMaxModDriver
 	End Function
 	End Function
 
 
 	Method registerAPIs()
 	Method registerAPIs()
-		self.AddAPI(0, "AUTOMATIC")	'= "UNSPECIFIED"
+		Self.AddAPI(0, "AUTOMATIC")	'= "UNSPECIFIED"
 		?Linux
 		?Linux
-		self.AddAPI(1, "LINUX_ALSA")
-		self.AddAPI(2, "LINUX_PULSE")
-		self.AddAPI(3, "LINUX_OSS")
-		self.AddAPI(4, "UNIX_JACK")
+		Self.AddAPI(1, "LINUX_ALSA")
+		Self.AddAPI(2, "LINUX_PULSE")
+		Self.AddAPI(3, "LINUX_OSS")
+		Self.AddAPI(4, "UNIX_JACK")
 		?MacOS
 		?MacOS
-		self.AddAPI(5, "MACOSX_CORE")
+		Self.AddAPI(5, "MACOSX_CORE")
 		?Win32
 		?Win32
-		self.AddAPI(6, "WINDOWS_ASIO")
-		self.AddAPI(7, "WINDOWS_DS")
+		Self.AddAPI(6, "WINDOWS_ASIO")
+		Self.AddAPI(7, "WINDOWS_DS")
 		?
 		?
 	End Method
 	End Method
 
 
@@ -100,21 +100,21 @@ Type TMaxModRtAudioDriver Extends TMaxModDriver
 	End Function
 	End Function
 
 
 
 
-	Function showWarnings(bool:int)
+	Function showWarnings(bool:Int)
 		optShowWarnings = bool
 		optShowWarnings = bool
-		if Active
+		If Active
 			RtAudio_showWarnings(Active._driver, optShowWarnings)
 			RtAudio_showWarnings(Active._driver, optShowWarnings)
-		endif
+		EndIf
 	End Function
 	End Function
 
 
 	'registers audio driver (with custom api)
 	'registers audio driver (with custom api)
-	Function Init(api:string="AUTOMATIC")
+	Function Init(api:String="AUTOMATIC")
 		TMaxModRtAudioDriver.CreateSpecific("MaxMod RtAudio", api)
 		TMaxModRtAudioDriver.CreateSpecific("MaxMod RtAudio", api)
 		TMaxModStreamDriver.AddDriver(TMaxModRtAudioDriver.Active,"MaxMod RtAudio")
 		TMaxModStreamDriver.AddDriver(TMaxModRtAudioDriver.Active,"MaxMod RtAudio")
 	End Function
 	End Function
 End Type
 End Type
 
 
-rem
+Rem
 		?Linux
 		?Linux
 		'default to Linux pulse on linux
 		'default to Linux pulse on linux
 		TMaxModRtAudioDriver.CreateSpecific("MaxMod RtAudio", "LINUX_PULSE")
 		TMaxModRtAudioDriver.CreateSpecific("MaxMod RtAudio", "LINUX_PULSE")