feat: sound manager added

This commit is contained in:
Sale Djenic 2022-02-10 15:04:11 +01:00 committed by Sale Djenic
parent d3fdb6eed2
commit 8d199aa829
4 changed files with 26 additions and 0 deletions

View File

@ -35,6 +35,7 @@ include "nimqml/private/singleinstance.nim"
include "nimqml/private/status/statusevent.nim"
include "nimqml/private/status/statusosnotification.nim"
include "nimqml/private/status/statuskeychainmanager.nim"
include "nimqml/private/status/statussoundmanager.nim"
proc signal_handler*(receiver: pointer, signal: cstring, slot: cstring) =
var dosqobj = cast[DosQObject](receiver)

View File

@ -378,6 +378,11 @@ proc dos_keychainmanager_delete_data_async(vptr: DosStatusKeychainManager,
proc dos_keychainmanager_delete(vptr: DosStatusKeychainManager)
{.cdecl, dynlib: dynLibName, importc.}
# DosStatusSoundManager
proc dos_soundmanager_play_sound(soundUrl: cstring) {.cdecl, dynlib: dynLibName, importc.}
proc dos_soundmanager_set_player_volume(volume: int) {.cdecl, dynlib: dynLibName, importc.}
proc dos_soundmanager_stop_player() {.cdecl, dynlib: dynLibName, importc.}
proc dos_to_local_file(fileUrl: cstring): cstring
{.cdecl, dynlib: dynLibName, importc.}

View File

@ -141,6 +141,8 @@ type
StatusOSNotification* = ref object of QObject
StatusKeychainManager* = ref object of QObject
StatusSoundManager* = ref object of RootObj
const
UserRole* = 0x100

View File

@ -0,0 +1,18 @@
proc setup(self: StatusSoundManager) =
discard
proc delete*(self: StatusSoundManager) =
discard
proc newStatusSoundManager*(): StatusSoundManager =
new(result, delete)
result.setup()
proc playSound*(self: StatusSoundManager, soundUrl: string) =
dos_soundmanager_play_sound(soundUrl)
proc setPlayerVolume*(self: StatusSoundManager, volume: int) =
dos_soundmanager_set_player_volume(volume)
proc stopPlayer*(self: StatusSoundManager) =
dos_soundmanager_stop_player()