@@ -24,6 +24,8 @@ import EditorActionDispatcher from '../editor/editor-action-dispatcher';
2424import EditorScoreState from '../editor/editor-score-state' ;
2525import exportGuitarPro from './editor-export/export-guitar-pro' ;
2626import exportMidi from './editor-export/export-midi' ;
27+ import { DialogAudioMixer } from '@dialogs/dialog-audio-mixer/dialog-audio-mixer' ;
28+ import useDialog from '@hooks/use-dialog' ;
2729
2830function useForceUpdate ( ) {
2931 const [ _ , setValue ] = useState ( 0 ) ; // integer state
@@ -56,7 +58,7 @@ const AppContent = styled('div')({
5658
5759const AppEditorControls = styled ( 'div' ) ( {
5860 position : 'absolute' ,
59- left : '120px ' ,
61+ left : '140px ' ,
6062 right : 0 ,
6163 zIndex : 999 ,
6264} )
@@ -202,6 +204,12 @@ export default function Editor({ hasDialog }: { hasDialog: boolean }) {
202204
203205 const score = ( ) : Score | null => api ?. score ?? null ;
204206
207+ const setTrackVolume = ( track : Track , volume : number ) => {
208+ if ( api ) {
209+ api . changeTrackVolume ( [ track ] , volume ) ;
210+ }
211+ }
212+
205213 const setVolume = ( volume : number ) => {
206214 if ( api ) {
207215 api . masterVolume = volume ;
@@ -243,8 +251,22 @@ export default function Editor({ hasDialog }: { hasDialog: boolean }) {
243251 editorActions . clearUndoAndRedoHistory ( ) ;
244252 } ;
245253
254+ const {
255+ openDialog : openAudioMixerDialog ,
256+ closeDialog : closeAudioMixerDialog ,
257+ isDialogOpen : isAudioMixerDialogOpen
258+ } = useDialog ( ) ;
259+
246260 return (
247261 < AppContainer >
262+ { api ?. score && (
263+ < DialogAudioMixer
264+ isOpen = { isAudioMixerDialogOpen }
265+ onClose = { closeAudioMixerDialog }
266+ score = { api . score }
267+ onVolumeChange = { setTrackVolume }
268+ />
269+ ) }
248270 < AppContent >
249271 < EditorLeftMenu
250272 tracks = { api ?. score ?. tracks ?? null }
@@ -290,6 +312,7 @@ export default function Editor({ hasDialog }: { hasDialog: boolean }) {
290312 onCountInChange = { setCountIn }
291313 onMetronomeChange = { setMetronome }
292314 onLoopingChange = { setIsLooping }
315+ onOpenVolumeMixer = { openAudioMixerDialog }
293316 isCountIn = { api ?. countInVolume !== 0 }
294317 isMetronome = { api ?. metronomeVolume !== 0 }
295318 isPlaying = { api ?. playerState === 1 }
0 commit comments