Functioning
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
|||||||
|
#ifndef AUDIODUMP_H
|
||||||
|
#define AUDIODUMP_H
|
||||||
|
|
||||||
|
#include"stdio.h"
|
||||||
|
#include"stdlib.h"
|
||||||
|
|
||||||
|
class AudioDump
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
AudioDump()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void dump()
|
||||||
|
{
|
||||||
|
system("amixer -c 1 get DAC0 > audio.txt");
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -4,9 +4,12 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include"AudioInformation.h"
|
#include"AudioInformation.h"
|
||||||
|
#include"AudioDump.h"
|
||||||
|
|
||||||
AudioInformation::AudioInformation()
|
AudioInformation::AudioInformation()
|
||||||
{
|
{
|
||||||
|
AudioDump ad;
|
||||||
|
ad.dump();
|
||||||
stripInformation();
|
stripInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,7 +18,6 @@ void AudioInformation::stripInformation()
|
|||||||
{
|
{
|
||||||
std::fstream readAudio;
|
std::fstream readAudio;
|
||||||
readAudio.open("audio.txt", std::ios::in);
|
readAudio.open("audio.txt", std::ios::in);
|
||||||
//std::cout << "In here" << std::endl;
|
|
||||||
|
|
||||||
while (!readAudio.eof())
|
while (!readAudio.eof())
|
||||||
{
|
{
|
||||||
@@ -30,12 +32,10 @@ void AudioInformation::stripInformation()
|
|||||||
if (count == 3)
|
if (count == 3)
|
||||||
{
|
{
|
||||||
readAudio >> data;
|
readAudio >> data;
|
||||||
std::cout << data << " volume" << std::endl;
|
|
||||||
volume = atoi(data.c_str());
|
volume = atoi(data.c_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//std::cout << std::endl;
|
|
||||||
|
|
||||||
readAudio.close();
|
readAudio.close();
|
||||||
readAudio.open("currentVolume.txt", std::ios::out);
|
readAudio.open("currentVolume.txt", std::ios::out);
|
||||||
|
|||||||
@@ -1,11 +1,28 @@
|
|||||||
|
#include"stdio.h"
|
||||||
|
#include"stdlib.h"
|
||||||
|
|
||||||
|
#include"AudioInformation.h"
|
||||||
#include"DecreaseVolume.h"
|
#include"DecreaseVolume.h"
|
||||||
|
|
||||||
DecreaseVolume::DecreaseVolume()
|
DecreaseVolume::DecreaseVolume()
|
||||||
{
|
{
|
||||||
|
AudioInformation vol;
|
||||||
|
|
||||||
|
volume = vol.getVolume();
|
||||||
|
|
||||||
|
newVolume();
|
||||||
|
updateVolume();
|
||||||
|
updateTheCurrentVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DecreaseVolume::newVolume()
|
||||||
|
{
|
||||||
|
volume = volume - AFFECTAMOUNT;
|
||||||
|
}
|
||||||
void DecreaseVolume::updateVolume()
|
void DecreaseVolume::updateVolume()
|
||||||
{
|
{
|
||||||
|
std::string command = "amixer -c 1 set DAC0 ";
|
||||||
|
command.append(std::to_string(volume));
|
||||||
|
system(command.c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class DecreaseVolume : public Volume
|
|||||||
public:
|
public:
|
||||||
DecreaseVolume();
|
DecreaseVolume();
|
||||||
|
|
||||||
|
void newVolume();
|
||||||
void updateVolume();
|
void updateVolume();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#Volume Dump
|
|
||||||
|
|
||||||
|
|
||||||
amixer -c 1 get DAC0 > audio.txt
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
#include"stdio.h"
|
||||||
|
#include"stdlib.h"
|
||||||
|
|
||||||
|
#include"IncreaseVolume.h"
|
||||||
|
#include"AudioInformation.h"
|
||||||
|
|
||||||
|
IncreaseVolume::IncreaseVolume()
|
||||||
|
{
|
||||||
|
AudioInformation vol;
|
||||||
|
|
||||||
|
volume = vol.getVolume();
|
||||||
|
|
||||||
|
newVolume();
|
||||||
|
updateVolume();
|
||||||
|
updateTheCurrentVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void IncreaseVolume::newVolume()
|
||||||
|
{
|
||||||
|
volume = volume + AFFECTAMOUNT;
|
||||||
|
}
|
||||||
|
void IncreaseVolume::updateVolume()
|
||||||
|
{
|
||||||
|
std::string command = "amixer -c 1 set DAC0 ";
|
||||||
|
command.append(std::to_string(volume));
|
||||||
|
system(command.c_str());
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef INCREASEVOLUME_H
|
||||||
|
#define INCREASEVOLUME_H
|
||||||
|
|
||||||
|
#include"Volume.h"
|
||||||
|
|
||||||
|
class IncreaseVolume : public Volume
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
IncreaseVolume();
|
||||||
|
|
||||||
|
void newVolume();
|
||||||
|
void updateVolume();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -14,15 +14,13 @@ int main(int argc, char* argv[])
|
|||||||
if (action.compare("up") == 0)
|
if (action.compare("up") == 0)
|
||||||
{
|
{
|
||||||
IncreaseVolume iv;
|
IncreaseVolume iv;
|
||||||
//iv.setVolume(30);
|
|
||||||
|
|
||||||
std::cout << "Volume test: " << iv.getVolume() << std::endl;
|
//std::cout << "Volume test: " << iv.getVolume() << std::endl;
|
||||||
}
|
}
|
||||||
else if (action.compare("down") == 0)
|
else if (action.compare("down") == 0)
|
||||||
{
|
{
|
||||||
DecreaseVolume dv;
|
DecreaseVolume dv;
|
||||||
//dv.setVolume(70);
|
//std::cout << "Volume test: " << dv.getVolume() << std::endl;
|
||||||
std::cout << "Volume test: " << dv.getVolume() << std::endl;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user