Skip to content

Commit

Permalink
Merge branch 'master' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
SLOBS-Release committed Jun 8, 2022
2 parents 631f3aa + 103bf92 commit 37d61e8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion app/services/platform-apps/api/modules/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Inject } from 'services/core/injector';
import { Subject } from 'rxjs';
import { PlatformAppsService } from 'services/platform-apps';
import { ScenesService } from 'services/scenes';
import { AudioService } from 'services/audio';
import { AudioService, IAudioSource } from 'services/audio';

interface ISourceFlags {
audio: boolean;
Expand All @@ -17,6 +17,8 @@ interface ISourceSize {
height: number;
}

type TMonitoringType = 'none' | 'monitor-only' | 'monitor-and-output';

interface ISource {
id: string;
name: string;
Expand All @@ -28,6 +30,7 @@ interface ISource {
appSourceId?: string;
muted?: boolean;
volume?: number;
monitoringType?: TMonitoringType;
}

export class SourcesModule extends Module {
Expand Down Expand Up @@ -162,6 +165,15 @@ export class SourcesModule extends Module {
if (patch.volume != null) {
this.audioService.views.getSource(patch.id).setDeflection(patch.volume);
}

if (patch.monitoringType) {
const monitorTypes: TMonitoringType[] = ['none', 'monitor-only', 'monitor-and-output'];
const type = monitorTypes.findIndex(t => t === patch.monitoringType);

if (type != null) {
this.audioService.setSettings(patch.id, { monitoringType: type });
}
}
}

@apiMethod()
Expand Down Expand Up @@ -215,6 +227,9 @@ export class SourcesModule extends Module {
const audioSource = this.audioService.views.getSource(source.sourceId);
serialized.volume = audioSource.fader.deflection;
serialized.muted = audioSource.muted;

const monitorTypes: TMonitoringType[] = ['none', 'monitor-only', 'monitor-and-output'];
serialized.monitoringType = monitorTypes[audioSource.monitoringType];
}

return serialized;
Expand Down

0 comments on commit 37d61e8

Please sign in to comment.