• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Sound project code question?

Mike "riff"

Member
Joined
Dec 27, 2016
Messages
16
Reaction score
5
Location
Toled,Ohio
Started sound project, know my plan where I'm going just can't get past this function call. Anyone who know c++ really well that cant give suggestions.
Code:
#include <string>



class CreatureSounds
{
public:
    CreatureSounds();
    ~CreatureSounds();

    char filePath[20] = "../data/sound";
    void getCreatureSound(const std::string& fileName);
private:
    
    unsigned m_creatureSound = 0;
    unsigned m_creatureGroup = 0;
    unsigned m_numChannels = 0;
Code:
#include "CreatureSounds.h"
#include "soundsource.h"

#include <iostream>


CreatureSounds::CreatureSounds()
{

}


CreatureSounds::~CreatureSounds()
{

}

void CreatureSounds::getCreatureSound(const std::string& fileName) {

    // how do I get creature name?

    // creatureName = filename

    std::ifstream file(filePath + fileName);

    file.open(fileName);

    if (file.fail()) {
        ERROR_ALERTED;
        std::cout << "File could not be found." << std::endl;

    }

}
 
solved
Code:
void CreatureSounds::getCreatureSound(const std::string& fileName) {

    const std::string& CreatureAttrName = fileName;

    std::ifstream file(filePath + fileName);

    file.open(fileName);

    if (file.fail()) {
        ERROR_ALERTED;
        std::cout << "File could not be found." << std::endl;

    }

}
 
Back
Top