forked from len0rd/rockbox
SWCODEC recording: More cleanup of stuff after queue additions and audio driver unification.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11783 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0025a97b95
commit
36c940555c
4 changed files with 33 additions and 60 deletions
|
|
@ -186,7 +186,12 @@ void audio_record(const char *filename);
|
||||||
void audio_stop_recording(void);
|
void audio_stop_recording(void);
|
||||||
void audio_pause_recording(void);
|
void audio_pause_recording(void);
|
||||||
void audio_resume_recording(void);
|
void audio_resume_recording(void);
|
||||||
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
static inline void audio_new_file(const char *filename)
|
||||||
|
{ audio_record(filename); }
|
||||||
|
#else
|
||||||
void audio_new_file(const char *filename);
|
void audio_new_file(const char *filename);
|
||||||
|
#endif /* CONFIG_CODEC == SWCODEC */
|
||||||
void audio_set_recording_options(struct audio_recording_options *options);
|
void audio_set_recording_options(struct audio_recording_options *options);
|
||||||
void audio_set_recording_gain(int left, int right, int type);
|
void audio_set_recording_gain(int left, int right, int type);
|
||||||
unsigned long audio_recorded_time(void);
|
unsigned long audio_recorded_time(void);
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,12 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
#include "logf.h"
|
#include "logf.h"
|
||||||
#include "panic.h"
|
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "ata.h"
|
#include "ata.h"
|
||||||
#include "usb.h"
|
#include "usb.h"
|
||||||
#if defined(HAVE_UDA1380)
|
|
||||||
#include "uda1380.h"
|
|
||||||
#include "general.h"
|
|
||||||
#elif defined(HAVE_TLV320)
|
|
||||||
#include "tlv320.h"
|
|
||||||
#endif
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
#include "general.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "sound.h"
|
#include "sound.h"
|
||||||
#include "id3.h"
|
#include "id3.h"
|
||||||
|
|
@ -45,7 +39,6 @@
|
||||||
* Public -
|
* Public -
|
||||||
* pcm_init_recording
|
* pcm_init_recording
|
||||||
* pcm_close_recording
|
* pcm_close_recording
|
||||||
* pcm_rec_mux
|
|
||||||
* Semi-private -
|
* Semi-private -
|
||||||
* pcm_rec_dma_start
|
* pcm_rec_dma_start
|
||||||
* pcm_rec_dma_stop
|
* pcm_rec_dma_stop
|
||||||
|
|
@ -234,11 +227,10 @@ enum
|
||||||
PCMREC_INIT, /* enable recording */
|
PCMREC_INIT, /* enable recording */
|
||||||
PCMREC_CLOSE, /* close recording */
|
PCMREC_CLOSE, /* close recording */
|
||||||
PCMREC_OPTIONS, /* set recording options */
|
PCMREC_OPTIONS, /* set recording options */
|
||||||
PCMREC_START, /* start recording */
|
PCMREC_RECORD, /* record a new file */
|
||||||
PCMREC_STOP, /* stop the current recording */
|
PCMREC_STOP, /* stop the current recording */
|
||||||
PCMREC_PAUSE, /* pause the current recording */
|
PCMREC_PAUSE, /* pause the current recording */
|
||||||
PCMREC_RESUME, /* resume the current recording */
|
PCMREC_RESUME, /* resume the current recording */
|
||||||
PCMREC_NEW_FILE, /* start new file */
|
|
||||||
#if 0
|
#if 0
|
||||||
PCMREC_FLUSH_NUM, /* flush a number of files out */
|
PCMREC_FLUSH_NUM, /* flush a number of files out */
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -427,20 +419,10 @@ void audio_set_recording_options(struct audio_recording_options *options)
|
||||||
void audio_record(const char *filename)
|
void audio_record(const char *filename)
|
||||||
{
|
{
|
||||||
logf("audio_record: %s", filename);
|
logf("audio_record: %s", filename);
|
||||||
queue_send(&pcmrec_queue, PCMREC_START, (void *)filename);
|
queue_send(&pcmrec_queue, PCMREC_RECORD, (void *)filename);
|
||||||
logf("audio_record_done");
|
logf("audio_record_done");
|
||||||
} /* audio_record */
|
} /* audio_record */
|
||||||
|
|
||||||
/**
|
|
||||||
* Equivalent to audio_record()
|
|
||||||
*/
|
|
||||||
void audio_new_file(const char *filename)
|
|
||||||
{
|
|
||||||
logf("audio_new_file: %s", filename);
|
|
||||||
queue_send(&pcmrec_queue, PCMREC_NEW_FILE, (void *)filename);
|
|
||||||
logf("audio_new_file done");
|
|
||||||
} /* audio_new_file */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop current recording if recording
|
* Stop current recording if recording
|
||||||
*/
|
*/
|
||||||
|
|
@ -471,6 +453,19 @@ void audio_resume_recording(void)
|
||||||
logf("audio_resume_recording done");
|
logf("audio_resume_recording done");
|
||||||
} /* audio_resume_recording */
|
} /* audio_resume_recording */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Note that microphone is mono, only left value is used
|
||||||
|
* See audiohw_set_recvol() for exact ranges.
|
||||||
|
*
|
||||||
|
* @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void audio_set_recording_gain(int left, int right, int type)
|
||||||
|
{
|
||||||
|
//logf("rcmrec: t=%d l=%d r=%d", type, left, right);
|
||||||
|
audiohw_set_recvol(left, right, type);
|
||||||
|
} /* audio_set_recording_gain */
|
||||||
|
|
||||||
/** Information about current state **/
|
/** Information about current state **/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1203,14 +1198,14 @@ static void pcmrec_set_recording_options(struct audio_recording_options *options
|
||||||
}
|
}
|
||||||
} /* pcmrec_set_recording_options */
|
} /* pcmrec_set_recording_options */
|
||||||
|
|
||||||
/* PCMREC_START/PCMREC_NEW_FILE - start recording (not gapless)
|
/* PCMREC_RECORD - start recording (not gapless)
|
||||||
or split stream (gapless) */
|
or split stream (gapless) */
|
||||||
static void pcmrec_start(const char *filename)
|
static void pcmrec_record(const char *filename)
|
||||||
{
|
{
|
||||||
unsigned long pre_sample_ticks;
|
unsigned long pre_sample_ticks;
|
||||||
int rd_start;
|
int rd_start;
|
||||||
|
|
||||||
logf("pcmrec_start: %s", filename);
|
logf("pcmrec_record: %s", filename);
|
||||||
|
|
||||||
/* reset stats */
|
/* reset stats */
|
||||||
num_rec_bytes = 0;
|
num_rec_bytes = 0;
|
||||||
|
|
@ -1223,7 +1218,7 @@ static void pcmrec_start(const char *filename)
|
||||||
pcmrec_new_stream(filename,
|
pcmrec_new_stream(filename,
|
||||||
CHUNKF_START_FILE | CHUNKF_END_FILE,
|
CHUNKF_START_FILE | CHUNKF_END_FILE,
|
||||||
0);
|
0);
|
||||||
goto start_done;
|
goto record_done;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
@ -1299,9 +1294,9 @@ static void pcmrec_start(const char *filename)
|
||||||
(pre_sample_ticks > 0 ? CHUNKF_PRERECORD : 0),
|
(pre_sample_ticks > 0 ? CHUNKF_PRERECORD : 0),
|
||||||
enc_rd_index);
|
enc_rd_index);
|
||||||
|
|
||||||
start_done:
|
record_done:
|
||||||
logf("pcmrec_start done");
|
logf("pcmrec_record done");
|
||||||
} /* pcmrec_start */
|
} /* pcmrec_record */
|
||||||
|
|
||||||
/* PCMREC_STOP */
|
/* PCMREC_STOP */
|
||||||
static void pcmrec_stop(void)
|
static void pcmrec_stop(void)
|
||||||
|
|
@ -1445,9 +1440,8 @@ static void pcmrec_thread(void)
|
||||||
(struct audio_recording_options *)ev.data);
|
(struct audio_recording_options *)ev.data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCMREC_START:
|
case PCMREC_RECORD:
|
||||||
case PCMREC_NEW_FILE:
|
pcmrec_record((const char *)ev.data);
|
||||||
pcmrec_start((const char *)ev.data);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCMREC_STOP:
|
case PCMREC_STOP:
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "tlv320.h"
|
#include "sound.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* Note that microphone is mono, only left value is used
|
|
||||||
* See audiohw_set_recvol() for exact ranges.
|
|
||||||
*
|
|
||||||
* @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void audio_set_recording_gain(int left, int right, int type)
|
|
||||||
{
|
|
||||||
//logf("rcmrec: t=%d l=%d r=%d", type, left, right);
|
|
||||||
audiohw_set_recvol(left, right, type);
|
|
||||||
} /* audio_set_recording_gain */
|
|
||||||
|
|
||||||
void audio_set_output_source(int source)
|
void audio_set_output_source(int source)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "uda1380.h"
|
#include "sound.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* Note that microphone is mono, only left value is used
|
|
||||||
* See audiohw_set_recvol() for exact ranges.
|
|
||||||
*
|
|
||||||
* @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void audio_set_recording_gain(int left, int right, int type)
|
|
||||||
{
|
|
||||||
//logf("rcmrec: t=%d l=%d r=%d", type, left, right);
|
|
||||||
audiohw_set_recvol(left, right, type);
|
|
||||||
} /* audio_set_recording_gain */
|
|
||||||
|
|
||||||
void audio_set_output_source(int source)
|
void audio_set_output_source(int source)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue