Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / upgrade problem

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. upgrade problem
#3042
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 wxwindows.org, 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)
             :wxThread(wxTHREAD_JOINABLE)
{                                                                                           <-----------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.",
                FullPath);
    throw cReadThreadException(Temp);
  }

  //check if the file format is supported
  CheckFormat();

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

  //m_AudioInfo.LogDebug();
}



class cReadThread : public wxThread
{
  public:
                 cReadThread(int FileNr, const wxString& FullPath) throw(cReadThreadException);
                 ~cReadThread();
    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
  private:
    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
#3045
Posted by: upCASE 2003-12-03 05:34:08
Hi!
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::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.

upcase
upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-4-19  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0