Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

audioconfig.C

Go to the documentation of this file.
00001 #include "audioconfig.h"
00002 #include "audiodevice.inc"
00003 #include "defaults.h"
00004 #include "maxchannels.h"
00005 #include <string.h>
00006 #include <string.h>
00007 
00008 #define CLAMP(x, y, z) (x) = ((x) < (y) ? (y) : ((x) > (z) ? (z) : (x)))
00009 
00010 AudioConfig::AudioConfig()
00011 {
00012 }
00013 
00014 AudioConfig::~AudioConfig()
00015 {
00016 }
00017 
00018 AudioConfig& AudioConfig::operator=(AudioConfig &that)
00019 {
00020 // Input
00021         audio_in_driver = that.audio_in_driver;
00022         afirewire_in_port = that.afirewire_in_port;
00023         afirewire_in_channel = that.afirewire_in_channel;
00024         strcpy(esound_in_server, that.esound_in_server);
00025         esound_in_port = that.esound_in_port;
00026         strcpy(oss_in_device, that.oss_in_device);
00027         oss_in_channels = that.oss_in_channels;
00028         oss_in_bits = that.oss_in_bits;
00029 
00030 // Output
00031         audio_out_driver = that.audio_out_driver;
00032         strcpy(oss_out_device, that.oss_out_device);
00033         strcpy(esound_out_server, that.esound_out_server);
00034         esound_out_port = that.esound_out_port;
00035         oss_out_channels = that.oss_out_channels;
00036         oss_out_bits = that.oss_out_bits;
00037 
00038 // Duplex
00039         audio_duplex_driver = that.audio_duplex_driver;
00040         strcpy(oss_duplex_device, that.oss_duplex_device);
00041         strcpy(esound_duplex_server, that.esound_duplex_server);
00042         esound_duplex_port = that.esound_duplex_port;
00043         oss_duplex_channels = that.oss_duplex_channels;
00044         oss_duplex_bits = that.oss_duplex_bits;
00045         CLAMP(oss_in_channels, 1, MAXCHANNELS);
00046         CLAMP(oss_in_bits, 8, 32);
00047         CLAMP(oss_duplex_channels, 1, MAXCHANNELS);
00048         CLAMP(oss_duplex_bits, 8, 32);
00049         return *this;
00050 }
00051 
00052 int AudioConfig::load_defaults(Defaults *defaults)
00053 {
00054         audio_in_driver =             defaults->get("AUDIOINDRIVER", AUDIO_OSS);
00055         afirewire_in_port =           defaults->get("AFIREWIRE_IN_PORT", 0);
00056         afirewire_in_channel =        defaults->get("AFIREWIRE_IN_CHANNEL", 63);
00057         sprintf(oss_in_device, "/dev/dsp");
00058                                       defaults->get("OSS_IN_DEVICE", oss_in_device);
00059         oss_in_channels =             defaults->get("OSS_IN_CHANNELS", 2);
00060         oss_in_bits =                 defaults->get("OSS_IN_BITS", 16);
00061         sprintf(esound_in_server, "");
00062                                       defaults->get("ESOUND_IN_SERVER", esound_in_server);
00063         esound_in_port =              defaults->get("ESOUND_IN_PORT", 0);
00064 
00065         audio_out_driver =                defaults->get("AUDIO_OUT_DRIVER", AUDIO_OSS);
00066         audio_duplex_driver =             defaults->get("AUDIO_DUPLEX_DRIVER", AUDIO_OSS);
00067         sprintf(oss_out_device, "/dev/dsp");
00068                                       defaults->get("OSS_OUT_DEVICE", oss_out_device);
00069         oss_out_channels =                defaults->get("OUT_CHANNELS", 2);
00070         oss_out_bits =                defaults->get("OUT_BITS", 16);
00071         sprintf(esound_out_server, "");
00072                                       defaults->get("ESOUND_OUT_SERVER", esound_out_server);
00073         esound_out_port =             defaults->get("ESOUND_OUT_PORT", 0);
00074 
00075         audio_duplex_driver =         defaults->get("AUDIO_DUPLEX_DRIVER", AUDIO_OSS);
00076         sprintf(oss_duplex_device, "/dev/dsp");
00077                                       defaults->get("OSS_DUPLEX_DEVICE", oss_duplex_device);
00078         oss_duplex_channels =         defaults->get("DUPLEX_CHANNELS", 2);
00079         oss_duplex_bits =             defaults->get("DUPLEX_BITS", 16);
00080         sprintf(esound_duplex_server, "");
00081                                       defaults->get("ESOUND_DUPLEX_SERVER", esound_duplex_server);
00082         esound_duplex_port =          defaults->get("ESOUND_DUPLEX_PORT", 0);
00083         return 0;
00084 }
00085 
00086 int AudioConfig::save_defaults(Defaults *defaults)
00087 {
00088         defaults->update("AUDIOINDRIVER", audio_in_driver);
00089         defaults->update("AFIREWIRE_IN_PORT", afirewire_in_port);
00090         defaults->update("AFIREWIRE_IN_CHANNEL", afirewire_in_channel);
00091         defaults->update("OSS_IN_DEVICE", oss_in_device);
00092         defaults->update("OSS_IN_CHANNELS", oss_in_channels);
00093         defaults->update("OSS_IN_BITS", oss_in_bits);
00094         defaults->update("ESOUND_IN_SERVER", esound_in_server);
00095         defaults->update("ESOUND_IN_PORT", esound_in_port);
00096 
00097         defaults->update("AUDIO_OUT_DRIVER", audio_out_driver);
00098         defaults->update("AUDIO_DUPLEX_DRIVER", audio_duplex_driver);
00099         defaults->update("OSS_OUT_DEVICE", oss_out_device);
00100         defaults->update("OUT_CHANNELS", oss_out_channels);
00101         defaults->update("OUT_BITS", oss_out_bits);
00102         defaults->update("ESOUND_OUT_SERVER", esound_out_server);
00103         defaults->update("ESOUND_OUT_PORT", esound_out_port);
00104 
00105         defaults->update("AUDIO_DUPLEX_DRIVER", audio_duplex_driver);
00106         defaults->update("OSS_DUPLEX_DEVICE", oss_duplex_device);
00107         defaults->update("OSS_DUPLEX_CHANNELS", oss_duplex_channels);
00108         defaults->update("OSS_DUPLEX_BITS", oss_duplex_bits);
00109         defaults->update("ESOUND_DUPLEX_SERVER", esound_duplex_server);
00110         defaults->update("ESOUND_DUPLEX_PORT", esound_duplex_port);
00111         return 0;
00112 }

Generated on Sun Jan 8 13:38:50 2006 for Cinelerra-svn by  doxygen 1.4.4