- if (!wxInitQT())
- return false;
- Handle myHandle, dataRef = nil;
- MovieImportComponent miComponent;
- Track targetTrack = nil;
- TimeValue addedDuration = 0;
- long outFlags = 0;
- OSErr err;
- ComponentResult result;
-
- myHandle = NewHandleClear((Size)m_waveLength);
-
- BlockMove(m_hSnd, *myHandle, m_waveLength);
-
- err = PtrToHand(&myHandle, &dataRef, sizeof(Handle));
-
- if (memcmp(&m_hSnd[8], "WAVE", 4) == 0)
- miComponent = OpenDefaultComponent(MovieImportType, kQTFileTypeWave);
- else if (memcmp(&m_hSnd[8], "AIFF", 4) == 0)
- miComponent = OpenDefaultComponent(MovieImportType, kQTFileTypeAIFF);
- else if (memcmp(&m_hSnd[8], "AIFC", 4) == 0)
- miComponent = OpenDefaultComponent(MovieImportType, kQTFileTypeAIFC);
- else
- {
- wxLogSysError(wxT("wxSound - Location in memory does not contain valid data"));
- return false;
- }
-
- movie = NewMovie(0);
-
- result = MovieImportDataRef(miComponent, dataRef,
- HandleDataHandlerSubType, movie,
- nil, &targetTrack,
- nil, &addedDuration,
- movieImportCreateTrack, &outFlags);
-
- if (result != noErr)
- {
- wxLogSysError(wxString::Format(wxT("Couldn't import movie data\nError:%i"), (int)result));
- }
-
- SetMovieVolume(movie, kFullVolume);
- GoToBeginningOfMovie(movie);
-
- DisposeHandle(myHandle);