#include "vg/vg_platform.h"
#include "vg/vg_io.h"
#include "vg/vg_m.h"
-#include "vg/vg_ui.h"
#include "vg/vg_console.h"
#include "vg/vg_store.h"
#include "vg/vg_profiler.h"
#include "vg/vg_audio_synth_bird.h"
-#include <sys/time.h>
-#include <math.h>
-
#ifdef __GNUC__
#ifndef __clang__
#pragma GCC push_options
typedef struct audio_lfo audio_lfo;
struct audio_clip{
- const char *path;
+ union { /* TODO oof.. */
+ u64 _p64_;
+ const char *path;
+ };
+
u32 flags;
u32 size;
- void *data;
+
+ union{
+ u64 _p64;
+ void *data;
+ };
};
-static struct vg_audio_system{
+struct vg_audio_system{
SDL_AudioDeviceID sdl_output_device;
void *audio_pool,
float internal_global_volume,
external_global_volume;
}
-vg_audio = { .external_global_volume = 1.0f };
+static vg_audio = { .external_global_volume = 1.0f };
#include "vg/vg_audio_dsp.h"
}
}
- if( !vg_validf( framevol_l ) ) vg_fatal_error( "NaN left channel" );
- if( !vg_validf( framevol_r ) ) vg_fatal_error( "NaN right channel" );
- if( !vg_validf( frame_samplerate ) )
- vg_fatal_error( "NaN sample rate" );
+ if( !vg_validf( framevol_l ) ||
+ !vg_validf( framevol_r ) ||
+ !vg_validf( frame_samplerate ) ){
+ vg_fatal_error( "Invalid sampling conditions.\n"
+ "This crash is to protect your ears.\n"
+ " channel: %p (%s)\n"
+ " sample_rate: %f\n"
+ " volume: L%f R%f\n"
+ " listener: %.2f %.2f %.2f [%.2f %.2f %.2f]\n",
+ ch, ch->name, frame_samplerate,
+ framevol_l, framevol_r,
+ vg_audio.internal_listener_pos[0],
+ vg_audio.internal_listener_pos[1],
+ vg_audio.internal_listener_pos[2],
+ vg_audio.internal_listener_ears[0],
+ vg_audio.internal_listener_ears[1],
+ vg_audio.internal_listener_ears[2]
+ );
+ }
}
u32 buffer_length = AUDIO_MIX_FRAME_SIZE;
*/
float budget = ((double)vg_audio.samples_last / 44100.0) * 1000.0;
-#if 0
vg_profile_drawn( (struct vg_profile *[]){ &vg_prof_audio_decode,
&vg_prof_audio_mix,
&vg_prof_audio_dsp}, 3,
budget, (ui_rect){ 4, VG_PROFILE_SAMPLE_COUNT*2 + 8,
512, 0 }, 3 );
-#endif
char perf[128];