7bb91fa038
checked in (request 36762) OBS-URL: https://build.opensuse.org/request/show/36762 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/ladspa?expand=0&rev=14
222 lines
8.0 KiB
Diff
222 lines
8.0 KiB
Diff
--- src/plugins/sine.cpp-dist 2005-10-04 16:29:44.000000000 +0200
|
|
+++ src/plugins/sine.cpp 2005-10-05 12:13:25.000000000 +0200
|
|
@@ -31,6 +31,8 @@
|
|
#define OSC_AMPLITUDE 1
|
|
#define OSC_OUTPUT 2
|
|
|
|
+namespace ladspa_sdk_sine {
|
|
+
|
|
/*****************************************************************************/
|
|
|
|
/* Sine table size is given by (1<<SINE_TABLE_BITS). */
|
|
@@ -92,99 +94,123 @@
|
|
}
|
|
|
|
friend LADSPA_Handle instantiateSineOscillator(const LADSPA_Descriptor *,
|
|
- unsigned long SampleRate) {
|
|
- return new SineOscillator(SampleRate);
|
|
- }
|
|
-
|
|
+ unsigned long SampleRate);
|
|
friend void connectPortToSineOscillator(LADSPA_Handle Instance,
|
|
unsigned long Port,
|
|
- LADSPA_Data * DataLocation) {
|
|
- switch (Port) {
|
|
- case OSC_FREQUENCY:
|
|
- ((SineOscillator *)Instance)->m_pfFrequency = DataLocation;
|
|
- break;
|
|
- case OSC_AMPLITUDE:
|
|
- ((SineOscillator *)Instance)->m_pfAmplitude = DataLocation;
|
|
- break;
|
|
- case OSC_OUTPUT:
|
|
- ((SineOscillator *)Instance)->m_pfOutput = DataLocation;
|
|
- break;
|
|
- }
|
|
- }
|
|
+ LADSPA_Data * DataLocation);
|
|
+ friend void activateSineOscillator(void * pvHandle);
|
|
+ friend void runSineOscillator_FreqAudio_AmpAudio(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount);
|
|
+ friend void runSineOscillator_FreqAudio_AmpCtrl(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount);
|
|
+ friend void runSineOscillator_FreqCtrl_AmpAudio(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount);
|
|
+ friend void runSineOscillator_FreqCtrl_AmpCtrl(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount);
|
|
+ friend void cleanupSineOscillator(void *pvHandle);
|
|
|
|
- friend void activateSineOscillator(void * pvHandle) {
|
|
- ((SineOscillator *)pvHandle)->m_lPhase = 0;
|
|
- }
|
|
+};
|
|
|
|
- friend void runSineOscillator_FreqAudio_AmpAudio(LADSPA_Handle Instance,
|
|
- unsigned long SampleCount) {
|
|
- SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
- for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
- /* Extract frequency at this point to guarantee inplace
|
|
- support. */
|
|
- LADSPA_Data fFrequency
|
|
- = (poSineOscillator->m_pfFrequency[lIndex]);
|
|
- poSineOscillator->m_pfOutput[lIndex]
|
|
- = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
- * poSineOscillator->m_pfAmplitude[lIndex]);
|
|
- poSineOscillator->setPhaseStepFromFrequency(fFrequency);
|
|
- poSineOscillator->m_lPhase
|
|
- += poSineOscillator->m_lPhaseStep;
|
|
- }
|
|
+LADSPA_Handle instantiateSineOscillator(const LADSPA_Descriptor *,
|
|
+ unsigned long SampleRate)
|
|
+{
|
|
+ return new SineOscillator(SampleRate);
|
|
+}
|
|
+
|
|
+void connectPortToSineOscillator(LADSPA_Handle Instance,
|
|
+ unsigned long Port,
|
|
+ LADSPA_Data * DataLocation)
|
|
+{
|
|
+ switch (Port) {
|
|
+ case OSC_FREQUENCY:
|
|
+ ((SineOscillator *)Instance)->m_pfFrequency = DataLocation;
|
|
+ break;
|
|
+ case OSC_AMPLITUDE:
|
|
+ ((SineOscillator *)Instance)->m_pfAmplitude = DataLocation;
|
|
+ break;
|
|
+ case OSC_OUTPUT:
|
|
+ ((SineOscillator *)Instance)->m_pfOutput = DataLocation;
|
|
+ break;
|
|
}
|
|
+}
|
|
|
|
- friend void runSineOscillator_FreqAudio_AmpCtrl(LADSPA_Handle Instance,
|
|
- unsigned long SampleCount) {
|
|
- SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
- LADSPA_Data fAmplitude = *(poSineOscillator->m_pfAmplitude);
|
|
- for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
- /* Extract frequency at this point to guarantee inplace
|
|
- support. */
|
|
- LADSPA_Data fFrequency
|
|
- = (poSineOscillator->m_pfFrequency[lIndex]);
|
|
- poSineOscillator->m_pfOutput[lIndex]
|
|
- = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
- * fAmplitude);
|
|
- poSineOscillator->setPhaseStepFromFrequency(fFrequency);
|
|
- poSineOscillator->m_lPhase
|
|
- += poSineOscillator->m_lPhaseStep;
|
|
- }
|
|
+void activateSineOscillator(void * pvHandle)
|
|
+{
|
|
+ ((SineOscillator *)pvHandle)->m_lPhase = 0;
|
|
+}
|
|
+
|
|
+void runSineOscillator_FreqAudio_AmpAudio(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount)
|
|
+{
|
|
+ SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
+ for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
+ /* Extract frequency at this point to guarantee inplace
|
|
+ support. */
|
|
+ LADSPA_Data fFrequency
|
|
+ = (poSineOscillator->m_pfFrequency[lIndex]);
|
|
+ poSineOscillator->m_pfOutput[lIndex]
|
|
+ = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
+ * poSineOscillator->m_pfAmplitude[lIndex]);
|
|
+ poSineOscillator->setPhaseStepFromFrequency(fFrequency);
|
|
+ poSineOscillator->m_lPhase
|
|
+ += poSineOscillator->m_lPhaseStep;
|
|
}
|
|
+}
|
|
|
|
- friend void runSineOscillator_FreqCtrl_AmpAudio(LADSPA_Handle Instance,
|
|
- unsigned long SampleCount) {
|
|
- SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
- poSineOscillator->setPhaseStepFromFrequency
|
|
- (*(poSineOscillator->m_pfFrequency));
|
|
- for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
- poSineOscillator->m_pfOutput[lIndex]
|
|
- = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
- * poSineOscillator->m_pfAmplitude[lIndex]);
|
|
- poSineOscillator->m_lPhase
|
|
- += poSineOscillator->m_lPhaseStep;
|
|
- }
|
|
+void runSineOscillator_FreqAudio_AmpCtrl(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount)
|
|
+{
|
|
+ SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
+ LADSPA_Data fAmplitude = *(poSineOscillator->m_pfAmplitude);
|
|
+ for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
+ /* Extract frequency at this point to guarantee inplace
|
|
+ support. */
|
|
+ LADSPA_Data fFrequency
|
|
+ = (poSineOscillator->m_pfFrequency[lIndex]);
|
|
+ poSineOscillator->m_pfOutput[lIndex]
|
|
+ = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
+ * fAmplitude);
|
|
+ poSineOscillator->setPhaseStepFromFrequency(fFrequency);
|
|
+ poSineOscillator->m_lPhase
|
|
+ += poSineOscillator->m_lPhaseStep;
|
|
}
|
|
+}
|
|
|
|
- friend void runSineOscillator_FreqCtrl_AmpCtrl(LADSPA_Handle Instance,
|
|
- unsigned long SampleCount) {
|
|
- SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
- LADSPA_Data fAmplitude = *(poSineOscillator->m_pfAmplitude);
|
|
- poSineOscillator->setPhaseStepFromFrequency
|
|
- (*(poSineOscillator->m_pfFrequency));
|
|
- for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
- poSineOscillator->m_pfOutput[lIndex]
|
|
- = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
- * fAmplitude);
|
|
- poSineOscillator->m_lPhase
|
|
- += poSineOscillator->m_lPhaseStep;
|
|
- }
|
|
+void runSineOscillator_FreqCtrl_AmpAudio(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount)
|
|
+{
|
|
+ SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
+ poSineOscillator->setPhaseStepFromFrequency
|
|
+ (*(poSineOscillator->m_pfFrequency));
|
|
+ for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
+ poSineOscillator->m_pfOutput[lIndex]
|
|
+ = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
+ * poSineOscillator->m_pfAmplitude[lIndex]);
|
|
+ poSineOscillator->m_lPhase
|
|
+ += poSineOscillator->m_lPhaseStep;
|
|
}
|
|
+}
|
|
|
|
- friend void cleanupSineOscillator(void *pvHandle) {
|
|
- delete (SineOscillator *)pvHandle;
|
|
+void runSineOscillator_FreqCtrl_AmpCtrl(LADSPA_Handle Instance,
|
|
+ unsigned long SampleCount)
|
|
+{
|
|
+ SineOscillator * poSineOscillator = (SineOscillator *)Instance;
|
|
+ LADSPA_Data fAmplitude = *(poSineOscillator->m_pfAmplitude);
|
|
+ poSineOscillator->setPhaseStepFromFrequency
|
|
+ (*(poSineOscillator->m_pfFrequency));
|
|
+ for (unsigned long lIndex = 0; lIndex < SampleCount; lIndex++) {
|
|
+ poSineOscillator->m_pfOutput[lIndex]
|
|
+ = (g_pfSineTable[poSineOscillator->m_lPhase >> SINE_TABLE_SHIFT]
|
|
+ * fAmplitude);
|
|
+ poSineOscillator->m_lPhase
|
|
+ += poSineOscillator->m_lPhaseStep;
|
|
}
|
|
+}
|
|
|
|
-};
|
|
+void cleanupSineOscillator(void *pvHandle)
|
|
+{
|
|
+ delete (SineOscillator *)pvHandle;
|
|
+}
|
|
|
|
/*****************************************************************************/
|
|
|
|
@@ -368,4 +394,6 @@
|
|
|
|
/*****************************************************************************/
|
|
|
|
+}
|
|
+
|
|
/* EOF */
|