summaryrefslogtreecommitdiff
blob: 18bed1aeeb09ca33056c7ff63d3184e5e0f86d07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
diff -ru audacity-src-1.1.1-3/src/export/ExportMP3.cpp /var/tmp/portage/audacity-1.1.1/work/audacity-src-1.1.1-3/src/export/ExportMP3.cpp
--- audacity-src-1.1.1-3/src/export/ExportMP3.cpp	2002-11-11 00:58:21.000000000 -0600
+++ /var/tmp/portage/audacity-1.1.1/work/audacity-src-1.1.1-3/src/export/ExportMP3.cpp	2003-01-15 00:30:29.000000000 -0600
@@ -190,6 +190,7 @@
          /* 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;
@@ -259,6 +260,10 @@
                                                                          "get_lame_version");
             lame_init_params = 
                (lame_init_params_t *) wxDllLoader::GetSymbol(libHandle, "lame_init_params");
+
+            lame_encode_buffer =
+                (lame_encode_buffer_t *) wxDllLoader::GetSymbol(libHandle,
+                                                          "lame_encode_buffer");
             lame_encode_buffer_interleaved =
                 (lame_encode_buffer_interleaved_t *) wxDllLoader::GetSymbol(libHandle,
                                                           "lame_encode_buffer_interleaved");
@@ -294,6 +299,7 @@
             if (!lame_init ||
                 !get_lame_version ||
                 !lame_init_params ||
+                !lame_encode_buffer ||
                 !lame_encode_buffer_interleaved ||
                 !lame_encode_flush ||
                 !lame_close ||
@@ -346,6 +352,22 @@
             mOutBufferSize);
       }
 
+
+
+      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);
+      }
+
+
       int FinishStream(unsigned char outbuffer[]) {
          mEncoding = false;
          int result = lame_encode_flush(mGF, outbuffer, mOutBufferSize);
@@ -425,6 +447,7 @@
          /* 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;
@@ -556,6 +579,10 @@
             FindSymbol(connID, name, &mainAddr, &symClass);
             lame_encode_buffer_interleaved = NewMachOFromCFM(mainAddr);
 
+            MakePString(name, "lame_encode_buffer");
+            FindSymbol(connID, name, &mainAddr, &symClass);
+            lame_encode_buffer = NewMachOFromCFM(mainAddr);
+
             MakePString(name, "lame_encode_flush");
             FindSymbol(connID, name, &mainAddr, &symClass);
             lame_encode_flush = NewMachOFromCFM(mainAddr);
@@ -594,6 +621,7 @@
             if (!lame_init ||
                 !get_lame_version ||
                 !lame_init_params ||
+                !lame_encode_buffer ||
                 !lame_encode_buffer_interleaved ||
                 !lame_encode_flush ||
                 !lame_close ||
@@ -636,7 +664,7 @@
       int EncodeBuffer(short int inbuffer[], unsigned char outbuffer[]) {
          if(!mEncoding) return -1;
 
-         return lame_encode_buffer_interleaved(mGF, inbuffer, mSamplesPerChunk,
+         return lame_encode_buffer_interleaved(mGF, inbuffer, inbuffer, mSamplesPerChunk,
             outbuffer, mOutBufferSize);
       }
 
@@ -646,6 +674,19 @@
             mOutBufferSize);
       }
 
+      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);
+      }
+
       int FinishStream(unsigned char outbuffer[]) {
          mEncoding = false;
          int result = lame_encode_flush(mGF, outbuffer, mOutBufferSize);
@@ -1285,9 +1326,22 @@
       short *mixed = (short *)mixer->GetBuffer();
 
       if(lastFrame)
-         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);
+	}
+      }
 
       outFile.Write(buffer, bytes);
 
diff -ru audacity-src-1.1.1-3/src/export/ExportMP3.h /var/tmp/portage/audacity-1.1.1/work/audacity-src-1.1.1-3/src/export/ExportMP3.h
--- audacity-src-1.1.1-3/src/export/ExportMP3.h	2002-11-11 00:58:21.000000000 -0600
+++ /var/tmp/portage/audacity-1.1.1/work/audacity-src-1.1.1-3/src/export/ExportMP3.h	2003-01-15 00:30:29.000000000 -0600
@@ -38,6 +38,11 @@
       virtual int EncodeBuffer(short int inbuffer[], unsigned char outbuffer[]) = 0;
       virtual int EncodeRemainder(short int inbuffer[], int nSamples,
                                unsigned char outbuffer[]) = 0;
+
+      virtual int EncodeBufferMono(short int inbuffer[], unsigned char outbuffer[]) = 0;
+      virtual int EncodeRemainderMono(short int inbuffer[], int nSamples,
+                               unsigned char outbuffer[]) = 0;
+
       virtual int FinishStream(unsigned char outbuffer[]) = 0;
       virtual void CancelEncoding() = 0;