0 Members and 1 Guest are viewing this topic.
// A modified SFML SoundStream class#include <SFML/Audio.hpp>#include <iostream> #include "emuStream.h"emuStream::emuStream(){ emu = NULL; gme_err_t err = gme_open_file("testing.nsf",&emu,44100); number_of_tracks = gme_track_count(emu); c_track = 0; gme_start_track(emu,c_track); Initialize(2,44100);}emuStream::emuStream(std::string fname){ emu = NULL; gme_err_t err = gme_open_file(fname.c_str(),&emu,44100); std::cout << err; // You may want to add exception handling for the returned error. number_of_tracks = gme_track_count(emu); c_track = 0; gme_start_track(emu,c_track); Initialize(2,44100);}bool emuStream::OnOpen(){ return true;}int emuStream::GetTracks(){ return gme_track_count(emu);}void emuStream::SetTrack(int track){ if(track <= number_of_tracks-1) { gme_start_track(emu,track); c_track = track; }}void emuStream::NextTrack(){ if(c_track < number_of_tracks - 1) { c_track += 1; } gme_start_track(emu,c_track);}bool emuStream::OnGetData(Chunk& Data){ short int *sndsample = NULL; sndsample = (short int*)malloc(sizeof(short int*)*buffer_size); if(!sndsample) { return false; } if(gme_track_ended(emu)) { if(c_track < number_of_tracks - 1) { c_track += 1; } gme_start_track(emu,c_track); } gme_err_t err = gme_play(emu,buffer_size,&sndsample[0]); Data.Samples = sndsample; Data.NbSamples = buffer_size; return true;}emuStream::~emuStream(){ gme_delete(emu);}
SFML.cpp: In function ‘double gmeInit(const char*)’:SFML.cpp:83:35: error: cannot allocate an object of abstract type ‘emuStream’emuStream.h:10:7: note: because the following virtual functions are pure within ‘emuStream’:/usr/include/SFML/Audio/SoundStream.hpp:238:18: note: virtual void sf::SoundStream::OnSeek(sf::Uint32)SFML.cpp: In function ‘double gmeLoad(const char*)’:SFML.cpp:99:35: error: cannot allocate an object of abstract type ‘emuStream’emuStream.h:10:7: note: since type ‘emuStream’ has pure virtual functionsmake[2]: *** [.eobjs/Linux/Linux/Run/SFML.o] Error 1make[2]: Leaving directory `/home/greg/Dropbox/Public/GM Stuff/enigma-dev/ENIGMAsystem/SHELL/Audio_Systems/SFML'make[1]: *** [build] Error 2make[1]: Leaving directory `/home/greg/Dropbox/Public/GM Stuff/enigma-dev/ENIGMAsystem/SHELL'make: *** [Game] Error 2
error: cannot allocate an object of abstract type ‘emuStream’ because the following virtual functions are pure within ‘emuStream’: virtual void sf::SoundStream::OnSeek(sf::Uint32)