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;
}
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;
}
for( int i=0; i<frame_count*2; i ++ )
pOut32F[i] = 0.0f;
- for( int i=0; i<AUDIO_LFOS; i++ ){
+ for( int i=0; i<AUDIO_LFOS; i++ )
+ {
audio_lfo *lfo = &vg_audio.oscillators[i];
lfo->time_startframe = lfo->time;
}
- for( int i=0; i<AUDIO_CHANNELS; i ++ ){
- audio_channel *ch = &vg_audio.channels[i];
+ for( int j=0; j<2; j++ )
+ {
+ for( int i=0; i<AUDIO_CHANNELS; i ++ )
+ {
+ audio_channel *ch = &vg_audio.channels[i];
- if( ch->activity == 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; i<frame_count; i++ )
- vg_dsp_process( pOut32F + i*2, pOut32F + i*2 );
- vg_profile_end( &_vg_prof_dsp );
+ if( use_dsp )
+ {
+ if( j==0 )
+ {
+ vg_profile_begin( &_vg_prof_dsp );
+ for( int i=0; i<frame_count; i++ )
+ vg_dsp_process( pOut32F + i*2, pOut32F + i*2 );
+ vg_profile_end( &_vg_prof_dsp );
+ }
+ }
+ else
+ break;
}
audio_lock();
- for( int i=0; i<AUDIO_CHANNELS; i ++ ){
+ for( int i=0; i<AUDIO_CHANNELS; i ++ )
+ {
audio_channel *ch = &vg_audio.channels[i];
ch->readable_activity = ch->activity;
}