→ index of namespace default
 
→ index of project tksdl
 
→ index of module tksdl

Class tksdl.AudioDevice


Synopsis: Static class that represents a wrapper audio output via SDL.

  Base classes:
  Methods: Description:


This class emits the following signals:
onAudioFrame() - called whenever a new frame (according to PPQ and BPM) starts
onAudioPostProcess(FloatArray buf) - Called when a block of samples is about to be sent to the output device
onAudioRender(FloatArray buf) - Called when a new sample frame needs to be rendered
onAudioBeginBlock(FloatArray buf) - Called when a new block of samples needs to be rendered. The application may decide to call processTimeFrames() to trigger the onAudioFrame() and onAudioRender() callbacks. Note: This function runs in a separate thread.


 
→ top of page

Method closeDSP
Close sound device
Signature
closeDSP()

 
→ top of page
Method enableFileOutput
Enable/disable file output
Signature
enableFileOutput(booleanbEnabled)
Arguments
booleanbEnabled–

 
→ top of page
Method finishBlock
Finally send sample block to audio device
Signature
finishBlock()

 
→ top of page
Method getBpm
Query beats per minute
Signature
getBpm():float
Returns
float–

 
→ top of page
Method getPpq
Query precision per quarter
Signature
getPpq():int
Returns
int–

 
→ top of page
Method getSwapstereo
Query whether stereo channels are swapped
Signature
getSwapstereo():boolean
Returns
boolean–

 
→ top of page
Method getVolume
Query master volume
Signature
getVolume():float
Returns
float–

 
→ top of page
Method openDSP
Open sound device with the given parameters
Signature
openDSP(floatfreq,
  intbufSize 
  )  
 :boolean
Arguments
floatfreq–
intbufSize–
Returns
boolean–

 
→ top of page
Method processTimeFrames
Trigger onAudioFrame(), onAudioRender() signal callbacks
Signature
processTimeFrames()

 
→ top of page
Method setBpm
Set beats per minute
Signature
setBpm(floatbpm)
Arguments
floatbpm–

 
→ top of page
Method setDefaultBufferSize
Set output buffer size (and thus audio latency). Warning: Not all drivers can handle small buffer sizes. The default buffer size is 8192 samples
Signature
setDefaultBufferSize(intbufSize)
Arguments
intbufSize–

 
→ top of page
Method setFileName
Where to write the sample data when file output is enabled
Signature
setFileName(StringfileName)
Arguments
StringfileName–

 
→ top of page
Method setPpq
Set precision per quarter
Signature
setPpq(intppq)
Arguments
intppq–

 
→ top of page
Method setSwapstereo
Enable stereo channel swapping
Signature
setSwapstereo(booleanb)
Arguments
booleanb–

 
→ top of page
Method setVolume
Set master volume for sample mixer.
Signature
setVolume(floatf)
Arguments
floatf–

 
→ top of page
Method start
Start sound output
Signature
start()

 
→ top of page
Method stop
Stop sound output
Signature
stop()

 
→ top of page
 

Project Modules:tksdl 
Project Classes:AudioDevice , AudioSample , Cursor , FPS , Joystick , Key , Mouse , SamplePlayer , SDL , Viewport 
Project Functions:MIDINoteToFrequency 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Tue, 3/Mar/2026 18:10:18