Golint
This commit is contained in:
parent
5d5a0e708f
commit
29546140b9
19 changed files with 432 additions and 432 deletions
|
@ -26,12 +26,12 @@ func (w *Wave) cptr() *C.Wave {
|
|||
return (*C.Wave)(unsafe.Pointer(w))
|
||||
}
|
||||
|
||||
// Returns new Wave
|
||||
// NewWave - Returns new Wave
|
||||
func NewWave(sampleCount, sampleRate, sampleSize, channels uint32, data unsafe.Pointer) Wave {
|
||||
return Wave{sampleCount, sampleRate, sampleSize, channels, data}
|
||||
}
|
||||
|
||||
// Returns new Wave from pointer
|
||||
// NewWaveFromPointer - Returns new Wave from pointer
|
||||
func NewWaveFromPointer(ptr unsafe.Pointer) Wave {
|
||||
return *(*Wave)(ptr)
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ func (s *Sound) cptr() *C.Sound {
|
|||
return (*C.Sound)(unsafe.Pointer(s))
|
||||
}
|
||||
|
||||
// Returns new Sound
|
||||
// NewSound - Returns new Sound
|
||||
func NewSound(source, buffer uint32, format int32) Sound {
|
||||
return Sound{source, buffer, format}
|
||||
}
|
||||
|
||||
// Returns new Sound from pointer
|
||||
// NewSoundFromPointer - Returns new Sound from pointer
|
||||
func NewSoundFromPointer(ptr unsafe.Pointer) Sound {
|
||||
return *(*Sound)(ptr)
|
||||
}
|
||||
|
@ -85,40 +85,40 @@ func (a *AudioStream) cptr() *C.AudioStream {
|
|||
return (*C.AudioStream)(unsafe.Pointer(a))
|
||||
}
|
||||
|
||||
// Returns new AudioStream
|
||||
// NewAudioStream - Returns new AudioStream
|
||||
func NewAudioStream(sampleRate, sampleSize, channels uint32, format int32, source uint32, buffers [2]uint32) AudioStream {
|
||||
return AudioStream{sampleRate, sampleSize, channels, format, source, buffers}
|
||||
}
|
||||
|
||||
// Returns new AudioStream from pointer
|
||||
// NewAudioStreamFromPointer - Returns new AudioStream from pointer
|
||||
func NewAudioStreamFromPointer(ptr unsafe.Pointer) AudioStream {
|
||||
return *(*AudioStream)(ptr)
|
||||
}
|
||||
|
||||
// Initialize audio device and context
|
||||
// InitAudioDevice - Initialize audio device and context
|
||||
func InitAudioDevice() {
|
||||
C.InitAudioDevice()
|
||||
}
|
||||
|
||||
// Close the audio device and context
|
||||
// CloseAudioDevice - Close the audio device and context
|
||||
func CloseAudioDevice() {
|
||||
C.CloseAudioDevice()
|
||||
}
|
||||
|
||||
// Check if audio device has been initialized successfully
|
||||
// IsAudioDeviceReady - Check if audio device has been initialized successfully
|
||||
func IsAudioDeviceReady() bool {
|
||||
ret := C.IsAudioDeviceReady()
|
||||
v := bool(int(ret) == 1)
|
||||
return v
|
||||
}
|
||||
|
||||
// Set master volume (listener)
|
||||
// SetMasterVolume - Set master volume (listener)
|
||||
func SetMasterVolume(volume float32) {
|
||||
cvolume := (C.float)(volume)
|
||||
C.SetMasterVolume(cvolume)
|
||||
}
|
||||
|
||||
// Load wave data from file into RAM
|
||||
// LoadWave - Load wave data from file into RAM
|
||||
func LoadWave(fileName string) Wave {
|
||||
cfileName := C.CString(fileName)
|
||||
defer C.free(unsafe.Pointer(cfileName))
|
||||
|
@ -127,7 +127,7 @@ func LoadWave(fileName string) Wave {
|
|||
return v
|
||||
}
|
||||
|
||||
// Load wave data from float array data (32bit)
|
||||
// LoadWaveEx - Load wave data from float array data (32bit)
|
||||
func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sampleSize int32, channels int32) Wave {
|
||||
csampleCount := (C.int)(sampleCount)
|
||||
csampleRate := (C.int)(sampleRate)
|
||||
|
@ -138,7 +138,7 @@ func LoadWaveEx(data unsafe.Pointer, sampleCount int32, sampleRate int32, sample
|
|||
return v
|
||||
}
|
||||
|
||||
// Load sound to memory
|
||||
// LoadSound - Load sound to memory
|
||||
func LoadSound(fileName string) Sound {
|
||||
cfileName := C.CString(fileName)
|
||||
defer C.free(unsafe.Pointer(cfileName))
|
||||
|
@ -147,7 +147,7 @@ func LoadSound(fileName string) Sound {
|
|||
return v
|
||||
}
|
||||
|
||||
// Load sound to memory from wave data
|
||||
// LoadSoundFromWave - Load sound to memory from wave data
|
||||
func LoadSoundFromWave(wave Wave) Sound {
|
||||
cwave := wave.cptr()
|
||||
ret := C.LoadSoundFromWave(*cwave)
|
||||
|
@ -155,7 +155,7 @@ func LoadSoundFromWave(wave Wave) Sound {
|
|||
return v
|
||||
}
|
||||
|
||||
// Update sound buffer with new data
|
||||
// UpdateSound - Update sound buffer with new data
|
||||
func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) {
|
||||
csound := sound.cptr()
|
||||
cdata := (unsafe.Pointer)(unsafe.Pointer(data))
|
||||
|
@ -163,43 +163,43 @@ func UpdateSound(sound Sound, data unsafe.Pointer, samplesCount int32) {
|
|||
C.UpdateSound(*csound, cdata, csamplesCount)
|
||||
}
|
||||
|
||||
// Unload wave data
|
||||
// UnloadWave - Unload wave data
|
||||
func UnloadWave(wave Wave) {
|
||||
cwave := wave.cptr()
|
||||
C.UnloadWave(*cwave)
|
||||
}
|
||||
|
||||
// Unload sound
|
||||
// UnloadSound - Unload sound
|
||||
func UnloadSound(sound Sound) {
|
||||
csound := sound.cptr()
|
||||
C.UnloadSound(*csound)
|
||||
}
|
||||
|
||||
// Play a sound
|
||||
// PlaySound - Play a sound
|
||||
func PlaySound(sound Sound) {
|
||||
csound := sound.cptr()
|
||||
C.PlaySound(*csound)
|
||||
}
|
||||
|
||||
// Pause a sound
|
||||
// PauseSound - Pause a sound
|
||||
func PauseSound(sound Sound) {
|
||||
csound := sound.cptr()
|
||||
C.PauseSound(*csound)
|
||||
}
|
||||
|
||||
// Resume a paused sound
|
||||
// ResumeSound - Resume a paused sound
|
||||
func ResumeSound(sound Sound) {
|
||||
csound := sound.cptr()
|
||||
C.ResumeSound(*csound)
|
||||
}
|
||||
|
||||
// Stop playing a sound
|
||||
// StopSound - Stop playing a sound
|
||||
func StopSound(sound Sound) {
|
||||
csound := sound.cptr()
|
||||
C.StopSound(*csound)
|
||||
}
|
||||
|
||||
// Check if a sound is currently playing
|
||||
// IsSoundPlaying - Check if a sound is currently playing
|
||||
func IsSoundPlaying(sound Sound) bool {
|
||||
csound := sound.cptr()
|
||||
ret := C.IsSoundPlaying(*csound)
|
||||
|
@ -207,21 +207,21 @@ func IsSoundPlaying(sound Sound) bool {
|
|||
return v
|
||||
}
|
||||
|
||||
// Set volume for a sound (1.0 is max level)
|
||||
// SetSoundVolume - Set volume for a sound (1.0 is max level)
|
||||
func SetSoundVolume(sound Sound, volume float32) {
|
||||
csound := sound.cptr()
|
||||
cvolume := (C.float)(volume)
|
||||
C.SetSoundVolume(*csound, cvolume)
|
||||
}
|
||||
|
||||
// Set pitch for a sound (1.0 is base level)
|
||||
// SetSoundPitch - Set pitch for a sound (1.0 is base level)
|
||||
func SetSoundPitch(sound Sound, pitch float32) {
|
||||
csound := sound.cptr()
|
||||
cpitch := (C.float)(pitch)
|
||||
C.SetSoundPitch(*csound, cpitch)
|
||||
}
|
||||
|
||||
// Convert wave data to desired format
|
||||
// WaveFormat - Convert wave data to desired format
|
||||
func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) {
|
||||
cwave := wave.cptr()
|
||||
csampleRate := (C.int)(sampleRate)
|
||||
|
@ -230,7 +230,7 @@ func WaveFormat(wave Wave, sampleRate int32, sampleSize int32, channels int32) {
|
|||
C.WaveFormat(cwave, csampleRate, csampleSize, cchannels)
|
||||
}
|
||||
|
||||
// Copy a wave to a new wave
|
||||
// WaveCopy - Copy a wave to a new wave
|
||||
func WaveCopy(wave Wave) Wave {
|
||||
cwave := wave.cptr()
|
||||
ret := C.WaveCopy(*cwave)
|
||||
|
@ -238,7 +238,7 @@ func WaveCopy(wave Wave) Wave {
|
|||
return v
|
||||
}
|
||||
|
||||
// Crop a wave to defined samples range
|
||||
// WaveCrop - Crop a wave to defined samples range
|
||||
func WaveCrop(wave Wave, initSample int32, finalSample int32) {
|
||||
cwave := wave.cptr()
|
||||
cinitSample := (C.int)(initSample)
|
||||
|
@ -246,7 +246,7 @@ func WaveCrop(wave Wave, initSample int32, finalSample int32) {
|
|||
C.WaveCrop(cwave, cinitSample, cfinalSample)
|
||||
}
|
||||
|
||||
// Get samples data from wave as a floats array
|
||||
// GetWaveData - Get samples data from wave as a floats array
|
||||
func GetWaveData(wave Wave) []float32 {
|
||||
var data []float32
|
||||
cwave := wave.cptr()
|
||||
|
@ -260,7 +260,7 @@ func GetWaveData(wave Wave) []float32 {
|
|||
return data
|
||||
}
|
||||
|
||||
// Load music stream from file
|
||||
// LoadMusicStream - Load music stream from file
|
||||
func LoadMusicStream(fileName string) Music {
|
||||
cfileName := C.CString(fileName)
|
||||
defer C.free(unsafe.Pointer(cfileName))
|
||||
|
@ -269,43 +269,43 @@ func LoadMusicStream(fileName string) Music {
|
|||
return v
|
||||
}
|
||||
|
||||
// Unload music stream
|
||||
// UnloadMusicStream - Unload music stream
|
||||
func UnloadMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
C.UnloadMusicStream(cmusic)
|
||||
}
|
||||
|
||||
// Start music playing
|
||||
// PlayMusicStream - Start music playing
|
||||
func PlayMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
C.PlayMusicStream(cmusic)
|
||||
}
|
||||
|
||||
// Updates buffers for music streaming
|
||||
// UpdateMusicStream - Updates buffers for music streaming
|
||||
func UpdateMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
C.UpdateMusicStream(cmusic)
|
||||
}
|
||||
|
||||
// Stop music playing
|
||||
// StopMusicStream - Stop music playing
|
||||
func StopMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
C.StopMusicStream(cmusic)
|
||||
}
|
||||
|
||||
// Pause music playing
|
||||
// PauseMusicStream - Pause music playing
|
||||
func PauseMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
C.PauseMusicStream(cmusic)
|
||||
}
|
||||
|
||||
// Resume playing paused music
|
||||
// ResumeMusicStream - Resume playing paused music
|
||||
func ResumeMusicStream(music Music) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
C.ResumeMusicStream(cmusic)
|
||||
}
|
||||
|
||||
// Check if music is playing
|
||||
// IsMusicPlaying - Check if music is playing
|
||||
func IsMusicPlaying(music Music) bool {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
ret := C.IsMusicPlaying(cmusic)
|
||||
|
@ -313,14 +313,14 @@ func IsMusicPlaying(music Music) bool {
|
|||
return v
|
||||
}
|
||||
|
||||
// Set volume for music (1.0 is max level)
|
||||
// SetMusicVolume - Set volume for music (1.0 is max level)
|
||||
func SetMusicVolume(music Music, volume float32) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
cvolume := (C.float)(volume)
|
||||
C.SetMusicVolume(cmusic, cvolume)
|
||||
}
|
||||
|
||||
// Set pitch for a music (1.0 is base level)
|
||||
// SetMusicPitch - Set pitch for a music (1.0 is base level)
|
||||
func SetMusicPitch(music Music, pitch float32) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
cpitch := (C.float)(pitch)
|
||||
|
@ -328,14 +328,14 @@ func SetMusicPitch(music Music, pitch float32) {
|
|||
}
|
||||
|
||||
// Set music loop count (loop repeats)
|
||||
// NOTE: If set to -1, means infinite loop
|
||||
// SetMusicLoopCount - NOTE: If set to -1, means infinite loop
|
||||
func SetMusicLoopCount(music Music, count float32) {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
ccount := (C.float)(count)
|
||||
C.SetMusicLoopCount(cmusic, ccount)
|
||||
}
|
||||
|
||||
// Get music time length (in seconds)
|
||||
// GetMusicTimeLength - Get music time length (in seconds)
|
||||
func GetMusicTimeLength(music Music) float32 {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
ret := C.GetMusicTimeLength(cmusic)
|
||||
|
@ -343,7 +343,7 @@ func GetMusicTimeLength(music Music) float32 {
|
|||
return v
|
||||
}
|
||||
|
||||
// Get current music time played (in seconds)
|
||||
// GetMusicTimePlayed - Get current music time played (in seconds)
|
||||
func GetMusicTimePlayed(music Music) float32 {
|
||||
cmusic := *(*C.Music)(unsafe.Pointer(&music))
|
||||
ret := C.GetMusicTimePlayed(cmusic)
|
||||
|
@ -351,7 +351,7 @@ func GetMusicTimePlayed(music Music) float32 {
|
|||
return v
|
||||
}
|
||||
|
||||
// Init audio stream (to stream raw audio pcm data)
|
||||
// InitAudioStream - Init audio stream (to stream raw audio pcm data)
|
||||
func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) AudioStream {
|
||||
csampleRate := (C.uint)(sampleRate)
|
||||
csampleSize := (C.uint)(sampleSize)
|
||||
|
@ -361,7 +361,7 @@ func InitAudioStream(sampleRate uint32, sampleSize uint32, channels uint32) Audi
|
|||
return v
|
||||
}
|
||||
|
||||
// Update audio stream buffers with data
|
||||
// UpdateAudioStream - Update audio stream buffers with data
|
||||
func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int32) {
|
||||
cstream := stream.cptr()
|
||||
cdata := (unsafe.Pointer)(unsafe.Pointer(data))
|
||||
|
@ -369,13 +369,13 @@ func UpdateAudioStream(stream AudioStream, data unsafe.Pointer, samplesCount int
|
|||
C.UpdateAudioStream(*cstream, cdata, csamplesCount)
|
||||
}
|
||||
|
||||
// Close audio stream and free memory
|
||||
// CloseAudioStream - Close audio stream and free memory
|
||||
func CloseAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
C.CloseAudioStream(*cstream)
|
||||
}
|
||||
|
||||
// Check if any audio stream buffers requires refill
|
||||
// IsAudioBufferProcessed - Check if any audio stream buffers requires refill
|
||||
func IsAudioBufferProcessed(stream AudioStream) bool {
|
||||
cstream := stream.cptr()
|
||||
ret := C.IsAudioBufferProcessed(*cstream)
|
||||
|
@ -383,25 +383,25 @@ func IsAudioBufferProcessed(stream AudioStream) bool {
|
|||
return v
|
||||
}
|
||||
|
||||
// Play audio stream
|
||||
// PlayAudioStream - Play audio stream
|
||||
func PlayAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
C.PlayAudioStream(*cstream)
|
||||
}
|
||||
|
||||
// Pause audio stream
|
||||
// PauseAudioStream - Pause audio stream
|
||||
func PauseAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
C.PauseAudioStream(*cstream)
|
||||
}
|
||||
|
||||
// Resume audio stream
|
||||
// ResumeAudioStream - Resume audio stream
|
||||
func ResumeAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
C.ResumeAudioStream(*cstream)
|
||||
}
|
||||
|
||||
// Stop audio stream
|
||||
// StopAudioStream - Stop audio stream
|
||||
func StopAudioStream(stream AudioStream) {
|
||||
cstream := stream.cptr()
|
||||
C.StopAudioStream(*cstream)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue