Update of /cvsroot/audacity/audacity-src/src/export
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv14053/export
Modified Files:
ExportMP3.cpp ExportMP3.h
Log Message:
Restore Blade API usage under Windows and update it to support VBR and channel
mode.
Change search sequence for lame library.
Simplify "find the library" dialog.
Index: ExportMP3.h
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMP3.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ExportMP3.h 17 Mar 2007 20:28:40 -0000 1.9
+++ ExportMP3.h 22 Mar 2007 05:17:53 -0000 1.10
@@ -18,132 +18,77 @@
/* --------------------------------------------------------------------------*/
-typedef lame_global_flags *lame_init_t(void);
-typedef int lame_init_params_t(lame_global_flags*);
-typedef const char* get_lame_version_t(void);
-
-typedef int lame_encode_buffer_t (
- lame_global_flags* gf,
- const short int buffer_l [],
- const short int buffer_r [],
- const int nsamples,
- unsigned char * mp3buf,
- const int mp3buf_size );
-
-typedef int lame_encode_buffer_interleaved_t(
- lame_global_flags* gf,
- short int pcm[],
- int num_samples, /* per channel */
- unsigned char* mp3buf,
- int mp3buf_size );
-
-typedef int lame_encode_flush_t(
- lame_global_flags *gf,
- unsigned char* mp3buf,
- int size );
-
-typedef int lame_close_t(lame_global_flags*);
-
-typedef int lame_set_in_samplerate_t(lame_global_flags*, int);
-typedef int lame_set_out_samplerate_t(lame_global_flags*, int);
-typedef int lame_set_num_channels_t(lame_global_flags*, int );
-typedef int lame_set_quality_t(lame_global_flags*, int);
-typedef int lame_get_quality_t(lame_global_flags*);
-typedef int lame_set_brate_t(lame_global_flags*, int);
-typedef int lame_get_brate_t(lame_global_flags*);
-typedef int lame_set_VBR_t(lame_global_flags *, vbr_mode);
-typedef vbr_mode lame_get_VBR_t(const lame_global_flags *);
-typedef int lame_set_VBR_q_t(lame_global_flags *, int);
-typedef int lame_get_VBR_q_t(const lame_global_flags *);
-typedef int lame_set_mode_t(lame_global_flags *, MPEG_mode);
-typedef MPEG_mode lame_get_mode_t(const lame_global_flags *);
+class AudacityProject;
+class MixerSpec;
+class MP3Exporter
+{
+public:
-/* --------------------------------------------------------------------------*/
+ enum
+ {
+ MP3_MODE_STEREO = 0,
+ MP3_MODE_JOINT,
+ MP3_MODE_DUAL,
+ MP3_MODE_MONO
+ } MP3Modes;
-class AudacityProject;
-class MixerSpec;
+ MP3Exporter();
+ virtual ~MP3Exporter();
-class MP3Exporter {
+ bool FindLibrary(wxWindow *parent, bool showdialog);
+ bool LoadLibrary(wxWindow *parent, bool askuser);
+ bool ValidLibraryLoaded();
- public:
-
- MP3Exporter();
- virtual ~MP3Exporter() { };
+ /* These global settings keep state over the life of the object */
+ void SetBitrate(int rate);
+ int GetBitrate();
+ void SetVBRQuality(int quality);
+ int GetVBRQuality();
+ void SetMode(int mode);
+ int GetMode();
- bool FindLibrary(wxWindow *parent);
- bool LoadLibrary();
- bool ValidLibraryLoaded();
- wxString GetLibraryVersion();
+ /* Virtual methods that must be supplied by library interfaces */
- /* returns the number of samples PER CHANNEL to send for each call to
EncodeBuffer */
- int InitializeStream(int channels, int sampleRate);
- /* In bytes. must be called AFTER InitializeStream */
- int GetOutBufferSize();
- /* returns the number of bytes written. input is interleaved if stereo*/
- int EncodeBuffer(short int inbuffer[], unsigned char outbuffer[]);
- int EncodeRemainder(short int inbuffer[], int nSamples,
- unsigned char outbuffer[]);
+ /* initialize the library interface */
+ virtual bool InitLibrary() = 0;
- int EncodeBufferMono(short int inbuffer[], unsigned char outbuffer[]);
- int EncodeRemainderMono(short int inbuffer[], int nSamples,
- unsigned char outbuffer[]);
+ /* get library info */
+ virtual wxString GetLibraryVersion() = 0;
+ virtual wxString GetLibraryName() = 0;
+ virtual wxString GetLibraryPath() = 0;
+ virtual wxString GetLibraryTypeString() = 0;
- int FinishStream(unsigned char outbuffer[]);
- void CancelEncoding();
+ /* returns the number of samples PER CHANNEL to send for each call to
EncodeBuffer */
+ virtual int InitializeStream(int channels, int sampleRate) = 0;
- /* The number of different quality settings */
- int GetQualityVariance();
-
- /* These global settings keep state over the life of the object */
- int GetConfigurationCaps();
- void SetBitrate(int rate);
- int GetBitrate();
- void SetQuality(int quality);
- int GetQuality();
- void SetVBRQuality(int quality);
- int GetVBRQuality();
- void SetMode(MPEG_mode mode);
- MPEG_mode GetMode();
+ /* In bytes. must be called AFTER InitializeStream */
+ virtual int GetOutBufferSize() = 0;
- protected:
+ /* returns the number of bytes written. input is interleaved if stereo*/
+ virtual int EncodeBuffer(short int inbuffer[], unsigned char outbuffer[]) =
0;
+ virtual int EncodeRemainder(short int inbuffer[], int nSamples,
+ unsigned char outbuffer[]) = 0;
- wxString mLibPath;
- wxDynamicLibrary lame_enc_lib;
+ virtual int EncodeBufferMono(short int inbuffer[], unsigned char
outbuffer[]) = 0;
+ virtual int EncodeRemainderMono(short int inbuffer[], int nSamples,
+ unsigned char outbuffer[]) = 0;
- private:
+ virtual int FinishStream(unsigned char outbuffer[]) = 0;
+ virtual void CancelEncoding() = 0;
- /* function pointers to the symbols we get from the library */
- lame_init_t* lame_init;
- lame_init_params_t* lame_init_params;
- lame_encode_buffer_t* lame_encode_buffer;
- lame_encode_buffer_interleaved_t* lame_encode_buffer_interleaved;
- lame_encode_flush_t* lame_encode_flush;
- lame_close_t* lame_close;
- get_lame_version_t* get_lame_version;
-
- lame_set_in_samplerate_t* lame_set_in_samplerate;
- lame_set_out_samplerate_t* lame_set_out_samplerate;
- lame_set_num_channels_t* lame_set_num_channels;
- lame_set_quality_t* lame_set_quality;
- lame_get_quality_t* lame_get_quality;
- lame_set_brate_t* lame_set_brate;
- lame_get_brate_t* lame_get_brate;
- lame_set_VBR_t* lame_set_VBR;
- lame_get_VBR_t* lame_get_VBR;
- lame_set_VBR_q_t* lame_set_VBR_q;
- lame_get_VBR_q_t* lame_get_VBR_q;
- lame_set_mode_t* lame_set_mode;
- lame_get_mode_t* lame_get_mode;
+protected:
- lame_global_flags *mGF;
-
- bool mLibraryLoaded, mEncoding;
- char mVersion[20];
+ wxString mLibPath;
+ wxDynamicLibrary lame_lib;
- static const int mSamplesPerChunk = 220500;
- static const int mOutBufferSize = int(1.25 * mSamplesPerChunk + 7200);
+ bool mLibraryLoaded;
+ bool mEncoding;
+ int mBitrate;
+ bool mVBR;
+ int mVBRQuality;
+ int mMode;
};
#define MP3CONFIG_BITRATE 0x00000001
Index: ExportMP3.cpp
===================================================================
RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMP3.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- ExportMP3.cpp 17 Mar 2007 20:28:40 -0000 1.50
+++ ExportMP3.cpp 22 Mar 2007 05:17:53 -0000 1.51
@@ -67,17 +67,19 @@
*//********************************************************************/
#include <wx/defs.h>
-#include <wx/textctrl.h>
#include <wx/dynlib.h>
+#include <wx/ffile.h>
+#include <wx/filedlg.h>
+#include <wx/intl.h>
+#include <wx/log.h>
+#include <wx/mimetype.h>
#include <wx/msgdlg.h>
[...1173 lines suppressed...]
outFile.Write(buffer, bytes);
@@ -634,13 +1039,16 @@
bytes = exporter->FinishStream(buffer);
- if (bytes)
+ if (bytes) {
outFile.Write(buffer, bytes);
+ }
/* Write ID3 tag if it was supposed to be at the end of the file */
- if (endOfFile)
+ if (endOfFile) {
outFile.Write(id3buffer, id3len);
+ }
+
free(id3buffer);
/* Close file */
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs