Skip to content

Commit 8a296c0

Browse files
author
dsward2
committed
In HTTPWebServerConnection, for using Audio Devices input, a text field was added to the HTML form where the user can specify a sox filter. The default value is "vol 1". Typically, the user might want to adjust the volume to 2 or more.
In SDRController, use the new sox filter string in the first stage chain, in the final sox task. Also, obtain the current sample rate for the audio input device and use it in the sox task that captures the audio input, typically 48000 or 44100. Previously, the standard macOS "Audio MIDI Setup.app" application could be used to adjust the device sample rate to 48000 before using LocalRadio to generate the audio stream, but now LocalRadio will obtain the correct value and use it automatically.
1 parent 60b1f2f commit 8a296c0

7 files changed

Lines changed: 214 additions & 113 deletions

File tree

LocalRadio.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5739,7 +5739,7 @@
57395739
CODE_SIGN_IDENTITY = "Developer ID Application";
57405740
CODE_SIGN_STYLE = Manual;
57415741
COMBINE_HIDPI_IMAGES = YES;
5742-
CURRENT_PROJECT_VERSION = 21;
5742+
CURRENT_PROJECT_VERSION = 22;
57435743
DEVELOPMENT_TEAM = MMFBWVS455;
57445744
ENABLE_HARDENED_RUNTIME = YES;
57455745
HEADER_SEARCH_PATHS = (
@@ -5755,7 +5755,7 @@
57555755
"$(PROJECT_DIR)/LocalRadio",
57565756
);
57575757
MACOSX_DEPLOYMENT_TARGET = 10.15;
5758-
MARKETING_VERSION = 1.21;
5758+
MARKETING_VERSION = 1.22;
57595759
OTHER_CFLAGS = "";
57605760
PRODUCT_BUNDLE_IDENTIFIER = com.arkphone.LocalRadio;
57615761
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -5776,7 +5776,7 @@
57765776
CODE_SIGN_IDENTITY = "Developer ID Application";
57775777
CODE_SIGN_STYLE = Manual;
57785778
COMBINE_HIDPI_IMAGES = YES;
5779-
CURRENT_PROJECT_VERSION = 21;
5779+
CURRENT_PROJECT_VERSION = 22;
57805780
DEVELOPMENT_TEAM = MMFBWVS455;
57815781
ENABLE_HARDENED_RUNTIME = YES;
57825782
HEADER_SEARCH_PATHS = (
@@ -5792,7 +5792,7 @@
57925792
"$(PROJECT_DIR)/LocalRadio",
57935793
);
57945794
MACOSX_DEPLOYMENT_TARGET = 10.15;
5795-
MARKETING_VERSION = 1.21;
5795+
MARKETING_VERSION = 1.22;
57965796
OTHER_CFLAGS = "";
57975797
PRODUCT_BUNDLE_IDENTIFIER = com.arkphone.LocalRadio;
57985798
PRODUCT_NAME = "$(TARGET_NAME)";

LocalRadio/LocalRadio-Source/Base.lproj/MainMenu.xib

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1234,7 +1234,7 @@ Gw
12341234
<font key="font" metaFont="system"/>
12351235
<tabViewItems>
12361236
<tabViewItem label="LocalRadio" identifier="" id="8Qy-d0-fpa">
1237-
<view key="view" ambiguous="YES" id="bIe-XZ-nnh">
1237+
<view key="view" id="bIe-XZ-nnh">
12381238
<rect key="frame" x="10" y="33" width="450" height="550"/>
12391239
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
12401240
<subviews>
@@ -1597,7 +1597,7 @@ Gw
15971597
</view>
15981598
</tabViewItem>
15991599
<tabViewItem label="Configuration" identifier="" id="Amd-pe-F7E">
1600-
<view key="view" id="QdK-3V-Sdm">
1600+
<view key="view" ambiguous="YES" id="QdK-3V-Sdm">
16011601
<rect key="frame" x="10" y="33" width="450" height="550"/>
16021602
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16031603
<subviews>

