summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2006-08-28 22:38:41 +0000
committerMichael Sevakis <jethead71@rockbox.org>2006-08-28 22:38:41 +0000
commit4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d (patch)
treeeb6113c7491072f7b5136e24775737764e2cdede /firmware/export
parent65c2c58b3aa26164bd919665e4d710efa2fa7c79 (diff)
downloadrockbox-4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d.zip
rockbox-4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d.tar.gz
rockbox-4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d.tar.bz2
rockbox-4fc717a4c19a1fe0349977d7b9c86561c5a5cf2d.tar.xz
Added FS#2939 Encoder Codec Interface + Codecs by Antonius Hellmann with additional FM Recording support and my modifications
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10789 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/audio.h46
-rw-r--r--firmware/export/config-h100.h3
-rw-r--r--firmware/export/config-h120.h3
-rw-r--r--firmware/export/config-h300.h3
-rw-r--r--firmware/export/config-iaudiox5.h4
-rw-r--r--firmware/export/fmradio.h16
-rw-r--r--firmware/export/id3.h42
-rw-r--r--firmware/export/pcm_record.h14
8 files changed, 128 insertions, 3 deletions
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index 9e3499e..2ee7f89 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -31,6 +31,9 @@
#define AUDIO_STATUS_PRERECORD 8
#define AUDIO_STATUS_ERROR 16
+#define AUDIO_STATUS_STAYON_FLAGS \
+ (AUDIO_STATUS_PLAY | AUDIO_STATUS_PAUSE | AUDIO_STATUS_RECORD | AUDIO_)
+
#define AUDIOERR_DISK_FULL 1
#define AUDIO_GAIN_LINEIN 0
@@ -69,6 +72,7 @@ void audio_resume(void);
void audio_next(void);
void audio_prev(void);
int audio_status(void);
+bool audio_query_poweroff(void);
int audio_track_count(void); /* SWCODEC only */
void audio_pre_ff_rewind(void); /* SWCODEC only */
void audio_ff_rewind(long newtime);
@@ -93,14 +97,56 @@ void audio_stop_recording(void);
void audio_pause_recording(void);
void audio_resume_recording(void);
void audio_new_file(const char *filename);
+
+/* audio sources */
+enum
+{
+ AUDIO_SRC_PLAYBACK = -1, /* for audio playback (default) */
+ AUDIO_SRC_MIC, /* monitor mic */
+ AUDIO_SRC_LINEIN, /* monitor line in */
+#ifdef HAVE_SPDIF_IN
+ AUDIO_SRC_SPDIF, /* monitor spdif */
+#endif
+#if defined(HAVE_FMRADIO_IN) || defined(CONFIG_TUNER)
+ AUDIO_SRC_FMRADIO, /* monitor fm radio */
+#endif
+ /* define new audio sources above this line */
+ AUDIO_SOURCE_LIST_END,
+ /* AUDIO_SRC_FMRADIO must be declared #ifdef CONFIG_TUNER but is not in
+ the list of recordable sources. HAVE_FMRADIO_IN implies CONFIG_TUNER. */
+#if defined(HAVE_FMRADIO_IN) || !defined(CONFIG_TUNER)
+ AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END,
+#else
+ AUDIO_NUM_SOURCES = AUDIO_SOURCE_LIST_END-1,
+#endif
+ AUDIO_SRC_MAX = AUDIO_NUM_SOURCES-1
+};
+
+/* channel modes */
+enum
+{
+ CHN_MODE_MONO = 1,
+ CHN_MODE_STEREO,
+};
void audio_set_recording_options(int frequency, int quality,
int source, int channel_mode,
bool editable, int prerecord_time);
void audio_set_recording_gain(int left, int right, int type);
unsigned long audio_recorded_time(void);
unsigned long audio_num_recorded_bytes(void);
+#if 0
+#ifdef HAVE_SPDIF_POWER
void audio_set_spdif_power_setting(bool on);
+#endif
+#endif
unsigned long audio_get_spdif_sample_rate(void);
+#if CONFIG_CODEC == SWCODEC
+/* audio encoder functions (defined in playback.c) */
+int audio_get_encoder_id(void);
+void audio_load_encoder(int enc_id);
+void audio_remove_encoder(void);
+#endif /* CONFIG_CODEC == SWCODEC */
+
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index c21c8a1..8f93686 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -135,6 +135,9 @@
/* Someone with H100 and BDM, please verify if this works. */
/* #define HAVE_EEPROM */
+/* Define this for FM radio input available (not for SIMULATOR) */
+#define HAVE_FMRADIO_IN
+
#endif /* !SIMULATOR */
/* Define this for S/PDIF input available */
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index 5ff567c..4ac4b2b 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -132,6 +132,9 @@
/* Define this if the EEPROM chip is used */
#define HAVE_EEPROM_SETTINGS
+/* Define this for FM radio input available (not for SIMULATOR) */
+#define HAVE_FMRADIO_IN
+
#endif /* !SIMULATOR */
/* Define this for S/PDIF input available */
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index d5c54d8..c9c0b04 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -140,4 +140,7 @@
/* Define this if there is an EEPROM chip */
#define HAVE_EEPROM
+/* Define this for FM radio input available (not for SIMULATOR) */
+#define HAVE_FMRADIO_IN
+
#endif /* SIMULATOR */
diff --git a/firmware/export/config-iaudiox5.h b/firmware/export/config-iaudiox5.h
index 8a2ed7a..d5c67c0 100644
--- a/firmware/export/config-iaudiox5.h
+++ b/firmware/export/config-iaudiox5.h
@@ -17,6 +17,7 @@
/* define this if you have access to the quickscreen */
#define HAVE_QUICKSCREEN
+
/* define this if you have access to the pitchscreen */
#define HAVE_PITCHSCREEN
@@ -81,6 +82,9 @@
should be defined as well. */
#define HAVE_LCD_SLEEP
+/* Define this for FM radio input available (not for SIMULATOR) */
+#define HAVE_FMRADIO_IN
+
/* Define this if you have a Motorola SCF5250 */
#define CONFIG_CPU MCF5250
diff --git a/firmware/export/fmradio.h b/firmware/export/fmradio.h
index 3c55fb7..7311323 100644
--- a/firmware/export/fmradio.h
+++ b/firmware/export/fmradio.h
@@ -20,6 +20,22 @@
#ifndef FMRADIO_H
#define FMRADIO_H
+/** declare some stuff here so powermgmt.c can properly tell if the radio is
+ actually playing and not just paused. This break in heirarchy is allowed
+ for audio_status(). **/
+
+/* set when radio is playing or paused within fm radio screen */
+#define FMRADIO_OFF 0x0
+#define FMRADIO_PLAYING 0x1
+#define FMRADIO_PAUSED 0x2
+
+/* returns the IN flag */
+#define FMRADIO_IN_SCREEN(s) ((s) & FMRADIO_IN_FLAG)
+#define FMRADIO_STATUS_PLAYING(s) ((s) & FMRADIO_PLAYING_OUT)
+#define FMRADIO_STATUS_PAUSED(s) ((s) & FMRADIO_PAUSED_OUT)
+
+extern int get_radio_status(void);
+
extern int fmradio_read(int addr);
extern void fmradio_set(int addr, int data);
diff --git a/firmware/export/id3.h b/firmware/export/id3.h
index 7930cd9..dc58178 100644
--- a/firmware/export/id3.h
+++ b/firmware/export/id3.h
@@ -24,7 +24,6 @@
#include "file.h"
/* Audio file types. */
-/* NOTE: When adding new audio types, also add to codec_labels[] in id3.c */
enum {
AFMT_UNKNOWN = 0, /* Unknown file format */
@@ -46,9 +45,48 @@ enum {
/* New formats must be added to the end of this list */
- AFMT_NUM_CODECS
+ AFMT_NUM_CODECS,
+
+#if CONFIG_CODEC == SWCODEC
+ /* masks to decompose parts */
+ CODEC_AFMT_MASK = 0x0fff,
+ CODEC_TYPE_MASK = 0x7000,
+
+ /* switch for specifying codec type when requesting a filename */
+ CODEC_TYPE_DECODER = (0 << 12), /* default */
+ CODEC_TYPE_ENCODER = (1 << 12)
+#endif
};
+#if CONFIG_CODEC == SWCODEC
+#define AFMT_ENTRY(label, codec_fname, codec_enc_fname, enc_ext) \
+ { label, codec_fname, codec_enc_fname, enc_ext }
+#else
+#define AFMT_ENTRY(label, codec_fname, codec_enc_fname, enc_ext) \
+ { label }
+#endif
+
+/* record describing the audio format */
+struct afmt_entry
+{
+#if CONFIG_CODEC == SWCODEC
+ char label[8]; /* format label */
+ char *codec_fn; /* filename of decoder codec */
+ char *codec_enc_fn; /* filename of encoder codec */
+ char *ext; /* default extension for file (enc only for now) */
+#else
+ char label[4];
+#endif
+};
+
+/* database of labels and codecs. add formats per above enum */
+extern const struct afmt_entry audio_formats[AFMT_NUM_CODECS];
+
+#if CONFIG_CODEC == SWCODEC
+/* recording quality to AFMT_* */
+extern const int rec_quality_info_afmt[9];
+#endif
+
struct mp3entry {
char path[MAX_PATH];
char* title;
diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h
index 5e2d7b7..b217335 100644
--- a/firmware/export/pcm_record.h
+++ b/firmware/export/pcm_record.h
@@ -20,10 +20,22 @@
#ifndef PCM_RECORD_H
#define PCM_RECORD_H
+void enc_set_parameters(int chunk_size, int num_chunks,
+ int samp_per_chunk, char *head_ptr, int head_size,
+ int enc_id);
+void enc_get_inputs(int *buffer_size, int *channels, int *quality);
+unsigned int* enc_alloc_chunk(void);
+void enc_free_chunk(void);
+int enc_wavbuf_near_empty(void);
+char* enc_get_wav_data(int size);
+extern void (*enc_set_header_callback)(void *head_buffer, int head_size,
+ int num_pcm_samples, bool is_file_header);
+
unsigned long pcm_rec_status(void);
void pcm_rec_init(void);
void pcm_rec_mux(int source);
-
+int pcm_rec_current_bitrate(void);
+int pcm_get_num_unprocessed(void);
void pcm_rec_get_peaks(int *left, int *right);
/* audio.h contains audio recording functions */