Skip to content

Commit

Permalink
Add audio api. Fix vdp_define_colour. Add vdp_plot general command. (#15
Browse files Browse the repository at this point in the history
)

Fix vdp_define_colour. Add vdp_plot. Add audio commands.
  • Loading branch information
robogeek42 authored Apr 6, 2024
1 parent 5c979f2 commit 13fcba6
Show file tree
Hide file tree
Showing 2 changed files with 395 additions and 17 deletions.
43 changes: 41 additions & 2 deletions src/libc/include/vdp_vdu.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void vdp_cursor_tab( int row, int col );
void vdp_set_text_colour( int colour );
void vdp_set_graphics_colour( int mode, int colour );
#define vdp_gcol( M, C ) vdp_set_graphics_colour( M, C )
void vdp_define_colour (int logical, int red, int green, int blue );
void vdp_define_colour(int logical, int physical, int red, int green, int blue );
void vdp_graphics_origin( int x, int y );
int vdp_mode( int mode );
void vdp_swap( void );
Expand All @@ -47,6 +47,7 @@ void vdp_reset_viewports( void );
void vdp_set_graphics_viewport( int left, int bottom, int right, int top );
void vdp_set_text_viewport( int left, int bottom, int right, int top );

void vdp_plot( int plot_mode, int x, int y );
void vdp_move_to( int x, int y );
void vdp_line_to( int x, int y );
void vdp_point( int x, int y );
Expand Down Expand Up @@ -92,9 +93,47 @@ int vdp_adv_load_sprite_bitmaps( const char *fname_prefix, const char *fname_for
void vdp_adv_add_sprite_bitmap( int b );
void vdp_adv_create_sprite( int sprite, int bitmap_num, int frames );

void vdp_audio_play_note( int channel, int volume, int frequency, int duration);
void vdp_audio_status( int channel );
void vdp_audio_set_volume( int channel, int volume );
void vdp_audio_set_frequency( int channel, int frequency );
#define VDP_AUDIO_WAVEFORM_SQUARE 0
#define VDP_AUDIO_WAVEFORM_TRIANGLE 1
#define VDP_AUDIO_WAVEFORM_SAWTOOTH 2
#define VDP_AUDIO_WAVEFORM_SINEWAVE 3
#define VDP_AUDIO_WAVEFORM_NOISE 4
#define VDP_AUDIO_WAVEFORM_VICNOISE 5
void vdp_audio_set_waveform( int channel, int waveform );
void vdp_audio_set_sample( int channel, int bufferID );
void vdp_audio_load_sample( int sample, int length, uint8_t *data);
void vdp_audio_clear_sample( int sample );
#define VDP_AUDIO_SAMPLE_FORMAT_8BIT_SIGNED 0
#define VDP_AUDIO_SAMPLE_FORMAT_8BIT_UNSIGNED 1
#define VDP_AUDIO_SAMPLE_FORMAT_SAMPLE_RATE_FOLLOWS 8
#define VDP_AUDIO_SAMPLE_FORMAT_SAMPLE_TUNEABLE 8
void vdp_audio_create_sample_from_buffer( int channel, int bufferID, int format);
void vdp_audio_set_sample_frequency( int sample, int frequency );
void vdp_audio_set_buffer_frequency( int channel, int bufferID, int frequency );
void vdp_audio_set_sample_repeat_start( int sample, int repeatStart );
void vdp_audio_set_buffer_repeat_start( int channel, int bufferID, int repeatStart );
void vdp_audio_set_sample_repeat_length( int sample, int repeatLength );
void vdp_audio_set_buffer_repeat_length( int channel, int bufferID, int repeatLength );

void vdp_audio_volume_envelope_disable( int channel );
void vdp_audio_volume_envelope_ADSR( int channel, int attack, int decay, int sustain, int release );
void vdp_audio_volume_envelope_multiphase_ADSR( int channel ); // variable length parameters to be send separately
void vdp_audio_frequency_envelope_disable( int channel );
#define VDP_AUDIO_FREQ_ENVELOPE_CONTROL_REPEATS 1
#define VDP_AUDIO_FREQ_ENVELOPE_CONTROL_CUMULATIVE 2
#define VDP_AUDIO_FREQ_ENVELOPE_CONTROL_RESTRICT 4
void vdp_audio_frequency_envelope_stepped( int channel, int phaseCount, int controlByte, int stepLength );

void vdp_audio_enable_channel( int channel );
void vdp_audio_disable_channel( int channel );
void vdp_audio_reset_channel( int channel );

#ifdef __cplusplus
}
#endif

#endif

Loading

0 comments on commit 13fcba6

Please sign in to comment.