Guidance Forums / wxWidgets (wxWindows) in C++ / upgrade problem

Search 搜索
Home Home

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. upgrade problem
Posted by: 2003-12-02 21:23:34
In order to solve the problem i posted about last week, i am now trying to upgrade 229 to 242. So far i am not really happy with the compatibility. :(

One of the problems i cannot solve myself. Much of the program i have not written myself, this part is about multithreading, i have read the info on, but i simply dont get it. :(

I get the following error at the arrow:
"error C2512: 'wxCondition' : no appropriate default constructor available"

i have no idea how to solve this. Thanx for helping.

cReadThread::cReadThread(int FileNr, const wxString& FullPath)
{                                                                                           <-----------ERROR
  wxASSERT((FileNr >= 0) && (FileNr <= MaxNrOfFiles));
  wxLogDebug("cReadThread %d cReadThread(%s)", FileNr, FullPath);
  //save the file number and the fullpath
  m_FileNr = FileNr;
  m_FullPath = FullPath;

  //open the audio file with libsndfile
  m_SndFile = NULL;
  m_SndFile = sf_open_read(m_FullPath, &m_SndFileInfo);
  if(m_SndFile == NULL)
    wxString Temp;
    Temp.Printf("The audio file "%s" could not be opened."
                "Check if the file is a valid audio file.",
    throw cReadThreadException(Temp);

  //check if the file format is supported

  //set all member variables to their initial value
  m_FilePositionFrames = 0;
  m_StopReading = false;
  m_IsReading = false;
  m_LastIndex = 0;


class cReadThread : public wxThread
                 cReadThread(int FileNr, const wxString& FullPath) throw(cReadThreadException);
    virtual void *Entry(); //thread execution starts here
    void         StartReading(int StartFilePositionFrames);
    void         StopReading();
    bool         IsReading();
    wxString     GetFilePath();
    void         GetAudioInfo(cAudioInfo& AudioInfo);
    float        GetFileDurationSec();
    wxString     AudioFormatToString();

    wxCondition  m_ConditionStartRead; //needs to be public so AudioIO can access it
    void         FillBlocks();
    void         CheckFormat() throw(cReadThreadException);

    int          m_FileNr; //the number of the audiofile. is used for finding the right buffer blocks
    wxString     m_FullPath; //the audiofile to read data from.
    SNDFILE      *m_SndFile; //pointer to audiofile, needed for libsndfile.
    SF_INFO      m_SndFileInfo; //structure with info about the opened audiofile.
    cAudioInfo   m_AudioInfo;
    long         m_FilePositionFrames; //the current read position in the file, in frames.
    int          m_LastIndex; //the index of the last buffer block that was filled.
    bool         m_StopReading;
    bool         m_IsReading;
Message2. Re: upgrade problem
Posted by: upCASE 2003-12-03 05:34:08
The problem really is in your header at this line

 wxCondition  m_ConditionStartRead; //needs to be public so AudioIO can access it

Check the API for wxCondition.
wxCondition(wxMutex& mutex)

Default and only constructor. The mutex must be locked by the caller before calling Wait function.

Use IsOk to check if the object was successfully intiialized.
Since there is no wxCondition::wxCondition() you'll have to use a mutex. Have a look at the example given for wxCondition and either change your code or comment out that line.

If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
© Sat 2023-2-4  Guidance Laboratory Inc. Hits:0