debugging with .wav

main
Tom Early 4 years ago
parent 788956d3ed
commit d2cf1cf2c6

@ -18,6 +18,8 @@
#include <sys/select.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include "TranscoderPacket.h"
#include "Controller.h"
@ -414,11 +416,28 @@ void CController::ReadDevice(std::shared_ptr<CDV3003> device, EAmbeType type)
// the socket will automatically close after sending
#ifdef DEBUG
Dump(spPacket, "Completed Transcoder packet");
AppendWave(spPacket);
#endif
}
}
}
void CController::AppendWave(const std::shared_ptr<CTranscoderPacket> packet) const
{
std::stringstream sstr;
sstr << std::hex << ntohs(packet->GetStreamId()) << ".raw";
std::ofstream pcmfile(sstr.str(), std::ofstream::binary);
if (pcmfile.good())
{
for (unsigned int i=0; i<160; i++)
pcmfile << packet->GetAudio()[i];
pcmfile.close();
}
else
std::cerr << "could not open pcm file " << sstr.str();
}
#ifdef DEBUG
void CController::Dump(const std::shared_ptr<CTranscoderPacket> p, const std::string &title) const
{

@ -58,6 +58,7 @@ protected:
void ReadDevice(std::shared_ptr<CDV3003> dv3003, EAmbeType type);
void AddFDSet(int &max, int newfd, fd_set *set) const;
#ifdef DEBUG
void AppendWave(const std::shared_ptr<CTranscoderPacket> packet) const;
void Dump(const std::shared_ptr<CTranscoderPacket> packet, const std::string &title) const;
#endif
};

Loading…
Cancel
Save

Powered by TurnKey Linux.