LocalRadio/LocalRadio-Source/HTTPWebServerConnection.m

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -576,21 +576,35 @@ - (BOOL)expectsRequestBodyFromMethod:(NSString *)method atPath:(NSString *)path
576576
{
577577
NSArray * deviceArray = object;
578578

579-
if (deviceArray.count == 1)
579+
if (deviceArray.count == 2)
580580
{
581-
id deviceArrayObject = deviceArray.firstObject;
582-
if ([deviceArrayObject isKindOfClass:[NSDictionary class]] == YES)
581+
NSString * inputDeviceNameString = NULL;
582+
NSString * deviceAudioOutputFilter = NULL;
583+
584+
for (id deviceArrayObject in deviceArray)
583585
{
584-
NSMutableDictionary * deviceDictionary = [deviceArrayObject mutableCopy];
585-
586-
NSString * settingName = [deviceDictionary objectForKey:@"name"];
587-
if ([settingName isEqualToString:@"audio_input"] == YES)
586+
if ([deviceArrayObject isKindOfClass:[NSDictionary class]] == YES)
588587
{
589-
NSString * deviceName = [deviceDictionary objectForKey:@"value"];
590-
591-
[self listenButtonClickedForDevice:deviceName];
588+
NSMutableDictionary * deviceDictionary = [deviceArrayObject mutableCopy];
589+
590+
NSString * settingName = [deviceDictionary objectForKey:@"name"];
591+
592+
if ([settingName isEqualToString:@"audio_input"] == YES)
593+
{
594+
inputDeviceNameString = [deviceDictionary objectForKey:@"value"];
595+
}
596+
597+
if ([settingName isEqualToString:@"audio_output_filter"] == YES)
598+
{
599+
deviceAudioOutputFilter = [deviceDictionary objectForKey:@"value"];
600+
}
592601
}
593602
}
603+
604+
if ((inputDeviceNameString != NULL) && (inputDeviceNameString != NULL))
605+
{
606+
[self listenButtonClickedForDevice:inputDeviceNameString deviceAudioOutputFilter:deviceAudioOutputFilter];
607+
}
594608
}
595609
}
596610

@@ -2268,13 +2282,13 @@ - (void)listenButtonClickedForFrequency:(NSMutableDictionary *)favoriteDictionar
22682282
// listenButtonClickedForDevice:
22692283
//==================================================================================
22702284

2271-
- (void)listenButtonClickedForDevice:(NSString *)deviceName
2285+
- (void)listenButtonClickedForDevice:(NSString *)deviceName deviceAudioOutputFilter:(NSString *)deviceAudioOutputFilter
22722286
{
22732287
if (deviceName != NULL)
22742288
{
22752289
[self startStreamingServer];
22762290

2277-
[self.sdrController startTasksForDevice:deviceName];
2291+
[self.sdrController startTasksForDevice:deviceName deviceAudioOutputFilter:deviceAudioOutputFilter];
22782292
}
22792293
}
22802294

@@ -2699,7 +2713,7 @@ - (NSString *)generateEditCategorySettingsStringForID:(NSString *)idString
26992713
[formString appendFormat:@"<option value='ale' %@>ale</option>", atanMathAleSelected];
27002714
[formString appendString:@"</select>"];
27012715

2702-
NSString * formAudioOutputFilterString = [NSString stringWithFormat:@"<label for='frequency'>Sox Audio Output Filter:</label><input class='twelve columns value-prop' type='text' id='scan_audio_output_filter' name='scan_audio_output_filter' value='%@'>", scanAudioOutputFilterString];
2716+
NSString * formAudioOutputFilterString = [NSString stringWithFormat:@"<label for='scan_audio_output_filter'>Sox Audio Output Filter:</label><input class='twelve columns value-prop' type='text' id='scan_audio_output_filter' name='scan_audio_output_filter' value='%@'>", scanAudioOutputFilterString];
27032717
[formString appendString:formAudioOutputFilterString];
27042718

27052719

@@ -2771,9 +2785,9 @@ - (NSString *)generateDevicesFormString
27712785

27722786
NSArray * audioDeviceArray = [self generateAudioDeviceList];
27732787

