Properly fixed audio texture bug
This commit is contained in:
@@ -146,13 +146,13 @@ Rectangle
|
|||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceItem: channelRect
|
sourceItem: channelRect
|
||||||
sourceRect: Qt.rect(0,0, mainItem.iResolution.x, mainItem.iResolution.y)
|
sourceRect: Qt.rect(0,0, channelRect.width, channelRect.height)
|
||||||
textureSize: Qt.size(mainItem.iResolution.x, mainItem.iResolution.y)
|
textureSize: Qt.size(channelRect.width, channelRect.height)
|
||||||
hideSource: true
|
hideSource: true
|
||||||
visible: true
|
visible: true
|
||||||
smooth: true
|
smooth: true
|
||||||
antialiasing: true
|
antialiasing: true
|
||||||
live: true
|
live: false
|
||||||
|
|
||||||
id: finalSource
|
id: finalSource
|
||||||
|
|
||||||
@@ -161,6 +161,15 @@ Rectangle
|
|||||||
live = false;
|
live = false;
|
||||||
live = true;
|
live = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: mainItem
|
||||||
|
function onIFrameChanged()
|
||||||
|
{
|
||||||
|
finalSource.scheduleUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the default shader pack configuration on component completion
|
// Load the default shader pack configuration on component completion
|
||||||
@@ -210,14 +219,19 @@ Rectangle
|
|||||||
onWheel: (mouse) => {
|
onWheel: (mouse) => {
|
||||||
mouse.accepted = false
|
mouse.accepted = false
|
||||||
}
|
}
|
||||||
}`, parent.parent, "mouseTrackerArea");
|
}`,
|
||||||
|
parent.parent,
|
||||||
|
"mouseTrackerArea"
|
||||||
|
);
|
||||||
|
|
||||||
ready = true
|
ready = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recursive helper function to parse channels
|
// Recursive helper function to parse channels
|
||||||
function parseChannel(channel, json, typeDefault = 2, autodestroy = true)
|
function parseChannel(channel, json)
|
||||||
{
|
{
|
||||||
|
var typeDefault = 2
|
||||||
|
var autodestroy = true
|
||||||
var component = Qt.createComponent("./ShaderChannel.qml")
|
var component = Qt.createComponent("./ShaderChannel.qml")
|
||||||
|
|
||||||
if (json.channel0)
|
if (json.channel0)
|
||||||
@@ -341,20 +355,6 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.frameBufferChannel = typeof json.frame_buffer_channel === "number" ? json.frame_buffer_channel : -1
|
|
||||||
channel.iTimeScale = typeof json.time_scale === "number" ? json.time_scale : 1.0
|
|
||||||
channel.iResolutionScale = typeof json.resolution_scale === "number" ? json.resolution_scale : 1.0
|
|
||||||
channel.iResolution = Qt.binding(() => { return json.resolution_x ? Qt.vector3d(json.resolution_x, json.resolution_y, 1.0) : Qt.vector3d(mainItem.iResolution.x,mainItem.iResolution.y,1.0); })
|
|
||||||
channel.mouseBias = json.mouse_scale ? json.mouse_scale : 1.0
|
|
||||||
channel.width = Qt.binding(() => channel.iResolution.x)
|
|
||||||
channel.height = Qt.binding(() => channel.iResolution.y)
|
|
||||||
channel.materialTexture = typeof json.materialTexture === "string" ? getFilePath(json.materialTexture) : ""
|
|
||||||
channel.materialShader = typeof json.materialShader === "string" ? getFilePath(json.materialShader) : ""
|
|
||||||
channel.mipmap = typeof json.mipmap === "boolean" ? json.mipmap : true
|
|
||||||
channel.blending = typeof json.blending === "boolean" ? json.blending : true
|
|
||||||
channel.samples = typeof json.samples === "number" ? json.samples : 1
|
|
||||||
channel.invert = typeof json.invert === "boolean" ? json.invert : false
|
|
||||||
|
|
||||||
if(typeof json.source === "string")
|
if(typeof json.source === "string")
|
||||||
{
|
{
|
||||||
channel.source = getFilePath(json.source)
|
channel.source = getFilePath(json.source)
|
||||||
@@ -364,26 +364,51 @@ Rectangle
|
|||||||
channel.source = ""
|
channel.source = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(channel.type === ShaderChannel.AudioChannel)
|
||||||
|
{
|
||||||
|
channel.visible = true
|
||||||
|
channel.width = 512
|
||||||
|
channel.height = 2
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channel.width = Qt.binding(() => channel.iResolution.x)
|
||||||
|
channel.height = Qt.binding(() => channel.iResolution.y)
|
||||||
|
}
|
||||||
|
|
||||||
|
channel.frameBufferChannel = typeof json.frame_buffer_channel === "number" ? json.frame_buffer_channel : -1
|
||||||
|
channel.iTimeScale = typeof json.time_scale === "number" ? json.time_scale : 1.0
|
||||||
|
channel.iResolutionScale = typeof json.resolution_scale === "number" ? json.resolution_scale : 1.0
|
||||||
|
channel.iResolution = Qt.binding(() => { return json.resolution_x ? Qt.vector3d(json.resolution_x, json.resolution_y, 1.0) : Qt.vector3d(mainItem.iResolution.x,mainItem.iResolution.y,1.0); })
|
||||||
|
channel.mouseBias = json.mouse_scale ? json.mouse_scale : 1.0
|
||||||
|
channel.materialTexture = typeof json.materialTexture === "string" ? getFilePath(json.materialTexture) : ""
|
||||||
|
channel.materialShader = typeof json.materialShader === "string" ? getFilePath(json.materialShader) : ""
|
||||||
|
channel.mipmap = typeof json.mipmap === "boolean" ? json.mipmap : true
|
||||||
|
channel.blending = typeof json.blending === "boolean" ? json.blending : false
|
||||||
|
channel.samples = typeof json.samples === "number" ? json.samples : 1
|
||||||
|
channel.invert = typeof json.invert === "boolean" ? json.invert : false
|
||||||
|
channel.visible = false
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Source Format
|
Source Format
|
||||||
*/
|
*/
|
||||||
var format = ShaderEffectSource.RGB8A
|
var format = ShaderEffectSource.RGBA8
|
||||||
|
|
||||||
if(typeof json.format === "string")
|
if(typeof json.format === "string")
|
||||||
{
|
{
|
||||||
switch(json.format.toLowerCase())
|
switch(json.format.toLowerCase())
|
||||||
{
|
{
|
||||||
case "rgb8a":
|
case "RGBA8":
|
||||||
format = ShaderEffectSource.RGB8A
|
format = ShaderEffectSource.RGBA8
|
||||||
break;
|
break;
|
||||||
case "rgb16f":
|
case "rgb16f":
|
||||||
format = ShaderEffectSource.RGB16F
|
format = ShaderEffectSource.RGBA16F
|
||||||
break;
|
break;
|
||||||
case "rgb32f":
|
case "rgb32f":
|
||||||
format = ShaderEffectSource.RGB32F
|
format = ShaderEffectSource.RGBA32F
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
format = ShaderEffectSource.RGB8A
|
format = ShaderEffectSource.RGBA8
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,14 +70,14 @@ Item
|
|||||||
property var iDate
|
property var iDate
|
||||||
property real iTimeScale: 1 // This is used to scale the time for the shader, allowing for slow motion or fast forward effects per channel
|
property real iTimeScale: 1 // This is used to scale the time for the shader, allowing for slow motion or fast forward effects per channel
|
||||||
property int frameBufferChannel: -1
|
property int frameBufferChannel: -1
|
||||||
property bool blending: true
|
property bool blending: false
|
||||||
property string materialTexture:""
|
property string materialTexture:""
|
||||||
property string materialShader:""
|
property string materialShader:""
|
||||||
property bool mipmap: false
|
property bool mipmap: true
|
||||||
property int samples: 1
|
property int samples: 2
|
||||||
property var textureMirroring: ShaderEffectSource.NoMirroring
|
property var textureMirroring: ShaderEffectSource.NoMirroring
|
||||||
property var wrapMode: ShaderEffectSource.ClampToEdge
|
property var wrapMode: ShaderEffectSource.Repeat
|
||||||
property var format: ShaderEffectSource.RGB8A
|
property var format: ShaderEffectSource.RGBA8
|
||||||
property var windowModel
|
property var windowModel
|
||||||
property bool invert: false
|
property bool invert: false
|
||||||
|
|
||||||
@@ -107,8 +107,10 @@ Item
|
|||||||
|
|
||||||
id: channel
|
id: channel
|
||||||
visible: false // Set to false by default, main shader needs be set to true in MainWindow.qml
|
visible: false // Set to false by default, main shader needs be set to true in MainWindow.qml
|
||||||
width: iResolution.x
|
width: channel.type === ShaderChannel.AudioChannel ? 512 : iResolution.x
|
||||||
height: iResolution.y
|
height: channel.type === ShaderChannel.AudioChannel ? 2 : iResolution.y
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
|
||||||
// This is used to dynamically load the appropriate channel type based on the `type` property of the channel
|
// This is used to dynamically load the appropriate channel type based on the `type` property of the channel
|
||||||
Loader
|
Loader
|
||||||
@@ -168,23 +170,6 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
transform: Rotation
|
|
||||||
{
|
|
||||||
id: channelRotation
|
|
||||||
origin.x: channel.width / 2
|
|
||||||
origin.y: channel.height / 2
|
|
||||||
|
|
||||||
// For vertical flipping, we need to transform the x axis
|
|
||||||
axis
|
|
||||||
{
|
|
||||||
x: 1
|
|
||||||
y: 0
|
|
||||||
z: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
angle: data.angle
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//The image channel will be the default channel type for backwards compatability
|
//The image channel will be the default channel type for backwards compatability
|
||||||
@@ -263,56 +248,8 @@ Item
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
autoStart()
|
autoStart()
|
||||||
//delayedStartTimer.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// onMediaStatusChanged:
|
|
||||||
// {
|
|
||||||
// switch(mediaStatus)
|
|
||||||
// {
|
|
||||||
// case MediaPlayer.NoMedia:
|
|
||||||
// console.log("No media loaded")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.LoadingMedia:
|
|
||||||
// console.log("Video loading")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.LoadedMedia:
|
|
||||||
// console.log("Video Loaded")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.BufferingMedia:
|
|
||||||
// console.log("Video buffering")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.StalledMedia:
|
|
||||||
// console.log("Video stalled")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.BufferedMedia:
|
|
||||||
// console.log("Video buffered")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.EndOfMedia:
|
|
||||||
// console.log("Video EOF")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.InvalidMedia:
|
|
||||||
// console.log("Video invalid")
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// onPlaybackStateChanged:
|
|
||||||
// {
|
|
||||||
// switch(playbackState)
|
|
||||||
// {
|
|
||||||
// case MediaPlayer.PlayingState:
|
|
||||||
// console.log("Video playback started")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.PausedState:
|
|
||||||
// console.log("Video playback paused")
|
|
||||||
// break;
|
|
||||||
// case MediaPlayer.StoppedState:
|
|
||||||
// console.log("Video playback stopped")
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
videoComponent.loaded = true
|
videoComponent.loaded = true
|
||||||
@@ -351,199 +288,6 @@ Item
|
|||||||
id: channelShaderContent
|
id: channelShaderContent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
// Setup the shader effect sources for each channel
|
|
||||||
// These are needed to provide the uniform data to the shader channel buffers
|
|
||||||
ShaderEffectSource
|
|
||||||
{
|
|
||||||
id: channelSource0
|
|
||||||
live: false
|
|
||||||
smooth: true
|
|
||||||
recursive: false
|
|
||||||
hideSource: true
|
|
||||||
width: channel.iResolution.x
|
|
||||||
height: channel.iResolution.y
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
format: channel.iChannel0 ? channel.iChannel0.format : ShaderEffectSource.RGB8A
|
|
||||||
sourceItem: channel.iChannel0 ? channel.iChannel0 : null
|
|
||||||
textureMirroring: channel.iChannel0 ? channel.iChannel0.textureMirroring : ShaderEffectSource.NoMirroring
|
|
||||||
wrapMode: channel.iChannel0 ? channel.iChannel0.wrapMode : ShaderEffectSource.Repeat
|
|
||||||
mipmap: channel.iChannel0 ? channel.iChannel0.mipmap : true
|
|
||||||
samples: channel.iChannel0 ? channel.iChannel0.samples : 1
|
|
||||||
|
|
||||||
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
|
||||||
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
|
||||||
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: channel.iChannel0
|
|
||||||
function onTypeChanged()
|
|
||||||
{
|
|
||||||
if(channel.iChannel0.type === ShaderChannel.AudioChannel)
|
|
||||||
{
|
|
||||||
//channelSource0.wrapMode = ShaderEffectSource.ClampToEdge
|
|
||||||
channelSource0.live = true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//channelSource0.wrapMode = ShaderEffectSource.Repeat
|
|
||||||
channelSource0.live = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(!channelSource0.live)
|
|
||||||
// channelSource0.scheduleUpdate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffectSource
|
|
||||||
{
|
|
||||||
id: channelSource1
|
|
||||||
live: false
|
|
||||||
smooth: false
|
|
||||||
recursive: false
|
|
||||||
hideSource: true
|
|
||||||
width: channel.iResolution.x
|
|
||||||
height: channel.iResolution.y
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
format: channel.iChannel1 ? channel.iChannel1.format : ShaderEffectSource.RGB8A
|
|
||||||
sourceItem: channel.iChannel1 ? channel.iChannel1 : null
|
|
||||||
textureMirroring: channel.iChannel1 ? channel.iChannel1.textureMirroring : ShaderEffectSource.NoMirroring
|
|
||||||
wrapMode: channel.iChannel1 ? channel.iChannel1.wrapMode : ShaderEffectSource.Repeat
|
|
||||||
mipmap: channel.iChannel1 ? channel.iChannel1.mipmap : true
|
|
||||||
samples: channel.iChannel1 ? channel.iChannel1.samples : 1
|
|
||||||
|
|
||||||
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
|
||||||
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
|
||||||
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: channel.iChannel1
|
|
||||||
function onTypeChanged()
|
|
||||||
{
|
|
||||||
if(channel.iChannel1.type === ShaderChannel.AudioChannel)
|
|
||||||
{
|
|
||||||
//channelSource1.wrapMode = ShaderEffectSource.ClampToEdge
|
|
||||||
channelSource1.live = true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//channelSource1.wrapMode = ShaderEffectSource.Repeat
|
|
||||||
channelSource1.live = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(!channelSource1.live)
|
|
||||||
// channelSource1.scheduleUpdate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffectSource
|
|
||||||
{
|
|
||||||
id: channelSource2
|
|
||||||
live: false
|
|
||||||
smooth: false
|
|
||||||
recursive: true
|
|
||||||
hideSource: true
|
|
||||||
width: channel.iResolution.x
|
|
||||||
height: channel.iResolution.y
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
format: channel.iChannel2 ? channel.iChannel2.format : ShaderEffectSource.RGB8A
|
|
||||||
sourceItem: channel.iChannel2 ? channel.iChannel2 : null
|
|
||||||
textureMirroring: channel.iChannel2 ? channel.iChannel2.textureMirroring : ShaderEffectSource.NoMirroring
|
|
||||||
wrapMode: channel.iChannel2 ? channel.iChannel2.wrapMode : ShaderEffectSource.Repeat
|
|
||||||
mipmap: channel.iChannel2 ? channel.iChannel2.mipmap : true
|
|
||||||
samples: channel.iChannel2 ? channel.iChannel2.samples : 1
|
|
||||||
|
|
||||||
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
|
||||||
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
|
||||||
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: channel.iChannel2
|
|
||||||
function onTypeChanged()
|
|
||||||
{
|
|
||||||
if(channel.iChannel2.type === ShaderChannel.AudioChannel)
|
|
||||||
{
|
|
||||||
//channelSource2.wrapMode = ShaderEffectSource.ClampToEdge
|
|
||||||
channelSource2.live = true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//channelSource2.wrapMode = ShaderEffectSource.Repeat
|
|
||||||
channelSource2.live = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(!channelSource2.live)
|
|
||||||
// channelSource2.scheduleUpdate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ShaderEffectSource
|
|
||||||
{
|
|
||||||
id: channelSource3
|
|
||||||
live: false
|
|
||||||
smooth: false
|
|
||||||
recursive: true
|
|
||||||
hideSource: true
|
|
||||||
width: channel.iResolution.x
|
|
||||||
height: channel.iResolution.y
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
format: channel.iChannel3 ? channel.iChannel1.format : ShaderEffectSource.RGB8A
|
|
||||||
sourceItem: channel.iChannel3 ? channel.iChannel3 : null
|
|
||||||
textureMirroring: channel.iChannel3 ? channel.iChannel3.textureMirroring : ShaderEffectSource.NoMirroring
|
|
||||||
wrapMode: channel.iChannel3 ? channel.iChannel3.wrapMode : ShaderEffectSource.Repeat
|
|
||||||
mipmap: channel.iChannel3 ? channel.iChannel3.mipmap : true
|
|
||||||
samples: channel.iChannel3 ? channel.iChannel3.samples : 1
|
|
||||||
|
|
||||||
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
|
||||||
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
|
||||||
|
|
||||||
Connections
|
|
||||||
{
|
|
||||||
target: channel.iChannel3
|
|
||||||
function onTypeChanged()
|
|
||||||
{
|
|
||||||
if(channel.iChannel3.type === ShaderChannel.AudioChannel)
|
|
||||||
{
|
|
||||||
//channelSource3.wrapMode = ShaderEffectSource.ClampToEdge
|
|
||||||
channelSource3.live = true
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//channelSource3.wrapMode = ShaderEffectSource.Repeat
|
|
||||||
channelSource3.live = false
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!channelSource3.live)
|
|
||||||
channelSource3.scheduleUpdate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// recursive frame buffer
|
|
||||||
ShaderEffectSource
|
|
||||||
{
|
|
||||||
id: frameBufferSource
|
|
||||||
sourceItem: channel.frameBufferChannel === -1 ? null : channelShaderOutput
|
|
||||||
sourceRect: Qt.rect(0,0, channelShaderOutput.width, channelShaderOutput.height)
|
|
||||||
wrapMode: ShaderEffectSource.ClampToEdge
|
|
||||||
live: false
|
|
||||||
mipmap: true
|
|
||||||
recursive: true
|
|
||||||
textureSize: Qt.size(channelShaderOutput.width, channelShaderOutput.height)
|
|
||||||
visible: false
|
|
||||||
textureMirroring: ShaderEffectSource.NoMirroring
|
|
||||||
width: channel.iResolution.x
|
|
||||||
height: channel.iResolution.y
|
|
||||||
format: ShaderEffectSource.RGB8A
|
|
||||||
samples: 2
|
|
||||||
}
|
|
||||||
|
|
||||||
// The shader effect that will be used to render the shader
|
// The shader effect that will be used to render the shader
|
||||||
ShaderEffect
|
ShaderEffect
|
||||||
{
|
{
|
||||||
@@ -570,7 +314,180 @@ Item
|
|||||||
|
|
||||||
id: channelShaderOutput
|
id: channelShaderOutput
|
||||||
|
|
||||||
blending: true
|
blending: false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setup the shader effect sources for each channel
|
||||||
|
// These are needed to provide the uniform data to the shader channel buffers
|
||||||
|
ShaderEffectSource
|
||||||
|
{
|
||||||
|
id: channelSource0
|
||||||
|
live: true
|
||||||
|
smooth: true
|
||||||
|
recursive: true
|
||||||
|
hideSource: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
format: channel.iChannel0 ? channel.iChannel0.format : ShaderEffectSource.RGBA8
|
||||||
|
sourceItem: channel.iChannel0
|
||||||
|
textureMirroring: channel.iChannel0 ? channel.iChannel0.textureMirroring : ShaderEffectSource.NoMirroring
|
||||||
|
wrapMode: channel.iChannel0 ? channel.iChannel0.wrapMode : ShaderEffectSource.ClampToEdge
|
||||||
|
mipmap: channel.iChannel0 ? channel.iChannel0.mipmap : true
|
||||||
|
samples: channel.iChannel0 ? channel.iChannel0.samples : 1
|
||||||
|
|
||||||
|
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
||||||
|
textureSize: Qt.size(sourceItem.width, sourceItem.height)
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: channel.iChannel0
|
||||||
|
function onTypeChanged()
|
||||||
|
{
|
||||||
|
if(channel.iChannel0.type === ShaderChannel.AudioChannel)
|
||||||
|
{
|
||||||
|
channelSource0.wrapMode = ShaderEffectSource.ClampToEdge
|
||||||
|
channelSource0.live = true
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelSource0.wrapMode = ShaderEffectSource.Repeat
|
||||||
|
channelSource0.live = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderEffectSource
|
||||||
|
{
|
||||||
|
id: channelSource1
|
||||||
|
live: false
|
||||||
|
smooth: true
|
||||||
|
recursive: true
|
||||||
|
hideSource: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
format: channel.iChannel1 ? channel.iChannel1.format : ShaderEffectSource.RGBA8
|
||||||
|
sourceItem: channel.iChannel1 ? channel.iChannel1 : null
|
||||||
|
textureMirroring: channel.iChannel1 ? channel.iChannel1.textureMirroring : ShaderEffectSource.NoMirroring
|
||||||
|
wrapMode: channel.iChannel1 ? channel.iChannel1.wrapMode : ShaderEffectSource.Repeat
|
||||||
|
mipmap: channel.iChannel1 ? channel.iChannel1.mipmap : true
|
||||||
|
samples: channel.iChannel1 ? channel.iChannel1.samples : 4
|
||||||
|
|
||||||
|
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
||||||
|
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: channel.iChannel1
|
||||||
|
function onTypeChanged()
|
||||||
|
{
|
||||||
|
if(channel.iChannel1.type === ShaderChannel.AudioChannel)
|
||||||
|
{
|
||||||
|
channelSource1.wrapMode = ShaderEffectSource.ClampToEdge
|
||||||
|
channelSource1.live = true
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelSource1.wrapMode = ShaderEffectSource.Repeat
|
||||||
|
channelSource1.live = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderEffectSource
|
||||||
|
{
|
||||||
|
id: channelSource2
|
||||||
|
live: false
|
||||||
|
smooth: true
|
||||||
|
recursive: true
|
||||||
|
hideSource: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
format: channel.iChannel2 ? channel.iChannel2.format : ShaderEffectSource.RGBA8
|
||||||
|
sourceItem: channel.iChannel2 ? channel.iChannel2 : null
|
||||||
|
textureMirroring: channel.iChannel2 ? channel.iChannel2.textureMirroring : ShaderEffectSource.NoMirroring
|
||||||
|
wrapMode: channel.iChannel2 ? channel.iChannel2.wrapMode : ShaderEffectSource.Repeat
|
||||||
|
mipmap: channel.iChannel2 ? channel.iChannel2.mipmap : true
|
||||||
|
samples: channel.iChannel2 ? channel.iChannel2.samples : 1
|
||||||
|
|
||||||
|
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
||||||
|
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: channel.iChannel2
|
||||||
|
function onTypeChanged()
|
||||||
|
{
|
||||||
|
if(channel.iChannel2.type === ShaderChannel.AudioChannel)
|
||||||
|
{
|
||||||
|
channelSource2.wrapMode = ShaderEffectSource.ClampToEdge
|
||||||
|
channelSource2.live = true
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelSource2.wrapMode = ShaderEffectSource.Repeat
|
||||||
|
channelSource2.live = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ShaderEffectSource
|
||||||
|
{
|
||||||
|
id: channelSource3
|
||||||
|
live: false
|
||||||
|
smooth: false
|
||||||
|
recursive: true
|
||||||
|
hideSource: true
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
format: channel.iChannel3 ? channel.iChannel1.format : ShaderEffectSource.RGBA8
|
||||||
|
sourceItem: channel.iChannel3 ? channel.iChannel3 : null
|
||||||
|
textureMirroring: channel.iChannel3 ? channel.iChannel3.textureMirroring : ShaderEffectSource.NoMirroring
|
||||||
|
wrapMode: channel.iChannel3 ? channel.iChannel3.wrapMode : ShaderEffectSource.Repeat
|
||||||
|
mipmap: channel.iChannel3 ? channel.iChannel3.mipmap : true
|
||||||
|
samples: channel.iChannel3 ? channel.iChannel3.samples : 1
|
||||||
|
|
||||||
|
sourceRect: sourceItem ? Qt.rect(0,0, sourceItem.width, sourceItem.height) : Qt.rect(0,0,0,0)
|
||||||
|
textureSize: Qt.size(channel.iResolution.x, channel.iResolution.y)
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: channel.iChannel3
|
||||||
|
function onTypeChanged()
|
||||||
|
{
|
||||||
|
if(channel.iChannel3.type === ShaderChannel.AudioChannel)
|
||||||
|
{
|
||||||
|
channelSource3.wrapMode = ShaderEffectSource.ClampToEdge
|
||||||
|
channelSource3.live = true
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelSource3.wrapMode = ShaderEffectSource.Repeat
|
||||||
|
channelSource3.live = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// recursive frame buffer
|
||||||
|
ShaderEffectSource
|
||||||
|
{
|
||||||
|
id: frameBufferSource
|
||||||
|
sourceItem: channel.channelShaderOutput === -1 ? null : channelShaderOutput
|
||||||
|
sourceRect: Qt.rect(0,0, channelShaderOutput.width, channelShaderOutput.height)
|
||||||
|
wrapMode: ShaderEffectSource.Repeat
|
||||||
|
live: false
|
||||||
|
mipmap: true
|
||||||
|
recursive: true
|
||||||
|
textureSize: Qt.size(channelShaderOutput.width, channelShaderOutput.height)
|
||||||
|
visible: false
|
||||||
|
textureMirroring: ShaderEffectSource.NoMirroring
|
||||||
|
width: channelShaderOutput.width
|
||||||
|
height: channelShaderOutput.height
|
||||||
|
format: ShaderEffectSource.RGBA8
|
||||||
|
samples: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
@@ -578,9 +495,6 @@ Item
|
|||||||
target: channel
|
target: channel
|
||||||
function onIFrameChanged()
|
function onIFrameChanged()
|
||||||
{
|
{
|
||||||
// skip first frame. frame 0 is a blank screen
|
|
||||||
if(channel.frameBufferChannel > -1 )//&& channel.iFrame > 1)
|
|
||||||
frameBufferSource.scheduleUpdate()
|
|
||||||
|
|
||||||
if(channel.iChannel0 !== undefined && !channelSource0.live)
|
if(channel.iChannel0 !== undefined && !channelSource0.live)
|
||||||
channelSource0.scheduleUpdate()
|
channelSource0.scheduleUpdate()
|
||||||
@@ -593,6 +507,10 @@ Item
|
|||||||
|
|
||||||
if(channel.iChannel3 !== undefined && !channelSource3.live)
|
if(channel.iChannel3 !== undefined && !channelSource3.live)
|
||||||
channelSource3.scheduleUpdate()
|
channelSource3.scheduleUpdate()
|
||||||
|
|
||||||
|
// skip first frame. frame 0 is a blank screen
|
||||||
|
if(channel.frameBufferChannel > -1 )//&& channel.iFrame > 1)
|
||||||
|
frameBufferSource.scheduleUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -664,36 +582,18 @@ Item
|
|||||||
id: channelAudio
|
id: channelAudio
|
||||||
|
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "black"
|
|
||||||
Image
|
|
||||||
{
|
{
|
||||||
width: 512
|
width: 512
|
||||||
height: 2
|
height: 2
|
||||||
anchors.top: !channel.invert ? undefined : parent.top
|
color: "black"
|
||||||
anchors.bottom: !channel.invert ? parent.bottom : undefined
|
anchors.top: parent.top
|
||||||
|
Image
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
id: textureImage
|
id: textureImage
|
||||||
source: "image://audiotexture/frame"
|
source: "image://audiotexture/frame"
|
||||||
fillMode: Image.Pad
|
fillMode: Image.Pad
|
||||||
|
cache: false
|
||||||
// we need to flip the texture when the channel itself is flipped
|
|
||||||
// so the orientation of the audio data is preserved
|
|
||||||
transform: Rotation
|
|
||||||
{
|
|
||||||
origin.x: textureImage.width / 2
|
|
||||||
origin.y: textureImage.height / 2
|
|
||||||
|
|
||||||
// For vertical flipping, we need to transform the x axis
|
|
||||||
axis
|
|
||||||
{
|
|
||||||
x: 1
|
|
||||||
y: 0
|
|
||||||
z: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
angle: data.angle + 180
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer
|
Timer
|
||||||
@@ -701,23 +601,27 @@ Item
|
|||||||
property int frame: 0
|
property int frame: 0
|
||||||
interval: 16
|
interval: 16
|
||||||
repeat: true
|
repeat: true
|
||||||
triggeredOnStart: true
|
triggeredOnStart: false
|
||||||
running: true
|
running: false
|
||||||
|
id: audioFrameTimer
|
||||||
|
|
||||||
onTriggered:
|
onTriggered: () =>
|
||||||
{
|
{
|
||||||
frame++
|
//lets hope there's no auto caching and we can prevent overflow like this
|
||||||
|
frame = frame === 0 ? 1 : 0
|
||||||
textureImage.source = "image://audiotexture/frame" + frame
|
textureImage.source = "image://audiotexture/frame" + frame
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted: () =>
|
||||||
{
|
{
|
||||||
Komplex.AudioModel.startCapture()
|
Komplex.AudioModel.startCapture()
|
||||||
|
audioFrameTimer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction:
|
Component.onDestruction: () =>
|
||||||
{
|
{
|
||||||
|
audioFrameTimer.stop()
|
||||||
Komplex.AudioModel.stopCapture()
|
Komplex.AudioModel.stopCapture()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,15 +79,16 @@ Item
|
|||||||
ShaderChannel
|
ShaderChannel
|
||||||
{
|
{
|
||||||
//Fallback to a channel if the output channel is not set or there was an error loading the shader
|
//Fallback to a channel if the output channel is not set or there was an error loading the shader
|
||||||
visible: wallpaper.configuration.iChannel0_flag && (channelOutput.source === "" || channelOutput.source === undefined)
|
//visible: wallpaper.configuration.iChannel0_flag && (channelOutput.source === "" || channelOutput.source === undefined)
|
||||||
|
visible: true
|
||||||
iTime: mainItem.iTime
|
iTime: mainItem.iTime
|
||||||
iMouse: mainItem.iMouse
|
iMouse: mainItem.iMouse
|
||||||
iResolution: mainItem.iResolution
|
iResolution: mainItem.iResolution
|
||||||
iFrame: mainItem.iFrame
|
iFrame: mainItem.iFrame
|
||||||
|
|
||||||
id: channel0
|
id: channel0
|
||||||
width: mainItem.iResolution.x
|
// width: mainItem.iResolution.x
|
||||||
height: mainItem.iResolution.y
|
// height: mainItem.iResolution.y
|
||||||
type: wallpaper.configuration.iChannel0_flag ? wallpaper.configuration.iChannel0_type : 0
|
type: wallpaper.configuration.iChannel0_flag ? wallpaper.configuration.iChannel0_type : 0
|
||||||
|
|
||||||
source: wallpaper.configuration.iChannel0_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel0) : ""
|
source: wallpaper.configuration.iChannel0_flag ? Qt.resolvedUrl(wallpaper.configuration.iChannel0) : ""
|
||||||
@@ -175,22 +176,22 @@ Item
|
|||||||
iChannel3: channel3
|
iChannel3: channel3
|
||||||
|
|
||||||
visible: true // Set to true to display the output
|
visible: true // Set to true to display the output
|
||||||
blending: true
|
blending: false
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderEffectSource
|
// ShaderEffectSource
|
||||||
{
|
// {
|
||||||
anchors.fill: parent
|
// anchors.fill: parent
|
||||||
sourceItem: channelOutput
|
// sourceItem: channelOutput
|
||||||
sourceRect: Qt.rect(0,0, mainItem.iResolution.x, mainItem.iResolution.y)
|
// sourceRect: Qt.rect(0,0, mainItem.iResolution.x, mainItem.iResolution.y)
|
||||||
textureSize: Qt.size(mainItem.iResolution.x, mainItem.iResolution.y)
|
// textureSize: Qt.size(mainItem.iResolution.x, mainItem.iResolution.y)
|
||||||
hideSource: true
|
// hideSource: true
|
||||||
visible: true
|
// visible: true
|
||||||
smooth: true
|
// smooth: true
|
||||||
live: true
|
// live: true
|
||||||
|
|
||||||
id: finalSource
|
// id: finalSource
|
||||||
}
|
// }
|
||||||
|
|
||||||
// To save on performance, just use one timer for all channels
|
// To save on performance, just use one timer for all channels
|
||||||
Timer
|
Timer
|
||||||
|
|||||||
Reference in New Issue
Block a user