summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2005-01-18 15:59:15 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2005-01-18 15:59:15 (GMT)
commit0d787bc6133900527a7d0a4cbadc3d5a9d344cef (patch)
treec29a0722b6e15098dd4ff2a801b1745a817643eb
parent38e9c0c9618116a792dee021dcc8ac51b66113f2 (diff)
downloadTASS-0d787bc6133900527a7d0a4cbadc3d5a9d344cef.zip
TASS-0d787bc6133900527a7d0a4cbadc3d5a9d344cef.tar.gz
TASS-0d787bc6133900527a7d0a4cbadc3d5a9d344cef.tar.bz2
Added internal audio play functionality.
-rw-r--r--Graphic_Equalizer/src/audio.hcc99
1 files changed, 63 insertions, 36 deletions
diff --git a/Graphic_Equalizer/src/audio.hcc b/Graphic_Equalizer/src/audio.hcc
index 2a65700..8722ce7 100644
--- a/Graphic_Equalizer/src/audio.hcc
+++ b/Graphic_Equalizer/src/audio.hcc
@@ -19,9 +19,12 @@
#include "pal_master.hch"
#include "configuration.hch"
+#include "smartmedia_shared.hch"
+#include "display_shared.hch"
#if USE_RUNFFT
#include "audio.hch"
#include "fft.hch"
+#include "smartmedia.hch"
#endif
#if HAVE_DEBUG
#include "debug.hch"
@@ -62,7 +65,6 @@ signed 16 *audioptr_out1,*audioptr_out2;
unsigned 6 *displayptr1,*displayptr2,*displayptr3,*displayptr4;
#endif
-unsigned 6 sample_count;
unsigned 1 FFT_Sync;
signed Output_sample;
@@ -180,7 +182,7 @@ macro proc audio_main(audiodata, AUDIOIN, AUDIOOUT)
macro proc run_fft(audiodata)
{
- for(;;)
+ while(TRUE)
{
if (FFT_Sync) //if 64 samples are read from ADC...
{
@@ -200,9 +202,10 @@ macro proc run_fft(audiodata)
displayptr3=displayptr4;
displayptr4=displayptr1;
- FFT_Sync = 0;
+
}
+ FFT_Sync = 0;
// FFT calculation
perform_fft(audioptr_in1);
@@ -232,55 +235,79 @@ macro proc sample_audio(audiodata, AUDIOOIN)
macro expr IW = PalAudioInGetMaxDataWidthCT();
signed IW LeftNew, RightNew;
+ unsigned 27 blockcount;
unsigned 8 not_saturated;
+ unsigned 6 sample_count;
unsigned 2 saturation;
+ unsigned 1 result;
- for(sample_count=0;;)//store the samples in the inputbuffer
- {
- if (!FFT_Sync)
+ par {
+ while (TRUE)
{
- par
+ if (FFT_Sync && audiodata.play) //if 64 samples are read from ...
+ {
+ result = load_audio_samples(audioptr_in1, blockcount, WINDOW_SIZE);
+ if (result) {
+ blockcount = 0;
+ } else {
+ blockcount++;
+ }
+ }
+ else
+ {
+ delay;
+ }
+ }
+ while (TRUE)//store the samples in the inputbuffer
+ {
+ if (!FFT_Sync)
{
- seq
+ par
{
- PalAudioInRead(AUDIOIN, &LeftNew, &RightNew);
+ seq
+ {
+ PalAudioInRead(AUDIOIN, &LeftNew, &RightNew);
+
+ if (!audiodata.play)
+ {
#if HARDWARE_MULTIPLY
- audioptr_in1[sample_count] = LeftNew;
+ audioptr_in1[sample_count] = LeftNew;
#else
- audioptr_in1[sample_count] = (LeftNew\\2);//drop 2 LSB's
+ audioptr_in1[sample_count] = (LeftNew\\2);//drop 2 LSB's
#endif
- if (LeftNew > 130000) {
- saturation++;
- if (!saturation) {
- audiodata.saturated = TRUE;
- event_notification ! TRUE;
- } else {
- audiodata.saturated = FALSE;
+ if (LeftNew > 130000) {
+ saturation++;
+ if (!saturation) {
+ audiodata.saturated = TRUE;
+ event_notification ! TRUE;
+ } else {
+ audiodata.saturated = FALSE;
+ }
+ } else {
+ not_saturated++;
+ if (!not_saturated) {
+ audiodata.saturated = FALSE;
+ saturation = 0;
+ event_notification ! TRUE;
+ }
+ }
}
- } else {
- not_saturated++;
- if (!not_saturated) {
- audiodata.saturated = FALSE;
- saturation = 0;
- event_notification ! TRUE;
+ sample_count++;
+ if (!sample_count)
+ {
+ FFT_Sync = TRUE;
}
}
-
- sample_count++;
- if (!sample_count)
+ seq
{
- FFT_Sync = 1;
+ Output_sample = audioptr_out2[sample_count];
}
}
- seq
- {
- Output_sample = audioptr_out2[sample_count];
- }
}
- }
- else
- {
- delay;
+ else
+ {
+ delay;
+ }
}
}
}/* --- sample_audio() --- */