-/*static short MacOpenSndFile (char * path)
-{
- VolumeParam vp;
- FSSpec fspec;
- Str255 name;
- char *c;
-
- // first, get the volume reference number for the file. Start by
- // making a Pstring with just the volume name
- strcpy ((char *) name, path);
- if (c = strchr ((char *) name, ':'))
- {
- c++;
- *c = '\0';
- }
+ switch(m_type)
+ {
+ case wxSound_MEMORY:
+ {
+ 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);
+ }
+ break;
+ case wxSound_RESOURCE:
+ {
+ SoundComponentData data;
+ unsigned long numframes, offset;