2024-12-15 19:23:31 +00:00
# include "RecordingSettings.h"
2024-12-14 18:15:22 +00:00
# include "VisualiserComponent.h"
# include "../PluginEditor.h"
2024-12-15 19:23:31 +00:00
RecordingSettings : : RecordingSettings ( RecordingParameters & ps ) : parameters ( ps ) {
2025-01-04 14:35:10 +00:00
# if SOSCI_FEATURES
2024-12-15 19:23:31 +00:00
addAndMakeVisible ( quality ) ;
2025-01-26 21:02:01 +00:00
addAndMakeVisible ( resolution ) ;
addAndMakeVisible ( frameRate ) ;
2025-01-08 11:28:28 +00:00
addAndMakeVisible ( losslessVideo ) ;
2024-12-15 19:23:31 +00:00
addAndMakeVisible ( recordAudio ) ;
addAndMakeVisible ( recordVideo ) ;
addAndMakeVisible ( compressionPreset ) ;
addAndMakeVisible ( compressionPresetLabel ) ;
2025-04-04 11:10:44 +00:00
addAndMakeVisible ( videoCodecSelector ) ;
addAndMakeVisible ( videoCodecLabel ) ;
2025-01-12 20:39:20 +00:00
addAndMakeVisible ( customSharedTextureOutputLabel ) ;
addAndMakeVisible ( customSharedTextureOutputEditor ) ;
2025-01-04 14:35:10 +00:00
2024-12-15 19:23:31 +00:00
quality . setSliderOnValueChange ( ) ;
quality . setRangeEnabled ( false ) ;
2025-01-26 21:02:01 +00:00
resolution . setSliderOnValueChange ( ) ;
resolution . setRangeEnabled ( false ) ;
frameRate . setSliderOnValueChange ( ) ;
frameRate . setRangeEnabled ( false ) ;
2024-12-15 19:23:31 +00:00
recordAudio . onClick = [ this ] {
if ( ! recordAudio . getToggleState ( ) & & ! recordVideo . getToggleState ( ) ) {
recordVideo . setToggleState ( true , juce : : NotificationType : : sendNotification ) ;
}
} ;
recordVideo . onClick = [ this ] {
if ( ! recordAudio . getToggleState ( ) & & ! recordVideo . getToggleState ( ) ) {
recordAudio . setToggleState ( true , juce : : NotificationType : : sendNotification ) ;
}
} ;
2025-01-08 11:28:28 +00:00
quality . setEnabled ( ! losslessVideo . getToggleState ( ) ) ;
losslessVideo . onClick = [ this ] {
quality . setEnabled ( ! losslessVideo . getToggleState ( ) ) ;
} ;
2024-12-15 19:23:31 +00:00
compressionPreset . onChange = [ this ] {
parameters . compressionPreset = parameters . compressionPresets [ compressionPreset . getSelectedId ( ) - 1 ] ;
2024-12-14 18:15:22 +00:00
} ;
2024-12-15 19:23:31 +00:00
compressionPreset . addItemList ( parameters . compressionPresets , 1 ) ;
compressionPreset . setSelectedId ( parameters . compressionPresets . indexOf ( parameters . compressionPreset ) + 1 ) ;
compressionPresetLabel . setTooltip ( " The compression preset to use when recording video. Slower presets will produce smaller files at the expense of encoding time. " ) ;
2025-01-12 20:39:20 +00:00
2025-04-04 11:10:44 +00:00
// Setup the codec selector
videoCodecSelector . addItem ( " H.264 " , static_cast < int > ( VideoCodec : : H264 ) + 1 ) ;
videoCodecSelector . addItem ( " H.265/HEVC " , static_cast < int > ( VideoCodec : : H265 ) + 1 ) ;
videoCodecSelector . addItem ( " VP9 " , static_cast < int > ( VideoCodec : : VP9 ) + 1 ) ;
# if JUCE_MAC
videoCodecSelector . addItem ( " ProRes " , static_cast < int > ( VideoCodec : : ProRes ) + 1 ) ;
# endif
videoCodecSelector . setSelectedId ( static_cast < int > ( parameters . videoCodec ) + 1 ) ;
videoCodecSelector . onChange = [ this ] {
parameters . videoCodec = static_cast < VideoCodec > ( videoCodecSelector . getSelectedId ( ) - 1 ) ;
} ;
videoCodecLabel . setTooltip ( " The video codec to use when recording. Different codecs offer different trade-offs between quality, file size, and compatibility. " ) ;
2025-01-12 20:39:20 +00:00
customSharedTextureOutputLabel . setTooltip ( " Custom name for when creating a new Syphon/Spout server. WARNING: You should not use the same name when running multiple servers at once!. " ) ;
customSharedTextureOutputEditor . setText ( parameters . customSharedTextureServerName ) ;
customSharedTextureOutputEditor . onTextChange = [ this ] {
parameters . customSharedTextureServerName = customSharedTextureOutputEditor . getText ( ) ;
} ;
2025-01-04 14:35:10 +00:00
# else
addAndMakeVisible ( recordVideoWarning ) ;
addAndMakeVisible ( sosciLink ) ;
recordVideoWarning . setText ( " Recording video is only available in osci-render premium or sosci. " ) ;
recordVideoWarning . setJustification ( juce : : Justification : : centred ) ;
recordVideoWarning . setColour ( juce : : TextEditor : : textColourId , Colours : : accentColor ) ;
recordVideoWarning . setMultiLine ( true ) ;
recordVideoWarning . setReadOnly ( true ) ;
recordVideoWarning . setInterceptsMouseClicks ( false , false ) ;
sosciLink . setColour ( juce : : HyperlinkButton : : textColourId , Colours : : accentColor ) ;
# endif
2024-12-14 18:15:22 +00:00
}
2024-12-15 19:23:31 +00:00
RecordingSettings : : ~ RecordingSettings ( ) { }
2024-12-14 18:15:22 +00:00
2024-12-15 19:23:31 +00:00
void RecordingSettings : : resized ( ) {
2024-12-14 18:15:22 +00:00
auto area = getLocalBounds ( ) . reduced ( 20 ) ;
2024-12-15 19:23:31 +00:00
double rowHeight = 30 ;
2025-01-04 14:35:10 +00:00
# if SOSCI_FEATURES
2025-01-08 11:28:28 +00:00
losslessVideo . setBounds ( area . removeFromTop ( rowHeight ) ) ;
2024-12-15 19:23:31 +00:00
quality . setBounds ( area . removeFromTop ( rowHeight ) . expanded ( 6 , 0 ) ) ;
2025-01-26 21:02:01 +00:00
resolution . setBounds ( area . removeFromTop ( rowHeight ) . expanded ( 6 , 0 ) ) ;
frameRate . setBounds ( area . removeFromTop ( rowHeight ) . expanded ( 6 , 0 ) ) ;
2024-12-15 19:23:31 +00:00
recordAudio . setBounds ( area . removeFromTop ( rowHeight ) ) ;
recordVideo . setBounds ( area . removeFromTop ( rowHeight ) ) ;
2025-04-04 11:10:44 +00:00
2024-12-15 19:23:31 +00:00
auto row = area . removeFromTop ( rowHeight ) ;
2025-01-12 20:39:20 +00:00
compressionPresetLabel . setBounds ( row . removeFromLeft ( 170 ) ) ;
compressionPreset . setBounds ( row . removeFromRight ( 100 ) ) ;
2025-04-04 11:10:44 +00:00
area . removeFromTop ( 5 ) ;
row = area . removeFromTop ( rowHeight ) ;
videoCodecLabel . setBounds ( row . removeFromLeft ( 170 ) ) ;
videoCodecSelector . setBounds ( row . removeFromRight ( 100 ) ) ;
2025-01-12 20:39:20 +00:00
area . removeFromTop ( 5 ) ;
row = area . removeFromTop ( rowHeight ) ;
customSharedTextureOutputLabel . setBounds ( row . removeFromLeft ( 170 ) ) ;
customSharedTextureOutputEditor . setBounds ( row . removeFromRight ( 100 ) ) ;
2025-01-04 14:35:10 +00:00
# else
recordVideoWarning . setBounds ( area . removeFromTop ( 2 * rowHeight ) ) ;
area . removeFromTop ( rowHeight / 2 ) ;
sosciLink . setBounds ( area . removeFromTop ( rowHeight ) ) ;
# endif
2024-12-14 18:15:22 +00:00
}