1 /* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */
6 #define MA_NO_GENERATION
13 #define MA_NO_NODE_GRAPH
14 #define MA_NO_RESOURCE_MANAGER
16 #include "dr_soft/miniaudio.h"
20 #include "vg/vg_stdint.h"
21 #include "vg/vg_platform.h"
25 #include "vg/vg_console.h"
26 #include "vg/vg_store.h"
31 #pragma GCC push_options
32 #pragma GCC optimize ("O3")
35 #pragma GCC diagnostic push
36 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
38 #define STB_VORBIS_MAX_CHANNELS 2
39 #include "stb/stb_vorbis.h"
41 #pragma GCC diagnostic pop
44 #pragma GCC pop_options
47 #define SFX_MAX_SYSTEMS 32
48 #define AUDIO_FLAG_LOOP 0x1
49 #define AUDIO_FLAG_ONESHOT 0x2
50 #define AUDIO_FLAG_SPACIAL_3D 0x4
51 #define AUDIO_FLAG_AUTO_START 0x8
53 #define FADEOUT_LENGTH 1100
54 #define FADEOUT_DIVISOR (1.0f/(float)FADEOUT_LENGTH)
56 #define AUDIO_DECODE_SIZE (1024*256) /* 256 kb decoding buffers */
58 typedef struct audio_clip audio_clip
;
66 typedef struct audio_mix_info audio_mix_info
;
76 typedef struct audio_player audio_player
;
79 aatree_ptr active_entity
; /* non-nil if currently playing */
87 typedef struct audio_entity audio_entity
;
96 u32 fadeout
, fadeout_current
;
103 * play again: if already playing, leave in queue while it fadeouts
104 * oneshot: create a ghost entity
108 static struct vg_audio_system
110 ma_device miniaudio_device
;
111 ma_device_config miniaudio_dconfig
;
120 vg_mutex mux_checker
,
123 /* Audio engine, thread 1 */
124 struct active_audio_player
130 aatree_pool_node pool_node
;
133 stb_vorbis
*vorbis_handle
;
134 stb_vorbis_alloc vorbis_alloc
;
136 active_players
[ SFX_MAX_SYSTEMS
];
138 aatree active_pool_info
; /* note: just using the pool */
139 aatree_ptr active_pool_head
;
141 /* System queue, and access from thread 0 */
142 audio_entity entity_queue
[SFX_MAX_SYSTEMS
];
144 int debug_ui
, debug_ui_3d
;
151 static struct vg_profile
152 _vg_prof_audio_decode
= {.mode
= k_profile_mode_accum
,
153 .name
= "[T2] audio_decode()"},
154 _vg_prof_audio_mix
= {.mode
= k_profile_mode_accum
,
155 .name
= "[T2] audio_mix()"},
156 vg_prof_audio_decode
,
160 * These functions are called from the main thread and used to prevent bad
161 * access. TODO: They should be no-ops in release builds.
163 VG_STATIC
int audio_lock_checker_load(void)
166 vg_mutex_lock( &vg_audio
.mux_checker
);
167 value
= vg_audio
.sync_locked
;
168 vg_mutex_unlock( &vg_audio
.mux_checker
);
172 VG_STATIC
void audio_lock_checker_store( int value
)
174 vg_mutex_lock( &vg_audio
.mux_checker
);
175 vg_audio
.sync_locked
= value
;
176 vg_mutex_unlock( &vg_audio
.mux_checker
);
179 VG_STATIC
void audio_require_lock(void)
181 if( audio_lock_checker_load() )
184 vg_error( "Modifying sound effects systems requires locking\n" );
188 VG_STATIC
void audio_lock(void)
190 vg_mutex_lock( &vg_audio
.mux_sync
);
191 audio_lock_checker_store(1);
194 VG_STATIC
void audio_unlock(void)
196 audio_lock_checker_store(0);
197 vg_mutex_unlock( &vg_audio
.mux_sync
);
201 VG_STATIC
void audio_mixer_callback( ma_device
*pDevice
, void *pOutBuf
,
202 const void *pInput
, ma_uint32 frameCount
);
204 VG_STATIC
void vg_audio_init(void)
206 vg_mutex_init( &vg_audio
.mux_checker
);
207 vg_mutex_init( &vg_audio
.mux_sync
);
209 /* TODO: Move here? */
210 vg_convar_push( (struct vg_convar
){
211 .name
= "debug_audio",
212 .data
= &vg_audio
.debug_ui
,
213 .data_type
= k_convar_dtype_i32
,
214 .opt_i32
= { .min
=0, .max
=1, .clamp
=1 },
218 /* allocate memory */
221 vg_audio
.audio_pool
=
222 vg_create_linear_allocator( vg_mem
.rtmemory
, 1024*1024*32 );
225 u32 decode_size
= AUDIO_DECODE_SIZE
* SFX_MAX_SYSTEMS
;
226 vg_audio
.decode_buffer
= vg_linear_alloc( vg_mem
.rtmemory
, decode_size
);
229 vg_audio
.active_pool_info
.base
= vg_audio
.active_players
;
230 vg_audio
.active_pool_info
.offset
= offsetof(struct active_audio_player
,
232 vg_audio
.active_pool_info
.stride
= sizeof(struct active_audio_player
);
233 vg_audio
.active_pool_info
.p_cmp
= NULL
;
234 aatree_init_pool( &vg_audio
.active_pool_info
, SFX_MAX_SYSTEMS
);
236 ma_device_config
*dconf
= &vg_audio
.miniaudio_dconfig
;
237 ma_device
*device
= &vg_audio
.miniaudio_device
;
239 *dconf
= ma_device_config_init( ma_device_type_playback
);
240 dconf
->playback
.format
= ma_format_f32
;
241 dconf
->playback
.channels
= 2;
242 dconf
->sampleRate
= 44100;
243 dconf
->dataCallback
= audio_mixer_callback
;
244 dconf
->periodSizeInFrames
= 441;
246 dconf
->pUserData
= NULL
;
248 vg_info( "Starting audio engine\n" );
250 if( ma_device_init( NULL
, dconf
, device
) != MA_SUCCESS
)
252 vg_fatal_exit_loop( "(audio) ma_device failed to initialize" );
256 if( ma_device_start( device
) != MA_SUCCESS
)
258 ma_device_uninit( device
);
259 vg_fatal_exit_loop( "(audio) ma_device failed to start" );
263 vg_success( "Ready\n" );
266 VG_STATIC
void vg_audio_free(void * nothing
)
268 ma_device
*device
= &vg_audio
.miniaudio_device
;
269 ma_device_uninit( device
);
272 vg_free( vg_audio
.mem
);
281 static aatree_ptr
audio_alloc_entity_internal(void)
283 aatree_ptr playerid
= aatree_pool_alloc( &vg_audio
.active_pool_info
,
284 &vg_audio
.active_pool_head
);
286 if( playerid
== AATREE_PTR_NIL
)
287 return AATREE_PTR_NIL
;
289 struct active_audio_player
*aap
= &vg_audio
.active_players
[ playerid
];
295 VG_STATIC
void audio_entity_free_internal( aatree_ptr id
)
297 struct active_audio_player
*aap
= &vg_audio
.active_players
[ id
];
300 /* Notify player that we've finished */
301 if( aap
->ent
.player
)
302 aap
->ent
.player
->active_entity
= AATREE_PTR_NIL
;
305 aatree_pool_free( &vg_audio
.active_pool_info
, id
,
306 &vg_audio
.active_pool_head
);
309 VG_STATIC
void *audio_entity_vorbis_ptr( aatree_ptr entid
)
311 u8
*buf
= (u8
*)vg_audio
.decode_buffer
,
312 *loc
= &buf
[AUDIO_DECODE_SIZE
*entid
];
317 VG_STATIC
void audio_entity_start( audio_entity
*src
)
319 aatree_ptr entid
= audio_alloc_entity_internal();
320 if( entid
== AATREE_PTR_NIL
)
323 audio_entity
*ent
= &vg_audio
.active_players
[ entid
].ent
;
325 ent
->info
= src
->info
;
326 ent
->name
= src
->info
.source
->path
;
328 ent
->player
= src
->player
;
331 ent
->fadeout_current
= 0;
333 /* Notify main player we are dequeud and playing */
336 src
->player
->enqued
= 0;
337 src
->player
->active_entity
= entid
;
340 /* Setup vorbis decoder */
341 struct active_audio_player
*aap
= &vg_audio
.active_players
[ entid
];
343 stb_vorbis_alloc alloc
= {
344 .alloc_buffer
= (char *)audio_entity_vorbis_ptr( entid
),
345 .alloc_buffer_length_in_bytes
= AUDIO_DECODE_SIZE
349 stb_vorbis
*decoder
= stb_vorbis_open_memory(
350 src
->info
.source
->data
,
351 src
->info
.source
->size
, &err
, &alloc
);
355 vg_error( "stb_vorbis_open_memory failed on '%s' (%d)\n",
356 src
->info
.source
->path
, err
);
358 audio_entity_free_internal( entid
);
363 ent
->length
= stb_vorbis_stream_length_in_samples( decoder
);
366 aap
->vorbis_handle
= decoder
;
370 * Read everything from the queue
372 VG_STATIC
void audio_system_enque(void)
374 /* Process incoming sound queue */
378 for( int i
=0; i
<vg_audio
.queue_len
; i
++ )
380 audio_entity
*src
= &vg_audio
.entity_queue
[ i
];
385 if( src
->player
->active_entity
== AATREE_PTR_NIL
)
387 audio_entity_start( src
);
391 /* Otherwise try start fadeout but dont remove from queue */
393 aatree_ptr entid
= src
->player
->active_entity
;
394 audio_entity
*ent
= &vg_audio
.active_players
[ entid
].ent
;
397 ent
->fadeout
= FADEOUT_LENGTH
;
398 ent
->fadeout_current
= FADEOUT_LENGTH
;
401 vg_audio
.entity_queue
[ wr
++ ] = *src
;
406 audio_entity_start( src
);
410 vg_audio
.queue_len
= wr
;
412 /* Localize others memory */
413 for( int i
=0; i
<SFX_MAX_SYSTEMS
; i
++ )
415 struct active_audio_player
*aap
= &vg_audio
.active_players
[i
];
419 if( aap
->ent
.player
)
421 /* Only copy information in whilst not requeing */
422 if( aap
->ent
.player
->enqued
== 0 )
424 aap
->ent
.info
= aap
->ent
.player
->info
;
433 * Redistribute sound systems
435 VG_STATIC
void audio_system_cleanup(void)
439 for( int i
=0; i
<SFX_MAX_SYSTEMS
; i
++ )
441 struct active_audio_player
*aap
= &vg_audio
.active_players
[i
];
444 audio_entity
*src
= &aap
->ent
;
445 if( src
->cur
< src
->length
|| (src
->info
.flags
& AUDIO_FLAG_LOOP
))
451 audio_entity_free_internal( i
);
460 * Get effective volume and pan from this entity
462 VG_STATIC
void audio_entity_spacialize( audio_entity
*ent
, float *vol
, float *pan
)
464 if( ent
->info
.vol
< 0.01f
)
466 *vol
= ent
->info
.vol
;
472 v3_sub( ent
->info
.world_position
, vg_audio
.listener_pos
, delta
);
474 float dist2
= v3_length2( delta
);
476 if( dist2
< 0.0001f
)
483 float dist
= sqrtf( dist2
),
484 attn
= (dist
/ ent
->info
.vol
) +1.0f
;
486 v3_muls( delta
, 1.0f
/dist
, delta
);
487 *pan
= v3_dot( vg_audio
.listener_ears
, delta
);
488 *vol
= 1.0f
/(attn
*attn
);
492 VG_STATIC
void audio_decode_uncompressed_mono( float *src
, u32 count
, float *dst
)
494 for( u32 i
=0; i
<count
; i
++ )
496 dst
[ i
*2 + 0 ] = src
[i
];
497 dst
[ i
*2 + 1 ] = src
[i
];
502 * adapted from stb_vorbis.h, since the original does not handle mono->stereo
505 stb_vorbis_get_samples_float_interleaved_stereo( stb_vorbis
*f
, float *buffer
,
509 c
= VG_MIN( 1, f
->channels
- 1 );
513 int k
= f
->channel_buffer_end
- f
->channel_buffer_start
;
518 for( int j
=0; j
< k
; ++j
)
520 *buffer
++ = f
->channel_buffers
[ 0 ][f
->channel_buffer_start
+j
];
521 *buffer
++ = f
->channel_buffers
[ c
][f
->channel_buffer_start
+j
];
525 f
->channel_buffer_start
+= k
;
530 if( !stb_vorbis_get_frame_float( f
, NULL
, NULL
))
537 VG_STATIC
void audio_entity_get_samples( aatree_ptr id
, u32 count
, float *buf
)
539 vg_profile_begin( &_vg_prof_audio_decode
);
541 struct active_audio_player
*aap
= &vg_audio
.active_players
[id
];
542 audio_entity
*ent
= &aap
->ent
;
544 u32 remaining
= count
;
545 u32 cursor
= ent
->cur
;
550 u32 samples_this_run
= VG_MIN( remaining
, ent
->length
- cursor
);
551 remaining
-= samples_this_run
;
553 float *dst
= &buf
[ buffer_pos
* 2 ];
555 int read_samples
= stb_vorbis_get_samples_float_interleaved_stereo(
560 if( read_samples
!= samples_this_run
)
562 vg_warn( "Invalid samples read (%s)\n", ent
->info
.source
->path
);
565 cursor
+= samples_this_run
;
566 buffer_pos
+= samples_this_run
;
568 if( (ent
->info
.flags
& AUDIO_FLAG_LOOP
) && remaining
)
570 stb_vorbis_seek_start( aap
->vorbis_handle
);
580 buf
[ buffer_pos
*2 + 0 ] = 0.0f
;
581 buf
[ buffer_pos
*2 + 1 ] = 0.0f
;
588 vg_profile_end( &_vg_prof_audio_decode
);
591 VG_STATIC
void audio_entity_mix( aatree_ptr id
, float *buffer
,
594 audio_entity
*ent
= &vg_audio
.active_players
[id
].ent
;
596 u32 cursor
= ent
->cur
, buffer_pos
= 0;
597 float *pcf
= alloca( frame_count
* 2 * sizeof(float) );
599 u32 frames_write
= frame_count
;
600 float fadeout_divisor
= 1.0f
/ (float)ent
->fadeout
;
602 float vol
= ent
->info
.vol
,
605 audio_entity_get_samples( id
, frame_count
, pcf
);
607 vg_profile_begin( &_vg_prof_audio_mix
);
609 if( ent
->info
.flags
& AUDIO_FLAG_SPACIAL_3D
)
610 audio_entity_spacialize( ent
, &vol
, &pan
);
612 for( u32 j
=0; j
<frame_count
; j
++ )
614 float frame_vol
= vol
;
618 /* Force this system to be removed now */
619 if( ent
->fadeout_current
== 0 )
621 ent
->info
.flags
= 0x00;
622 ent
->cur
= ent
->length
;
626 frame_vol
*= (float)ent
->fadeout_current
* fadeout_divisor
;
627 ent
->fadeout_current
--;
633 buffer
[ buffer_pos
*2+0 ] += pcf
[ buffer_pos
*2+0 ] * frame_vol
* sl
;
634 buffer
[ buffer_pos
*2+1 ] += pcf
[ buffer_pos
*2+1 ] * frame_vol
* sr
;
639 vg_profile_end( &_vg_prof_audio_mix
);
643 * callback from miniaudio.h interface
645 VG_STATIC
void audio_mixer_callback( ma_device
*pDevice
, void *pOutBuf
,
646 const void *pInput
, ma_uint32 frame_count
)
648 struct timespec time_start
, time_end
;
649 clock_gettime( CLOCK_REALTIME
, &time_start
);
651 audio_system_enque();
654 float *pOut32F
= (float *)pOutBuf
;
655 for( int i
=0; i
<frame_count
*2; i
++ )
659 for( int i
=0; i
<SFX_MAX_SYSTEMS
; i
++ )
661 struct active_audio_player
*aap
= &vg_audio
.active_players
[i
];
665 audio_entity_mix( i
, pOut32F
, frame_count
);
670 audio_system_cleanup();
672 /* TODO: what the hell is this? */
677 vg_profile_increment( &_vg_prof_audio_decode
);
678 vg_profile_increment( &_vg_prof_audio_mix
);
680 vg_prof_audio_mix
= _vg_prof_audio_mix
;
681 vg_prof_audio_decode
= _vg_prof_audio_decode
;
683 vg_audio
.samples_last
= frame_count
;
687 VG_STATIC
void audio_clip_load( audio_clip
*clip
)
689 clip
->data
= vg_file_read( vg_audio
.audio_pool
, clip
->path
);
690 clip
->size
= vg_file_size( vg_audio
.audio_pool
);
693 vg_fatal_exit_loop( "Audio failed to load" );
695 float mb
= (float)(clip
->size
) / (1024.0f
*1024.0f
);
696 vg_info( "Loaded audio clip '%s' (%.1fmb)\n", clip
->path
, mb
);
699 VG_STATIC
void audio_clip_loadn( audio_clip
*arr
, int count
)
701 for( int i
=0; i
<count
; i
++ )
702 audio_clip_load( &arr
[i
] );
705 /* Mark change to be uploaded through queue system */
706 VG_STATIC
void audio_player_commit( audio_player
*sys
)
708 audio_require_lock();
710 if( vg_audio
.queue_len
>= vg_list_size( vg_audio
.entity_queue
) )
712 vg_warn( "Audio commit queue full\n" );
718 vg_warn( "Audio commit spamming; already enqued (%s)\n", sys
->name
);
723 audio_entity
*ent
= &vg_audio
.entity_queue
[ vg_audio
.queue_len
++ ];
724 ent
->info
= sys
->info
;
728 VG_STATIC
void audio_require_init( audio_player
*player
)
733 vg_fatal_exit_loop( "Must init audio player before playing! \n" );
736 VG_STATIC
void audio_require_clip_loaded( audio_clip
*clip
)
738 if( clip
->data
&& clip
->size
)
741 vg_fatal_exit_loop( "Must load audio clip before playing! \n" );
744 /* Play a clip using player. If its already playing something, it will
745 * fadeout quickly and start the next sound */
746 VG_STATIC
void audio_player_playclip( audio_player
*player
, audio_clip
*clip
)
748 audio_require_lock();
749 audio_require_init( player
);
750 audio_require_clip_loaded( clip
);
752 player
->info
.source
= clip
;
753 audio_player_commit( player
);
757 VG_STATIC
void audio_player_playoneshot( audio_player
*player
, audio_clip
*clip
)
759 audio_require_lock();
760 audio_require_init( player
);
764 VG_STATIC
void audio_play_oneshot( audio_clip
*clip
, float volume
)
766 audio_require_lock();
767 audio_require_clip_loaded( clip
);
769 if( vg_audio
.queue_len
>= vg_list_size( vg_audio
.entity_queue
) )
771 vg_warn( "Audio commit queue full\n" );
775 audio_entity
*ent
= &vg_audio
.entity_queue
[ vg_audio
.queue_len
++ ];
777 ent
->info
.flags
= AUDIO_FLAG_ONESHOT
;
778 ent
->info
.pan
= 0.0f
;
779 ent
->info
.source
= clip
;
780 ent
->info
.vol
= volume
;
784 VG_STATIC
void audio_player_init( audio_player
*player
)
786 player
->active_entity
= AATREE_PTR_NIL
;
795 * Safety enforced Get/set attributes
798 VG_STATIC
int audio_player_is_playing( audio_player
*sys
)
800 audio_require_lock();
802 if( sys
->active_entity
!= AATREE_PTR_NIL
)
808 VG_STATIC
void audio_player_set_position( audio_player
*sys
, v3f pos
)
810 audio_require_lock();
811 v3_copy( pos
, sys
->info
.world_position
);
814 VG_STATIC
void audio_player_set_vol( audio_player
*sys
, float vol
)
816 audio_require_lock();
820 VG_STATIC
float audio_player_get_vol( audio_player
*sys
)
822 audio_require_lock();
823 return sys
->info
.vol
;
826 VG_STATIC
void audio_player_set_pan( audio_player
*sys
, float pan
)
828 audio_require_lock();
832 VG_STATIC
float audio_player_get_pan( audio_player
*sys
)
834 audio_require_lock();
835 return sys
->info
.pan
;
838 VG_STATIC
void audio_player_set_flags( audio_player
*sys
, u32 flags
)
840 audio_require_lock();
841 sys
->info
.flags
= flags
;
844 VG_STATIC u32
audio_player_get_flags( audio_player
*sys
)
846 audio_require_lock();
847 return sys
->info
.flags
;
855 VG_STATIC
void audio_debug_ui( m4x4f mtx_pv
)
857 if( !vg_audio
.debug_ui
)
864 u32 cursor
, flags
, length
;
868 infos
[ SFX_MAX_SYSTEMS
];
873 for( int i
=0; i
<SFX_MAX_SYSTEMS
; i
++ )
875 struct active_audio_player
*aap
= &vg_audio
.active_players
[i
];
880 audio_entity
*ent
= &aap
->ent
;
881 struct sound_info
*snd
= &infos
[ num_systems
++ ];
883 snd
->name
= ent
->name
;
884 snd
->cursor
= ent
->cur
;
885 snd
->flags
= ent
->info
.flags
;
886 snd
->length
= ent
->length
;
887 snd
->vol
= ent
->info
.vol
*100.0f
;
888 v3_copy( ent
->info
.world_position
, snd
->pos
);
891 float budget
= ((double)vg_audio
.samples_last
/ 44100.0) * 1000.0;
892 vg_profile_drawn( (struct vg_profile
*[]){ &vg_prof_audio_decode
,
893 &vg_prof_audio_mix
}, 2,
894 budget
, (ui_rect
){ 4, VG_PROFILE_SAMPLE_COUNT
*2 + 8,
902 vg_uictx
.cursor
[0] = 258;
903 vg_uictx
.cursor
[1] = VG_PROFILE_SAMPLE_COUNT
*2+8+24+12;
904 vg_uictx
.cursor
[2] = 150;
905 vg_uictx
.cursor
[3] = 12;
907 float mb1
= 1024.0f
*1024.0f
,
908 usage
= vg_linear_get_cur( vg_audio
.audio_pool
) / mb1
,
909 total
= vg_linear_get_capacity( vg_audio
.audio_pool
) / mb1
,
910 percent
= (usage
/total
) * 100.0f
;
912 snprintf( perf
, 127, "Mem: %.1f/%.1fmb (%.1f%%)\n", usage
, total
, percent
);
914 ui_text( vg_uictx
.cursor
, perf
, 1, 0 );
915 vg_uictx
.cursor
[1] += 20;
917 ui_rect overlap_buffer
[ SFX_MAX_SYSTEMS
];
918 u32 overlap_length
= 0;
920 /* Draw audio stack */
921 for( int i
=0; i
<num_systems
; i
++ )
923 struct sound_info
*inf
= &infos
[i
];
925 vg_uictx
.cursor
[2] = 200;
926 vg_uictx
.cursor
[3] = 18;
928 u32 alpha
= 0xa0000000;
932 ui_fill_rect( vg_uictx
.cursor
, 0x00333333|alpha
);
934 ui_px baseline
= vg_uictx
.cursor
[0],
936 c
= baseline
+ ((float)inf
->cursor
/ (float)inf
->length
) * w
;
939 vg_uictx
.cursor
[2] = 2;
940 vg_uictx
.cursor
[0] = c
;
941 ui_fill_rect( vg_uictx
.cursor
, 0xffffffff );
943 vg_uictx
.cursor
[0] = baseline
+ 2;
944 vg_uictx
.cursor
[1] += 2;
945 snprintf( perf
, 127, "%s %.1f%%", infos
[i
].name
, infos
[i
].vol
);
946 ui_text( vg_uictx
.cursor
, perf
, 1, 0 );
948 if( inf
->flags
& AUDIO_FLAG_SPACIAL_3D
)
951 v3_copy( inf
->pos
, wpos
);
953 m4x4_mulv( mtx_pv
, wpos
, wpos
);
956 goto projected_behind
;
958 v2_muls( wpos
, (1.0f
/wpos
[3]) * 0.5f
, wpos
);
959 v2_add( wpos
, (v2f
){ 0.5f
, 0.5f
}, wpos
);
962 wr
[0] = wpos
[0] * vg
.window_x
;
963 wr
[1] = (1.0f
-wpos
[1]) * vg
.window_y
;
967 for( int j
=0; j
<12; j
++ )
970 for( int k
=0; k
<overlap_length
; k
++ )
972 ui_px
*wk
= overlap_buffer
[k
];
973 if( ((wr
[0] <= wk
[0]+wk
[2]) && (wr
[0]+wr
[2] >= wk
[0])) &&
974 ((wr
[1] <= wk
[1]+wk
[3]) && (wr
[1]+wr
[3] >= wk
[1])) )
987 ui_text( wr
, perf
, 1, 0 );
989 ui_rect_copy( wr
, overlap_buffer
[ overlap_length
++ ] );
996 vg_uictx
.cursor
[1] += 1;
1000 #endif /* VG_AUDIO_H */