[Audacity-devel] mono MP3 export patch
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Paolo P. <p.p...@ip...> - 2002-11-18 11:59:37
|
This is my patch for exporting mono in mp3 format on GNU/Linux. Thanks Paolo Patruno > Dear developers > > the last cvs doesn't work exporting mono trak to mp3 or ogg. > In ogg the sample rate looks like wrong. > > mp3: It is an old bug also present in version 1.0. > I think ExportMP3 require lame_encode_buffer, not only > lame_encode_buffer_interleaved that doesn't work for mono trak. > >I am using Red Hat 7.3, wx 2.3.3, red hat gcc 2.96, lame-3.92-fr4. Index: ExportMP3.cpp =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMP3.cpp,v retrieving revision 1.15 diff -r1.15 ExportMP3.cpp 192a193 > lame_encode_buffer_t* lame_encode_buffer; 261a263,266 > > lame_encode_buffer = > (lame_encode_buffer_t *) wxDllLoader::GetSymbol(libHandle, > "lame_encode_buffer"); 296a302 > !lame_encode_buffer || 348a355,370 > > > int EncodeBufferMono(short int inbuffer[], unsigned char outbuffer[]) { > if(!mEncoding) return -1; > > return lame_encode_buffer(mGF, inbuffer,inbuffer, mSamplesPerChunk, > outbuffer, mOutBufferSize); > } > > int EncodeRemainderMono(short int inbuffer[], int nSamples, > unsigned char outbuffer[]) { > return lame_encode_buffer(mGF, inbuffer, inbuffer, nSamples, outbuffer, > mOutBufferSize); > } > > 427a450 > lame_encode_buffer_t* lame_encode_buffer; 558a582,585 > MakePString(name, "lame_encode_buffer"); > FindSymbol(connID, name, &mainAddr, &symClass); > lame_encode_buffer = NewMachOFromCFM(mainAddr); > 596a624 > !lame_encode_buffer || 639c667 < return lame_encode_buffer_interleaved(mGF, inbuffer, mSamplesPerChunk, --- > return lame_encode_buffer_interleaved(mGF, inbuffer, inbuffer, mSamplesPerChunk, 648a677,689 > int EncodeBufferMono(short int inbuffer[], unsigned char outbuffer[]) { > if(!mEncoding) return -1; > > return lame_encode_buffer(mGF, inbuffer, inbuffer, mSamplesPerChunk, > outbuffer, mOutBufferSize); > } > > int EncodeRemainderMono(short int inbuffer[], int nSamples, > unsigned char outbuffer[]) { > return lame_encode_buffer(mGF, inbuffer, inbuffer , inbuffer, nSamples, outbuffer, > mOutBufferSize); > } > 1288,1290c1329,1344 < bytes = GetMP3Exporter()->EncodeRemainder(mixed, numSamples, buffer);< else < bytes = GetMP3Exporter()->EncodeBuffer(mixed, buffer); --- > > if (stereo) { > bytes = GetMP3Exporter()->EncodeRemainder(mixed, numSamples , buffer);> } > else{ > bytes = GetMP3Exporter()->EncodeRemainderMono(mixed, numSamples , buffer); > } > else { > > if (stereo) { > bytes = GetMP3Exporter()->EncodeBuffer(mixed, buffer); > } > else { > bytes = GetMP3Exporter()->EncodeBufferMono(mixed, buffer); > } > } Index: ExportMP3.h =================================================================== RCS file: /cvsroot/audacity/audacity-src/src/export/ExportMP3.h,v retrieving revision 1.2 diff -r1.2 ExportMP3.h 40a41,45 > > virtual int EncodeBufferMono(short int inbuffer[], unsigned char outbuffer[]) = 0; > virtual int EncodeRemainderMono(short int inbuffer[], int nSamples, > unsigned char outbuffer[]) = 0; > |