mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
197 lines
4.9 KiB
Go
197 lines
4.9 KiB
Go
|
package multimedia
|
||
|
|
||
|
/*
|
||
|
|
||
|
#include "gen_qsound.h"
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
*/
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"github.com/mappu/miqt/qt"
|
||
|
"runtime"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
type QSound__Loop int
|
||
|
|
||
|
const (
|
||
|
QSound__Infinite QSound__Loop = -1
|
||
|
)
|
||
|
|
||
|
type QSound struct {
|
||
|
h *C.QSound
|
||
|
*qt.QObject
|
||
|
}
|
||
|
|
||
|
func (this *QSound) cPointer() *C.QSound {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func (this *QSound) UnsafePointer() unsafe.Pointer {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return unsafe.Pointer(this.h)
|
||
|
}
|
||
|
|
||
|
func newQSound(h *C.QSound) *QSound {
|
||
|
if h == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return &QSound{h: h, QObject: qt.UnsafeNewQObject(unsafe.Pointer(h))}
|
||
|
}
|
||
|
|
||
|
func UnsafeNewQSound(h unsafe.Pointer) *QSound {
|
||
|
return newQSound((*C.QSound)(h))
|
||
|
}
|
||
|
|
||
|
// NewQSound constructs a new QSound object.
|
||
|
func NewQSound(filename string) *QSound {
|
||
|
filename_ms := C.struct_miqt_string{}
|
||
|
filename_ms.data = C.CString(filename)
|
||
|
filename_ms.len = C.size_t(len(filename))
|
||
|
defer C.free(unsafe.Pointer(filename_ms.data))
|
||
|
ret := C.QSound_new(filename_ms)
|
||
|
return newQSound(ret)
|
||
|
}
|
||
|
|
||
|
// NewQSound2 constructs a new QSound object.
|
||
|
func NewQSound2(filename string, parent *qt.QObject) *QSound {
|
||
|
filename_ms := C.struct_miqt_string{}
|
||
|
filename_ms.data = C.CString(filename)
|
||
|
filename_ms.len = C.size_t(len(filename))
|
||
|
defer C.free(unsafe.Pointer(filename_ms.data))
|
||
|
ret := C.QSound_new2(filename_ms, (*C.QObject)(parent.UnsafePointer()))
|
||
|
return newQSound(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QSound) MetaObject() *qt.QMetaObject {
|
||
|
return qt.UnsafeNewQMetaObject(unsafe.Pointer(C.QSound_MetaObject(this.h)))
|
||
|
}
|
||
|
|
||
|
func (this *QSound) Metacast(param1 string) unsafe.Pointer {
|
||
|
param1_Cstring := C.CString(param1)
|
||
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
||
|
return (unsafe.Pointer)(C.QSound_Metacast(this.h, param1_Cstring))
|
||
|
}
|
||
|
|
||
|
func QSound_Tr(s string) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QSound_Tr(s_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QSound_TrUtf8(s string) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QSound_TrUtf8(s_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QSound_Play(filename string) {
|
||
|
filename_ms := C.struct_miqt_string{}
|
||
|
filename_ms.data = C.CString(filename)
|
||
|
filename_ms.len = C.size_t(len(filename))
|
||
|
defer C.free(unsafe.Pointer(filename_ms.data))
|
||
|
C.QSound_Play(filename_ms)
|
||
|
}
|
||
|
|
||
|
func (this *QSound) Loops() int {
|
||
|
return (int)(C.QSound_Loops(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QSound) LoopsRemaining() int {
|
||
|
return (int)(C.QSound_LoopsRemaining(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QSound) SetLoops(loops int) {
|
||
|
C.QSound_SetLoops(this.h, (C.int)(loops))
|
||
|
}
|
||
|
|
||
|
func (this *QSound) FileName() string {
|
||
|
var _ms C.struct_miqt_string = C.QSound_FileName(this.h)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func (this *QSound) IsFinished() bool {
|
||
|
return (bool)(C.QSound_IsFinished(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QSound) Play2() {
|
||
|
C.QSound_Play2(this.h)
|
||
|
}
|
||
|
|
||
|
func (this *QSound) Stop() {
|
||
|
C.QSound_Stop(this.h)
|
||
|
}
|
||
|
|
||
|
func QSound_Tr2(s string, c string) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
c_Cstring := C.CString(c)
|
||
|
defer C.free(unsafe.Pointer(c_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QSound_Tr2(s_Cstring, c_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QSound_Tr3(s string, c string, n int) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
c_Cstring := C.CString(c)
|
||
|
defer C.free(unsafe.Pointer(c_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QSound_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QSound_TrUtf82(s string, c string) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
c_Cstring := C.CString(c)
|
||
|
defer C.free(unsafe.Pointer(c_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QSound_TrUtf82(s_Cstring, c_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QSound_TrUtf83(s string, c string, n int) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
c_Cstring := C.CString(c)
|
||
|
defer C.free(unsafe.Pointer(c_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QSound_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
// Delete this object from C++ memory.
|
||
|
func (this *QSound) Delete() {
|
||
|
C.QSound_Delete(this.h)
|
||
|
}
|
||
|
|
||
|
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
|
||
|
// from C++ memory once it is unreachable from Go memory.
|
||
|
func (this *QSound) GoGC() {
|
||
|
runtime.SetFinalizer(this, func(this *QSound) {
|
||
|
this.Delete()
|
||
|
runtime.KeepAlive(this.h)
|
||
|
})
|
||
|
}
|