X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=blobdiff_plain;f=vg_audio.c;fp=vg_audio.c;h=de57c9fc970479d9c9ebee52500f684346172050;hp=1611a622e86ccdbe7782bf3235e697219eee4bb9;hb=0b8f57a12f41b67b6f088fb56855a0a70ecc7ca8;hpb=44e70cb7cea5ef7d99893b4760abfb6fdccf8845 diff --git a/vg_audio.c b/vg_audio.c index 1611a62..de57c9f 100644 --- a/vg_audio.c +++ b/vg_audio.c @@ -360,11 +360,12 @@ int audio_oneshot_3d( audio_clip *clip, v3f position, f32 range, f32 volume ) audio_require_lock(); audio_channel *ch = audio_get_first_idle_channel(); - if( ch ){ + if( ch ) + { audio_channel_init( ch, clip, AUDIO_FLAG_SPACIAL_3D ); audio_channel_set_spacial( ch, position, range ); audio_channel_edit_volume( ch, volume, 1 ); - ch = audio_relinquish_channel( ch ); + audio_relinquish_channel( ch ); return 1; } @@ -377,10 +378,11 @@ int audio_oneshot( audio_clip *clip, f32 volume, f32 pan ) audio_require_lock(); audio_channel *ch = audio_get_first_idle_channel(); - if( ch ){ - audio_channel_init( ch, clip, 0x00 ); + if( ch ) + { + audio_channel_init( ch, clip, AUDIO_FLAG_NO_DSP ); audio_channel_edit_volume( ch, volume, 1 ); - ch = audio_relinquish_channel( ch ); + audio_relinquish_channel( ch ); return 1; } @@ -875,39 +877,67 @@ static void audio_mixer_callback( void *user, u8 *stream, int byte_count ){ for( int i=0; itime_startframe = lfo->time; } - for( int i=0; iactivity == k_channel_activity_alive ){ - if( ch->_.lfo ) - ch->_.lfo->time = ch->_.lfo->time_startframe; + if( use_dsp ) + { + if( ch->flags & AUDIO_FLAG_NO_DSP ) + { + if( j==0 ) + continue; + } + else + { + if( j==1 ) + continue; + } + } + + if( ch->activity == k_channel_activity_alive ) + { + if( ch->_.lfo ) + ch->_.lfo->time = ch->_.lfo->time_startframe; - u32 remaining = frame_count, - subpos = 0; + u32 remaining = frame_count, + subpos = 0; - while( remaining ){ - audio_channel_mix( ch, pOut32F+subpos ); - remaining -= AUDIO_MIX_FRAME_SIZE; - subpos += AUDIO_MIX_FRAME_SIZE*2; + while( remaining ) + { + audio_channel_mix( ch, pOut32F+subpos ); + remaining -= AUDIO_MIX_FRAME_SIZE; + subpos += AUDIO_MIX_FRAME_SIZE*2; + } } } - } - if( use_dsp ){ - vg_profile_begin( &_vg_prof_dsp ); - for( int i=0; ireadable_activity = ch->activity; }