Skip to content

Commit 632f611

Browse files
author
runrevali
committed
[[ Bug 12885 ]] Update Quicktime sound recording to use SGAudioMediaType
1 parent ab94dbb commit 632f611

13 files changed

Lines changed: 1121 additions & 9 deletions

engine/engine.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,8 @@
525525
4DFFC7E113DD8A91006233A4 /* sysunxnetwork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFC7DF13DD8A91006233A4 /* sysunxnetwork.cpp */; };
526526
4DFFC7E713DD8AB9006233A4 /* objectpropsets.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFC7E613DD8AB9006233A4 /* objectpropsets.cpp */; };
527527
4DFFC7EF13DD8AFC006233A4 /* name.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFC7EE13DD8AFC006233A4 /* name.cpp */; };
528+
76CCAA7C19800BCD00C79271 /* mac-qt-recorder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 76CCAA7B198003B000C79271 /* mac-qt-recorder.mm */; };
529+
76CCAA7E1980152A00C79271 /* platform-recorder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76CCAA7D19800EFE00C79271 /* platform-recorder.cpp */; };
528530
A71F80540F4F178C003012FD /* Standalone.icns in Resources */ = {isa = PBXBuildFile; fileRef = A71F80530F4F178C003012FD /* Standalone.icns */; };
529531
A71F80550F4F17C1003012FD /* LiveCode.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D5885610B80DEAC00200116 /* LiveCode.icns */; };
530532
A71F80620F4F17F9003012FD /* StandaloneDoc.icns in Resources */ = {isa = PBXBuildFile; fileRef = A71F80610F4F17F9003012FD /* StandaloneDoc.icns */; };
@@ -1524,6 +1526,8 @@
15241526
4DFFC7DF13DD8A91006233A4 /* sysunxnetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sysunxnetwork.cpp; path = src/sysunxnetwork.cpp; sourceTree = "<group>"; };
15251527
4DFFC7E613DD8AB9006233A4 /* objectpropsets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = objectpropsets.cpp; path = src/objectpropsets.cpp; sourceTree = "<group>"; };
15261528
4DFFC7EE13DD8AFC006233A4 /* name.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = name.cpp; path = src/name.cpp; sourceTree = "<group>"; };
1529+
76CCAA7B198003B000C79271 /* mac-qt-recorder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = "mac-qt-recorder.mm"; path = "src/mac-qt-recorder.mm"; sourceTree = "<group>"; };
1530+
76CCAA7D19800EFE00C79271 /* platform-recorder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "platform-recorder.cpp"; path = "src/platform-recorder.cpp"; sourceTree = "<group>"; };
15271531
A04643DB0BAAA63A0030A830 /* w32ans.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = w32ans.cpp; path = src/w32ans.cpp; sourceTree = "<group>"; };
15281532
A04643DE0BAAA63A0030A830 /* w32dc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = w32dc.cpp; path = src/w32dc.cpp; sourceTree = "<group>"; };
15291533
A04643DF0BAAA63A0030A830 /* w32dc.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = w32dc.h; path = src/w32dc.h; sourceTree = "<group>"; };
@@ -1898,6 +1902,7 @@
18981902
4D232D5618DAEDEF00A4FF3E /* Platform */ = {
18991903
isa = PBXGroup;
19001904
children = (
1905+
76CCAA7D19800EFE00C79271 /* platform-recorder.cpp */,
19011906
4DECC94018856DB400463D52 /* platform.h */,
19021907
4DECC9AB18857A9100463D52 /* platform.cpp */,
19031908
4DECC9A918857A3900463D52 /* platform-internal.h */,
@@ -2088,6 +2093,7 @@
20882093
4D6F92ED12AA5C7800026A72 /* Desktop - Mac */ = {
20892094
isa = PBXGroup;
20902095
children = (
2096+
76CCAA7B198003B000C79271 /* mac-qt-recorder.mm */,
20912097
E8AE876B177B3F5C0041B7E0 /* cgimageutil.cpp */,
20922098
4C977250193CAF5000DB2F4A /* coretextfonts.cpp */,
20932099
4D5880140B80A4F800200116 /* osxcoreimage.cpp */,
@@ -3854,6 +3860,8 @@
38543860
1DDE08D11945DD32000E3705 /* mac-qt-player.mm in Sources */,
38553861
1DDE08D31945DD43000E3705 /* mac-av-player.mm in Sources */,
38563862
E87FAFEC1924F25000ED338B /* region.cpp in Sources */,
3863+
76CCAA7C19800BCD00C79271 /* mac-qt-recorder.mm in Sources */,
3864+
76CCAA7E1980152A00C79271 /* platform-recorder.cpp in Sources */,
38573865
);
38583866
runOnlyForDeploymentPostprocessing = 0;
38593867
};

engine/src/ans.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,6 @@ extern void MCA_getcolordialogcolors(MCExecPoint &ep);
103103

104104
extern void MCA_setcolordialogcolors(MCExecPoint &ep);
105105

106+
extern void MCA_record(MCExecPoint &ep);
107+
106108
#endif

engine/src/answer.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
4242
#include "answer.h"
4343
#include "printer.h"
4444

45+
#include "platform.h"
46+
4547
const char *MCdialogtypes[] =
4648
{
4749
"plain",
@@ -427,7 +429,31 @@ Exec_errors MCAnswer::exec_record(MCExecPoint& ep, const char *p_title)
427429
MCresult -> clear(False);
428430

429431
#ifdef FEATURE_PLATFORM_RECORDER
430-
// TODO-RECORDER: Implement using MCPlatformSoundRecorder.
432+
433+
extern MCPlatformSoundRecorderRef MCrecorder;
434+
if (MCrecorder == nil)
435+
MCPlatformSoundRecorderCreate(MCrecorder);
436+
437+
MCPlatformSoundRecorderBeginConfigurationDialog(MCrecorder);
438+
439+
MCPlatformDialogResult t_result;
440+
441+
for (;;)
442+
{
443+
t_result = MCPlatformSoundRecorderEndConfigurationDialog(MCrecorder);
444+
if (t_result != kMCPlatformDialogResultContinue)
445+
break;
446+
447+
MCscreen -> wait(REFRESH_INTERVAL, True, True);
448+
}
449+
450+
ep.clear();
451+
452+
if (t_result == kMCPlatformDialogResultCancel)
453+
MCresult->sets(MCcancelstring);
454+
455+
return EE_UNDEFINED;
456+
431457
#else
432458
extern void MCQTRecordDialog(MCExecPoint& ep, const char *p_title, Boolean sheet);
433459
MCQTRecordDialog(ep, p_title, sheet);

engine/src/cmdsc.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,8 +1926,12 @@ Exec_stat MCRecord::exec(MCExecPoint &ep)
19261926
char *soundfile = MCS_get_canonical_path(ep.getcstring());
19271927

19281928
#ifdef FEATURE_PLATFORM_RECORDER
1929-
// TODO-RECORD: Implement using MCPlatformSoundRecorder.
1930-
#else
1929+
extern MCPlatformSoundRecorderRef MCrecorder;
1930+
if (MCrecorder == nil)
1931+
MCPlatformSoundRecorderCreate(MCrecorder);
1932+
1933+
MCPlatformSoundRecorderStart(MCrecorder, soundfile);
1934+
#else
19311935
extern void MCQTRecordSound(char *soundfile);
19321936
MCQTRecordSound(soundfile);
19331937
#endif

engine/src/cmdse.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,11 @@ Exec_stat MCStop::exec(MCExecPoint &ep)
22662266
break;
22672267
case SC_RECORDING:
22682268
#ifdef FEATURE_PLATFORM_RECORDER
2269-
// TODO-RECORDER: Implement using MCPlatformSoundRecorder
2269+
extern MCPlatformSoundRecorderRef MCrecorder;
2270+
if (MCrecorder == nil)
2271+
break;
2272+
2273+
MCPlatformSoundRecorderStop(MCrecorder);
22702274
#else
22712275
extern void MCQTStopRecording(void);
22722276
MCQTStopRecording();

engine/src/funcs.cpp

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,9 +1909,18 @@ Exec_stat MCQTEffects::eval(MCExecPoint &ep)
19091909
Exec_stat MCRecordCompressionTypes::eval(MCExecPoint &ep)
19101910
{
19111911
#ifdef /* MCRecordCompressionTypes */ LEGACY_EXEC
1912-
19131912
#ifdef FEATURE_PLATFORM_RECORDER
1914-
// TODO-RECORDER: Implement using MCPlatformSoundRecorder - the format is list of 'label,id'.
1913+
1914+
ep . clear();
1915+
1916+
extern MCPlatformSoundRecorderRef MCrecorder;
1917+
1918+
if (MCrecorder == nil)
1919+
MCPlatformSoundRecorderCreate(MCrecorder);
1920+
1921+
extern bool list_inputs_callback(void *context, unsigned int id, const char *label);
1922+
1923+
MCPlatformSoundRecorderListInputs(MCrecorder, list_inputs_callback, &ep);
19151924
#else
19161925
extern void MCQTGetRecordCompressionList(MCExecPoint& ep);
19171926
MCQTGetRecordCompressionList(ep);
@@ -1926,7 +1935,16 @@ Exec_stat MCRecordLoudness::eval(MCExecPoint &ep)
19261935
#ifdef /* MCRecordLoudness */ LEGACY_EXEC
19271936

19281937
#ifdef FEATURE_PLATFORM_RECORDER
1929-
// TODO-RECORDER: Implement using MCPlatformSoundRecorder.
1938+
extern MCPlatformSoundRecorderRef MCrecorder;
1939+
1940+
double t_loudness;
1941+
t_loudness = 0;
1942+
1943+
if (MCrecorder != nil)
1944+
t_loudness = MCPlatformSoundRecorderGetLoudness(MCrecorder);
1945+
1946+
ep . setnvalue(t_loudness);
1947+
19301948
#else
19311949
extern void MCQTGetRecordLoudness(MCExecPoint& ep);
19321950
MCQTGetRecordLoudness(ep);

engine/src/globals.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ MCVariable *MCurlresult;
368368
Boolean MCexitall;
369369
int4 MCretcode;
370370
Boolean MCrecording;
371+
MCPlatformSoundRecorderRef MCrecorder;
371372

372373
// MW-2012-03-08: [[ StackFile5500 ]] Make stackfile version 5.5 the default.
373374
uint4 MCstackfileversion = 5500;
@@ -738,6 +739,7 @@ void X_clear_globals(void)
738739
MCexitall = False;
739740
MCretcode = 0;
740741
MCrecording = False;
742+
MCrecorder = nil;
741743
// MW-2012-03-08: [[ StackFile5500 ]] Make 5.5 stackfile version the default.
742744
MCstackfileversion = 5500;
743745
MClook = LF_MOTIF;
@@ -1026,7 +1028,11 @@ int X_close(void)
10261028

10271029
MCU_play_stop();
10281030
#ifdef FEATURE_PLATFORM_RECORDER
1029-
// TODO-RECORDER: Implement using MCPlatformSoundRecorder
1031+
if (MCrecorder != nil)
1032+
{
1033+
MCPlatformSoundRecorderStop(MCrecorder);
1034+
MCPlatformSoundRecorderRelease(MCrecorder);
1035+
}
10301036
#else
10311037
if (MCrecording)
10321038
{

0 commit comments

Comments
 (0)