Bug fixes for audio textures
This commit is contained in:
@@ -42,8 +42,8 @@ Item
|
||||
ImageChannel,
|
||||
VideoChannel,
|
||||
ShaderChannel,
|
||||
CubeMapChannel
|
||||
// AudioChannel
|
||||
CubeMapChannel,
|
||||
AudioChannel
|
||||
}
|
||||
|
||||
property int type: ShaderChannel.Type.ImageChannel
|
||||
@@ -133,15 +133,15 @@ Item
|
||||
{
|
||||
loader.sourceComponent: channelShader
|
||||
}
|
||||
},
|
||||
State
|
||||
{
|
||||
when: channel.type === ShaderChannel.Type.AudioChannel
|
||||
PropertyChanges
|
||||
{
|
||||
loader.sourceComponent: channelAudio
|
||||
}
|
||||
}
|
||||
// State
|
||||
// {
|
||||
// when: channel.type === ShaderChannel.Type.AudioChannel
|
||||
// PropertyChanges
|
||||
// {
|
||||
// loader.sourceComponent: channelAudio
|
||||
// }
|
||||
// }
|
||||
]
|
||||
|
||||
transform: Rotation
|
||||
@@ -373,80 +373,40 @@ Item
|
||||
|
||||
// Supporting this as an mp3 feels kinda silly. Should really figure out how to capture desktop audio with qml
|
||||
// UPDATE: This is not currently supported in QML, so we will need to implement this in C++ later
|
||||
// Component
|
||||
// {
|
||||
// id: channelAudio
|
||||
// Rectangle
|
||||
// {
|
||||
// anchors.fill: parent
|
||||
// color: "black"
|
||||
Component
|
||||
{
|
||||
id: audioChannel
|
||||
|
||||
// property var audioData: new Array(512).fill(0)
|
||||
// property alias texture: audioTexture
|
||||
Item
|
||||
{
|
||||
|
||||
// MediaDevices
|
||||
// {
|
||||
// id: devices
|
||||
// }
|
||||
Image
|
||||
{
|
||||
id: textureImage
|
||||
source: "image://audiotexture/frame"
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
// AudioInput
|
||||
// {
|
||||
// id: audioInput
|
||||
// device: devices.defaultAudioInput
|
||||
// }
|
||||
Timer
|
||||
{
|
||||
property int frame: 0
|
||||
interval: 16
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
running: true
|
||||
|
||||
// CaptureSession
|
||||
// {
|
||||
// id: captureSession
|
||||
// audioInput: audioInput
|
||||
// }
|
||||
onTriggered:
|
||||
{
|
||||
frame++
|
||||
textureImage.source = "image://audiotexture/frame" + frame
|
||||
}
|
||||
}
|
||||
|
||||
// Timer
|
||||
// {
|
||||
// interval: 16 // ~60fps update
|
||||
// running: true
|
||||
// repeat: true
|
||||
// onTriggered:
|
||||
// {
|
||||
// // Get audio levels and update texture
|
||||
// // let buffer = audioInput.probe.audioBuffer()
|
||||
// // if (buffer)
|
||||
// // {
|
||||
// // for (let i = 0; i < Math.min(buffer.length, 512); i++) {
|
||||
// // audioData[i] = Math.abs(buffer[i])
|
||||
// // }
|
||||
// // audioTexture.update()
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
// ShaderEffectSource
|
||||
// {
|
||||
// id: audioTexture
|
||||
// width: 512
|
||||
// height: 1
|
||||
// format: ShaderEffectSource.Alpha
|
||||
// smooth: false
|
||||
// hideSource: true
|
||||
// sourceItem: Row
|
||||
// {
|
||||
// Repeater
|
||||
// {
|
||||
// model: 512
|
||||
// Rectangle
|
||||
// {
|
||||
// width: 1
|
||||
// height: 1
|
||||
// color: Qt.rgba(1, 1, 1, root.audioData[index])
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// Component.onCompleted:
|
||||
// {
|
||||
// //captureSession.start()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
Component.onCompleted:
|
||||
{
|
||||
Komplex.AudioModel.startCapture()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,16 +88,13 @@ Item
|
||||
{
|
||||
id: selectionModel
|
||||
|
||||
// Commented out Audio channel as it is not implemented yet
|
||||
// ListElement
|
||||
// {
|
||||
// file: true
|
||||
// name: "Audio"
|
||||
// icon: "qrc:/icons/audio.svg"
|
||||
// title: "Select an Audio File"
|
||||
// filter: "MP3 Files (*.mp3):WAV Files (*.wav)"
|
||||
// type: ShaderChannel.Type.AudioChannel
|
||||
// }
|
||||
ListElement
|
||||
{
|
||||
file: true
|
||||
name: "Audio"
|
||||
icon: "./icons/audio.svg"
|
||||
type: ShaderChannel.Type.AudioChannel
|
||||
}
|
||||
|
||||
ListElement
|
||||
{
|
||||
@@ -271,6 +268,7 @@ Item
|
||||
|
||||
RowLayout
|
||||
{
|
||||
visible: window.tmp_type != ShaderChannel.Type.AudioChannel
|
||||
Layout.alignment: Qt.AlignTop
|
||||
|
||||
Label
|
||||
@@ -611,6 +609,8 @@ Item
|
||||
case ShaderChannel.Type.VideoChannel:
|
||||
window.currentFolder = window.videoFolder
|
||||
break;
|
||||
case ShaderChannel.Type.AudioChannel:
|
||||
break;
|
||||
}
|
||||
|
||||
// Set the current selection index
|
||||
|
||||
@@ -124,7 +124,7 @@ Kirigami.FormLayout
|
||||
model: [
|
||||
{ "label": i18nd("@option:komplex_mode", "ShaderToys") },
|
||||
{ "label": i18nd("@option:komplex_mode", "Komplex") }
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
TabBar
|
||||
|
||||
Reference in New Issue
Block a user