All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vexaudio.h File Reference

DAC port driver macros and prototypes. More...

Go to the source code of this file.

Data Structures

struct  _vsl_ct
 

Typedefs

typedef struct _vsl_ct vsl_ct
 

Functions

void vexAudioPlaySound (int freq, int amplitude, int timems)
 Play frequency at given amplitude. More...
 
void vexAudioPlaySoundWait (int freq, int amplitude, int timems)
 Play frequency at given amplitude and wait for completion. More...
 
void vexAudioStopSound (void)
 Stop sound playing. More...
 
char * vexAudioPlayRtttl (char *song, int amplitude, int repeat)
 Play ringtone string using the vsl sound library. More...
 
int vexAudioInitChipToneSong (int len)
 Initialize a chiptone song. More...
 
void vexAudioDeinitChipToneSong (void)
 Free memory occupied by a song. More...
 
void vexAudioStartChipToneSong (int repeat)
 Start playback of the song. More...
 
void vexAudioStopChipToneSong (void)
 Stop playback of the song. More...
 
void vexAudioSetNextChipTone (int freq, int amplitude, int timems)
 Add a tone to the array for the song. More...
 
void vexAudioDebugChipTone (void)
 Print out the song data for debug. More...
 
int vexAudioPlayNextChipTone (void)
 
void VSL_Factorize (int n, int *f1, int *f2)
 
void VSL_CreateSineWave (int amplitude)
 
void VSL_InitTimer (int prescale, int period)
 
void VSL_Init (void)
 
void VSL_Deinit (void)
 

Detailed Description

DAC port driver macros and prototypes.

Typedef Documentation

typedef struct _vsl_ct vsl_ct

Function Documentation

void vexAudioPlaySound ( int  freq,
int  amplitude,
int  timems 
)

Play frequency at given amplitude.

Parameters
[in]freqdesired frequency in Hz
[in]amplitudedesired amplitude 0 = silence, 128 = max
[in]timemsduration of tone

This is the base function that all sound playback uses. The first time this is called all the DAC and DMA initialization is done, a thread is created to stop the sound after the requested playback time

void vexAudioPlaySoundWait ( int  freq,
int  amplitude,
int  timems 
)

Play frequency at given amplitude and wait for completion.

void vexAudioStopSound ( void  )

Stop sound playing.

This clears the counter used for tone duration and resets the semaphore the audio task is blocking on causing it to wake.

char* vexAudioPlayRtttl ( char *  song,
int  amplitude,
int  repeat 
)

Play ringtone string using the vsl sound library.

Parameters
[in]songPointer to buffer with rtttl sound data
[in]amplitudevolume to play song at
[in]repeatflag indicating song is played continuously in a loop
Returns
char * to name of song
int vexAudioInitChipToneSong ( int  len)

Initialize a chiptone song.

Parameters
[in]lennumber of tones in the song

Initalize a chiptone song, allocate memory and clear all variables memory will be reused for subsequent songs if there is enough space to avoid multiple calls to malloc/free

void vexAudioDeinitChipToneSong ( void  )

Free memory occupied by a song.

void vexAudioStartChipToneSong ( int  repeat)

Start playback of the song.

void vexAudioStopChipToneSong ( void  )

Stop playback of the song.

void vexAudioSetNextChipTone ( int  freq,
int  amplitude,
int  timems 
)

Add a tone to the array for the song.

Parameters
[in]freqdesired frequency in Hz
[in]amplitudedesired amplitude 0 = silence, 128 = max
[in]timemsduration of tone
void vexAudioDebugChipTone ( void  )

Print out the song data for debug.

int vexAudioPlayNextChipTone ( void  )
void VSL_Factorize ( int  n,
int *  f1,
int *  f2 
)
void VSL_CreateSineWave ( int  amplitude)
void VSL_InitTimer ( int  prescale,
int  period 
)
void VSL_Init ( void  )
void VSL_Deinit ( void  )