Skip to content

Commit 2f2e166

Browse files
committed
[[ Cocoa ]] Refactored QT sound recording.
1 parent 490e2d1 commit 2f2e166

11 files changed

Lines changed: 438 additions & 459 deletions

File tree

engine/engine.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
4D8387211678B2C9003BEC7C /* imagebitmap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D83871C1678B2C9003BEC7C /* imagebitmap.cpp */; };
322322
4D8387221678B2C9003BEC7C /* irle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D83871D1678B2C9003BEC7C /* irle.cpp */; };
323323
4D8589F9173AAA0900B20951 /* uuid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D8589AA173A856600B20951 /* uuid.cpp */; };
324+
4D87710018C8B30700A88AF9 /* quicktime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4D8770FF18C8B30700A88AF9 /* quicktime.cpp */; };
324325
4D8B47990BE7B3240046CD2F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D8B47960BE7B3240046CD2F /* Cocoa.framework */; };
325326
4D8B479A0BE7B3240046CD2F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D8B47960BE7B3240046CD2F /* Cocoa.framework */; };
326327
4D8BED0211B959F500DED42A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D8BED0111B959F500DED42A /* Security.framework */; };
@@ -1297,6 +1298,7 @@
12971298
4D8387261678B2F4003BEC7C /* imagebitmap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imagebitmap.h; path = src/imagebitmap.h; sourceTree = "<group>"; };
12981299
4D8589AA173A856600B20951 /* uuid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = uuid.cpp; path = src/uuid.cpp; sourceTree = "<group>"; };
12991300
4D8589AC173A88D700B20951 /* uuid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = uuid.h; path = src/uuid.h; sourceTree = "<group>"; };
1301+
4D8770FF18C8B30700A88AF9 /* quicktime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = quicktime.cpp; path = src/quicktime.cpp; sourceTree = "<group>"; };
13001302
4D88B73815F4C66F002CFBD6 /* libgif.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libgif.xcodeproj; path = ../thirdparty/libgif/libgif.xcodeproj; sourceTree = SOURCE_ROOT; };
13011303
4D8B47960BE7B3240046CD2F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13021304
4D8BEC3F11B9379500DED42A /* osxicon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = osxicon.cpp; path = src/osxicon.cpp; sourceTree = "<group>"; };
@@ -2258,6 +2260,7 @@
22582260
4D05B90D13E06AAB001CD82A /* dskmain.cpp */,
22592261
4D05B90F13E06AAC001CD82A /* dskw32main.cpp */,
22602262
4DE7ED0D13B33B7F002634F5 /* dskspec.cpp */,
2263+
4D8770FF18C8B30700A88AF9 /* quicktime.cpp */,
22612264
);
22622265
name = Desktop;
22632266
sourceTree = "<group>";
@@ -3654,6 +3657,7 @@
36543657
4D30E44618AA7C200034CDC6 /* desktop-ans.cpp in Sources */,
36553658
E82206E1184F810A00117D10 /* resolution.cpp in Sources */,
36563659
4DAF5C8718C0E76500B9713C /* mac-scripting.mm in Sources */,
3660+
4D87710018C8B30700A88AF9 /* quicktime.cpp in Sources */,
36573661
);
36583662
runOnlyForDeploymentPostprocessing = 0;
36593663
};

engine/src/answer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,8 @@ Exec_errors MCAnswer::exec_effect(MCExecPoint& ep, const char *p_title)
425425
Exec_errors MCAnswer::exec_record(MCExecPoint& ep, const char *p_title)
426426
{
427427
MCresult -> clear(False);
428-
MCtemplateplayer -> stdrecorddlg(ep, p_title, sheet);
428+
extern void MCQTRecordDialog(MCExecPoint& ep, const char *p_title, Boolean sheet);
429+
MCQTRecordDialog(ep, p_title, sheet);
429430
return EE_UNDEFINED;
430431
}
431432
#endif /* MCAnswer::exec_record */

engine/src/cmdsc.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,7 +1924,9 @@ Exec_stat MCRecord::exec(MCExecPoint &ep)
19241924
return ES_ERROR;
19251925
}
19261926
char *soundfile = MCS_get_canonical_path(ep.getcstring());
1927-
MCtemplateplayer->recordsound(soundfile);
1927+
1928+
extern void MCQTRecordSound(char *soundfile);
1929+
MCQTRecordSound(soundfile);
19281930
return ES_NORMAL;
19291931
#endif /* MCRecord */
19301932
}

engine/src/cmdse.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,8 @@ Exec_stat MCStop::exec(MCExecPoint &ep)
22562256
MCU_play_stop();
22572257
break;
22582258
case SC_RECORDING:
2259-
MCtemplateplayer->stoprecording();
2259+
extern void MCQTStopRecording(void);
2260+
MCQTStopRecording();
22602261
break;
22612262
case SC_USING:
22622263
{

engine/src/desktop-dc.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,16 @@ Boolean MCScreenDC::wait(real8 duration, Boolean dispatch, Boolean anyevent)
834834
else if (!done && eventtime > curtime)
835835
t_sleep = MCMin(eventtime - curtime, exittime - curtime);
836836

837+
#ifdef FEATURE_QUICKTIME_EFFECTS
838+
// If we are recording, then poke QT (if enabled) and reduce sleep.
839+
if (MCrecording)
840+
{
841+
extern void MCQTHandleRecord(void);
842+
MCQTHandleRecord();
843+
t_sleep = MCMin(0.1, t_sleep);
844+
}
845+
#endif
846+
837847
// Wait for t_sleep seconds and collect at most one event. If an event
838848
// is collected and anyevent is True, then we are done.
839849
if (MCPlatformWaitForEvent(t_sleep, dispatch == False) && anyevent)

engine/src/funcs.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,15 +1909,17 @@ Exec_stat MCQTEffects::eval(MCExecPoint &ep)
19091909
Exec_stat MCRecordCompressionTypes::eval(MCExecPoint &ep)
19101910
{
19111911
#ifdef /* MCRecordCompressionTypes */ LEGACY_EXEC
1912-
MCtemplateplayer->getrecordcompressionlist(ep);
1912+
extern void MCQTGetRecordCompressionList(MCExecPoint& ep);
1913+
MCQTGetRecordCompressionList(ep);
19131914
return ES_NORMAL;
19141915
#endif /* MCRecordCompressionTypes */
19151916
}
19161917

19171918
Exec_stat MCRecordLoudness::eval(MCExecPoint &ep)
19181919
{
19191920
#ifdef /* MCRecordLoudness */ LEGACY_EXEC
1920-
MCtemplateplayer->getrecordloudness(ep);
1921+
extern void MCQTGetRecordLoudness(MCExecPoint& ep);
1922+
MCQTGetRecordLoudness(ep);
19211923
return ES_NORMAL;
19221924
#endif /* MCRecordLoudness */
19231925
}

engine/src/globals.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,10 @@ int X_close(void)
10141014

10151015
MCU_play_stop();
10161016
if (MCrecording)
1017-
MCtemplateplayer->stoprecording();
1017+
{
1018+
extern void MCQTStopRecording(void);
1019+
MCQTStopRecording();
1020+
}
10181021
MClockmessages = True;
10191022
MCS_killall();
10201023

0 commit comments

Comments
 (0)