2774-
[formString appendString:@"<label for='audio_input'>Select Audio Input</label>\n"];
2788+
[formString appendString:@"<label for='audio_input'>Select Audio Input:</label>\n"];
27752789
[formString appendString:@"<select name='audio_input' class='twelve columns value-prop' title='The Audio Input setting selects a Core Audio device, like \"Built-in Input\".'>\n"];
2776-
2790+
27772791
for (NSDictionary * deviceDictionary in audioDeviceArray)
27782792
{
27792793
NSNumber * inputChannelCountNumber = [deviceDictionary objectForKey:@"inputChannelCount"];
@@ -2798,6 +2812,9 @@ - (NSString *)generateDevicesFormString
27982812
}
27992813
[formString appendString:@"</select>\n"];
28002814

2815+
NSString * formAudioOutputFilterString = @"<label for='audio_output_filter'>Sox Audio Output Filter:</label>\n<input class='twelve columns value-prop' type='text' id='audio_output_filter' name='audio_output_filter' value='vol 1' title='The Audio Output Filter is used by the Sox audio tool for several purposes. This filter is for the final Sox output. The default value is \"vol 1\". Do not set a \"rate\" command here, LocalRadio automatically sets the sample rate to 48000.'>\n";
2816+
[formString appendString:formAudioOutputFilterString];
2817+
28012818
NSString * listenButtonString = @"<br><br><input class='twelve columns button button-primary' type='button' value='Listen' onclick=\"var deviceForm=getElementById('deviceForm'); deviceListenButtonClicked(deviceForm);\" title=\"Click the Listen button for the selected device. You may also need to click on the Play button in the audio controls below.\">";
28022819
[formString appendString:listenButtonString];
28032820

@@ -3238,7 +3255,7 @@ - (NSString *)generateEditFrequencyFormStringForFrequency:(NSDictionary *)favori
32383255
[formString appendFormat:@"<option value='ale' %@>ale</option>", atanMathAleSelected];
32393256
[formString appendString:@"</select>\n"];
32403257

3241-
NSString * formAudioOutputFilterString = [NSString stringWithFormat:@"<label for='frequency'>Sox Audio Output Filter:</label>\n<input class='twelve columns value-prop' type='text' id='audio_output_filter' name='audio_output_filter' value='%@' title='The Audio Output Filter is used by the Sox audio tool for several purposes. This filter is for the final Sox output. The default value is \"vol 1\". Do not set a \"rate\" command here, LocalRadio automatically sets the sample rate to 48000.'>\n", audioOutputFilterString];
3258+
NSString * formAudioOutputFilterString = [NSString stringWithFormat:@"<label for='audio_output_filter'>Sox Audio Output Filter:</label>\n<input class='twelve columns value-prop' type='text' id='audio_output_filter' name='audio_output_filter' value='%@' title='The Audio Output Filter is used by the Sox audio tool for several purposes. This filter is for the final Sox output. The default value is \"vol 1\". Do not set a \"rate\" command here, LocalRadio automatically sets the sample rate to 48000.'>\n", audioOutputFilterString];
32423259
[formString appendString:formAudioOutputFilterString];
32433260

32443261
[formString appendString:@"&nbsp;<br>\n"];

LocalRadio/LocalRadio-Source/SDRController.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
@property (strong) NSNumber * tunerSampleRateNumber;
3333
@property (strong) NSString * statusFunctionString;
3434

35-
@property (strong) NSString * deviceName;
35+
@property (strong) NSString * deviceName; // for playing from Core Audio device input
36+
@property (strong) NSString * deviceAudioOutputFilterString;
37+
3638
@property (strong) NSString * customTaskID;
3739

3840
@property (assign) BOOL enableDirectSamplingQBranchMode;
@@ -48,7 +50,7 @@
4850

4951
- (void)startRtlsdrTasksForFrequency:(NSDictionary *)frequencyDictionary;
5052
- (void)startRtlsdrTasksForFrequencies:(NSArray *)frequenciesArray category:(NSMutableDictionary *)categoryDictionary;
51-
- (void)startTasksForDevice:(NSString *)deviceName;
53+
- (void)startTasksForDevice:(NSString *)deviceName deviceAudioOutputFilter:(NSString *)deviceAudioOutputFilter;
5254
- (void)startTasksForCustomTaskID:(NSString *)customTaskID;
5355

5456
@end

0 commit comments

Comments
 (0)